[SCM] opencore-amr packaging branch, master, updated. upstream/0.1.2-10-g7bf1e45

ceros-guest at users.alioth.debian.org ceros-guest at users.alioth.debian.org
Fri Sep 18 20:48:45 UTC 2009


The following commit has been merged in the master branch:
commit c8fb2a62eb2e79be00b5598555226090265c0911
Author: Martin Storsjo <martin at martin.st>
Date:   Sun Jun 7 21:45:26 2009 -0700

    Updated the opencore subdirectory to a new upstream version
    
    This is a unmodified copy of git version
    fd46810380dc8857b48fb5100bd359a5a71f85d5 in the opencore
    upstream repo.

diff --git a/opencore/ChangeLog b/opencore/ChangeLog
index 31b2cea..ef3588c 100644
--- a/opencore/ChangeLog
+++ b/opencore/ChangeLog
@@ -1,4 +1,156 @@
 ===============================================================================
+2009-05-10  OpenCORE 2.04
+
+New Features
+- Create external download datastream An external download datastream is
+introduced to allow for an external entity to pass a datastream interface 
+to the player SDK.  The external entity is responsible for doing the actual 
+download of the media data.  Full support in Android is not complete until 
+playerdriver changes and more unit testing is done.
+
+- Fixed cache option in Oscl_File
+Adding an option to configure the Oscl file cache to use one or more fixed
+caches in addition to the movable cache.
+
+- Modify author engine to contain a notion of "authoring clock"
+Author engine has the option to pass an "authoring clock" to media input
+components so that they can use this to sync audio and video timestamps.  
+Author engine has been modified to own a PVMFMediaClock.  Author engine 
+provides a pointer to its to data source node (media input node typically) 
+at the end of author engine Init cycle, using PVMF_AUTHORING_CLOCK_KEY.  
+No media input component changes were done. All media input components 
+used in author engine unit test currently operate from a file and have no
+need for such a clock, but some device media input components can make use 
+of the clock if needed in the future, since author engine will pass the 
+clock pointer all the time to data sources.
+
+- Shoutcast (of MP3) support
+Shoutcast support of MP3 and internet radio streaming is added.
+
+- Enable AAC PDL Support 
+More robust support of PDL of AAC content, including underflow handling.
+
+- Add support for 3GPP2 speech (EVRC, QCELP etc) in MP4 FF library
+Support for the 3GPP2 speech codecs is added at the file format library
+level.  No 3GPP2 speech codecs are added.
+
+- OpenMAX encoder and decoder unit test suite
+
+- Use external filehandle in Android
+
+- Introduce new macro to android makefiles to enable 2way
+
+
+Improvements
+- Add support for "all" metadata key in CPM plugins.  This feature provides 
+  a single key to request that all available metadata be returned.
+- Add support for OMX_ColorFormatCbYCrY 
+- OMX video dec node now sets the codec parameters (width/height etc.) in the 
+  output port of the omx component.
+- A loadable module for the OMA1 passthru CPM plugin now exists.  It serves 
+  as an example for creating a loadable CPM plugin.
+- Compressed testcases have been added in Authior Engine unit tests to 
+  author 3gp file from AVC and M4V and AAC bitstreams
+- Added checks to verify that the PCM output of the mp3 frame will not exceed
+  the output buffer size, so the mp3 decoder / OMX component is nore robust.
+- Removed unnecessary "ComponentGetRolesOfComponent" methods from OMX 
+  components.
+- Restored "/x-pvmf/ff-mux/mp4" MIME Type in Author engine. 
+- Modified the Initial AVC buffers so that the image that appears initially 
+  is black (not green/pink) if I-frame is missing. 
+- Fixed the IFrameInterval setting in the OpenMAX video encoder node. 
+- Added the ability to pass a peer PvmiCapabilityAndConfig interface to 
+  the Media I/O (MIO) components using the Capability Exchange.  The purpose 
+  is to allow the MIO components to set and get parameters (i.e., drive the 
+  process) rather than on relying on the media output node to do it.
+- Added checks to the OMX components to verify that the buffer size 
+  (in allocate/use buffer) (nAllocLen) is adequate (i.e. >= than nBufferSize)
+- Updated OMX components so that standard component roles can be queried as 
+  well as set.
+- AMR-NB common library modified to mark the proper symbol exports and moved
+  some functions to encoder and decoder libraries instead of common. 
+- Updated h264 decoder to take advantage of the fact that there will be no 
+  in-band SPS/PPS NALs for the mime Video dec node prevents in-band SPS/PPS 
+  for the format PVMF_MIME_H264_VIDEO_MP4
+- Add macro for enabling build of pv test engine executables in Android 
+- Remove 12-bit, 24-bit, and 32-bit routines from Android libraries 
+- Modified OMX timestamps to be in in microseconds rather than milliseconds
+  as specified in the OMX spec 1.1.2.
+- Improvements and workarounds for non-compliant OMX components
+- Replace OPEN_FILE_ONCE_PER_TRACK macro with member variable 
+aOpenFileOncePerTrack in mp4ffparser lib
+- 2way: send data fragment by fragment from parser side
+- Added a new function to convert PVMFStatus to human friendly strings
+- Implement logic to choose correct OMX component when decoding streaming 
+H264
+- OMX dec nodes should report error and not even call config parser if 
+config data is missing (but is required by the format)
+- Update playerdriver.cpp to send "disable-firewall-packets" KVP key based 
+on system Android property
+
+
+Bugs Fixed
+- Moov atom is not being written into .3gp file if Author driver does not 
+  close file handle.
+- omx mp4 component in no-marker-bit mode crashes when playing a certain clip
+- Error handling incase of input other then 8K AMR 
+- Add PVReleaseInterface method to OMX shared library interfaces 
+  (components + main)
+- pull sdcard while recording causes media server to crash 
+- Changes to buffering status notifications while streaming 
+- OMX nodes should not send repositioning request to OMX component until 
+  config data has been processed by OMX components 
+- Crash in the author SDK as part of engine Reset 
+- If SSRC is not provided in setup response, then pvplayer client doesn't 
+  send firewall packets to the server 
+- PVAuthorEngineNodeUtility::NodeCommandCompleted does not check whether 
+  iCmdQueue is empty 
+- AMR Local Playback -> FF to EOS when repeat song is on will cause a force 
+  crash 
+- some source nodes will put same timestamp for DataTS in old stream id 
+  and DiscardTS
+- Change pv omx encoder node to default iOMXComponentNeedsNALStartCodes to 
+  false and do sanity check
+- When reconfig happen,SinkNode should send reconfig notification with 
+  FormatSpecificInfo to MIO 
+- Race condition - If port settings event and node stop command arrive 
+  simultaneously - omx component may fail port flush command 
+- Mp3FFParserNode: Memory leak in Duration Calculator 
+- Playback clock starts even before PlayerEngine Start( ) is issued 
+- Clip plays beyond EOS.  Fixed setting of the actual normal play time (NPT)
+  when repositioning. 
+- Modified OSCL and player driver handling of external file handles in the 
+  player.
+- MP3 PS - Repositioning is not working properly 
+- MP3 Parser needs to validate consecutive mp3 headers before parsing starts
+- Crash in MIO component due to setPeer(NULL) is not called 
+- Improvements and robustness in thumbnail generation from normal and 
+  corrupted clips
+- Improvements in stability of Author Engine Unit tests when using OMX 
+  encoder node
+- Modify OSCL Mempool to assert when a buffer is deallocated back to 
+  mempool twice in a row 
+- Fix a possible race condition in omx proxy threads. 
+- H263 decoder (OMX version) needs to remove the DEFAULT width-height 
+  initialization 
+- Oscl file cache assert when reading binary file in text mode 
+- AAC and MP3 decoders have ARMv4 incorrect defines on normalization routines.
+  (see https://review.source.android.com/Gerrit#change,9668)
+- AMR component roles do not distinguish between AMR_NB and AMR_WB 
+- OSCL shared library avoid dlopen() leaking in case of failure(dlsym() fails)
+- Mp3 Clip hangs for some time when repositioned near to the end
+- PV_atof will return a value that is larger than it should be if the input 
+string has a CR at the end
+- Sequence number rollover in RTP info param during prolonged RTSP streaming
+
+===============================================================================
+2009-03-31  OpenCORE 2.03
+
+Improvements
+- Enable OpenCORE on master - part 2
+
+
+===============================================================================
 2009-03-10  OpenCORE 2.02
 
 ********
@@ -8,7 +160,7 @@
    new release is 2.02, which is a minor version increment beyond
    the previous release.
 ********
-	
+
 New Features
 - AMR-WB support added to the OMX encoder node so that it can utilize 
   an OMX AMR-WB encoder component if it is part of the OMX core. 
@@ -37,7 +189,7 @@ Improvements
 - Update of tests for support for progressive download of AMR
 - OMX Khronos header files (Omx_Core.h, Omx_Component.h) capitalization 
   changed to match that from the Khronos (previously they were all lowercase).
-- Updated MIO Developer's Guide in the top-level doc directory.
+
 
 Bugs Fixed
 - Memory leak when running GCF TC212 (2way-related)
@@ -47,6 +199,7 @@ Bugs Fixed
 - OMX dec node did not reset all the internal state during 
   Reset processing.  
 
+
 ===============================================================================
 2009-02-26  OpenCORE 2.1 (2.01)
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk
index b22b43a..9d586d8 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/Android.mk
@@ -6,25 +6,17 @@ LOCAL_SRC_FILES := \
  	src/az_lsp.cpp \
  	src/bitno_tab.cpp \
  	src/bitreorder_tab.cpp \
- 	src/bits2prm.cpp \
- 	src/bytesused.cpp \
  	src/c2_9pf_tab.cpp \
- 	src/copy.cpp \
- 	src/div_32.cpp \
  	src/div_s.cpp \
- 	src/extract_h.cpp \
- 	src/extract_l.cpp \
  	src/gains_tbl.cpp \
  	src/gc_pred.cpp \
+ 	src/get_const_tbls.cpp \
  	src/gmed_n.cpp \
  	src/grid_tbl.cpp \
  	src/gray_tbl.cpp \
  	src/int_lpc.cpp \
  	src/inv_sqrt.cpp \
  	src/inv_sqrt_tbl.cpp \
- 	src/l_abs.cpp \
- 	src/l_deposit_h.cpp \
- 	src/l_deposit_l.cpp \
  	src/l_shr_r.cpp \
  	src/log2.cpp \
  	src/log2_norm.cpp \
@@ -52,14 +44,12 @@ LOCAL_SRC_FILES := \
  	src/reorder.cpp \
  	src/residu.cpp \
  	src/round.cpp \
- 	src/set_zero.cpp \
  	src/shr.cpp \
  	src/shr_r.cpp \
  	src/sqrt_l.cpp \
  	src/sqrt_l_tbl.cpp \
  	src/sub.cpp \
  	src/syn_filt.cpp \
- 	src/vad1.cpp \
  	src/weight_a.cpp \
  	src/window_tab.cpp
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build/make/local.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build/make/local.mk
index 12ea1a0..b628b43 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build/make/local.mk
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/build/make/local.mk
@@ -17,25 +17,17 @@ SRCS := add.cpp \
 	az_lsp.cpp \
 	bitno_tab.cpp \
 	bitreorder_tab.cpp \
-	bits2prm.cpp \
-	bytesused.cpp \
 	c2_9pf_tab.cpp \
-	copy.cpp \
-	div_32.cpp \
 	div_s.cpp \
-	extract_h.cpp \
-	extract_l.cpp \
 	gains_tbl.cpp \
 	gc_pred.cpp \
+	get_const_tbls.cpp \
 	gmed_n.cpp \
 	grid_tbl.cpp \
 	gray_tbl.cpp \
 	int_lpc.cpp \
 	inv_sqrt.cpp \
 	inv_sqrt_tbl.cpp \
-	l_abs.cpp \
-	l_deposit_h.cpp \
-	l_deposit_l.cpp \
 	l_shr_r.cpp \
 	log2.cpp \
 	log2_norm.cpp \
@@ -63,14 +55,12 @@ SRCS := add.cpp \
 	reorder.cpp \
 	residu.cpp \
 	round.cpp \
-	set_zero.cpp \
 	shr.cpp \
 	shr_r.cpp \
 	sqrt_l.cpp \
 	sqrt_l_tbl.cpp \
 	sub.cpp \
 	syn_filt.cpp \
-	vad1.cpp \
 	weight_a.cpp \
 	window_tab.cpp
 
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
index 8ae8c40..04e383a 100644
--- 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
@@ -28,19 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/include/abs_s.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for abs_s function.
-
- Description: Updated template to make it build for Symbian.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: abs_s.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -54,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	ABS_S_H
-#define	ABS_S_H
+#ifndef ABS_S_H
+#define ABS_S_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index 9a978c9..18fdcee 100644
--- 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
@@ -28,26 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/add.h
-
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Created separate header file for add function.
-
- Description: Changed function prototype; pointer to  overflow flag is passed
-			  in as a parameter.
-
- Description: Updated copyright section.
-			  Changed "overflow" to "pOverflow" in the function prototype.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who: 							Date:
- Description:
-
+ Filename: add.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -58,13 +39,13 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 */
 
-#ifndef	ADD_H
-#define	ADD_H
+#ifndef ADD_H
+#define ADD_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -103,7 +84,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    Word16 add(Word16 var1, Word16 var2, Flag *pOverflow);
+    OSCL_IMPORT_REF Word16 add_16(Word16 var1, Word16 var2, Flag *pOverflow);
 
     /*----------------------------------------------------------------------------
     ; END
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
index 320ce64..241772d 100644
--- 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
@@ -28,22 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/az_lsp.h.h
-
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Changed function prototype; pointer to  overflow flag is passed
-			  in as a parameter. Added extern declaration for grid_tbl[],
-              defined in grid_tbl.c
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who: 							Date:
- Description:
-
+ Filename: az_lsp.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -54,13 +39,13 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 */
 
-#ifndef	AZ_LSP_H
-#define	AZ_LSP_H
+#ifndef AZ_LSP_H
+#define AZ_LSP_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"typedef.h"
+#include    "typedef.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index 46f1035..33cd704 100644
--- 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
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./include/basic_op.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Revised basic_op.h since the basicop2.c functions were split
-	      up into separate source and header files. This function was
-	      retained because there are legacy GSM AMR C functions that still
-	      include this file. This file now includes the various basicop2
-	      functions' header files instead of defining the function
-	      prototypes.
-
- Description: Including header files with platform specific inline assembly
-              instructions.
-
- Who:						Date:
- Description:
+ Filename: basic_op.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -57,18 +41,18 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	BASIC_OP_H
-#define	BASIC_OP_H
+#ifndef BASIC_OP_H
+#define BASIC_OP_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 #if defined(PV_ARM_V5)
 #include "basic_op_arm_v5.h"
 
-#elif defined(PV_ARM_GCC_V5)
+#elif defined(xxPV_ARM_GCC_V5) // @TODO: Enable gcc-arm assembly
 #include "basic_op_arm_gcc_v5.h"
 
 #else
@@ -78,25 +62,18 @@ terms listed above has been obtained from the copyright holder.
 
 
 
-#include	"add.h"
-#include	"div_s.h"
-#include	"div_32.h"
-#include	"extract_h.h"
-#include	"extract_l.h"
-#include	"l_deposit_h.h"
-#include	"l_deposit_l.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_abs.h"
-#include 	"l_negate.h"
-#include 	"l_extract.h"
-#include	"l_abs.h"
+#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"
@@ -162,11 +139,11 @@ extern "C"
 
     */
     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 L_var1_hi,
+    Word16 L_var1_lo,
+    Word16 L_var2_hi,
+    Word16 L_var2_lo,
+    Flag *pOverflow)
     {
         Word16  product;
 
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
index 1fa2297..1abc4fa 100644
--- 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
@@ -28,13 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
-  Pathname: ./include/basic_op_arm_gcc_v5.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Who:						Date:
- Description:
+ Filename: basic_op_arm_gcc_v5.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -47,8 +41,8 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	BASIC_OP_ARM_GCC_V5_H
-#define	BASIC_OP_ARM_GCC_V5_H
+#ifndef BASIC_OP_ARM_GCC_V5_H
+#define BASIC_OP_ARM_GCC_V5_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
@@ -103,19 +97,19 @@ extern "C"
      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_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.
+        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)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the 32 bit add operation resulted in overflow
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
 
      Returns:
-    	L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
+        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)
@@ -141,19 +135,19 @@ extern "C"
      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_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.
+        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)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the 32 bit add operation resulted in overflow
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
 
      Returns:
-    	L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
+        L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
     */
     __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
 {
@@ -223,19 +217,19 @@ extern "C"
      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_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.
+        L_var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
 
-    	pOverflow = pointer to overflow (Flag)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the 32 bit add operation resulted in overflow
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
 
      Returns:
-    	L_product = 32-bit product of L_var1 and L_var2 (Word32)
+        L_product = 32-bit product of L_var1 and L_var2 (Word32)
     */
 
     __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
@@ -460,19 +454,19 @@ extern "C"
      INPUT AND OUTPUT DEFINITIONS
 
      Inputs:
-    	var1 = 16 bit short signed integer (Word16) whose value falls in
-    	       the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        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.
+        var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
 
-    	pOverflow = pointer to overflow (Flag)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the add operation resulted in overflow
+        pOverflow -> 1 if the add operation resulted in overflow
 
      Returns:
-    	product = 16-bit limited product of var1 and var2 (Word16)
+        product = 16-bit limited product of var1 and var2 (Word16)
     */
     __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
 {
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h
index 02581cb..23fd18d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h
@@ -27,13 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./include/basic_op_arm_v5.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Who:						Date:
- Description:
+ Filename: basic_op_arm_v5.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -46,8 +40,8 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	BASIC_OP_ARM_V5_H
-#define	BASIC_OP_ARM_V5_H
+#ifndef BASIC_OP_ARM_V5_H
+#define BASIC_OP_ARM_V5_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
@@ -101,19 +95,19 @@ extern "C"
      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_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.
+        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)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the 32 bit add operation resulted in overflow
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
 
      Returns:
-    	L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
+        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)
@@ -135,19 +129,19 @@ extern "C"
      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_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.
+        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)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the 32 bit add operation resulted in overflow
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
 
      Returns:
-    	L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
+        L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
     */
     __inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
     {
@@ -206,19 +200,19 @@ extern "C"
      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_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.
+        L_var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
 
-    	pOverflow = pointer to overflow (Flag)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the 32 bit add operation resulted in overflow
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
 
      Returns:
-    	L_product = 32-bit product of L_var1 and L_var2 (Word32)
+        L_product = 32-bit product of L_var1 and L_var2 (Word32)
     */
     __inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
     {
@@ -377,19 +371,19 @@ extern "C"
      INPUT AND OUTPUT DEFINITIONS
 
      Inputs:
-    	var1 = 16 bit short signed integer (Word16) whose value falls in
-    	       the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        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.
+        var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
 
-    	pOverflow = pointer to overflow (Flag)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the add operation resulted in overflow
+        pOverflow -> 1 if the add operation resulted in overflow
 
      Returns:
-    	product = 16-bit limited product of var1 and var2 (Word16)
+        product = 16-bit limited product of var1 and var2 (Word16)
     */
     __inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
     {
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
index 5e847c4..fe49cd3 100644
--- 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
@@ -28,13 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./include/basic_op_c_equivalent.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Who:						Date:
- Description:
+ Filename: basic_op_c_equivalent.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -47,8 +41,8 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	BASIC_OP_C_EQUIVALENT_H
-#define	BASIC_OP_C_EQUIVALENT_H
+#ifndef BASIC_OP_C_EQUIVALENT_H
+#define BASIC_OP_C_EQUIVALENT_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
@@ -101,19 +95,19 @@ extern "C"
      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_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.
+        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)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the 32 bit add operation resulted in overflow
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
 
      Returns:
-    	L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
+        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)
     {
@@ -140,19 +134,19 @@ extern "C"
      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_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.
+        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)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the 32 bit add operation resulted in overflow
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
 
      Returns:
-    	L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
+        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)
@@ -230,19 +224,19 @@ extern "C"
      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_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.
+        L_var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
 
-    	pOverflow = pointer to overflow (Flag)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the 32 bit add operation resulted in overflow
+        pOverflow -> 1 if the 32 bit add operation resulted in overflow
 
      Returns:
-    	L_product = 32-bit product of L_var1 and L_var2 (Word32)
+        L_product = 32-bit product of L_var1 and L_var2 (Word32)
     */
     static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
     {
@@ -436,19 +430,19 @@ extern "C"
      INPUT AND OUTPUT DEFINITIONS
 
      Inputs:
-    	var1 = 16 bit short signed integer (Word16) whose value falls in
-    	       the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+        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.
+        var2 = 16 bit short signed integer (Word16) whose value falls in
+               the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
 
-    	pOverflow = pointer to overflow (Flag)
+        pOverflow = pointer to overflow (Flag)
 
      Outputs:
-    	pOverflow -> 1 if the add operation resulted in overflow
+        pOverflow -> 1 if the add operation resulted in overflow
 
      Returns:
-    	product = 16-bit limited product of var1 and var2 (Word16)
+        product = 16-bit limited product of var1 and var2 (Word16)
     */
     static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
     {
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
index 9251094..4d94c4c 100644
--- 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
@@ -28,15 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/include/basicop_malloc.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus after Include section.
-
- Who:						Date:
- Description:
+ Filename: basicop_malloc.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -50,8 +42,8 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	BASICOP_MALLOC_H
-#define	BASICOP_MALLOC_H
+#ifndef BASICOP_MALLOC_H
+#define BASICOP_MALLOC_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
@@ -83,8 +75,8 @@ extern "C"
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern	Flag Overflow;
-    extern	Flag Carry;
+    extern  Flag Overflow;
+    extern  Flag Carry;
 
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
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
index a170750..b071c71 100644
--- 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
@@ -28,19 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
-  Pathname: .audio/gsm-amr/c/include/bitno_tab.h
-
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Define "const Word16 *bitno[N_MODES]" as "const Word16 *const
-                      bitno[N_MODES]"
-
- Description: Added #ifdef __cplusplus after Include section.
-
- Who:                       Date:
- Description:
+ Filename: bitno_tab.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index bfcb4cf..48d8e08 100644
--- 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
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/include/bitreorder.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Define "const Word16 *reorderBits[NUM_MODES-1]" as
-              "const Word16 *const reorderBits[NUM_MODES-1]".
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus after Include section.
-
- Who:                       Date:
- Description:
+ Filename: bitreorder_tab.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bits2prm.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bits2prm.h
deleted file mode 100644
index 8e1b432..0000000
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bits2prm.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
-    3GPP TS 26.073
-    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
-    Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, 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             : bits2prm.h
-*      Purpose          : Retrieves the vector of encoder parameters from
-*                       : the received serial bits in a frame.
-*
-*****************************************************************************
-*/
-#ifndef bits2prm_h
-#define bits2prm_h "$Id $"
-
-/*
-*****************************************************************************
-*                         INCLUDE FILES
-*****************************************************************************
-*/
-#include "typedef.h"
-#include "mode.h"
-
-#ifndef OSCL_BASE_H_INCLUDED
-#include "oscl_base.h"
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-    /*
-    *****************************************************************************
-    *                         DEFINITION OF DATA TYPES
-    *****************************************************************************
-    */
-
-    /*
-    *****************************************************************************
-    *                         DECLARATION OF PROTOTYPES
-    *****************************************************************************
-    */
-    /*
-    **************************************************************************
-    *
-    *  Function    : Bits2prm
-    *  Purpose     : Retrieves the vector of encoder parameters from
-    *                the received serial bits in a frame.
-    *  Returns     : void
-    *
-    **************************************************************************
-    */
-    OSCL_IMPORT_REF void Bits2prm(
-        enum Mode mode,
-        Word16 bits[],   /* input : serial bits, (244 + bfi)               */
-        Word16 prm[]     /* output: analysis parameters, (57+1 parameters) */
-    );
-
-#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
index fe43cbb..f97beae 100644
--- 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
@@ -28,15 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/include/BytesUsed.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus after Include section.
-
- Who:						Date:
- Description:
+ Filename: bytesused.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -49,8 +41,8 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	BYTESUSED_H
-#define	BYTESUSED_H
+#ifndef BYTESUSED_H
+#define BYTESUSED_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/copy.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/copy.h
deleted file mode 100644
index b539ebb..0000000
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/copy.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
-    3GPP TS 26.073
-    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
-    Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
-Permission to distribute, modify and use this file under the standard license
-terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
-/*
-********************************************************************************
-*
-*      GSM AMR-NB speech codec   R98   Version 7.5.0   March 2, 2001
-*                                R99   Version 3.2.0
-*                                REL-4 Version 4.0.0
-*
-********************************************************************************
-*      File             : copy.h
-*      Purpose          : Copy vector x[] to y[]
-*
-********************************************************************************
-*/
-#ifndef copy_h
-#define copy_h "$Id $"
-
-/*
-********************************************************************************
-*                         INCLUDE FILES
-********************************************************************************
-*/
-#include "typedef.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-    /*
-    ********************************************************************************
-    *                         DEFINITION OF DATA TYPES
-    ********************************************************************************
-    */
-
-    /*
-    ********************************************************************************
-    *                         DECLARATION OF PROTOTYPES
-    ********************************************************************************
-    */
-
-    /*
-    **************************************************************************
-    *
-    *  Function    : Copy
-    *  Purpose     : Copy vector x[] to y[], vector length L
-    *  Returns     : void
-    *
-    **************************************************************************
-    */
-    void Copy(
-        const Word16 x[],  /* i : input vector (L)    */
-        Word16 y[],        /* o : output vector (L)   */
-        Word16 L           /* i : vector length       */
-    );
-
-#ifdef __cplusplus
-}
-#endif
-
-#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
index 70868f4..99c2540 100644
--- 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
@@ -28,15 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/include/d_gain_c.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: d_gain_c.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -112,6 +104,7 @@ extern "C"
         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
     );
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
index fec072b..04babd9 100644
--- 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
@@ -70,7 +70,8 @@ extern "C"
     */
     Word16 d_gain_pitch(       /* return value: gain (Q14)                */
         enum Mode mode,        /* i : AMR mode                            */
-        Word16 index           /* i   : index of quantization             */
+        Word16 index,          /* i   : index of quantization             */
+        const Word16* qua_gain_pitch_ptr /* i : pointer to read-only tables   */
     );
 
 #ifdef __cplusplus
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
index 0e5ca9a..dbefcba 100644
--- 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
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/d_plsf.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: d_plsf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -64,6 +51,7 @@ terms listed above has been obtained from the copyright holder.
 #include "typedef.h"
 #include "cnst.h"
 #include "mode.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -117,7 +105,7 @@ extern "C"
     *
     **************************************************************************
     */
-    Word16 D_plsf_reset(D_plsfState *st);
+    Word16 D_plsf_reset(D_plsfState *st, const Word16* mean_lsf_5_ptr);
 
     /*
     **************************************************************************
@@ -151,6 +139,7 @@ extern "C"
         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               */
@@ -172,6 +161,7 @@ extern "C"
         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               */
     );
@@ -185,7 +175,8 @@ extern "C"
      *
      *************************************************************************/
     void Init_D_plsf_3(D_plsfState *st,  /* i/o: State struct                */
-                       Word16 index      /* i  : past_rq_init[] index [0, 7] */
+                       Word16 index,     /* i  : past_rq_init[] index [0, 7] */
+                       const Word16* past_rq_init_ptr /* ptr to read-only table */
                       );
 
     /*----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_32.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_32.h
deleted file mode 100644
index 8a55ed8..0000000
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_32.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
-    3GPP TS 26.073
-    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
-    Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
-Permission to distribute, modify and use this file under the standard license
-terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
-/*
-
- Filename: /audio/gsm_amr/c/include/div_32.h
-
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
-
-------------------------------------------------------------------------------
- INCLUDE DESCRIPTION
-
- This file contains all the constant definitions and prototype definitions
- needed by the Div_32 function.
-
-------------------------------------------------------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-; CONTINUE ONLY IF NOT ALREADY DEFINED
-----------------------------------------------------------------------------*/
-#ifndef DIV_32_H
-#define DIV_32_H
-
-/*----------------------------------------------------------------------------
-; INCLUDES
-----------------------------------------------------------------------------*/
-
-#include        "basicop_malloc.h"
-
-/*--------------------------------------------------------------------------*/
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-    /*----------------------------------------------------------------------------
-    ; MACROS
-    ; Define module specific macros here
-    ----------------------------------------------------------------------------*/
-
-    /*----------------------------------------------------------------------------
-    ; DEFINES
-    ; Include all pre-processor statements here.
-    ----------------------------------------------------------------------------*/
-
-    /*----------------------------------------------------------------------------
-    ; EXTERNAL VARIABLES REFERENCES
-    ; Declare variables used in this module but defined elsewhere
-    ----------------------------------------------------------------------------*/
-
-    /*----------------------------------------------------------------------------
-    ; SIMPLE TYPEDEF'S
-    ----------------------------------------------------------------------------*/
-
-    /*----------------------------------------------------------------------------
-    ; ENUMERATED TYPEDEF'S
-    ----------------------------------------------------------------------------*/
-
-    /*----------------------------------------------------------------------------
-    ; STRUCTURES TYPEDEF'S
-    ----------------------------------------------------------------------------*/
-
-    /*----------------------------------------------------------------------------
-    ; GLOBAL FUNCTION DEFINITIONS
-    ; Function Prototype declaration
-    ----------------------------------------------------------------------------*/
-    Word32 Div_32(Word32 L_num,
-                  Word16 L_denom_hi,
-                  Word16 L_denom_lo,
-                  Flag   *pOverflow) ;
-
-    /*----------------------------------------------------------------------------
-    ; END
-    ----------------------------------------------------------------------------*/
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _DIV_32_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_s.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/div_s.h
index 441c5a4..98aa0f9 100644
--- 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
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/include/div_s.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for div_s function.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: div_s.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -55,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	DIV_S_H
-#define	DIV_S_H
+#ifndef DIV_S_H
+#define DIV_S_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -100,7 +87,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    Word16 div_s(Word16 var1, Word16 var2);
+    OSCL_IMPORT_REF Word16 div_s(Word16 var1, Word16 var2);
 
     /*----------------------------------------------------------------------------
     ; END
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
index c29b9e1..0daa965 100644
--- 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
@@ -27,14 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/include/dtx_common_def.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Who:                       Date:
- Description:
+ Filename: dtx_common_def.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/extract_h.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/extract_h.h
deleted file mode 100644
index 1d59ca2..0000000
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/extract_h.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
-    3GPP TS 26.073
-    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
-    Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
-Permission to distribute, modify and use this file under the standard license
-terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
-/*
-
- Pathname: ./gsm-amr/c/include/extract_h.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for extract_h function.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
-
-------------------------------------------------------------------------------
- INCLUDE DESCRIPTION
-
- This file contains all the constant definitions and prototype definitions
- needed by the extract_h function.
-
-------------------------------------------------------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-; CONTINUE ONLY IF NOT ALREADY DEFINED
-----------------------------------------------------------------------------*/
-#ifndef	EXTRACT_H_H
-#define	EXTRACT_H_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 extract_h(Word32 L_var1);
-
-    /*----------------------------------------------------------------------------
-    ; END
-    ----------------------------------------------------------------------------*/
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/extract_l.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/extract_l.h
deleted file mode 100644
index 964123c..0000000
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/extract_l.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
-    3GPP TS 26.073
-    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
-    Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
-Permission to distribute, modify and use this file under the standard license
-terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
-/*
-
- Pathname: ./gsm-amr/c/include/extract_l.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for extract_l function.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
-
-------------------------------------------------------------------------------
- INCLUDE DESCRIPTION
-
- This file contains all the constant definitions and prototype definitions
- needed by the extract_l function.
-
-------------------------------------------------------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-; CONTINUE ONLY IF NOT ALREADY DEFINED
-----------------------------------------------------------------------------*/
-#ifndef	EXTRACT_L_H
-#define	EXTRACT_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
-    ----------------------------------------------------------------------------*/
-    Word16 extract_l(Word32 L_var1);
-
-    /*----------------------------------------------------------------------------
-    ; END
-    ----------------------------------------------------------------------------*/
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
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
index f1fb197..1d0c6c1 100644
--- 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
@@ -66,15 +66,15 @@ extern "C"
     */
 
     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 */
-                     };
+        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,
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
index d11d240..f82ec46 100644
--- 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
@@ -28,17 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/include/frame_type_3gpp.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated to new PV C header template.
-
- Description: Added #ifdef __cplusplus after Include section.
-
- Who:						Date:
- Description:
+ Filename: frame_type_3gpp.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -48,8 +38,8 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 */
 
-#ifndef	FRAME_TYPE_3GPP_H
-#define	FRAME_TYPE_3GPP_H
+#ifndef FRAME_TYPE_3GPP_H
+#define FRAME_TYPE_3GPP_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
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
index b82603c..f2c1f55 100644
--- 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
@@ -28,17 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/include/gc_pred.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: gc_pred.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -105,7 +95,7 @@ extern "C"
     ; [List function prototypes here]
     ----------------------------------------------------------------------------*/
 
-    Word16 gc_pred_reset(gc_predState *st);
+    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
      */
@@ -125,7 +115,7 @@ extern "C"
      * PURPOSE: MA prediction of the innovation energy
      *          (in dB/(20*log10(2))) with mean  removed).
      */
-    void gc_pred(
+    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)   */
@@ -143,7 +133,7 @@ extern "C"
      * FUNCTION:  gc_pred_update()
      * PURPOSE: update MA predictor with last quantized energy
      */
-    void gc_pred_update(
+    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))                  */
@@ -156,7 +146,7 @@ extern "C"
      * PURPOSE: get average of MA predictor state values (with a lower limit)
      *          [used in error concealment]
      */
-    void gc_pred_average_limited(
+    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))                 */
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
index 1c4ede2..49f4c51 100644
--- 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
@@ -66,7 +66,7 @@ extern "C"
     *                         DECLARATION OF PROTOTYPES
     ********************************************************************************
     */
-    Word16 gmed_n(    /* o : index of the median value (0...N-1)      */
+    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  */
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
index 83e8408..465e705 100644
--- 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
@@ -28,14 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: codecs/audio/gsm_amr/gsm_two_way/c/include/gsm_amr_typedefs.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Removed unused defintions and corrected ifdef, that depended on
-              incorrect typedef
+ Filename: gsm_amr_typedefs.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index e95e6ca..3f241cb 100644
--- 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
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/lsp_avg.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: int_lpc.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -120,7 +109,7 @@ extern "C"
     *
     **************************************************************************
     */
-    void Int_lpc_1and3(
+    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)                              */
@@ -174,7 +163,7 @@ extern "C"
     *
     **************************************************************************
     */
-    void Int_lpc_1to3(
+    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) */
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
index 35b4d02..2ee9e71 100644
--- 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
@@ -28,15 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/int_lsf.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: int_lsf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index 4fb2b11..24e60ba 100644
--- 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
@@ -28,25 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/inv_sqrt.h
-
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Added an extern declaration for inv_sqrt_tbl[], now defined in
-              the file inv_sqrt_tbl.c
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                           Date:
- Description:
-
+ Filename: inv_sqrt.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -102,7 +84,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    Word32 Inv_sqrt(        /* (o) : output value   */
+    OSCL_IMPORT_REF Word32 Inv_sqrt(        /* (o) : output value   */
         Word32 L_x,         /* (i) : input value    */
         Flag   *pOverflow  /* (i) : pointer to overflow flag */
     );
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
index 136b914..8fceb9d 100644
--- 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
@@ -28,26 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/l_add.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_add function.
-
- Description: Changed function prototype declaration. A pointer to the overflow
-              flag is being passed in as a parameter instead of using global
-              data.
-
- Description: Updated template. Changed paramter name from overflow to
-              pOverflow
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: Providing support for ARM and Linux-ARM assembly instructions.
-
- Who:                       Date:
- Description:
+ Filename: l_add.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index 1559dcc..7af7cdc 100644
--- 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
@@ -28,21 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/l_add_c.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_add_c function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag and carry flag is passed into the
-              function. Updated template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: l_add_c.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -56,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	L_ADD_C_H
-#define	L_ADD_C_H
+#ifndef L_ADD_C_H
+#define L_ADD_C_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index 02a4bb7..7738ad2 100644
--- 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
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/include/l_comp.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Passing in pOverflow for EPOC changes.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: l_comp.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_deposit_h.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_deposit_h.h
deleted file mode 100644
index abbddef..0000000
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_deposit_h.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
-    3GPP TS 26.073
-    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
-    Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
-Permission to distribute, modify and use this file under the standard license
-terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
-/*
-
- Pathname: ./gsm-amr/c/include/l_deposit_h.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_deposit_h function.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
-
-------------------------------------------------------------------------------
- INCLUDE DESCRIPTION
-
- This file contains all the constant definitions and prototype definitions
- needed by the L_deposit_h function.
-
-------------------------------------------------------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-; CONTINUE ONLY IF NOT ALREADY DEFINED
-----------------------------------------------------------------------------*/
-#ifndef	L_DEPOSIT_H_H
-#define	L_DEPOSIT_H_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_deposit_h(Word16 var1);
-
-    /*----------------------------------------------------------------------------
-    ; END
-    ----------------------------------------------------------------------------*/
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_deposit_l.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_deposit_l.h
deleted file mode 100644
index 388844c..0000000
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_deposit_l.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-/****************************************************************************************
-Portions of this file are derived from the following 3GPP standard:
-
-    3GPP TS 26.073
-    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
-    Available from http://www.3gpp.org
-
-(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
-Permission to distribute, modify and use this file under the standard license
-terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
-/*
-
- Pathname: ./gsm-amr/c/include/l_deposit_l.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_deposit_l function.
-
- Description: Updated template to make it build for Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
-
-------------------------------------------------------------------------------
- INCLUDE DESCRIPTION
-
- This file contains all the constant definitions and prototype definitions
- needed by the L_deposit_l function.
-
-------------------------------------------------------------------------------
-*/
-
-/*----------------------------------------------------------------------------
-; CONTINUE ONLY IF NOT ALREADY DEFINED
-----------------------------------------------------------------------------*/
-#ifndef	L_DEPOSIT_L_H
-#define	L_DEPOSIT_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
-    ----------------------------------------------------------------------------*/
-    Word32 L_deposit_l(Word16 var1);
-
-    /*----------------------------------------------------------------------------
-    ; 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
index c28072e..2816f83 100644
--- 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
@@ -28,19 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/l_extract.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: l_extract.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -54,8 +42,8 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	L_EXTRACT_H
-#define	L_EXTRACT_H
+#ifndef L_EXTRACT_H
+#define L_EXTRACT_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
@@ -101,9 +89,9 @@ extern "C"
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
     void L_Extract(Word32 L_var,
-                   Word16 *pL_var_hi,
-                   Word16 *pL_var_lo,
-                   Flag   *pOverflow);
+    Word16 *pL_var_hi,
+    Word16 *pL_var_lo,
+    Flag   *pOverflow);
 
     /*----------------------------------------------------------------------------
     ; END
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
index b4af3aa..865f043 100644
--- 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
@@ -27,24 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/include/l_mac.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_mac function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: 1. Updated the function to include ARM and Linux-ARM assembly
-                 instructions.
-              2. Added OSCL_UNUSED_ARG(pOverflow) to remove compiler warnings.
-
- Description:
+ Filename: l_mac.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index 3bafb00..b1a51ba 100644
--- 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
@@ -27,23 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/include/l_msu.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_msu function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: Providing support for ARM and Linux-ARM assembly instructions.
-
- Who:                       Date:
- Description:
+ Filename: l_msu.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index a2eb91c..2aaea47 100644
--- 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
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/l_mult.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_mult function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: Providing support for ARM and Linux-ARM assembly instructions.
-
- Who:						Date:
- Description:
+ Filename: l_mult.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -58,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	L_MULT_H
-#define	L_MULT_H
+#ifndef L_MULT_H
+#define L_MULT_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index 8ddb24a..e406bb8 100644
--- 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
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/include/l_negate.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_negate function.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: l_negate.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -55,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	L_NEGATE_H
-#define	L_NEGATE_H
+#ifndef L_NEGATE_H
+#define L_NEGATE_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index 90b778b..5430bc7 100644
--- 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
@@ -28,21 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/l_shl.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_shl function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: l_shl.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -56,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	L_SHL_H
-#define	L_SHL_H
+#ifndef L_SHL_H
+#define L_SHL_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index b749ce4..424c948 100644
--- 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
@@ -27,21 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/include/l_shr.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_shr function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: l_shr.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -55,13 +41,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	L_SHR_H
-#define	L_SHR_H
+#ifndef L_SHR_H
+#define L_SHR_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index e41a0c4..29d99da 100644
--- 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
@@ -28,21 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/l_shr_r.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_shr_r function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: l_shr_r.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -56,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	L_SHR_R_H
-#define	L_SHR_R_H
+#ifndef L_SHR_R_H
+#define L_SHR_R_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -101,7 +87,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    Word32 L_shr_r(Word32 L_var1, Word16 var2, Flag *pOverflow);
+    OSCL_IMPORT_REF Word32 L_shr_r(Word32 L_var1, Word16 var2, Flag *pOverflow);
 
     /*----------------------------------------------------------------------------
     ; END
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
index e461a92..a9b0732 100644
--- 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
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/l_sub.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_sub function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: Providing support for ARM and Linux-ARM assembly instructions.
-
- Who:						Date:
- Description:
+ Filename: l_sub.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -58,14 +42,14 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	L_SUB_H
-#define	L_SUB_H
+#ifndef L_SUB_H
+#define L_SUB_H
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index e589b2f..ce27dba 100644
--- 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
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/log2.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. Deleted function
-          prototype for Log2_norm and put it in its own header file.
-          Added log2_norm.h in Include section for legacy files.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section..
-
- Who:                       Date:
- Description:
+ Filename: log2.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -103,7 +87,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    void Log2(
+    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) */
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
index 1f73c6d..8c552b3 100644
--- 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
@@ -28,21 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/log2_norm.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for Log2_norm function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template. Added extern declaration for log2_tbl[]
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: log2_norm.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -55,15 +41,15 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	LOG2_NORM_H
-#define	LOG2_NORM_H
+#ifndef LOG2_NORM_H
+#define LOG2_NORM_H
 
-#define log2_h "$Id $"				/* Used by legacy code */
+#define log2_h "$Id $"              /* Used by legacy code */
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"typedef.h"
+#include    "typedef.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index d9a1f80..cca36d4 100644
--- 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
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/lsfwt.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: lsfwt.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index 26a4b34..99b6151 100644
--- 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
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/lsp.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: lsp.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -124,7 +111,7 @@ extern "C"
     *
     **************************************************************************
     */
-    Word16 lsp_init(lspState **st);
+    OSCL_IMPORT_REF Word16 lsp_init(lspState **st);
 
     /*
     **************************************************************************
@@ -135,7 +122,7 @@ extern "C"
     *
     **************************************************************************
     */
-    Word16 lsp_reset(lspState *st);
+    OSCL_IMPORT_REF Word16 lsp_reset(lspState *st);
 
     /*
     **************************************************************************
@@ -146,7 +133,7 @@ extern "C"
     *
     **************************************************************************
     */
-    void lsp_exit(lspState **st);
+    OSCL_IMPORT_REF void lsp_exit(lspState **st);
 
     /*
     **************************************************************************
@@ -164,15 +151,15 @@ extern "C"
     *
     **************************************************************************
     */
-    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           */
-            );
+    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
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
index e5d10e2..fb3d248 100644
--- 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
@@ -28,15 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/lsp_az.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: lsp_az.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -50,8 +42,8 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	LSP_AZ_H
-#define	LSP_AZ_H
+#ifndef LSP_AZ_H
+#define LSP_AZ_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
@@ -95,7 +87,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    void Lsp_Az(
+    OSCL_IMPORT_REF void Lsp_Az(
         Word16 lsp[],        /* (i)  : line spectral frequencies            */
         Word16 a[],          /* (o)  : predictor coefficients (order = 10)  */
         Flag  *pOverflow     /* (o)  : overflow flag                        */
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
index 186b4d3..5cdbb4c 100644
--- 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
@@ -27,17 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/include/lsp_lsf.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: lsp_lsf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -97,13 +87,13 @@ extern "C"
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
 
-    void Lsf_lsp(
+    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            */
     );
-    void Lsp_lsf(
+    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                                */
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
index 01b3317..db3cd52 100644
--- 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
@@ -28,15 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/include/lsp_tab.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus after Include section.
-
- Who:                       Date:
- Description:
+ Filename: lsp_tab.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index aeb0256..b79a84f 100644
--- 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
@@ -28,23 +28,9 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/mac_32.h
+ Filename: mac_32.h
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: Inlined the functions from mac_32.cpp. A performance improvement
-              change.
-
- Who:                       Date:
- Description:
-------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
  This file contains all the constant definitions and prototype definitions
@@ -103,11 +89,11 @@ extern "C"
     ----------------------------------------------------------------------------*/
 
     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 L_var1_hi,
+    Word16 L_var1_lo,
+    Word16 L_var2_hi,
+    Word16 L_var2_lo,
+    Flag *pOverflow)
     {
         Word16  product;
 
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
index f4695ca..75f86cb 100644
--- 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
@@ -61,19 +61,19 @@ extern "C"
     ********************************************************************************
     */
     enum Mode { MR475 = 0,
-                MR515,
-                MR59,
-                MR67,
-                MR74,
-                MR795,
-                MR102,
-                MR122,
+        MR515,
+        MR59,
+        MR67,
+        MR74,
+        MR795,
+        MR102,
+        MR122,
 
-                MRDTX,
+        MRDTX,
 
-                N_MODES     /* number of (SPC) modes */
+        N_MODES     /* number of (SPC) modes */
 
-              };
+    };
 
 #ifdef __cplusplus
 }
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
index a016241..f2cb7cf 100644
--- 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
@@ -28,21 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/mpy_32.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: Updated the function to include ARM and Linux-ARM assembly
-              instructions.
-
- Description:
+ Filename: mpy_32.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -62,7 +48,7 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -105,10 +91,10 @@ extern "C"
 #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)
+    Word16 L_var1_lo,
+    Word16 L_var2_hi,
+    Word16 L_var2_lo,
+    Flag   *pOverflow)
 
     {
         /*----------------------------------------------------------------------------
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
index 07debc3..5274446 100644
--- 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
@@ -28,7 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
-  Filename: /audio/gsm_amr/c/include/mpy_32_16.h
+ Filename: mpy_32_16.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -42,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	MPY_32_16_H
-#define	MPY_32_16_H
+#ifndef MPY_32_16_H
+#define MPY_32_16_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -91,9 +91,9 @@ extern "C"
 #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)
+    Word16 L_var1_lo,
+    Word16 var2,
+    Flag *pOverflow)
     {
 
         Word32 L_product;
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
index 639f1b3..eac2004 100644
--- 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
@@ -28,26 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/mult.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for mult function.
-
- Description: Changed prototype of the mult() function. Instead of using global
-			  a pointer to overflow flag is now passed into the function.
-
- Description: Updated copyright information.
-			  Updated variable name from "overflow" to "pOverflow" to match
-			  with original function declaration.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: Providing support for ARM and Linux-ARM assembly instructions.
-
- Who:						Date:
- Description:
+ Filename: mult.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -58,14 +39,14 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 */
 
-#ifndef	MULT_H
-#define	MULT_H
+#ifndef MULT_H
+#define MULT_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -186,5 +167,5 @@ extern "C"
 }
 #endif
 
-#endif	/* _MULT_H_ */
+#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
index 4a904f4..90f7e83 100644
--- 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
@@ -28,25 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/mult_r.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for mult_r function.
-
- Description: Changed prototype of the mult() function. Instead of using global
-			  data, a pointer to overflow flag is now passed into the function.
-
- Description: Made the following based on P2/P3 review
-			  1) Changed the parameter name from "overflow" to "pOverflow"
-			  in the function prototype declaration.
-			  2) Updated template
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: mult_r.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -57,14 +39,14 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 */
 
-#ifndef	MULT_R__H
-#define	MULT_R__H
+#ifndef MULT_R__H
+#define MULT_R__H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -103,7 +85,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow);
+    OSCL_IMPORT_REF Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow);
 
     /*----------------------------------------------------------------------------
     ; END
@@ -113,7 +95,7 @@ extern "C"
 #endif
 
 
-#endif	/* _MULT_R_H_ */
+#endif  /* _MULT_R_H_ */
 
 
 
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
index 05d8a6f..2b77f77 100644
--- 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
@@ -15,7 +15,7 @@
  * and limitations under the License.
  * -------------------------------------------------------------------
  */
-/****************************************************************************************
+/*****************************************************************************
 Portions of this file are derived from the following 3GPP standard:
 
     3GPP TS 26.073
@@ -25,22 +25,9 @@ Portions of this file are derived from the following 3GPP standard:
 (C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
 Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
-****************************************************************************************/
+**************************************************************************/
 /*
- Pathname: ./gsm-amr/c/include/negate.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for negate function.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: negate.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -54,13 +41,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	NEGATE_H
-#define	NEGATE_H
+#ifndef NEGATE_H
+#define NEGATE_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
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
index 756a850..faea591 100644
--- 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
@@ -27,22 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/include/norm_l.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for norm_l function.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: Support for ARM and Linux-ARM assembly.
-
- Who:						Date:
- Description:
+ Filename: norm_l.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -56,13 +41,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	NORM_L_H
-#define	NORM_L_H
+#ifndef NORM_L_H
+#define NORM_L_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -104,7 +89,7 @@ extern "C"
 #if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) )
 
     /* C EQUIVALENT */
-    Word16 norm_l(Word32 L_var1);
+    OSCL_IMPORT_REF Word16 norm_l(Word32 L_var1);
 
 #elif defined(PV_ARM_V5)
 
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
index 0606af3..955903a 100644
--- 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
@@ -27,20 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/include/norm_s.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for norm_s function.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: norm_s.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -54,13 +41,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	NORM_S_H
-#define	NORM_S_H
+#ifndef NORM_S_H
+#define NORM_S_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -103,7 +90,7 @@ extern "C"
 
     /* C EQUIVALENT */
 
-    Word16 norm_s(Word16 var1);
+    OSCL_IMPORT_REF Word16 norm_s(Word16 var1);
 
 #elif defined(PV_ARM_V5)
 
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
index 2611b16..c2ef975 100644
--- 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
@@ -28,16 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/include/oper_32b.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Deleted inclusion of files that were not part of the original
-	      oper_32b.h file.
-
- Who:						Date:
- Description:
+ Filename: oper_32b.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -50,15 +41,14 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	OPER_32B_H
-#define	OPER_32B_H
+#ifndef OPER_32B_H
+#define OPER_32B_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include        "typedef.h"
 
-#include        "div_32.h"
 #include        "l_comp.h"
 #include        "l_extract.h"
 
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
index 6c277da..6a13a57 100644
--- 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
@@ -28,17 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/include/p_ol_wgh.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: p_ol_wgh.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index 639c068..db4529b 100644
--- 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
@@ -28,19 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/log2_norm.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template. Added extern declaration for pow2_tbl[]
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: pow2.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -53,13 +41,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	POW2_H
-#define	POW2_H
+#ifndef POW2_H
+#define POW2_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"typedef.h"
+#include    "typedef.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -99,7 +87,8 @@ extern "C"
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
 
-    Word32 Pow2(            /* (o)  : result       (range: 0<=val<=0x7fffffff) */
+    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                           */
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
index 45d9272..28a0dd8 100644
--- 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
@@ -27,15 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/include/pred_lt.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: pred_lt.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -94,7 +86,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    void Pred_lt_3or6(
+    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                            */
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
index 431272a..9298d09 100644
--- 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
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/q_plsf.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: q_plsf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -139,7 +126,7 @@ extern "C"
        stores NULL in *st
      */
 
-    void Q_plsf_3(
+    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  */
@@ -149,7 +136,7 @@ extern "C"
         Flag  *pOverflow    /* o : Flag set when overflow occurs             */
     );
 
-    void Q_plsf_5(
+    OSCL_IMPORT_REF void Q_plsf_5(
         Q_plsfState *st,
         Word16 *lsp1,      /* i  : 1st LSP vector,                     Q15 */
         Word16 *lsp2,      /* i  : 2nd LSP vector,                     Q15 */
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
index 1bd0212..8bf7047 100644
--- 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
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/q_plsf_3_tbl.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created this file from the reference, q_plsf_3_tbl.tab
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who: 						Date:
- Description:
+ Filename: q_plsf_3_tbl.h
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
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
index 245b5f4..e495c4a 100644
--- 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
@@ -28,13 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/include/q_plsf_5_tbl.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Who:                        Date:
- Description:
+ Filename: q_plsf_5_tbl.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index 6c0d766..cfa5dee 100644
--- 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
@@ -28,13 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/include/qgain475_tab.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Who:                        Date:
- Description:
+ Filename: qgain475_tab.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index 65b35ee..951a2c4 100644
--- 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
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/qua_gain.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: qua_gain.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -62,6 +51,7 @@ terms listed above has been obtained from the copyright holder.
 #include "typedef.h"
 #include "gc_pred.h"
 #include "mode.h"
+#include "get_const_tbls.h"
 
 
 /*--------------------------------------------------------------------------*/
@@ -120,6 +110,7 @@ extern "C"
         /*      (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                     */
     );
     /*----------------------------------------------------------------------------
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
index a7691e7..b3d2c01 100644
--- 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
@@ -28,13 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/include/qua_gain_tbl.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Who:                        Date:
- Description:
+ Filename: qua_gain_tbl.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index 620cd0b..231bc9a 100644
--- 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
@@ -27,15 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/include/reorder.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                           Date:
- Description:
+ Filename: reorder.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -91,7 +83,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    void Reorder_lsf(
+    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                                */
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
index f4d0041..2c6d430 100644
--- 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
@@ -69,7 +69,7 @@ extern "C"
     *                         DECLARATION OF PROTOTYPES
     ********************************************************************************
     */
-    void Residu(
+    OSCL_IMPORT_REF void Residu(
         Word16 a[],        /* (i)  : prediction coefficients                    */
         Word16 x[],        /* (i)  : speech signal                              */
         Word16 y[],        /* (o)  : residual signal                            */
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
index fcc8df6..5933e15 100644
--- 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
@@ -28,21 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/include/reverse_bits.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Adding #include "mode.h" so that it compiles and works for the
-              ARM tools.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                        Date:
- Description:
+ Filename: reverse_bits.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
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
index 3129e27..f4f8072 100644
--- 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
@@ -27,24 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/include/round.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for round function.
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: round.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -103,7 +86,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    Word16 pv_round(Word32 L_var1, Flag *pOverflow);
+    OSCL_IMPORT_REF Word16 pv_round(Word32 L_var1, Flag *pOverflow);
 
     /*----------------------------------------------------------------------------
     ; END
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
index de4aed7..ca09201 100644
--- 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
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/shl.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for shl function.
-
- Description: Changed prototype of the mult() function. Instead of using global
-			  a pointer to overflow flag is now passed into the function.
-
- Description: Updated template. Changed the parameter name from "overflow" to
-			  "pOverflow" in the function prototype declaration
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: shl.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -58,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	SHL_H
-#define	SHL_H
+#ifndef SHL_H
+#define SHL_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -112,7 +96,7 @@ extern "C"
 }
 #endif
 
-#endif	/* _SHL_H_ */
+#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
index a7111c1..b3149a0 100644
--- 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
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/shr.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for shr function.
-
- Description: Changed the function prototype declaration.
-			  Updated template.
-
- Description: Updated template. Changed the parameter name from "overflow" to
-			  "pOverflow" in the function prototype declaration
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: shr.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -58,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	SHR_H
-#define	SHR_H
+#ifndef SHR_H
+#define SHR_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -103,7 +87,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    Word16 shr(Word16 var1, Word16 var2, Flag *pOverflow);
+    OSCL_IMPORT_REF Word16 shr(Word16 var1, Word16 var2, Flag *pOverflow);
 
     /*----------------------------------------------------------------------------
     ; END
@@ -112,4 +96,4 @@ extern "C"
 }
 #endif
 
-#endif	/* _SHR_H_ */
+#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
index c4f9e2c..30ccf29 100644
--- 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
@@ -27,22 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/include/shr_r.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for shr_r function.
-
- Description: Passing in pOverflow.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #define after Include section.
-
- Who:                           Date:
- Description:
+ Filename: shr_r.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -101,7 +86,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    Word16 shr_r(Word16 var1, Word16 var2, Flag *pOverflow);
+    OSCL_IMPORT_REF Word16 shr_r(Word16 var1, Word16 var2, Flag *pOverflow);
 
     /*----------------------------------------------------------------------------
     ; END
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
index 86209bd..f41f8d3 100644
--- 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
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/sqrt_l.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Updated function prototype declaration to reflect new interface.
-              A pointer to overflow flag is passed into the function. Updated
-              template.
-
- Description: Added extern declaration for sqrt_l_tbl[]
-
- Description: Moved _cplusplus #ifdef before function prototype.
-
- Who:                           Date:
- Description:
-
+ Filename: sqrt_l.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -101,7 +85,7 @@ extern "C"
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
 
-    Word32 sqrt_l_exp(      /* o : output value,                          Q31 */
+    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 */
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
index ea7aa40..b28d686 100644
--- 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
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/sub.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for sub function.
-
- Description: Changed function prototype declaration.
-
- Description: Updated copyright information.
-			  Updated variable name from "overflow" to "pOverflow" to match
-			  with original function declaration.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:						Date:
- Description:
+ Filename: sub.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -58,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	SUB_H
-#define	SUB_H
+#ifndef SUB_H
+#define SUB_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -103,7 +87,7 @@ extern "C"
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-    Word16 sub(Word16 var1, Word16 var2, Flag *pOverflow);
+    OSCL_IMPORT_REF Word16 sub(Word16 var1, Word16 var2, Flag *pOverflow);
 
     /*----------------------------------------------------------------------------
     ; END
@@ -112,4 +96,4 @@ extern "C"
 }
 #endif
 
-#endif	/* _SUB_H_ */
+#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
index 7fff112..4d8cd13 100644
--- 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
@@ -67,7 +67,7 @@ extern "C"
     *                         DECLARATION OF PROTOTYPES
     ********************************************************************************
     */
-    void Syn_filt(
+    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                              */
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
index fbac230..b9ee89f 100644
--- 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
@@ -51,8 +51,8 @@ terms listed above has been obtained from the copyright holder.
 ********************************************************************************
 */
 
-#include "vad1.h"	/* for VAD option 1 */
-#include "vad2.h"	/* for VAD option 2 */
+#include "vad1.h"   /* for VAD option 1 */
+#include "vad2.h"   /* for VAD option 2 */
 
 /*
 ********************************************************************************
@@ -66,7 +66,7 @@ terms listed above has been obtained from the copyright holder.
 ********************************************************************************
 */
 
-#ifndef	VAD2
+#ifndef VAD2
 #define vadState vadState1
 #else
 #define vadState vadState2
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
index 0358c85..cede607 100644
--- 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
@@ -68,7 +68,7 @@ extern "C"
     *                         DECLARATION OF PROTOTYPES
     ********************************************************************************
     */
-    void Weight_Ai(
+    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         */
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
index 7cb441f..5928c54 100644
--- 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
@@ -27,13 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: .audio/gsm-amr/c/include/window_tab.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Who:						Date:
- Description:
+ Filename: window_tab.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -46,8 +40,8 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	WINDOW_TAB_H
-#define	WINDOW_TAB_H
+#ifndef WINDOW_TAB_H
+#define WINDOW_TAB_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
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
index b923e52..c005f52 100644
--- 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
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/include/src/wmf_to_ets.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed mode to frame_type_3gpp
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: wmf_to_ets.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -63,6 +50,7 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 #include "frame_type_3gpp.h"
 #include "typedef.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -104,8 +92,9 @@ extern "C"
     ----------------------------------------------------------------------------*/
 
     void wmf_to_ets(enum Frame_Type_3GPP frame_type_3gpp,
-                    UWord8   *wmf_input_ptr,
-                    Word16   *ets_output_ptr);
+    UWord8   *wmf_input_ptr,
+    Word16   *ets_output_ptr,
+    CommonAmrTbls* common_amr_tbls);
 
 
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/add.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/add.cpp
index f503d47..8085ac2 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/add.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/add.cpp
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/add.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for add function. Sync'ed up with the
-	      current template and fixed tabs.
-
- Description: Changed all occurrences of L_sum with sum.
-
- Description: Changed function protype to pass in pointer to Overflow flag
-				as a parameter.
-
- Description: Removed code that updates MOPS counter
-
- Who: 						Date:
- Description:
+ Filename: add.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -58,7 +42,7 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -89,19 +73,19 @@ terms listed above has been obtained from the copyright holder.
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	var1 = 16 bit short signed integer (Word16) whose value falls in
-	       the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+    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.
+    var2 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
 
-	pOverflow = pointer to overflow (Flag)
+    pOverflow = pointer to overflow (Flag)
 
  Outputs:
-	pOverflow -> 1 if the add operation resulted in overflow
+    pOverflow -> 1 if the add operation resulted in overflow
 
  Returns:
-	sum = 16-bit limited sum of var1 and var2 (Word16)
+    sum = 16-bit limited sum of var1 and var2 (Word16)
 
  Global Variables Used:
     None
@@ -148,22 +132,6 @@ terms listed above has been obtained from the copyright holder.
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -173,7 +141,7 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
-Word16 add(Word16 var1, Word16 var2, Flag *pOverflow)
+OSCL_EXPORT_REF Word16 add_16(Word16 var1, Word16 var2, Flag *pOverflow)
 {
     /*----------------------------------------------------------------------------
     ; Define all local variables
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp
index bd99b30..688cda3 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/az_lsp.cpp
@@ -28,55 +28,12 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/src/az_lsp.c
+ Filename: az_lsp.cpp
  Funtions: Chebps
            Chebps_Wrapper
            Az_lsp
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Finished first pass of optimization.
-
- Description: Made changes based on review comments.
-
- Description: Made input to Chebps_Wrapper consistent with that of Chebps.
-
- Description: Replaced current Pseudo-code with the UMTS code version 3.2.0.
-              Updated coding template.
-
- Description: Replaced basic_op.h and oper_32b.h with the header files of the
-              math functions used by the file.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Used "-" operator instead of calling sub function in the
-                 az_lsp() code.
-              2. Copied detailed function description of az_lsp from the
-                 header file.
-              3. Modified local variable definition to one per line.
-              4. Used NC in the definition of f1 and f2 arrays.
-              5. Added curly brackets in the IF statement.
-
- Description: Changed function interface to pass in a pointer to overflow
-              flag into the function instead of using a global flag. Removed
-              inclusion of unneeded header files.
-
- Description:  For Chebps() and Az_lsp()
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation.
-              4. Eliminated not needed variables
-              5. Eliminated if-else checks for saturation
-              6. Deleted unused function cheps_wraper
-
- Description:  Added casting to eliminate warnings
-
-
- Who:                           Date:
- Description:
-
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
  These modules compute the LSPs from the LP coefficients.
@@ -216,22 +173,6 @@ static Word16 Chebps (Word16 x,
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -535,22 +476,6 @@ void Az_lsp (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitno_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitno_tab.cpp
index 4ee04a5..e75b692 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitno_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitno_tab.cpp
@@ -28,21 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/src/bitno_tab.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Define "const Word16 *bitno[N_MODES]" as "const Word16 *const
-                      bitno[N_MODES]"
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who:                       Date:
- Description:
+ Filename: bitno_tab.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -89,28 +75,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -152,7 +116,7 @@ extern "C"
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
     /* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
-    const Word16 prmno[N_MODES] =
+    extern const Word16 prmno[N_MODES] =
     {
         PRMNO_MR475,
         PRMNO_MR515,
@@ -166,7 +130,7 @@ extern "C"
     };
 
     /* number of parameters to first subframe per modes */
-    const Word16 prmnofsf[N_MODES - 1] =
+    extern const Word16 prmnofsf[N_MODES - 1] =
     {
         PRMNOFSF_MR475,
         PRMNOFSF_MR515,
@@ -179,7 +143,7 @@ extern "C"
     };
 
     /* parameter sizes (# of bits), one table per mode */
-    const Word16 bitno_MR475[PRMNO_MR475] =
+    extern const Word16 bitno_MR475[PRMNO_MR475] =
     {
         8, 8, 7,                                 /* LSP VQ          */
         8, 7, 2, 8,                              /* first subframe  */
@@ -188,7 +152,7 @@ extern "C"
         4, 7, 2,                                 /* fourth subframe */
     };
 
-    const Word16 bitno_MR515[PRMNO_MR515] =
+    extern const Word16 bitno_MR515[PRMNO_MR515] =
     {
         8, 8, 7,                                 /* LSP VQ          */
         8, 7, 2, 6,                              /* first subframe  */
@@ -197,7 +161,7 @@ extern "C"
         4, 7, 2, 6,                              /* fourth subframe */
     };
 
-    const Word16 bitno_MR59[PRMNO_MR59] =
+    extern const Word16 bitno_MR59[PRMNO_MR59] =
     {
         8, 9, 9,                                 /* LSP VQ          */
         8, 9, 2, 6,                              /* first subframe  */
@@ -206,7 +170,7 @@ extern "C"
         4, 9, 2, 6,                              /* fourth subframe */
     };
 
-    const Word16 bitno_MR67[PRMNO_MR67] =
+    extern const Word16 bitno_MR67[PRMNO_MR67] =
     {
         8, 9, 9,                                 /* LSP VQ          */
         8, 11, 3, 7,                             /* first subframe  */
@@ -215,7 +179,7 @@ extern "C"
         4, 11, 3, 7,                             /* fourth subframe */
     };
 
-    const Word16 bitno_MR74[PRMNO_MR74] =
+    extern const Word16 bitno_MR74[PRMNO_MR74] =
     {
         8, 9, 9,                                 /* LSP VQ          */
         8, 13, 4, 7,                             /* first subframe  */
@@ -224,7 +188,7 @@ extern "C"
         5, 13, 4, 7,                             /* fourth subframe */
     };
 
-    const Word16 bitno_MR795[PRMNO_MR795] =
+    extern const Word16 bitno_MR795[PRMNO_MR795] =
     {
         9, 9, 9,                                 /* LSP VQ          */
         8, 13, 4, 4, 5,                          /* first subframe  */
@@ -233,7 +197,7 @@ extern "C"
         6, 13, 4, 4, 5,                          /* fourth subframe */
     };
 
-    const Word16 bitno_MR102[PRMNO_MR102] =
+    extern const Word16 bitno_MR102[PRMNO_MR102] =
     {
         8, 9, 9,                                 /* LSP VQ          */
         8, 1, 1, 1, 1, 10, 10, 7, 7,             /* first subframe  */
@@ -242,7 +206,7 @@ extern "C"
         5, 1, 1, 1, 1, 10, 10, 7, 7,             /* fourth subframe */
     };
 
-    const Word16 bitno_MR122[PRMNO_MR122] =
+    extern const Word16 bitno_MR122[PRMNO_MR122] =
     {
         7, 8, 9, 8, 6,                           /* LSP VQ          */
         9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5,   /* first subframe  */
@@ -251,7 +215,7 @@ extern "C"
         6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5    /* fourth subframe */
     };
 
-    const Word16 bitno_MRDTX[PRMNO_MRDTX] =
+    extern const Word16 bitno_MRDTX[PRMNO_MRDTX] =
     {
         3,
         8, 9, 9,
@@ -259,7 +223,7 @@ extern "C"
     };
 
     /* overall table with all parameter sizes for all modes */
-    const Word16 * const bitno[N_MODES] =
+    extern const Word16 * const bitno[N_MODES] =
     {
         bitno_MR475,
         bitno_MR515,
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitreorder_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitreorder_tab.cpp
index 4897495..1cb2bbf 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitreorder_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bitreorder_tab.cpp
@@ -28,25 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/src/bitreorder.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed file name to bitreorder_tab.c and .h. Also, updated the
-              module description.
-
- Description: Define "const Word16 *reorderBits[NUM_MODES-1]" as
-              "const Word16 *const reorderBits[NUM_MODES-1]".
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition. Removed corresponding header file from Include
-              section.
-
- Description: Put "extern" back.
-
- Who:                       Date:
- Description:
+ Filename: bitreorder_tab.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -94,28 +76,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -171,7 +131,7 @@ extern "C"
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
     /* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
-    const Word16 numOfBits[NUM_MODES] =
+    extern const Word16 numOfBits[NUM_MODES] =
     {
         NUMBIT_MR475,
         NUMBIT_MR515,
@@ -191,7 +151,7 @@ extern "C"
         NUMBIT_NO_DATA
     };
 
-    const Word16 reorderBits_MR475[NUMBIT_MR475] =
+    extern const Word16 reorderBits_MR475[NUMBIT_MR475] =
     {
         0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
         10, 11, 12, 13, 14, 15, 23, 24, 25, 26,
@@ -205,7 +165,7 @@ extern "C"
         92, 31, 52, 65, 86
     };
 
-    const Word16 reorderBits_MR515[NUMBIT_MR515] =
+    extern const Word16 reorderBits_MR515[NUMBIT_MR515] =
     {
         7,  6,  5,  4,  3,  2,  1,  0, 15, 14,
         13, 12, 11, 10,  9,  8, 23, 24, 25, 26,
@@ -220,7 +180,7 @@ extern "C"
         53, 72, 91
     };
 
-    const Word16 reorderBits_MR59[NUMBIT_MR59] =
+    extern const Word16 reorderBits_MR59[NUMBIT_MR59] =
     {
         0,  1,  4,  5,  3,  6,  7,  2, 13, 15,
         8,  9, 11, 12, 14, 10, 16, 28, 74, 29,
@@ -236,7 +196,7 @@ extern "C"
         38, 59, 84, 105, 37, 58, 83, 104
     };
 
-    const Word16 reorderBits_MR67[NUMBIT_MR67] =
+    extern const Word16 reorderBits_MR67[NUMBIT_MR67] =
     {
         0,  1,  4,  3,  5,  6, 13,  7,  2,  8,
         9, 11, 15, 12, 14, 10, 28, 82, 29, 83,
@@ -254,7 +214,7 @@ extern "C"
         36, 61, 90, 115
     };
 
-    const Word16 reorderBits_MR74[NUMBIT_MR74] =
+    extern const Word16 reorderBits_MR74[NUMBIT_MR74] =
     {
         0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
         10, 11, 12, 13, 14, 15, 16, 26, 87, 27,
@@ -273,7 +233,7 @@ extern "C"
         39, 68, 100, 129, 40, 69, 101, 130
     };
 
-    const Word16 reorderBits_MR795[NUMBIT_MR795] =
+    extern const Word16 reorderBits_MR795[NUMBIT_MR795] =
     {
         8,  7,  6,  5,  4,  3,  2, 14, 16,  9,
         10, 12, 13, 15, 11, 17, 20, 22, 24, 23,
@@ -293,7 +253,7 @@ extern "C"
         139, 37, 69, 103, 135, 38, 70, 104, 136
     };
 
-    const Word16 reorderBits_MR102[NUMBIT_MR102] =
+    extern const Word16 reorderBits_MR102[NUMBIT_MR102] =
     {
         7,  6,  5,  4,  3,  2,  1,  0, 16, 15,
         14, 13, 12, 11, 10,  9,  8, 26, 27, 28,
@@ -318,7 +278,7 @@ extern "C"
         63, 46, 55, 56
     };
 
-    const Word16 reorderBits_MR122[NUMBIT_MR122] =
+    extern const Word16 reorderBits_MR122[NUMBIT_MR122] =
     {
         0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
         10, 11, 12, 13, 14, 23, 15, 16, 17, 18,
@@ -348,7 +308,7 @@ extern "C"
     };
 
     /* overall table with all parameter sizes for all modes */
-    const Word16 * const reorderBits[NUM_MODES-1] =
+    extern const Word16 * const reorderBits[NUM_MODES-1] =
     {
         reorderBits_MR475,
         reorderBits_MR515,
@@ -361,7 +321,7 @@ extern "C"
     };
 
     /* Number of Frames (16-bit segments sent for each mode */
-    const Word16 numCompressedBytes[16] =
+    extern const Word16 numCompressedBytes[16] =
     {
         13, /*4.75*/
         14, /*5.15*/
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bits2prm.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bits2prm.cpp
index 1d6f7b1..3901545 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bits2prm.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bits2prm.cpp
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/bits2prm.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Fixed a typo in the include section. Optimized some lines of
-              code as per review comments.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Who:                       Date:
- Description:
+ Filename: bits2prm.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -134,22 +123,6 @@ static Word16 Bin2int ( // Reconstructed parameter
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -241,22 +214,6 @@ void Bits2prm (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bytesused.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bytesused.cpp
index b61bac4..d4b50b2 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bytesused.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/bytesused.cpp
@@ -28,22 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/src/BytesUsed.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Corrected entries for all SID frames and updated function
-              description. Updated copyright year.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition. Removed corresponding header file from Include
-              section.
-
- Description: Put "extern" back.
-
- Who:                       Date:
- Description:
+ Filename: bytesused.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -94,28 +79,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -152,7 +115,7 @@ extern "C"
     ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
-    const short BytesUsed[16] =
+    extern const short BytesUsed[16] =
     {
         13, /* 4.75 */
         14, /* 5.15 */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/c2_9pf_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/c2_9pf_tab.cpp
index 9bb6bc2..cfb56d1 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/c2_9pf_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/c2_9pf_tab.cpp
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/c2_9pf_tab.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
- (1)    Corrected the module description
- (2)    Corrected the filename in the template.
- (3)    Removed embedded tabs.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who:                       Date:
- Description:
+ Filename: c2_9pf_tab.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -86,11 +70,11 @@ extern "C"
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    const Word16 startPos[2*4*2] = {0, 2, 0, 3,
-                                               0, 2, 0, 3,
-                                               1, 3, 2, 4,
-                                               1, 4, 1, 4
-                                              };
+    extern const Word16 startPos[2*4*2] = {0, 2, 0, 3,
+        0, 2, 0, 3,
+        1, 3, 2, 4,
+        1, 4, 1, 4
+    };
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -138,22 +122,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp
index 143e37c..ea02926 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp
@@ -28,28 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/div_32.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Changed function interface to pass in a
-              pointer to overflow flag into the function instead of using a
-              global flag. Removed inclusion of unwanted header files. Changed
-              the name of input and output variables for clarity.
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced l_extract functionality, code size and speed
-                 do not justify calling this function
-              3. Eliminated sub() function call, replace by (-), this knowing
-                 that the result will not saturate.
-
- Description:  Added casting to eliminate warnings
-
- Who:                           Date:
- Description:
-
+ Filename: div_32.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -140,22 +119,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp
index 9e7d23a..f60f18b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_s.cpp
@@ -27,54 +27,34 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/src/div_s.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the div_s function. Sync'ed up
-	      with the current template and fixed tabs.
-
- Description: Making changes based on review meeting.
-
- Description: Made changes based on P3 review meeting.
-
- Description: Changing abort() to exit(0).
-
- Description: Made the following changes
-              1. Unrolled the division loop to make three comparison per
-                 pass, using only five iterations of the loop and saving
-                 shifts cycles
-
- Who: 						Date:
- Description:
+ Filename: div_s.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	var1 = 16 bit signed integer (Word16) whose value falls in
-	       the range : 0x0000 <= var1 <= 0x7fff.
-	var2 = 16 bit signed integer (Word16) whose value falls in
-	       the range : 0x0000 <= var1 <= 0x7fff.
+    var1 = 16 bit signed integer (Word16) whose value falls in
+           the range : 0x0000 <= var1 <= 0x7fff.
+    var2 = 16 bit signed integer (Word16) whose value falls in
+           the range : 0x0000 <= var1 <= 0x7fff.
 
  Local Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Global Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Outputs:
-	var_out = quotient of var1 divided by var2 (Word16)
+    var_out = quotient of var1 divided by var2 (Word16)
 
  Pointers and Buffers Modified:
-	None
+    None
 
  Local Stores Modified:
-	None
+    None
 
  Global Stores Modified:
-	None
+    None
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
@@ -143,35 +123,13 @@ Word16 div_s (Word16 var1, Word16 var2)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-		  stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-		 name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-		   used to represent cycle count for each subroutine
-		   called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-		name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -207,7 +165,7 @@ Word16 div_s (Word16 var1, Word16 var2)
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
-Word16 div_s(register Word16 var1, register Word16 var2)
+OSCL_EXPORT_REF Word16 div_s(register Word16 var1, register Word16 var2)
 {
     /*----------------------------------------------------------------------------
     ; Define all local variables
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_h.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_h.cpp
index 8f5036d..54d0dee 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_h.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_h.cpp
@@ -28,43 +28,32 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/src/extract_h.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the extract_h function. Sync'ed up
-	      with the current template and fixed tabs.
-
- Description: Removed conditional code that updates WMOPS counter
-
- Who: 						Date:
- Description:
+ Filename: extract_h.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	L_var1 = 32 bit long signed integer (Word32 ) whose value falls
-	         in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+    L_var1 = 32 bit long signed integer (Word32 ) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
 
  Local Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Global Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Outputs:
-	L_var1 = Most significant word of input (Word16)
+    L_var1 = Most significant word of input (Word16)
 
  Pointers and Buffers Modified:
-	None
+    None
 
  Local Stores Modified:
-	None
+    None
 
  Global Stores Modified:
-	None
+    None
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
@@ -96,35 +85,13 @@ Word16 extract_h (Word32 L_var1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-		  stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-		 name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-		   used to represent cycle count for each subroutine
-		   called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-		name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_l.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_l.cpp
index e005bc5..a96519b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_l.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/extract_l.cpp
@@ -27,43 +27,32 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/src/extract_l.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the extract_l function. Sync'ed up
-	      with the current template and fixed tabs.
-
- Description: Removed conditional code that updates WMOPS counter
-
- Who: 						Date:
- Description:
+ Filename: extract_l.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	L_var1 = 32 bit long signed integer (Word32 ) whose value falls
-	         in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+    L_var1 = 32 bit long signed integer (Word32 ) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
 
  Local Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Global Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Outputs:
-	L_var1 = Most significant word of input (Word16)
+    L_var1 = Most significant word of input (Word16)
 
  Pointers and Buffers Modified:
-	None
+    None
 
  Local Stores Modified:
-	None
+    None
 
  Global Stores Modified:
-	None
+    None
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
@@ -95,35 +84,13 @@ Word16 extract_l (Word32 L_var1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-		  stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-		 name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-		   used to represent cycle count for each subroutine
-		   called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-		name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gains_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gains_tbl.cpp
index 88015da..4584f5d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gains_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gains_tbl.cpp
@@ -28,22 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/gains_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created this file from the reference, gains.tab
-
- Description: Added include of "typedef.h" to includes section.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who:                               Date:
- Description:
+ Filename: gains_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -86,14 +71,14 @@ extern "C"
     ----------------------------------------------------------------------------*/
 
 
-    const Word16 qua_gain_pitch[NB_QUA_PITCH] =
+    extern const Word16 qua_gain_pitch[NB_QUA_PITCH] =
     {
         0, 3277, 6556, 8192, 9830, 11469, 12288, 13107,
         13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661
     };
 
 
-    const Word16 qua_gain_code[(NB_QUA_CODE+1)*3] =
+    extern const Word16 qua_gain_code[(NB_QUA_CODE+1)*3] =
     {
         /* gain factor (g_fac) and quantized energy error (qua_ener_MR122, qua_ener)
          * are stored:
@@ -153,13 +138,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -187,22 +172,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp
index 3650f3c..9179fe4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gc_pred.cpp
@@ -28,7 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/src/gc_pred.c
+ Filename: gc_pred.cpp
  Functions:
             gc_pred_reset
             gc_pred
@@ -148,29 +148,13 @@ int gc_pred_reset (gc_predState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-Word16 gc_pred_reset(gc_predState *state)
+OSCL_EXPORT_REF Word16 gc_pred_reset(gc_predState *state)
 {
     Word16 i;
 
@@ -441,29 +425,13 @@ gc_pred(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void gc_pred(
+OSCL_EXPORT_REF void gc_pred(
     gc_predState *st,   /* i/o: State struct                           */
     enum Mode mode,     /* i  : AMR mode                               */
     Word16 *code,       /* i  : innovative codebook vector (L_SUBFR)   */
@@ -645,7 +613,7 @@ void gc_pred(
             :                 = frac_en            * 2^exp_en
                           ==> exp_en = -11-exp_code;      */
             *frac_en = (Word16)(ener_code >> 16);
-            *exp_en = sub(-11, exp_code, pOverflow);
+            *exp_en = -11 - exp_code;
 
             /* mean = 36 dB */
             L_temp2 = (Word32) 17062 << 7;
@@ -811,29 +779,13 @@ void gc_pred_update(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void gc_pred_update(
+OSCL_EXPORT_REF void gc_pred_update(
     gc_predState *st,      /* i/o: State struct                     */
     Word16 qua_ener_MR122, /* i  : quantized energy for update, Q10 */
     /*      (log2(qua_err))                  */
@@ -961,29 +913,13 @@ void gc_pred_average_limited(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void gc_pred_average_limited(
+OSCL_EXPORT_REF void gc_pred_average_limited(
     gc_predState *st,       /* i: State struct                    */
     Word16 *ener_avg_MR122, /* o: everaged quantized energy,  Q10 */
     /*    (log2(qua_err))                 */
@@ -1000,7 +936,7 @@ void gc_pred_average_limited(
     for (i = 0; i < NPRED; i++)
     {
         av_pred_en =
-            add(av_pred_en, st->past_qua_en_MR122[i], pOverflow);
+            add_16(av_pred_en, st->past_qua_en_MR122[i], pOverflow);
     }
 
     /* av_pred_en = 0.25*av_pred_en  (with sign-extension)*/
@@ -1024,7 +960,7 @@ void gc_pred_average_limited(
     av_pred_en = 0;
     for (i = 0; i < NPRED; i++)
     {
-        av_pred_en = add(av_pred_en, st->past_qua_en[i], pOverflow);
+        av_pred_en = add_16(av_pred_en, st->past_qua_en[i], pOverflow);
     }
 
     /* av_pred_en = 0.25*av_pred_en  (with sign-extension)*/
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/get_const_tbls.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/get_const_tbls.cpp
new file mode 100644
index 0000000..87ecb86
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/get_const_tbls.cpp
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+#ifndef GET_CONST_TBLS_H
+#include "get_const_tbls.h"
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    extern const Word16 dgray[];
+    extern const Word16 dico1_lsf_3[];
+    extern const Word16 dico1_lsf_5[];
+    extern const Word16 dico2_lsf_3[];
+    extern const Word16 dico2_lsf_5[];
+    extern const Word16 dico3_lsf_3[];
+    extern const Word16 dico3_lsf_5[];
+    extern const Word16 dico4_lsf_5[];
+    extern const Word16 dico5_lsf_5[];
+    extern const Word16 gray[];
+    extern const Word16 lsp_init_data[];
+    extern const Word16 mean_lsf_3[];
+    extern const Word16 mean_lsf_5[];
+    extern const Word16 mr515_3_lsf[];
+    extern const Word16 mr795_1_lsf[];
+    extern const Word16 past_rq_init[];
+    extern const Word16 pred_fac_3[];
+    extern const Word16 qua_gain_code[];
+    extern const Word16 qua_gain_pitch[];
+    extern const Word16 startPos[];
+    extern const Word16 table_gain_lowrates[];
+    extern const Word16 table_gain_highrates[];
+    extern const Word16 prmno[];
+    extern const Word16* const bitno[];
+    extern const Word16 numOfBits[];
+    extern const Word16* const reorderBits[];
+    extern const Word16 numCompressedBytes[];
+    extern const Word16 window_200_40[];
+    extern const Word16 window_160_80[];
+    extern const Word16 window_232_8[];
+    extern const Word16 ph_imp_low_MR795[];
+    extern const Word16 ph_imp_mid_MR795[];
+    extern const Word16 ph_imp_low[];
+    extern const Word16 ph_imp_mid[];
+
+#ifdef __cplusplus
+}
+#endif
+
+OSCL_EXPORT_REF void get_const_tbls(CommonAmrTbls* tbl_struct_ptr)
+{
+    tbl_struct_ptr->dgray_ptr = dgray;
+    tbl_struct_ptr->dico1_lsf_3_ptr = dico1_lsf_3;
+    tbl_struct_ptr->dico1_lsf_5_ptr = dico1_lsf_5;
+    tbl_struct_ptr->dico2_lsf_3_ptr = dico2_lsf_3;
+    tbl_struct_ptr->dico2_lsf_5_ptr = dico2_lsf_5;
+    tbl_struct_ptr->dico3_lsf_3_ptr = dico3_lsf_3;
+    tbl_struct_ptr->dico3_lsf_5_ptr = dico3_lsf_5;
+    tbl_struct_ptr->dico4_lsf_5_ptr = dico4_lsf_5;
+    tbl_struct_ptr->dico5_lsf_5_ptr = dico5_lsf_5;
+    tbl_struct_ptr->gray_ptr = gray;
+    tbl_struct_ptr->lsp_init_data_ptr = lsp_init_data;
+    tbl_struct_ptr->mean_lsf_3_ptr = mean_lsf_3;
+    tbl_struct_ptr->mean_lsf_5_ptr = mean_lsf_5;
+    tbl_struct_ptr->mr515_3_lsf_ptr = mr515_3_lsf;
+    tbl_struct_ptr->mr795_1_lsf_ptr = mr795_1_lsf;
+    tbl_struct_ptr->past_rq_init_ptr = past_rq_init;
+    tbl_struct_ptr->pred_fac_3_ptr = pred_fac_3;
+    tbl_struct_ptr->qua_gain_code_ptr = qua_gain_code;
+    tbl_struct_ptr->qua_gain_pitch_ptr = qua_gain_pitch;
+    tbl_struct_ptr->startPos_ptr = startPos;
+    tbl_struct_ptr->table_gain_lowrates_ptr = table_gain_lowrates;
+    tbl_struct_ptr->table_gain_highrates_ptr = table_gain_highrates;
+    tbl_struct_ptr->prmno_ptr = prmno;
+    tbl_struct_ptr->bitno_ptr = bitno;
+    tbl_struct_ptr->numOfBits_ptr = numOfBits;
+    tbl_struct_ptr->reorderBits_ptr = reorderBits;
+    tbl_struct_ptr->numCompressedBytes_ptr = numCompressedBytes;
+    tbl_struct_ptr->window_200_40_ptr = window_200_40;
+    tbl_struct_ptr->window_160_80_ptr = window_160_80;
+    tbl_struct_ptr->window_232_8_ptr = window_232_8;
+    tbl_struct_ptr->ph_imp_low_MR795_ptr = ph_imp_low_MR795;
+    tbl_struct_ptr->ph_imp_mid_MR795_ptr = ph_imp_mid_MR795;
+    tbl_struct_ptr->ph_imp_low_ptr = ph_imp_low;
+    tbl_struct_ptr->ph_imp_mid_ptr = ph_imp_mid;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp
index be76241..a723ce4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gmed_n.cpp
@@ -27,23 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/gmed_n.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Put file into template and first pass at optimization.
-
- Description: Made changes based on comments from the review meeting. Used
-    pointers instead of index addressing in the arrays.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unncessary include files.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Who:                           Date:
- Description:
+ Filename: gmed_n.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -53,6 +37,7 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 #include    "gmed_n.h"
 #include    "typedef.h"
+#include    "oscl_mem.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -158,29 +143,13 @@ Word16 gmed_n (   // o : The median value (0...N-1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-Word16 gmed_n(            /* o : the median value    */
+OSCL_EXPORT_REF Word16 gmed_n(            /* o : the median value    */
     Word16 ind[],   /* i : input values        */
     Word16 n        /* i : number of inputs    */
 )
@@ -191,10 +160,7 @@ Word16 gmed_n(            /* o : the median value    */
     Word16  tmp[NMAX];
     Word16  tmp2[NMAX];
 
-    for (i = 0; i < n; i++)
-    {
-        *(tmp2 + i) = *(ind + i);
-    }
+    oscl_memmove(tmp2, ind, n*sizeof(*ind));
 
     for (i = 0; i < n; i++)
     {
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gray_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gray_tbl.cpp
index 014df61..f4e4975 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gray_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/gray_tbl.cpp
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/gray_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who: 						Date:
- Description:
+ Filename: gray_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -83,8 +72,8 @@ extern "C"
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
 
-    const Word16 gray[8]  = {0, 1, 3, 2, 6, 4, 5, 7};
-    const Word16 dgray[8] = {0, 1, 3, 2, 5, 6, 4, 7};
+    extern const Word16 gray[8]  = {0, 1, 3, 2, 6, 4, 5, 7};
+    extern const Word16 dgray[8] = {0, 1, 3, 2, 5, 6, 4, 7};
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -98,13 +87,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -132,22 +121,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/grid_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/grid_tbl.cpp
index bc60519..1033cea 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/grid_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/grid_tbl.cpp
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/grid_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who: 						Date:
- Description:
+ Filename: grid_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -91,7 +80,7 @@ extern "C"
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    const Word16 grid[grid_points + 1] =
+    extern const Word16 grid[grid_points + 1] =
     {
         32760, 32723, 32588, 32364, 32051, 31651,
         31164, 30591, 29935, 29196, 28377, 27481,
@@ -118,13 +107,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -152,22 +141,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/int_lpc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/int_lpc.cpp
index 806474d..dc08c11 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/int_lpc.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/int_lpc.cpp
@@ -27,31 +27,10 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/int_lpc.c
+ Filename: int_lpc.cpp
  Functions:
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description: Per review comments, replaced includes of "basic_op.h"
- and "count.h" with "shr.h", "sub.h", and "add.h"
-
- Description:  For Int_lpc_1and3()  and Int_lpc_1and3_2()
-              1. Replaced array addressing by pointers
-              2. Eliminated math operations that unnecessary checked for
-                 saturation
-              3. Unrolled loops to speed up processing
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
-
- Who:                           Date:
- Description:
-
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
 
@@ -149,29 +128,13 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Int_lpc_1and3(
+OSCL_EXPORT_REF void Int_lpc_1and3(
     Word16 lsp_old[],  /* i : LSP vector at the 4th subfr. of past frame (M) */
     Word16 lsp_mid[],  /* i : LSP vector at the 2nd subfr. of
                               present frame (M)                              */
@@ -286,22 +249,6 @@ void Int_lpc_1and3(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -410,29 +357,13 @@ void Int_lpc_1and3_2(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Int_lpc_1to3(
+OSCL_EXPORT_REF void Int_lpc_1to3(
     Word16 lsp_old[], /* input : LSP vector at the 4th SF of past frame    */
     Word16 lsp_new[], /* input : LSP vector at the 4th SF of present frame */
     Word16 Az[],      /* output: interpolated LP parameters in all SFs     */
@@ -441,17 +372,13 @@ void Int_lpc_1to3(
 {
     Word16 i;
     Word16 temp;
-    Word16 temp2;
 
     Word16 lsp[M];
 
     for (i = 0; i < M; i++)
     {
-        temp = shr(lsp_old[i], 2, pOverflow);
-        temp = sub(lsp_old[i], temp, pOverflow);
-        temp2 = shr(lsp_new[i], 2, pOverflow);
-
-        lsp[i] = add(temp2, temp, pOverflow);
+        temp = lsp_old[i] - (lsp_old[i] >> 2);
+        lsp[i] = temp + (lsp_new[i] >> 2);
     }
 
     Lsp_Az(
@@ -464,38 +391,27 @@ void Int_lpc_1to3(
 
     for (i = 0; i < M; i++)
     {
-        temp = shr(lsp_new[i], 1, pOverflow);
-        temp2 = shr(lsp_old[i], 1, pOverflow);
-        lsp[i] = add(temp, temp2, pOverflow);
+        lsp[i] = (lsp_new[i] >> 1) + (lsp_old[i] >> 1);
+
     }
 
-    Lsp_Az(
-        lsp,
-        Az,
-        pOverflow);        /* Subframe 2 */
+    Lsp_Az(lsp, Az, pOverflow);        /* Subframe 2 */
 
     Az += MP1;
 
     for (i = 0; i < M; i++)
     {
-        temp = shr(lsp_new[i], 2, pOverflow);
-        temp = sub(lsp_new[i], temp, pOverflow);
-        temp2 = shr(lsp_old[i], 2, pOverflow);
 
-        lsp[i] = add(temp2, temp, pOverflow);
+        temp = lsp_new[i] - (lsp_new[i] >> 2);
+        lsp[i] = temp + (lsp_old[i] >> 2);
+
     }
 
-    Lsp_Az(
-        lsp,
-        Az,
-        pOverflow);       /* Subframe 3 */
+    Lsp_Az(lsp, Az, pOverflow);        /* Subframe 3 */
 
     Az += MP1;
 
-    Lsp_Az(
-        lsp_new,
-        Az,
-        pOverflow);        /* Subframe 4 */
+    Lsp_Az(lsp_new, Az, pOverflow);    /* Subframe 4 */
 
     return;
 }
@@ -547,22 +463,6 @@ void Int_lpc_1to3(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -578,55 +478,37 @@ void Int_lpc_1to3_2(
 {
     Word16 i;
     Word16 temp;
-    Word16 temp2;
     Word16 lsp[M];
 
     for (i = 0; i < M; i++)
     {
-        temp = shr(lsp_old[i], 2, pOverflow);
-
-        temp = sub(lsp_old[i], temp, pOverflow);
-
-        temp2 = shr(lsp_new[i], 2, pOverflow);
+        temp = lsp_old[i] - (lsp_old[i] >> 2);
+        lsp[i] = temp + (lsp_new[i] >> 2);
 
-        lsp[i] = add(temp2, temp, pOverflow);
     }
 
-    Lsp_Az(
-        lsp,
-        Az,
-        pOverflow);        /* Subframe 1 */
+    Lsp_Az(lsp, Az, pOverflow);         /* Subframe 1 */
 
     Az += MP1;
 
     for (i = 0; i < M; i++)
     {
-        temp = shr(lsp_new[i], 1, pOverflow);
-        temp2 = shr(lsp_old[i], 1, pOverflow);
+        lsp[i] = (lsp_new[i] >> 1) + (lsp_old[i] >> 1);
 
-        lsp[i] = add(temp2, temp, pOverflow);
     }
 
-    Lsp_Az(
-        lsp,
-        Az,
-        pOverflow);        /* Subframe 2 */
+    Lsp_Az(lsp, Az, pOverflow);         /* Subframe 2 */
 
     Az += MP1;
 
     for (i = 0; i < M; i++)
     {
-        temp = shr(lsp_new[i], 2, pOverflow);
-        temp = sub(lsp_new[i], temp, pOverflow);
-        temp2 = shr(lsp_old[i], 2, pOverflow);
+        temp = lsp_new[i] - (lsp_new[i] >> 2);
+        lsp[i] = temp + (lsp_old[i] >> 2);
 
-        lsp[i] = add(temp, temp2, pOverflow);
     }
 
-    Lsp_Az(
-        lsp,
-        Az,
-        pOverflow);        /* Subframe 3 */
+    Lsp_Az(lsp, Az, pOverflow);         /* Subframe 3 */
 
     return;
 }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt.cpp
index 83f4d0c..0125dd4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt.cpp
@@ -27,41 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/inv_sqrt.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Put file into template.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Replaced basic_op.h with the header files of the math functions
-              used in the file.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Defined one local variable per line.
-              2. Used "&=", ">>=", and "+=" in the code.
-
- Description: Updated template. Changed function interface to pass in a
-              pointer to overflow flag into the function instead of using a
-              global flag.
-
- Description: Removed inclusion of inv_sqrt.tab file. Changed array name
-              from "table" to "inv_sqrt_tbl"
-
- Description: Removed math operations that were not needed as functions,
-             this because the numbers themselves will not saturate the
-             operators, so there is not need to check for saturation.
-
- Description: Updated copyrigth year, according to code review comments.
-
- Description:  Replaced "int" and/or "char" with defined types.
-               Added proper casting (Word32) to some left shifting operations
-
- Who:                           Date:
- Description:
+ Filename: inv_sqrt.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -196,29 +162,13 @@ Word32 Inv_sqrt (       // (o) : output value
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-Word32 Inv_sqrt(        /* (o) : output value   */
+OSCL_EXPORT_REF Word32 Inv_sqrt(        /* (o) : output value   */
     Word32 L_x,         /* (i) : input value    */
     Flag   * pOverflow  /* (i) : pointer to overflow flag */
 )
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt_tbl.cpp
index 3caa1f2..696c3e3 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/inv_sqrt_tbl.cpp
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/inv_sqrt_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed table name to inv_sqrt_tbl
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who:                           Date:
- Description:
+ Filename: inv_sqrt_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -82,7 +69,7 @@ extern "C"
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    const Word16 inv_sqrt_tbl[49] =
+    extern const Word16 inv_sqrt_tbl[49] =
     {
 
         32767, 31790, 30894, 30070, 29309, 28602, 27945, 27330, 26755, 26214,
@@ -139,22 +126,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp
index bcde5fa..e436006 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp
@@ -27,43 +27,32 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/src/l_abs.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the L_abs function. Sync'ed up
-	      with the current template and fixed tabs.
-
- Description: Removed conditional code that updates WMOPS counter
-
- Who: 						Date:
- Description:
+ Filename: l_abs.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	L_var1 = 32 bit long signed integer (Word32 ) whose value falls
-	         in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+    L_var1 = 32 bit long signed integer (Word32 ) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
 
  Local Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Global Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Outputs:
-	L_var1 = absolute value of input (Word32)
+    L_var1 = absolute value of input (Word32)
 
  Pointers and Buffers Modified:
-	None
+    None
 
  Local Stores Modified:
-	None
+    None
 
  Global Stores Modified:
-	None
+    None
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
@@ -112,35 +101,13 @@ Word32 L_abs (Word32 L_var1)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-		  stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-		 name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-		   used to represent cycle count for each subroutine
-		   called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-		name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_h.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_h.cpp
index 8aa7e02..2a8ad2f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_h.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_h.cpp
@@ -27,43 +27,32 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/src/l_deposit_h.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the L_deposit_h function. Sync'ed up
-	      with the current template and fixed tabs.
-
- Description: Removed conditional code that updates WMOPS counter
-
- Who: 						Date:
- Description:
+ Filename: l_deposit_h.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	var1 = 16 bit short signed integer (Word16) whose value falls in
-	       the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
 
  Local Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Global Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Outputs:
-	var1 = deposit of var1 into MSWord of 32 bit value (Word32)
+    var1 = deposit of var1 into MSWord of 32 bit value (Word32)
 
  Pointers and Buffers Modified:
-	None
+    None
 
  Local Stores Modified:
-	None
+    None
 
  Global Stores Modified:
-	None
+    None
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
@@ -96,35 +85,13 @@ Word32 L_deposit_h (Word16 var1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-		  stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-		 name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-		   used to represent cycle count for each subroutine
-		   called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-		name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_l.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_l.cpp
index 50977b8..1f5f1fb 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_l.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_deposit_l.cpp
@@ -27,43 +27,32 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/src/l_deposit_l.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the L_deposit_l function. Sync'ed up
-	      with the current template and fixed tabs.
-
- Description: Removed conditional code that updates WMOPS counter
-
- Who: 						Date:
- Description:
+ Filename: l_deposit_l.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	var1 = 16 bit short signed integer (Word16) whose value falls in
-	       the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
 
  Local Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Global Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Outputs:
-	var1 = deposit of var1 into LSWord of 32 bit value (Word32)
+    var1 = deposit of var1 into LSWord of 32 bit value (Word32)
 
  Pointers and Buffers Modified:
-	None
+    None
 
  Local Stores Modified:
-	None
+    None
 
  Global Stores Modified:
-	None
+    None
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
@@ -96,35 +85,13 @@ Word32 L_deposit_l (Word16 var1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-		  stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-		 name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-		   used to represent cycle count for each subroutine
-		   called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-		name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp
index f609a73..0a07135 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_shr_r.cpp
@@ -27,23 +27,8 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/src/l_shr_r.c
+ Filename: l_shr_r.cpp
 
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the L_shr_r function. Sync'ed up
-          with the current template and fixed tabs.
-
- Description: Updated template. Changed function interface to pass in a
-              pointer to overflow flag into the function instead of using a
-              global flag. Removed code that updates MOPS counter. Changed
-              function return value name from "L_var_out" to "result".
-
- Who:                       Date:
- Description:
-
-------------------------------------------------------------------------------
 */
 
 
@@ -165,22 +150,6 @@ Word32 L_shr_r (Word32 L_var1, Word16 var2)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -190,7 +159,7 @@ Word32 L_shr_r (Word32 L_var1, Word16 var2)
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
-Word32 L_shr_r(register Word32 L_var1, register Word16 var2, Flag *pOverflow)
+OSCL_EXPORT_REF Word32 L_shr_r(register Word32 L_var1, register Word16 var2, Flag *pOverflow)
 {
     Word32 result;
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2.cpp
index 6007b3f..d08543f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2.cpp
@@ -27,28 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/src/log2.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. Moved Log2_norm
-	      function to its own file.
-
- Description: Changed l_shl.c to l_shl.h in Include section.
-
- Description: Updated template. Changed function interface to pass in a
-              pointer to overflow flag into the function instead of using a
-              global flag. Changed input pointer names for clarity.
-
- Description:
-              1. Eliminated l_shl function knowing that after normalization
-                 the left shift factor will not saturate.
-              2. Eliminated unused include files typedef.h and l_shl.h.
-
-
- Who: 						Date:
- Description:
+ Filename: log2.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -89,18 +68,18 @@ terms listed above has been obtained from the copyright holder.
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	L_x = input value of type Word32
-	pExponent = pointer to the integer part of Log2 of type Word16 whose
-		   valid range is: 0 <= value <= 30
-	pFraction = pointer to the fractional part of Log2 of type Word16
-		   whose valid range is: 0 <= value < 1
+    L_x = input value of type Word32
+    pExponent = pointer to the integer part of Log2 of type Word16 whose
+           valid range is: 0 <= value <= 30
+    pFraction = pointer to the fractional part of Log2 of type Word16
+           whose valid range is: 0 <= value < 1
     pOverflow = pointer to overflow flag
 
 
  Outputs:
-	pExponent -> integer part of the newly calculated Log2
-	pFraction -> fractional part of the newly calculated Log2
-	pOverflow -> 1 if the log2() operation resulted in saturation
+    pExponent -> integer part of the newly calculated Log2
+    pFraction -> fractional part of the newly calculated Log2
+    pOverflow -> 1 if the log2() operation resulted in saturation
 
  Returns:
     None
@@ -135,22 +114,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -160,7 +123,7 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
-void Log2(
+OSCL_EXPORT_REF void Log2(
     Word32 L_x,         /* (i) : input value                                */
     Word16 *pExponent,  /* (o) : Integer part of Log2.   (range: 0<=val<=30)*/
     Word16 *pFraction,  /* (o) : Fractional part of Log2. (range: 0<=val<1) */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_norm.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_norm.cpp
index feda874..174d57f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_norm.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_norm.cpp
@@ -28,27 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/src/log2_norm.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for Log2_norm function.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include file.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Modified code to improve performance.
-              2. Fixed typecasting issue with TI C compiler.
-              3. Added more comments to the code.
-
- Description: Removed unnecessary line of code (line 208).
-
- Description: Removed inclusion of "log2.tab"
-
- Who:                           Date:
- Description:
+ Filename: log2_norm.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -171,22 +151,6 @@ void Log2_norm (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_tbl.cpp
index 2186c2c..c0fbc48 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/log2_tbl.cpp
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/log2_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who: 						Date:
- Description:
+ Filename: log2_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -82,7 +71,7 @@ extern "C"
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
 
-    const Word16 log2_tbl[33] =
+    extern const Word16 log2_tbl[33] =
     {
         0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, 10549, 11716,
         12855, 13967, 15054, 16117, 17156, 18172, 19167, 20142, 21097, 22033,
@@ -102,13 +91,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -136,22 +125,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsfwt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsfwt.cpp
index 6b511f7..310ba3c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsfwt.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsfwt.cpp
@@ -27,27 +27,9 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/lsfwt.c
+ Filename: lsfwt.cpp
  Functions: Lsf_wt
 
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated to accept new parameter, Flag *pOverflow.  Placed
- file in the proper PV Software template.
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation, by evaluating the operands
-              4. Unrolled loops to speed up processing, use decrement loops
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Who:                       Date:
- Description:
-
  ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
@@ -113,28 +95,6 @@ Compute LSF weighting factors
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp.cpp
index fcd7690..d5c1d27 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp.cpp
@@ -27,34 +27,10 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/lsp.c
+ Filename: lsp.cpp
  Functions:
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description: Per review comments, added pOverflow flag to a few forgotten
- functions.  Removed unnecessary include files.
-
- Description:  For lsp_reset() and lsp()
-              1. Replaced copy() with more efficient memcpy().
-              2. Eliminated unused include file copy.h.
-
- Description:  For lsp_reset()
-              1. Modified memcpy() operands order.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Who:                           Date:
- Description:
-
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
 
@@ -136,29 +112,13 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-Word16 lsp_init(lspState **st)
+OSCL_EXPORT_REF Word16 lsp_init(lspState **st)
 {
     lspState* s;
 
@@ -237,28 +197,12 @@ Word16 lsp_init(lspState **st)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
-Word16 lsp_reset(lspState *st)
+OSCL_EXPORT_REF Word16 lsp_reset(lspState *st)
 {
 
     if (st == (lspState *) NULL)
@@ -326,28 +270,12 @@ Word16 lsp_reset(lspState *st)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
-void lsp_exit(lspState **st)
+OSCL_EXPORT_REF void lsp_exit(lspState **st)
 {
     if (st == NULL || *st == NULL)
         return;
@@ -414,35 +342,19 @@ void lsp_exit(lspState **st)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
-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           */
+OSCL_EXPORT_REF void lsp(lspState *st,       /* i/o : State struct            */
+                         enum Mode req_mode, /* i   : requested coder mode                    */
+                         enum Mode used_mode,/* i   : used coder mode                         */
+                         Word16 az[],        /* i/o : interpolated LP parameters Q12          */
+                         Word16 azQ[],       /* o   : quantization interpol. LP parameters Q12*/
+                         Word16 lsp_new[],   /* o   : new lsp vector                          */
+                         Word16 **anap,      /* o   : analysis parameters                     */
+                         Flag   *pOverflow)  /* o   : Flag set when overflow occurs           */
 
 {
     Word16 lsp_new_q[M];    /* LSPs at 4th subframe           */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp
index 6b7b471..c41f614 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_az.cpp
@@ -28,64 +28,11 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/src/lsp_az.c
- Funtions: Get_lsp_pol
+ Filename: lsp_az.cpp
+ Functions: Get_lsp_pol
            Lsp_Az
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Deleted all Local stores needed/modified. Optimized Lsp_Az
-          function by getting rid of call to L_shr_r function.
-
- Description: Updated file per comments gathered from Phase 2/3 review.
-
- Description: Added setting of Overflow flag in the inlined code.
-
- Description: 1. Optimized Lsp_Az function code.
-              2. Changed Input/Output definitions by adding Word type.
-
- Description: Made changes based on review meeting.
-              1. Removed pseudocode.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Replaced basic_op.h and oper_32b.h with the header files of the
-              math functions used in the file.
-
- Description: Modified to pass overflow flag through to L_add and L_sub.  The
- flag is passed back to the calling function by pointer reference.
-
- Description: Removed the id line since it was removed in the header file by
-              Ken.
-
- Description: Added the write-only variable, pOverflow, to the inputs section.
-
- Description:  For lsp_az() and Get_lsp_pol()
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation, in some cases this by shifting before adding and
-                 in other cases by evaluating the operands
-              4. Unrolled loops to speed up processing
-              5. Replaced mpy_32_16 by multpilcations in place
-              6. Eliminated if-else statements for sign extension when
-                 right-shifting
-
- Description:  Added casting to eliminate warnings, and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with defined types.
-               Added proper casting (Word32) to some left shifting operations
-
- Who:                           Date:
- Description:
-
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
  This file contains functions that convert line spectral pairs (LSP) to
@@ -227,22 +174,6 @@ static void Get_lsp_pol (Word16 *lsp, Word32 *f)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -297,100 +228,6 @@ static void Get_lsp_pol(
 /****************************************************************************/
 
 
-/*
-------------------------------------------------------------------------------
- FUNCTION NAME: Get_lsp_pol_wrapper
-------------------------------------------------------------------------------
- INPUT AND OUTPUT DEFINITIONS
-
- Inputs:
-    lsp = pointer to the buffer containing the line spectral pairs (LSP)
-          of type Word16
-    f = pointer to the polynomial of type Word32 to be generated
-
-    pOverflow  = pointer set in case where one of the operations overflows.
-                 [data type Pointer to Flag]
-
- Outputs:
-    buffer pointed to by f contains the polynomial generated
-
-    pOverflow  = pointer set in case where one of the operations overflows.
-                 [data type Pointer to Flag]
-
- Returns:
-    None
-
- Global Variables Used:
-    None
-
- Local Variables Needed:
-    None
-
-------------------------------------------------------------------------------
- FUNCTION DESCRIPTION
-
- This function provides external access to the static function Get_lsp_pol.
-
-------------------------------------------------------------------------------
- REQUIREMENTS
-
- None
-
-------------------------------------------------------------------------------
- REFERENCES
-
- None
-
-------------------------------------------------------------------------------
- PSEUDO-CODE
-
- CALL Get_lsp_pol(lsp = lsp_ptr
-                  f = f_ptr )
-   MODIFYING(nothing)
-   RETURNING(nothing)
-
-------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
- CAUTION [optional]
- [State any special notes, constraints or cautions for users of this function]
-
-------------------------------------------------------------------------------
-*/
-
-void Get_lsp_pol_wrapper(
-    Word16 *lsp,
-    Word32 *f,
-    Flag   *pOverflow)
-{
-    /*----------------------------------------------------------------------------
-     CALL Get_lsp_pol(lsp = lsp_ptr
-              f = f_ptr )
-    ----------------------------------------------------------------------------*/
-    Get_lsp_pol(lsp, f, pOverflow);
-
-    /*----------------------------------------------------------------------------
-       MODIFYING(nothing)
-       RETURNING(nothing)
-    ----------------------------------------------------------------------------*/
-    return;
-}
-
-/****************************************************************************/
 
 
 /*
@@ -483,29 +320,13 @@ void Lsp_Az (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Lsp_Az(
+OSCL_EXPORT_REF void Lsp_Az(
     Word16 lsp[],        /* (i)  : line spectral frequencies            */
     Word16 a[],          /* (o)  : predictor coefficients (order = 10)  */
     Flag  *pOverflow     /* (o)  : overflow flag                        */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf.cpp
index 39d6eda..f315f5f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf.cpp
@@ -27,45 +27,11 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/lsp_lsf.c
+ Filename: lsp_lsf.cpp
  Functions: Lsp_lsf
             Lsf_lsp
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
-
- Description: Deleted variables listed in the Local Stores Needed/Modified
-              section.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template and removed unnecessary include files.
-
- Description: Replaced basic_op.h with the header file of the math functions
-              used in the file.
-
- Description: Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description: Placed table declarations in a .c file, rather than an included
- .tab.  The tables are now referenced via an extern in this file.
-
- Description:  For Lsp_lsf()
-              1. Eliminated unused include file typedef.h.
-              2. Replaced array addressing by pointers
-
- Description:  Replaced "int" and/or "char" with defined types.
-               Added proper casting (Word32) to some left shifting operations
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Who:                           Date:
- Description:
-
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
  This file contains the functions that convert line spectral pairs (LSP) to
@@ -189,29 +155,13 @@ void Lsf_lsp (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Lsf_lsp(
+OSCL_EXPORT_REF void Lsf_lsp(
     Word16 lsf[],       /* (i) : lsf[m] normalized (range: 0.0<=val<=0.5) */
     Word16 lsp[],       /* (o) : lsp[m] (range: -1<=val<1)                */
     Word16 m,           /* (i) : LPC order                                */
@@ -229,7 +179,7 @@ void Lsf_lsp(
         /* lsp[i] = table[ind]+ ((table[ind+1]-table[ind])*offset) / 256 */
 
         L_tmp = ((Word32)(table[ind + 1] - table[ind]) * offset) >> 8;
-        lsp[i] = add(table[ind], (Word16) L_tmp, pOverflow);
+        lsp[i] = table[ind] + (Word16) L_tmp;
 
     }
 
@@ -321,29 +271,13 @@ void Lsp_lsf (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Lsp_lsf(
+OSCL_EXPORT_REF void Lsp_lsf(
     Word16 lsp[],       /* (i)  : lsp[m] (range: -1<=val<1)                */
     Word16 lsf[],       /* (o)  : lsf[m] normalized (range: 0.0<=val<=0.5) */
     Word16 m,           /* (i)  : LPC order                                */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf_tbl.cpp
index 98841f6..03a5195 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_lsf_tbl.cpp
@@ -27,17 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/src/lsp_lsf_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created this file from the reference, lsp_lsf.tab
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
+ Filename: lsp_lsf_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -77,7 +67,7 @@ extern "C"
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
 
-    const Word16 table[65] =
+    extern const Word16 table[65] =
     {
         32767, 32729, 32610, 32413, 32138, 31786, 31357, 30853,
         30274, 29622, 28899, 28106, 27246, 26320, 25330, 24279,
@@ -94,7 +84,7 @@ extern "C"
 
     /* slope used to compute y = acos(x) */
 
-    const Word16 slope[64] =
+    extern const Word16 slope[64] =
     {
         -26887, -8812, -5323, -3813, -2979, -2444, -2081, -1811,
         -1608, -1450, -1322, -1219, -1132, -1059, -998, -946,
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_tab.cpp
index 928abca..b712c30 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/lsp_tab.cpp
@@ -28,19 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/src/lsp_tab.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition. Removed corresponding header file from Include
-              section.
-
- Description: Put "extern" back.
-
- Who:                       Date:
- Description:
+ Filename: lsp_tab.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -87,28 +75,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -146,9 +112,9 @@ extern "C"
     ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
-    const Word16 lsp_init_data[M] = {30000, 26000, 21000, 15000, 8000,
-                                                0, -8000, -15000, -21000, -26000
-                                               };
+    extern const Word16 lsp_init_data[M] = {30000, 26000, 21000, 15000, 8000,
+        0, -8000, -15000, -21000, -26000
+    };
 
     /*----------------------------------------------------------------------------
     ; EXTERNAL FUNCTION REFERENCES
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp
index 04968ef..6ee82b2 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/mult_r.cpp
@@ -28,26 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/mult_r.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the mult_r function. Sync'ed up
-	      with the current template and fixed tabs.
-
- Description: Passing in a pointer to the overflow flag instead of using
-		  a global flag.
-
- Description: Made the following changes based on P2/P3 review:
-			  1) Simplified test to determine if sign extension is necessary
-			  2) Changed the name of pointer "overflow" to "Poverflow"
-			  3) Removed code that updates MOPS counter
-			  4) Updated template and reference section
-
- Who: 						Date:
- Description:
-
+ Filename: mult_r.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -60,7 +41,7 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -91,19 +72,19 @@ terms listed above has been obtained from the copyright holder.
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	var1 = 16 bit short signed integer (Word16) whose value falls in
-	       the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+    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.
+    var2 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
 
-	pOverflow = pointer to overflow (Flag)
+    pOverflow = pointer to overflow (Flag)
 
  Outputs:
-	pOverflow -> 1 if the add operation resulted in overflow
+    pOverflow -> 1 if the add operation resulted in overflow
 
  Returns:
-	L_product_arr = 16-bit limited product of var1 and var2 (Word16)
+    L_product_arr = 16-bit limited product of var1 and var2 (Word16)
 
  Global Variables Used:
     None
@@ -116,8 +97,8 @@ terms listed above has been obtained from the copyright holder.
 
  This function performs the multiplication of var1 by var2 with rounding, and
  gives a 16 bit result which is scaled, i.e.:
-	mult_r(var1,var2) = extract_l(L_shr(((var1 * var2) + 16384),15)) and  |
-	mult_r(-32768,-32768) = 32767
+    mult_r(var1,var2) = extract_l(L_shr(((var1 * var2) + 16384),15)) and  |
+    mult_r(-32768,-32768) = 32767
 
 ------------------------------------------------------------------------------
  REQUIREMENTS
@@ -161,22 +142,6 @@ Word16 mult_r (Word16 var1, Word16 var2)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -187,7 +152,7 @@ Word16 mult_r (Word16 var1, Word16 var2)
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
 
-Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow)
+OSCL_EXPORT_REF Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow)
 {
 
     register Word32 L_product_arr;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp
index ae37554..3db2458 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/negate.cpp
@@ -28,43 +28,32 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/src/negate.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the negate function. Sync'ed up with
-	      the current template and fixed tabs.
-
- Description: Removed conditional code that updates WMOPS counter
-
- Who: 						Date:
- Description:
+ Filename: negate.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	var1 = 16 bit short signed integer (Word16) whose value falls in
-	       the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+    var1 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
 
  Local Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Global Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Outputs:
-	var1 = negated value of input (Word16)
+    var1 = negated value of input (Word16)
 
  Pointers and Buffers Modified:
-	None
+    None
 
  Local Stores Modified:
-	None
+    None
 
  Global Stores Modified:
-	None
+    None
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
@@ -97,35 +86,13 @@ Word16 negate (Word16 var1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-		  stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-		 name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-		   used to represent cycle count for each subroutine
-		   called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-		name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"negate.h"
+#include    "negate.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp
index 132fed6..e690246 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_l.cpp
@@ -27,29 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/src/norm_l.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the norm_l function. Sync'ed up
-          with the current template and fixed tabs.
-
- Description: Updated module description to be the same as the equivalent
-          assembly file (norm_l.asm).
-
- Description: Removed conditional code that updates WMOPS counter
-
- Description: Made the following changes
-              1. Unrolled the search loop to make four comparison per
-                 pass, using only four iterations of the loop and saving
-                 shifts cycles
-              2. Updated header and copyright year
-
- Description: 1. Support for ARM and Linux-ARM assembly instructions.
-
- Who:                       Date:
- Description:
+ Filename: norm_l.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -132,28 +110,6 @@ Word16 norm_l (Word32 L_var1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -197,7 +153,7 @@ Word16 norm_l (Word32 L_var1)
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
 #if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) )
-Word16 norm_l(register Word32 L_var1)
+OSCL_EXPORT_REF Word16 norm_l(register Word32 L_var1)
 {
     /*----------------------------------------------------------------------------
     ; Define all local variables
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp
index 8cdcdb8..892d06e 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/norm_s.cpp
@@ -28,24 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/src/norm_s.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the norm_s function. Sync'ed up
-          with the current template and fixed tabs.
-
- Description: Updated input/output definition and module description to
-          be the same as the equivalent assembly file (norm_s.asm).
-
- Description: Updated definition of var1 to be the same as that in the
-          assembly file (norm_s.asm).
-
- Description: Removed conditional code that updates WMOPS counter
-
- Who:                       Date:
- Description:
+ Filename: norm_s.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -128,28 +111,6 @@ Word16 norm_s (Word16 var1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -194,7 +155,7 @@ Word16 norm_s (Word16 var1)
 ----------------------------------------------------------------------------*/
 #if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) )
 
-Word16 norm_s(register Word16 var1)
+OSCL_EXPORT_REF Word16 norm_s(register Word16 var1)
 {
     /*----------------------------------------------------------------------------
     ; Define all local variables
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/overflow_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/overflow_tbl.cpp
index c83aa73..ba1c759 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/overflow_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/overflow_tbl.cpp
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/overflow_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who: 						Date:
- Description:
+ Filename: overflow_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -81,23 +70,23 @@ extern "C"
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    const Word32 overflow_tbl [32]   = {0x7fffffffL, 0x3fffffffL,
-                0x1fffffffL, 0x0fffffffL,
-                0x07ffffffL, 0x03ffffffL,
-                0x01ffffffL, 0x00ffffffL,
-                0x007fffffL, 0x003fffffL,
-                0x001fffffL, 0x000fffffL,
-                0x0007ffffL, 0x0003ffffL,
-                0x0001ffffL, 0x0000ffffL,
-                0x00007fffL, 0x00003fffL,
-                0x00001fffL, 0x00000fffL,
-                0x000007ffL, 0x000003ffL,
-                0x000001ffL, 0x000000ffL,
-                0x0000007fL, 0x0000003fL,
-                0x0000001fL, 0x0000000fL,
-                0x00000007L, 0x00000003L,
-                0x00000001L, 0x00000000L
-                                                  };
+    extern const Word32 overflow_tbl [32]   = {0x7fffffffL, 0x3fffffffL,
+        0x1fffffffL, 0x0fffffffL,
+        0x07ffffffL, 0x03ffffffL,
+        0x01ffffffL, 0x00ffffffL,
+        0x007fffffL, 0x003fffffL,
+        0x001fffffL, 0x000fffffL,
+        0x0007ffffL, 0x0003ffffL,
+        0x0001ffffL, 0x0000ffffL,
+        0x00007fffL, 0x00003fffL,
+        0x00001fffL, 0x00000fffL,
+        0x000007ffL, 0x000003ffL,
+        0x000001ffL, 0x000000ffL,
+        0x0000007fL, 0x0000003fL,
+        0x0000001fL, 0x0000000fL,
+        0x00000007L, 0x00000003L,
+        0x00000001L, 0x00000000L
+    };
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -111,13 +100,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -146,22 +135,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp
index 9af6788..3a41508 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/ph_disp_tab.cpp
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/ph_disp_tab.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who: 						Date:
- Description:
+ Filename: ph_disp_tab.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -81,14 +70,14 @@ extern "C"
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    const Word16 ph_imp_low_MR795[40] =
+    extern const Word16 ph_imp_low_MR795[40] =
     {
         26777,    801,   2505,   -683,  -1382,    582,    604,  -1274,   3511,  -5894,
         4534,   -499,  -1940,   3011,  -5058,   5614,  -1990,  -1061,  -1459,   4442,
         -700,  -5335,   4609,    452,   -589,  -3352,   2953,   1267,  -1212,  -2590,
         1731,   3670,  -4475,   -975,   4391,  -2537,    949,  -1363,   -979,   5734
     };
-    const Word16 ph_imp_mid_MR795[40] =
+    extern const Word16 ph_imp_mid_MR795[40] =
     {
         30274,   3831,  -4036,   2972,  -1048,  -1002,   2477,  -3043,   2815,  -2231,
         1753,  -1611,   1714,  -1775,   1543,  -1008,    429,   -169,    472,  -1264,
@@ -96,14 +85,14 @@ extern "C"
         -2063,   2644,  -3060,   2897,  -1978,    557,    780,  -1369,    842,    655
     };
 
-    const Word16 ph_imp_low[40] =
+    extern const Word16 ph_imp_low[40] =
     {
         14690,  11518,   1268,  -2761,  -5671,   7514,    -35,  -2807,  -3040,   4823,
         2952,  -8424,   3785,   1455,   2179,  -8637,   8051,  -2103,  -1454,    777,
         1108,  -2385,   2254,   -363,   -674,  -2103,   6046,  -5681,   1072,   3123,
         -5058,   5312,  -2329,  -3728,   6924,  -3889,    675,  -1775,     29,  10145
     };
-    const Word16 ph_imp_mid[40] =
+    extern const Word16 ph_imp_mid[40] =
     {
         30274,   3831,  -4036,   2972,  -1048,  -1002,   2477,  -3043,   2815,  -2231,
         1753,  -1611,   1714,  -1775,   1543,  -1008,    429,   -169,    472,  -1264,
@@ -123,13 +112,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -157,22 +146,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2.cpp
index a8686f8..637f92d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2.cpp
@@ -28,17 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/pow2.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Changed function interface to pass in a
-              pointer to overflow flag into the function instead of using a
-              global flag. Removed inclusion of "pow2.tab"
-
- Who:                           Date:
- Description:
+ Filename: pow2.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -147,22 +137,6 @@ Word32 Pow2 (           // (o)  : result       (range: 0<=val<=0x7fffffff)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -173,7 +147,7 @@ Word32 Pow2 (           // (o)  : result       (range: 0<=val<=0x7fffffff)
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
 
-Word32 Pow2(            /* (o)  : result       (range: 0<=val<=0x7fffffff) */
+OSCL_EXPORT_REF Word32 Pow2(            /* (o)  : result       (range: 0<=val<=0x7fffffff) */
     Word16 exponent,    /* (i)  : Integer part.      (range: 0<=val<=30)   */
     Word16 fraction,    /* (i)  : Fractional part.  (range: 0.0<=val<1.0)  */
     Flag *pOverflow
@@ -189,13 +163,13 @@ Word32 Pow2(            /* (o)  : result       (range: 0<=val<=0x7fffffff) */
     i = ((Word16)(L_x >> 16)) & 31;             /* ensure index i is bounded */
     a = (Word16)((L_x >> 1) & 0x7fff);
 
-    L_x = L_deposit_h(pow2_tbl[i]);             /* pow2_tbl[i] << 16       */
+    L_x = ((Word32) pow2_tbl[i] << 16);             /* pow2_tbl[i] << 16       */
 
     /* pow2_tbl[i] - pow2_tbl[i+1] */
-    tmp = sub(pow2_tbl[i], pow2_tbl[i + 1], pOverflow);
+    tmp = pow2_tbl[i] - pow2_tbl[i + 1];
     L_x = L_msu(L_x, tmp, a, pOverflow);        /* L_x -= tmp*a*2        */
 
-    exp = sub(30, exponent, pOverflow);
+    exp = 30 - exponent;
     L_x = L_shr_r(L_x, exp, pOverflow);
 
     return (L_x);
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2_tbl.cpp
index 647ca7c..ecf481e 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2_tbl.cpp
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/pow2_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who: 						Date:
- Description:
+ Filename: pow2_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -81,7 +70,7 @@ extern "C"
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
 
-    const Word16 pow2_tbl[33] =
+    extern const Word16 pow2_tbl[33] =
     {
         16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066, 19484, 19911,
         20347, 20792, 21247, 21713, 22188, 22674, 23170, 23678, 24196, 24726,
@@ -101,13 +90,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -135,22 +124,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp
index a18b838..fd51242 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pred_lt.cpp
@@ -27,49 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/pred_lt.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Deleted variables listed in the Local Stores Needed/Modified
-          sections.
-
- Description: Updated file per comments from Phase 2/3 review.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Fixed typecasting issue with TI C compiler. Updated copyright
-              year.
-
- Description:
- (1) Removed instance of static in the const table "inter_6"
- (2) Changed Overflow from a global to a parameter passed via a pointer.
- (3) Made numerous small changes to bring code more in line with PV standards.
-
- Description:  For pred_ltp()
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation
-              4. Unrolled loops to speed up processing, use decrement loops,
-                 loaded into memory filter coefficient in linear order for
-                 faster execution in main loop.
-              5. Eliminated call to round by proper initialization
-
- Description:  Replaced "int" and/or "char" with defined types.
-               Added proper casting (Word32) to some left shifting operations
-
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Who:                           Date:
- Description:
+ Filename: pred_lt.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -142,14 +100,14 @@ const Word16 inter_6_pred_lt[FIR_SIZE] =
     flag3 = flag to indicate the upsampling rate; if set, upsampling
             rate is 3, otherwise, upsampling rate is 6 (Word16)
 
-	pOverflow = pointer to overflow (Flag)
+    pOverflow = pointer to overflow (Flag)
 
  Returns:
     None
 
  Outputs:
     exc buffer contains the newly formed adaptive codebook excitation
-	pOverflow -> 1 if the add operation resulted in overflow
+    pOverflow -> 1 if the add operation resulted in overflow
 
  Global Variables Used:
     inter_6_pred_lt = (1/6) resolution interpolation filter table (Word16)
@@ -229,29 +187,13 @@ void Pred_lt_3or6 (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Pred_lt_3or6(
+OSCL_EXPORT_REF void Pred_lt_3or6(
     Word16 exc[],     /* in/out: excitation buffer                          */
     Word16 T0,        /* input : integer pitch lag                          */
     Word16 frac,      /* input : fraction of lag                            */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp
index cc06454..2c5446b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3.cpp
@@ -28,7 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/src/q_plsf_3.c
+ Filename: q_plsf_3.cpp
  Funtions: Vq_subvec4
            Test_Vq_subvec4
            Vq_subvec3
@@ -36,53 +36,6 @@ terms listed above has been obtained from the copyright holder.
            Q_plsf_3
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Updated modules per Phase 2/3 review comments. Updated
-          Vq_subvec3 pseudo-code to reflect the new restructured code.
-
- Description: Added setting of Overflow flag in inlined code.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Replaced basic_op.h with the header file of the math functions
-              used in the file.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Fixed typecasting issue with TI C compiler.
-              2. Optimized IF stament in Vq_subvec3() function.
-              3. Updated copyright year.
-
- Description: Removed redundancy in the Vq_subvec4 function.
-
- Description: Updated to accept new parameter, Flag *pOverflow.
-
- Description: Per review comments, added pOverflow flag description
- to the input/outputs section.
-
- Description: Corrected missed Overflow global variables -- changed to
- proper pOverflow.
-
- Description: Optimized all functions to further reduce clock cycle usage.
-              Updated copyright year.
-
- Description: Added left shift by 1 in line 1050 of Q_plsf_3().
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Who:                           Date:
- Description:
-
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
  This file contains the functions that perform the quantization of LSF
@@ -249,22 +202,6 @@ Vq_subvec4(             // o: quantization index,            Q0
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -404,22 +341,6 @@ static Word16 Vq_subvec4( /* o: quantization index,            Q0  */
    RETURNING(index = tst_index4)
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -575,22 +496,6 @@ Vq_subvec3(             // o: quantization index,            Q0
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -738,22 +643,6 @@ static Word16 Vq_subvec3( /* o: quantization index,            Q0  */
    RETURNING(index = tst_index3)
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -979,29 +868,13 @@ void Q_plsf_3(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Q_plsf_3(
+OSCL_EXPORT_REF void Q_plsf_3(
     Q_plsfState *st,    /* i/o: state struct                             */
     enum Mode mode,     /* i  : coder mode                               */
     Word16 *lsp1,       /* i  : 1st LSP vector                      Q15  */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3_tbl.cpp
index 8f8e04c..8714fcd 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_3_tbl.cpp
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/q_plsf_3_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created this file from the reference, q_plsf_3_tbl.tab
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who: 						Date:
- Description:
+ Filename: q_plsf_3_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5.cpp
index 2f9e40e..10d514d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5.cpp
@@ -27,50 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/q_plsf_5.c
- Funtions:
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed code in the PV standard template format.
- Updated to accept new parameter, Flag *pOverflow.
-
- Description:
-              Eliminated unused include files.
-              For Vq_subvec()
-              1. Eliminated math operations that unnecessary checked for
-                 saturation (number are bounded to 2^12)
-              2. Eliminated access to (slow) memory by using axiliar variables
-              3. Because this routine is looking for the minimum distance,
-                 introduced 3 check conditions inside the loop, so when the
-                 partial distance is bigger than the minimun distance, the
-                 loop is not completed and process continue with next iteration
-              For Vq_subvec_s()
-              1. Eliminated math operations that unnecessary checked for
-                 saturation (number are bounded to 2^12)
-              2. Combined increasing and decreasing loops to avoid double
-                 accesses to the same table element
-              3. Eliminated access to (slow) memory by using axiliar variables
-              4. Because this routine is looking for the minimum distance,
-                 introduced 2 check conditions inside the loop, so when the
-                 partial distance is bigger than the minimun distance, the
-                 loop is not completed and process continue with next iteration
-              For Q_plsf_5()
-              1. Eliminated math operations that unnecessary checked for
-                 saturation (number are bounded to 2^12)
-              2. Replaced array addressing by pointers
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Who:                           Date:
- Description:
+ Filename: q_plsf_5.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -179,22 +136,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -343,22 +284,6 @@ static Word16 Vq_subvec( /* o : quantization index,            Q0  */
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -569,29 +494,13 @@ static Word16 Vq_subvec_s(  /* o : quantization index            Q0  */
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Q_plsf_5(
+OSCL_EXPORT_REF void Q_plsf_5(
     Q_plsfState *st,
     Word16 *lsp1,      /* i : 1st LSP vector,                     Q15 */
     Word16 *lsp2,      /* i : 2nd LSP vector,                     Q15 */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5_tbl.cpp
index 885ee45..8894a1e 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/q_plsf_5_tbl.cpp
@@ -28,23 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/q_plsf_5_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created this file from the reference, q_plsf_5_tbl.tab
-
- Description: Changed #defines of DICO_SIZE to DICO_5_SIZE, to avoid name
- conflicts.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who: 						Date:
- Description:
+ Filename: q_plsf_5_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -94,7 +78,7 @@ extern "C"
     ----------------------------------------------------------------------------*/
     /* LSF means ->normalize frequency domain */
 
-    const Word16 mean_lsf_5[10] =
+    extern const Word16 mean_lsf_5[10] =
     {
         1384,
         2077,
@@ -108,7 +92,7 @@ extern "C"
         13701
     };
 
-    const Word16 dico1_lsf_5[DICO1_5_SIZE * 4] =
+    extern const Word16 dico1_lsf_5[DICO1_5_SIZE * 4] =
     {
         -451, -1065, -529, -1305,
         -450, -756, -497, -863,
@@ -240,7 +224,7 @@ extern "C"
         1469, 2181, 1443, 2016
     };
 
-    const Word16 dico2_lsf_5[DICO2_5_SIZE * 4] =
+    extern const Word16 dico2_lsf_5[DICO2_5_SIZE * 4] =
     {
         -1631, -1600, -1796, -2290,
         -1027, -1770, -1100, -2025,
@@ -500,7 +484,7 @@ extern "C"
         2374, 2787, 1821, 2788
     };
 
-    const Word16 dico3_lsf_5[DICO3_5_SIZE * 4] =
+    extern const Word16 dico3_lsf_5[DICO3_5_SIZE * 4] =
     {
         -1812, -2275, -1879, -2537,
         -1640, -1848, -1695, -2004,
@@ -760,7 +744,7 @@ extern "C"
         2180, 1975, 2326, 2020
     };
 
-    const Word16 dico4_lsf_5[DICO4_5_SIZE * 4] =
+    extern const Word16 dico4_lsf_5[DICO4_5_SIZE * 4] =
     {
         -1857, -1681, -1857, -1755,
         -2056, -1150, -2134, -1654,
@@ -1020,7 +1004,7 @@ extern "C"
         1716, 1376, 1948, 1465
     };
 
-    const Word16 dico5_lsf_5[DICO5_5_SIZE * 4] =
+    extern const Word16 dico5_lsf_5[DICO5_5_SIZE * 4] =
     {
         -1002, -929, -1096, -1203,
         -641, -931, -604, -961,
@@ -1100,13 +1084,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -1134,22 +1118,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/qua_gain_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/qua_gain_tbl.cpp
index f0a0dd8..6c03ce5 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/qua_gain_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/qua_gain_tbl.cpp
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/qua_gain_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created this file from the reference, qua_gain.tab
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who:                               Date:
- Description:
+ Filename: qua_gain_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -96,7 +83,7 @@ extern "C"
 
     /* table used in 'high' rates: MR67 MR74 */
 
-    const Word16 table_gain_highrates[VQ_SIZE_HIGHRATES*4] =
+    extern const Word16 table_gain_highrates[VQ_SIZE_HIGHRATES*4] =
     {
 
         /*
@@ -240,7 +227,7 @@ extern "C"
 
     /* table used in 'low' rates: MR475, MR515, MR59 */
 
-    const Word16 table_gain_lowrates[VQ_SIZE_LOWRATES*4] =
+    extern const Word16 table_gain_lowrates[VQ_SIZE_LOWRATES*4] =
     {
         /*g_pit,    g_fac,  qua_ener_MR122, qua_ener */
         10813,    28753,            2879,    17333,
@@ -321,13 +308,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -356,22 +343,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/reorder.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/reorder.cpp
index b1e4711..0f932e5 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/reorder.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/reorder.cpp
@@ -27,22 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/src/reorder.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
-              1. Eliminated unused include file add.h.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation
-              4. Replaced loop counter with decrement loops
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Who:                       Date:
- Description:
+ Filename: reorder.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -145,22 +130,6 @@ void Reorder_lsf (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -170,7 +139,7 @@ void Reorder_lsf (
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
-void Reorder_lsf(
+OSCL_EXPORT_REF void Reorder_lsf(
     Word16 *lsf,        /* (i/o)    : vector of LSFs   (range: 0<=val<=0.5) */
     Word16 min_dist,    /* (i)      : minimum required distance             */
     Word16 n,           /* (i)      : LPC order                             */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp
index b25d3be..787e043 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/residu.cpp
@@ -28,41 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/src/residu.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. First attempt at
-          optimizing code.
-
- Description: Deleted stores listed in the Local Stores Needed/Modified
-          section.
-
- Description: Updated file per comments gathered from Phase 2/3 review.
-
- Description: Updating to reflect variable name changes made in residu.asm
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Modified FOR loops to count down.
-              2. Fixed typecasting issue with TI C compiler.
-
- Description: Made the following changes
-              1. Unrolled the convolutional loop.
-              2. Performed 4 convolution per pass to avoid recalling the same
-                 filter coefficient as many times.
-              2. Eliminated math operations that check for saturation.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Who:                           Date:
- Description:
+ Filename: residu.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -171,29 +137,13 @@ void Residu (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Residu(
+OSCL_EXPORT_REF void Residu(
     Word16 coef_ptr[],      /* (i)     : prediction coefficients*/
     Word16 input_ptr[],     /* (i)     : speech signal          */
     Word16 residual_ptr[],  /* (o)     : residual signal        */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp
index 7710be2..9fd4abb 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/round.cpp
@@ -28,34 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/round.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the round function. Sync'ed up
-	      with the current template and fixed tabs.
-
- Description: Made changes based on review meeting:
-              1. Removed long in Inputs Definitions.
-              2. Changed L_var1 to var_out and description in
-                 Output Definitions.
-
- Description: Added a parameter to the function interface, pOverflow which is
-              a pointer to the overflow flag. This flag is required by the
-              L_add() function invoked by round().
-              Removed code that updates the MOPS counter.
-              Created a new return variable result.
-
- Description: Removed embedded tabs. Included comment in the Pseudo code
-              Section about using pointer to overflow flag in the actual
-              implementation instead of using a global flag.
-
- Description: Changed function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Who:   					Date:
- Description:
+ Filename: round.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -98,13 +71,13 @@ terms listed above has been obtained from the copyright holder.
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	L_var1 = 32 bit signed integer (Word32) whose value falls
-	         in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+    L_var1 = 32 bit signed integer (Word32) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
 
-	pOverflow = pointer to overflow (Flag)
+    pOverflow = pointer to overflow (Flag)
 
  Outputs:
-	None
+    None
 
  Returns:
         result = MS 16 bits of rounded input L_var1.
@@ -121,7 +94,7 @@ terms listed above has been obtained from the copyright holder.
  This function rounds the lower 16 bits of the 32 bit input number into the
  MS 16 bits with saturation. Shift the resulting bits right by 16 and return
  the 16 bit number:
-	pv_round(L_var1) = extract_h(L_add(L_var1,32768))
+    pv_round(L_var1) = extract_h(L_add(L_var1,32768))
 
 ------------------------------------------------------------------------------
  REQUIREMENTS
@@ -159,22 +132,6 @@ Word16 pv_round (Word32 L_var1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -184,7 +141,7 @@ Word16 pv_round (Word32 L_var1)
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
-Word16 pv_round(register Word32 L_var1, Flag *pOverflow)
+OSCL_EXPORT_REF Word16 pv_round(register Word32 L_var1, Flag *pOverflow)
 {
     Word16  result;
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp
index dbb1cea..a0fbd35 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr.cpp
@@ -28,38 +28,9 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/shr.c
+ Filename: shr.cpp
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the shr function. Sync'ed up with
-	      the current template and fixed tabs.
-
- Description: 1. Modified code by seperating var2=0 condition.
-              2. Changed Input range definitions.
-
- Description: Made changes based on review meeting.
-              1. Changed Overflow definition.
-              2. Removed pseudo-code.
-              3. Deleted (var2>15&&var1!=0) condition.
-              4. Moved var2>0 condition in front of var2<0 condition.
-
- Description: Changed the function prototype to pass in a pointer to the
-			  overflow flag instead of using global data.
-
- Description: Made changes per formal review. Updated template.
-			  Removed code that updates MOPS counter.
-			  Changed parameter name from "overflow" and "pOverflow".
-			  Optimized code by eliminating unnecessary typecasting.
-			  Filled in the PSEUDO CODE section
-
- Description: Further optimized typecasting for overflow case
-
- Who:		  				Date:
- Description:
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
  Shift right function with overflow control
 ------------------------------------------------------------------------------
@@ -68,7 +39,7 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -99,19 +70,19 @@ terms listed above has been obtained from the copyright holder.
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	var1 = 16 bit short signed integer (Word16) whose value falls in
-	       the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
+    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.
+    var2 = 16 bit short signed integer (Word16) whose value falls in
+           the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
 
-	pOverflow = pointer to overflow (Flag)
+    pOverflow = pointer to overflow (Flag)
 
  Outputs:
-	pOverflow -> 1 if the shift operation resulted in overflow
+    pOverflow -> 1 if the shift operation resulted in overflow
 
  Returns:
-	product = Shifted result limited to 16 bits (Word16)
+    product = Shifted result limited to 16 bits (Word16)
 
  Global Variables Used:
     None
@@ -177,22 +148,6 @@ Word16 shr_std (Word16 var1, Word16 var2)
     return (var_out);
 }
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -202,45 +157,33 @@ Word16 shr_std (Word16 var1, Word16 var2)
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
-Word16 shr(register Word16 var1, register Word16 var2, Flag *pOverflow)
+OSCL_EXPORT_REF Word16 shr(register Word16 var1, register Word16 var2, Flag *pOverflow)
 {
     register Word16 result;
-    register Word32 temp_res;
 
     if (var2 != 0)
     {
         if (var2 > 0)
         {
-            if (var2 >= 15)
-            {
-                result = ((var1 < 0) ? -1 : 0);
-            }
-            else
+            if (var2 > 15)
             {
-                if (var1 < 0)
-                {
-                    result = (~((~var1) >> var2));
-                }
-                else
-                {
-                    result = (var1 >> var2);
-                }
+                var2 = 15;
             }
+
+            result = var1 >> var2;
+
         }
         else
         {
-            if (var2 < -16)
+            var2 = -var2;   /* Shift right negative is equivalent */
+
+            if (var2 > 15)
             {
-                var2 = -16;
+                var2 = 15;
             }
 
-            var2 = -var2;	/* Shift right negative is equivalent */
-            /*   to shifting left positive.       */
-
-            temp_res = ((Word32) var1) << var2;
-            result = (Word16)(temp_res);
-
-            if (temp_res != (Word32) result)
+            result = (var1 << var2);
+            if ((result >> var2) != var1)
             {
                 *pOverflow = 1;
                 result = ((var1 > 0) ? MAX_16 : MIN_16);
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp
index 6656f93..b403885 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/shr_r.cpp
@@ -28,18 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/src/shr_r.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the shr_r function. Sync'ed up
-          with the current template and fixed tabs.
-
- Description: Passing around pOverflow as per EPOC changes.
-
- Who:                           Date:
- Description:
+ Filename: shr_r.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -129,28 +118,6 @@ Word16 shr_r (Word16 var1, Word16 var2)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -193,7 +160,7 @@ Word16 shr_r (Word16 var1, Word16 var2)
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
-Word16 shr_r(register Word16 var1, register Word16 var2, Flag *pOverflow)
+OSCL_EXPORT_REF Word16 shr_r(register Word16 var1, register Word16 var2, Flag *pOverflow)
 {
     /*----------------------------------------------------------------------------
     ; Define all local variables
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l.cpp
index 8f74aa6..6038388 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l.cpp
@@ -28,22 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/src/sqrt_l.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Updated template. Changed function interface to pass in a
-              pointer to overflow flag into the function instead of using a
-              global flag. Changed name of an input pointer from "exp" to "pExp"
-              for clarity. Removed inclusion of unwanted header files.
-
- Description: Removed inclusion of sqrt_l.tab file. Changed the array name
-              "table" to "sqrt_l_tbl". Fixed typos.
-
- Who:                           Date:
- Description:
+ Filename: sqrt_l.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -185,29 +170,13 @@ Word32 sqrt_l_exp (     // o : output value
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-Word32 sqrt_l_exp(      /* o : output value,                          Q31 */
+OSCL_EXPORT_REF Word32 sqrt_l_exp(      /* o : output value,          Q31 */
     Word32 L_x,         /* i : input value,                           Q31 */
     Word16 *pExp,       /* o : right shift to be applied to result,   Q1  */
     Flag   *pOverflow   /* i : pointer to overflow flag */
@@ -252,10 +221,10 @@ Word32 sqrt_l_exp(      /* o : output value,                          Q31 */
         i -= 16;                              /* 0 <= i <= 47                   */
     }
 
-    L_y = L_deposit_h(sqrt_l_tbl[i]);       /* sqrt_l_tbl[i] << 16            */
+    L_y = ((Word32) sqrt_l_tbl[i] << 16);      /* sqrt_l_tbl[i] << 16            */
 
     /* sqrt_l_tbl[i] - sqrt_l_tbl[i+1]) */
-    tmp = sub(sqrt_l_tbl[i], sqrt_l_tbl[i + 1], pOverflow);
+    tmp = sqrt_l_tbl[i] - sqrt_l_tbl[i + 1];
 
     L_y = L_msu(L_y, tmp, a, pOverflow);    /* L_y -= tmp*a*2                 */
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l_tbl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l_tbl.cpp
index 53fa7ab..548da65 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l_tbl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sqrt_l_tbl.cpp
@@ -28,20 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/sqrt_l_tbl.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed the table name to sqrt_l_tbl.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who:                           Date:
- Description:
+ Filename: sqrt_l_tbl.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -85,7 +72,7 @@ extern "C"
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    const Word16 sqrt_l_tbl[50] =
+    extern const Word16 sqrt_l_tbl[50] =
     {
         16384, 16888, 17378, 17854, 18318, 18770, 19212, 19644, 20066, 20480,
         20886, 21283, 21674, 22058, 22435, 22806, 23170, 23530, 23884, 24232,
@@ -142,22 +129,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sub.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sub.cpp
index d936128..ed9fccc 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sub.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/sub.cpp
@@ -28,33 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/sub.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the sub function. Sync'ed up with the
-          current template and fixed tabs.
-
- Description: Changed all occurrences of L_diff to diff, deleted "short" in
-          the definition of var1 and var2, and fixed the range values.
-
- Description: Changed function prototype passing in a pointer to overflow flag
-              instead of using global data.
-
- Description: Changes made per formal review comments.
-              1. Changed the parameter name fron "overflow" to "pOverflow"
-              2. Updated template
-              3. Updated reference section
-
- Description: Removed conditional code that updates WMOPS counter
-
- Description:
-              1. Modified if-else structure to save cycles by processing
-                 the most common case faster.
-
- Who:                       Date:
- Description:
+ Filename: sub.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -161,22 +135,6 @@ terms listed above has been obtained from the copyright holder.
  }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -187,7 +145,7 @@ terms listed above has been obtained from the copyright holder.
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
 
-Word16 sub(Word16 var1, Word16 var2, Flag *pOverflow)
+OSCL_EXPORT_REF Word16 sub(Word16 var1, Word16 var2, Flag *pOverflow)
 {
 
     Word32 diff;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/syn_filt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/syn_filt.cpp
index 5ffa044..221f4dc 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/syn_filt.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/syn_filt.cpp
@@ -27,63 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/syn_filt.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Making changes based on comments from the review meeting.
-
- Description: Added typedef to Input/Output Definition section.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template.
-
- Description: Fixed typecasting issue with the TI C compiler.
-
- Description: Modified FOR loops to count down.
-
- Description: Modified FOR loop to count up again so that the correct values
-              are stored in the tmp buffer. Updated copyright year.
-
- Description:
-        - Modified for loop and introduced pointers to avoid adding
-          offsets
-        - Eliminated check for saturation given that the max values of input
-          data and coefficients will not saturate the multiply and
-          accumulation
-        - eliminated memcpy to update history buffer in every pass. This is
-          done now just updating the pointers.
-
- Description:
-              1. Eliminated unused include files.
-              2. Unrolled loops to process twice as many samples as before,
-                 this saves on memory accesses to the vector coeff. a[] and
-                 elements in the history buffer of this recursive filter
-
- Description:
-              1. Added overflow check inside both loops. (this is needed just
-                 to satisfy bit exactness on the decoder, a faster
-                 implementation will add an extra shift, do the same,
-                 but will not be bit exact, and it may have better audio
-                 quality because will avoid clipping)
-              2. Added include file for constant definitions
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description: Using fxp_arithmetic.h that includes inline assembly functions
-              for ARM and linux-arm.
-
- Description: Replacing fxp_arithmetic.h with basic_op.h.
-
- Who:                           Date:
- Description:
+ Filename: syn_filt.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -222,29 +166,13 @@ void Syn_filt (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Syn_filt(
+OSCL_EXPORT_REF void Syn_filt(
     Word16 a[],     /* (i)   : a[M+1] prediction coefficients   (M=10)  */
     Word16 x[],     /* (i)   : input signal                             */
     Word16 y[],     /* (o)   : output signal                            */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp
index 7597d22..d5c42dc 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp
@@ -27,32 +27,10 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/vad1.c
+ Filename: vad1.cpp
  Functions:
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description: Made changes per review comments
- (1) Removed include of "count.h"
- (2) Replaced "basic_op.h" with individual include files
- (3) Removed some unnecessary instances of sub().
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Who:                           Date:
- Description:
-
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
 
@@ -138,22 +116,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -269,22 +231,6 @@ static void first_filter_stage(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -373,22 +319,6 @@ static void filter5(Word16 *in0,    /* i/o : input values; output low-pass part
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -477,22 +407,6 @@ static void filter3(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -585,22 +499,6 @@ static Word16 level_calculation(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -722,22 +620,6 @@ static void filter_bank(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -916,22 +798,6 @@ static void update_cntrl(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1075,22 +941,6 @@ static Word16 hangover_addition(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1225,22 +1075,6 @@ static void noise_estimate_update(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1343,22 +1177,6 @@ static void complex_estimate_adapt(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1450,22 +1268,6 @@ static Word16 complex_vad(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1607,22 +1409,6 @@ static Word16 vad_decision(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1693,22 +1479,6 @@ Word16 vad1_init(vadState1 **state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1818,22 +1588,6 @@ Word16 vad1_reset(vadState1 *state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1894,22 +1648,6 @@ void vad1_exit(vadState1 **state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1971,22 +1709,6 @@ void vad_complex_detection_update(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -2060,22 +1782,6 @@ void vad_tone_detection(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -2148,22 +1854,6 @@ void vad_tone_detection_update(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -2260,22 +1950,6 @@ void vad_pitch_detection(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp
index 2e2efc4..98382b8 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/weight_a.cpp
@@ -28,32 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./audio/gsm-amr/c/src/weight_a.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Put file into template and first pass at optimization.
-
- Description: Made changes based on comments from the review meeting. Used
-    pointers instead of index addressing in the arrays.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Fixed typecasting issue with TI C compiler.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Modified FOR loop to count down.
-              2. Used address pre-increment instead of address offsets.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Who:                           Date:
- Description:
+ Filename: weight_a.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -150,29 +125,13 @@ void Weight_Ai (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-void Weight_Ai(
+OSCL_EXPORT_REF void Weight_Ai(
     Word16 a[],         /* (i)   : a[M+1]  LPC coefficients   (M=10)    */
     const Word16 fac[], /* (i)   : Spectral expansion factors.          */
     Word16 a_exp[]      /* (o)   : Spectral expanded LPC coefficients   */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/window_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/window_tab.cpp
index 9bee88b..2279d2e 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/window_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/window_tab.cpp
@@ -27,20 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: .audio/gsm-amr/c/src/window_tab.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed tables from static const to just const.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Who:                       Date:
- Description:
+ Filename: window_tab.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -87,28 +74,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -154,7 +119,7 @@ extern "C"
 
     /* window for non-EFR modesm; uses 40 samples lookahead */
 
-    const Word16 window_200_40[L_WINDOW] =
+    extern const Word16 window_200_40[L_WINDOW] =
     {
         2621,  2623,  2629,  2638,  2651,  2668,  2689,  2713,  2741,  2772,
         2808,  2847,  2890,  2936,  2986,  3040,  3097,  3158,  3223,  3291,
@@ -185,7 +150,7 @@ extern "C"
 
     /* window for EFR, first two subframes, no lookahead */
 
-    const Word16 window_160_80[L_WINDOW] =
+    extern const Word16 window_160_80[L_WINDOW] =
     {
         2621, 2624, 2633, 2648, 2668, 2695, 2727, 2765, 2809, 2859,
         2915, 2976, 3043, 3116, 3194, 3279, 3368, 3464, 3565, 3671,
@@ -215,7 +180,7 @@ extern "C"
 
     /* window for EFR, last two subframes, no lookahead */
 
-    const Word16 window_232_8[L_WINDOW] =
+    extern const Word16 window_232_8[L_WINDOW] =
     {
         2621, 2623, 2627, 2634, 2644, 2656, 2671, 2689, 2710, 2734,
         2760, 2789, 2821, 2855, 2893, 2933, 2975, 3021, 3069, 3120,
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/decoder_gsm_amr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/decoder_gsm_amr.h
index 7db5211..5fab78d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/decoder_gsm_amr.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/decoder_gsm_amr.h
@@ -27,9 +27,9 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 //////////////////////////////////////////////////////////////////////////////////
-//																				//
-//	File: decoder_amr_nb.h	                                                    //
-//																				//
+//                                                                              //
+//  File: decoder_amr_nb.h                                                      //
+//                                                                              //
 //////////////////////////////////////////////////////////////////////////////////
 
 #ifndef _DECODER_AMR_NB_H
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/pvamrnbdecoder_api.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/pvamrnbdecoder_api.h
index 31887c4..7c324c5 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/pvamrnbdecoder_api.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/include/pvamrnbdecoder_api.h
@@ -30,13 +30,6 @@ terms listed above has been obtained from the copyright holder.
  Name: pvamrnbdecoder_api.h
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Who:                                       Date:
- Description:
-
-------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
  Main header file for the Packet Video AMR Narrow  Band  decoder library. The
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.cpp
index fb7cff3..674094f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.cpp
@@ -31,27 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename:  /audio/gsm-amr/c/src/a_refl.c
+ Filename: a_refl.cpp
  Functions: a_refl
 
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Removing unneeded include files and the goto statement.
-
-
- Description: Changed function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:  Using inline functions from basic_op.h .
-               Removing unneeded include files.
-
- Description:
-
 ------------------------------------------------------------------------------
 */
 
@@ -204,22 +186,6 @@ ExitRefl:
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -269,7 +235,7 @@ void A_Refl(
         L_acc = L_sub(MAX_32, L_temp, pOverflow);
 
         normShift = norm_l(L_acc);
-        scale = sub(15, normShift, pOverflow);
+        scale = 15 - normShift;
 
         L_acc = L_shl(L_acc, normShift, pOverflow);
         normProd = pv_round(L_acc, pOverflow);
@@ -278,14 +244,18 @@ void A_Refl(
 
         for (j = 0; j < i; j++)
         {
-            L_acc = L_deposit_h(aState[j]);
+            L_acc = ((Word32)aState[j] << 16);
             L_acc = L_msu(L_acc, refl[i], aState[i-j-1], pOverflow);
 
             temp = pv_round(L_acc, pOverflow);
             L_temp = L_mult(mult, temp, pOverflow);
             L_temp = L_shr_r(L_temp, scale, pOverflow);
 
-            if (L_abs(L_temp) > 32767)
+
+            Word32 L_tmp_abs = L_temp - (L_temp < 0);
+            L_tmp_abs = L_tmp_abs ^(L_tmp_abs >> 31);
+
+            if (L_tmp_abs > 32767)
             {
                 for (i = 0; i < M; i++)
                 {
@@ -294,7 +264,7 @@ void A_Refl(
                 break;
             }
 
-            bState[j] = extract_l(L_temp);
+            bState[j] = (Word16)(L_temp);
         }
 
         for (j = 0; j < i; j++)
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.h
index 4028e1e..d16e572 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/a_refl.h
-
-     Date: 08/11/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: a_refl.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.cpp
index 4c66d54..c06c24a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.cpp
@@ -31,7 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/agc.c
+ Filename: agc.cpp
  Funtions: energy_old
            energy_new
            agc_init
@@ -143,22 +143,6 @@ static Word32 energy_old( // o : return energy of signal
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -233,22 +217,6 @@ static Word32 energy_old(       /* o : return energy of signal      */
    RETURNING(energy_old_value = s)
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -345,22 +313,6 @@ static Word32 energy_new( // o : return energy of signal
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -453,22 +405,6 @@ static Word32 energy_new(       /* o : return energy of signal      */
    RETURNING(energy_new_value = s)
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -552,22 +488,6 @@ int agc_reset (agcState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -712,22 +632,6 @@ int agc (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -938,22 +842,6 @@ void agc2 (
     return;
 }
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.h
index 9788caa..95cb10e 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/agc.h
@@ -31,26 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/agc.h
-
-     Date: 12/07/2001
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Removed unneeded sections of the standard template.
-              Updated function prototype for agc() and agc2() to match new
-              interface
-
- Description: Changed paramter name from "overflow" to "pOverflow" for
-              functions agc() and agc2()
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: agc.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -138,7 +119,7 @@ extern "C"
         Word16 *sig_out,   /* i/o : postfilter output signal, (l_trm) */
         Word16 agc_fac,    /* i   : AGC factor                        */
         Word16 l_trm,      /* i   : subframe size                     */
-        Flag *pOverflow    /* i   : overflow flag					  */
+        Flag *pOverflow    /* i   : overflow flag                     */
     );
 
     /*----------------------------------------------------------------------------
@@ -151,7 +132,7 @@ extern "C"
         Word16 *sig_in,    /* i   : postfilter input signal   */
         Word16 *sig_out,   /* i/o : postfilter output signal  */
         Word16 l_trm,      /* i   : subframe size             */
-        Flag *pOverflow    /* i   : overflow flag			  */
+        Flag *pOverflow    /* i   : overflow flag             */
     );
 
 #ifdef __cplusplus
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.cpp
index 873d7af..7a68676 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.cpp
@@ -30,66 +30,7 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 
 
- Pathname: ./audio/gsm-amr/c/src/amrdecode.c
-
-     Date: 05/23/2001
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:       AMRDecode now doesn't call getbits() or put_header_in().
-                    It also now obtains a new bit_offset value from a constant
-                    rather than from the returned value of getbits().
-
- Description:       AMRDecode now returns byte_offset rather than bit_offset,
-                    so the program can access the next frame that is byte
-                    aligned rather than packed without padding.
-
- Description:       The structure types Speech_Decode_FrameState are now
-                    passed into amrdecode( ) using void pointers, so that
-                    higher level functions don't need to know anything about
-                    this structure type.
-
- Description: Changed input argument list. Added code to handle incoming DTX
-              frames, and added call to wmf_to_ets function prior to calling
-              GSMFrameDecode.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Changed all references to bit_offset to byte_offset.
-
- Description: Added input_type to the function interface and modified code
-              to check type of conversion that needs to be made.
-
- Description: Modified pseudo-code to include IF2 and ETS input formats.
-              Removed byte_offset from input list. Renamed speech_bits
-              to speech_bits_ptr.
-
- Description: Added dec_input_format_tab.h in Include section. Modified
-              pseudo-code to use correct table names. Renamed input_type to
-              input_format and speech_bits to speech_bits_ptr.
-
- Description: Removed *prev_mode_ptr in the input argument list.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Removed dec_input_format_tab.h from Include section.
-              2. Changed type definition of raw_pcm_buffer in the I/O
-                 definition section.
-
- Description: Renamed WmfBytesPerFrame to WmfDecBytesPerFrame, and
-              If2BytesPerFrame to If2DecBytesPerFrame.
-
- Description: Modified code so that the ETS testvectors could be fed directly
-              to this function.
-
- Description: Changed '&' to '&&' in the setting of rx_type and mode for
-              AMR_SID < frame_type < NO_DATA case.
-
- Description: Added code comments and made some code optimizations per Phase
-              2/3 review comments.
-
- Description: Added conditional compile around the call to GSMFrameDecode to
-              allow amrdecode.c to be used in the ETS reference console.
-
- Description:
+ Filename: amrdecode.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -363,22 +304,6 @@ terms listed above has been obtained from the copyright holder.
  RETURN (byte_offset)
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -416,7 +341,7 @@ Word16 AMRDecode(
         if (input_format == MIME_IETF)
         {
             /* Convert incoming packetized raw WMF data to ETS format */
-            wmf_to_ets(frame_type, speech_bits_ptr, dec_ets_input_bfr);
+            wmf_to_ets(frame_type, speech_bits_ptr, dec_ets_input_bfr, &(decoder_state->decoder_amrState.common_amr_tbls));
 
             /* Address offset of the start of next frame */
             byte_offset = WmfDecBytesPerFrame[frame_type];
@@ -424,7 +349,7 @@ Word16 AMRDecode(
         else   /* else has to be input_format  IF2 */
         {
             /* Convert incoming packetized raw IF2 data to ETS format */
-            if2_to_ets(frame_type, speech_bits_ptr, dec_ets_input_bfr);
+            if2_to_ets(frame_type, speech_bits_ptr, dec_ets_input_bfr, &(decoder_state->decoder_amrState.common_amr_tbls));
 
             /* Address offset of the start of next frame */
             byte_offset = If2DecBytesPerFrame[frame_type];
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.h
index db951b9..1715f0d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/amrdecode.h
@@ -31,59 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./gsm-amr/c/include/amrdecode.h
-
-     Date: 05/23/2001
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added BytesUsed table so that the code can allow for padding
-              at the end of each frame.
-
- Description: Removed function prototypes for getbits, putbits,
-              put_frame_header_in, and get_frame_header_off. Removed
-              basicop_malloc.h and replaced it with typedef.h in the include
-              section. Fixed table entries for various SID modes. Removed
-              #defines because they are not used by AMRDecode function.
-              Removed tables not used by AMRDecode function.
-
- Description: The data type Speech_Decode_FrameState is now being passed into
-              this function as a void pointer rather than a structure of type
-              Speech_Decode_FrameState.
-
- Description: The variable decoder_state was renamed to state_data.
-
- Description: Updated function prototype and header template.
-
- Description: Added mode.h and frame_type_3gpp.h to include section, and
-              removed sp_dec.h.
-
- Description: Removed definition of Changed BytesThisFrame[] table. Added
-              extern declaration for BytesThisFrame[] table.
-
- Description: Added #define for WMF and IF2. Updated function prototype.
-
- Description: Moved input format #defines and BytesThisFrame table to
-              dec_input_format_tab.h and dec_input_format_tab.c, respectively.
-              Updated function prototype.
-
- Description: Updated function prototype of AMRDecode due to the removal of
-              *prev_mode_ptr. Added extern of If2BytesPerFrame
-
- Description: Added #defines for WMF, IF2, and ETS input formats.
-
- Description: Changed WmfBytesPerFrame to WmfDecBytesPerFrame, and
-              If2BytesPerFrame to If2DecBytesPerFrame.
-
- Description: Renamed #defines for input format types to make it unique to the
-              decoder.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: amrdecode.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.cpp
index 30d3fee..f5317e6 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.cpp
@@ -31,24 +31,11 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/b_cn_cod.c
+ Filename: b_cn_cod.cpp
  Functions: pseudonoise
             build_CN_code
             build_CN_param
 
-     Date: 09/28/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Cleaned up code. Passing in a pointer to
-              overflow flag for build_CN_code() and build_CN_param() functions.
-              Removed unnecessary header files.
- Description: Make chnages per formal review. Fix error introduced during
-              optimization in pseudonoise().
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -173,22 +160,6 @@ Word16 pseudonoise (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -329,22 +300,6 @@ void build_CN_code (
    return;
 }
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -374,7 +329,7 @@ void build_CN_code(
 
         temp = (Word16)(L_mult(i, 10, pOverflow));
         i = temp >> 1;
-        i = add(i, k, pOverflow);
+        i = add_16(i, k, pOverflow);
 
         j = pseudonoise(pSeed, 1);       /* generate sign */
 
@@ -461,22 +416,6 @@ void build_CN_param (
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -491,6 +430,7 @@ void build_CN_param(
     const Word16 n_param,           /* i  : number of params                */
     const Word16 param_size_table[],/* i : size of params                   */
     Word16 parm[],                  /* o : CN Generated params              */
+    const Word16* window_200_40_ptr, /* i : ptr to read-only table          */
     Flag  *pOverflow                /* i/o : Overflow Flag                  */
 )
 
@@ -505,9 +445,9 @@ void build_CN_param(
 
     *pSeed = (Word16)(L_add(L_temp, 13849L, pOverflow));
 
-    pTemp = &window_200_40[*pSeed & 0x7F];
+    pTemp = &window_200_40_ptr[*pSeed & 0x7F];
 
-    for (i = 0; i < n_param;i++)
+    for (i = 0; i < n_param; i++)
     {
         temp = ~(0xFFFF << param_size_table[i]);
         parm[i] = *pTemp++ & temp;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.h
index 743237c..aec7c7c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/b_cn_cod.h
@@ -31,31 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/add.h
-
-
-
-
-     Date: 08/11/2000
-
-
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Created separate header file for add function.
-
- Description: Changed function prototype; pointer to  overflow flag is passed
-              in as a parameter.
-
- Description: Updated copyright section.
-              Changed "overflow" to "pOverflow" in the function prototype.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
-
+ Filename: b_cn_cod.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -94,7 +70,6 @@ extern "C"
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern Word16 window_200_40[];
 
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
@@ -157,6 +132,7 @@ extern "C"
         const Word16 n_param,               /* i  : number of params            */
         const Word16 param_size_table[],    /* i : size of params               */
         Word16 parm[],                  /* o : CN Generated params              */
+        const Word16* window_200_40_ptr, /* i : ptr to read-only table          */
         Flag  *pOverflow                /* i/o : Overflow Flag                  */
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.cpp
index 50f603d..e14dbcd 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.cpp
@@ -29,7 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
- Pathname: ./audio/gsm-amr/c/src/bgnscd.c
+ Filename: bgnscd.cpp
  Functions:
            Bgn_scd_reset
            Bgn_scd
@@ -50,7 +50,6 @@ terms listed above has been obtained from the copyright holder.
 #include    "typedef.h"
 #include    "basic_op.h"
 #include    "cnst.h"
-#include    "copy.h"
 #include    "gmed_n.h"
 #include    "sqrt_l.h"
 #include    "oscl_mem.h"
@@ -138,22 +137,6 @@ Word16 Bgn_scd_reset (Bgn_scdState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -373,22 +356,6 @@ Word16 Bgn_scd (Bgn_scdState *st,      // i : State variables for bgn SCD
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.h
index 41349d9..f98eab9 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/bgnscd.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/bgnscd.h
-
-     Date: 12/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: bgnscd.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.cpp
index 37e262c..7a86760 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.cpp
@@ -31,42 +31,11 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/c_g_aver.c
+ Filename: c_g_aver.cpp
  Functions:
             Cb_gain_average_reset
             Cb_gain_average
 
-     Date: 03/28/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Made some changes to the comments to match the comments from
-    other modules.
-
- Description: Made changes based on comments from the review meeting.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Defined one local variable per line.
-
- Description: Removed the functions Cb_gain_average_init and
- Cb_gain_average_exit.  The Cb_gain_average related structure is no longer
- dynamically allocated.
-
- Description: Passing in pOverflow to comply with changes needed for EPOC
-              Updated the include files for the module.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -168,22 +137,6 @@ Word16 Cb_gain_average_reset (Cb_gain_averageState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -437,22 +390,6 @@ Word16 Cb_gain_average (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -514,7 +451,7 @@ Word16 Cb_gain_average(
     {
         tmp1 = abs_s(sub(*(lspAver + i), *(lsp + i), pOverflow));
         /* Q15      */
-        shift1 = sub(norm_s(tmp1), 1, pOverflow);       /* Qn       */
+        shift1 = norm_s(tmp1) - 1 ;                     /* Qn       */
         tmp1 = shl(tmp1, shift1, pOverflow);            /* Q15+Qn   */
         shift2 = norm_s(*(lspAver + i));                /* Qm       */
         tmp2 = shl(*(lspAver + i), shift2, pOverflow);  /* Q15+Qm   */
@@ -533,7 +470,7 @@ Word16 Cb_gain_average(
             /* Q15+Qn-Qm-Qx=Q13 */
         }
 
-        diff = add(diff, *(tmp + i), pOverflow);           /* Q13 */
+        diff = add_16(diff, *(tmp + i), pOverflow);           /* Q13 */
     }
 
     /* Compute hangover */
@@ -570,12 +507,12 @@ Word16 Cb_gain_average(
                     (mode == MR59))))
         {
             /* bgMix = min(0.25, max(0.0, diff-0.55)) / 0.25; */
-            tmp_diff = sub(diff, 4506, pOverflow);   /* 0.55 in Q13 */
+            tmp_diff = diff - 4506;   /* 0.55 in Q13 */
         }
         else
         {
             /* bgMix = min(0.25, max(0.0, diff-0.40)) / 0.25; */
-            tmp_diff = sub(diff, 3277, pOverflow); /* 0.4 in Q13 */
+            tmp_diff = diff - 3277; /* 0.4 in Q13 */
         }
 
         /* max(0.0, diff-0.55)  or  */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.h
index 0b53753..ac56383 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/c_g_aver.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/c_g_aver.h
-
-     Date: 12/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: c_g_aver.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp
index 899daba..d56b922 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.cpp
@@ -31,24 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d1035pf.c
-
-     Date: 04/14/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Updated file per comments gathered from Phase 2/3 review.
-
- Description: Synchronized file with UTMS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Removed inclusion of "gray.tab".
-
- Description:
+ Filename: d1035pf.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -182,22 +165,6 @@ void dec_10i40_35bits (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -206,7 +173,8 @@ void dec_10i40_35bits (
 
 void dec_10i40_35bits(
     Word16 index[],    /* (i)     : index of 10 pulses (sign+position)       */
-    Word16 cod[]       /* (o)     : algebraic (fixed) codebook excitation    */
+    Word16 cod[],       /* (o)     : algebraic (fixed) codebook excitation    */
+    const Word16* dgray_ptr /* i : ptr to read-only tbl                       */
 )
 {
     register Word16 i, j, pos1, pos2;
@@ -225,7 +193,7 @@ void dec_10i40_35bits(
 
         tmp = *(index + j);
         i = tmp & 7;
-        i = *(dgray + i);
+        i = *(dgray_ptr + i);
 
         i = (Word16)(i * 5);
         pos1 = i + j; /* position of pulse "j" */
@@ -246,7 +214,7 @@ void dec_10i40_35bits(
         /* compute index i */
 
         i = *(index + j + 5) & 7;
-        i = *(dgray + i);
+        i = *(dgray_ptr + i);
         i = (Word16)(i * 5);
 
         pos2 = i + j;      /* position of pulse "j+5" */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.h
index e3bbf4c..ac15905 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d1035pf.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/d1035pf.h
-
-     Date: 09/28/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Added extern declaration for dgray[] defined
-              in gray_tbl.c
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: d1035pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -56,13 +44,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	D1035PF_H
-#define	D1035PF_H
+#ifndef D1035PF_H
+#define D1035PF_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"typedef.h"
+#include    "typedef.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -84,7 +72,7 @@ extern "C"
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern Word16 dgray[];
+
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
     ----------------------------------------------------------------------------*/
@@ -104,7 +92,8 @@ extern "C"
 
     void dec_10i40_35bits(
         Word16 index[],    /* (i)   : index of 10 pulses (sign+position)        */
-        Word16 cod[]       /* (o)   : algebraic (fixed) codebook excitation     */
+        Word16 cod[],       /* (o)   : algebraic (fixed) codebook excitation     */
+        const Word16* dgray_ptr /* i : ptr to read-only tbl                      */
     );
 
     /*----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.cpp
index e1e544f..8a70032 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_11pf.cpp
@@ -31,23 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d2_11pf.c
- Functions:
-
-     Date: 01/28/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified to place file in the correct template format. Eliminated
- use of special functions to perform simple mathematical operations.
-
- Description: Per review comments...
- (1) Removed include of "count.h" and "basic_op.h"
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: d2_11pf.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -125,22 +109,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.cpp
index 2c36706..fca7a8a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.cpp
@@ -31,28 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d2_9pf.c
+ Filename: d2_9pf.cpp
  Functions: decode_2i40_9bits
 
-     Date: 01/28/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified to place file in the correct template format. Eliminated
- use of special functions to perform simple mathematical operations, where
- possible.  Added the parameter pOverflow for the basic math operations.
-
- Description: Per review comments...
- (1) Removed include of basic_op.h, replaced with shl.h
- (2) Added pOverflow to the output section of the template
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -101,8 +82,6 @@ extern "C"
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
 
-    extern const Word16 startPos[];
-
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
 }
@@ -150,22 +129,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -176,6 +139,7 @@ void decode_2i40_9bits(
     Word16 subNr,  /* i : subframe number                          */
     Word16 sign,   /* i : signs of 2 pulses.                       */
     Word16 index,  /* i : Positions of the 2 pulses.               */
+    const Word16* startPos_ptr, /*  i: ptr to read only table          */
     Word16 cod[],  /* o : algebraic (fixed) codebook excitation    */
     Flag  *pOverflow  /* o : Flag set when overflow occurs         */
 )
@@ -203,16 +167,16 @@ void decode_2i40_9bits(
 
     k += j;
 
-    /* pos0 =i*5+startPos[j*8+subNr*2] */
-    pos[0] = i * 5 + startPos[k++];
+    /* pos0 =i*5+startPos_ptr[j*8+subNr*2] */
+    pos[0] = i * 5 + startPos_ptr[k++];
 
 
     index >>= 3;
 
     i = index & 7;
 
-    /* pos1 =i*5+startPos[j*8+subNr*2 + 1] */
-    pos[1] = i * 5 + startPos[k];
+    /* pos1 =i*5+startPos_ptr[j*8+subNr*2 + 1] */
+    pos[1] = i * 5 + startPos_ptr[k];
 
 
     /* decode the signs  and build the codeword */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.h
index 38076d8..ef7c16b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d2_9pf.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/d2_9pf.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: d2_9pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -107,6 +95,7 @@ extern "C"
         Word16 subNr,       /* i : subframe number                          */
         Word16 sign,        /* i : signs of 2 pulses.                       */
         Word16 index,       /* i : Positions of the 2 pulses.               */
+        const Word16* startPos_ptr, /*  i: ptr to read only table               */
         Word16 cod[],       /* o : algebraic (fixed) codebook excitation    */
         Flag   * pOverflow  /* o : Flag set when overflow occurs            */
     );
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.cpp
index d1912cf..193b7de 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.cpp
@@ -31,25 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d3_14pf.c
+ Filename: d3_14pf.cpp
  Functions: decode_3i40_14bits
 
-     Date: 01/28/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified to place file in the correct template format. Eliminated
- use of special functions to perform simple mathematical operations.
-
- Description: Per review comments...
- (1) Removed include of "count.h" and "basic_op.h"
- (2) Updated the pathname to indicate the correct file.  (Line 39)
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -131,22 +115,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.h
index 1e2e0cd..e8a0de1 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d3_14pf.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/d2_9pf.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: d3_14pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.cpp
index ece82c0..62838bd 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.cpp
@@ -31,27 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d4_17pf.c
+ Filename: d4_17pf.cpp
  Functions: decode_4i40_17bits
 
-     Date: 01/28/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified to place file in the correct template format. Eliminated
- use of special functions to perform simple mathematical operations.
-
- Description: An incorrect comment in the original source lead me to implement
- the calculation of pos[2] incorrectly.  The correct formula is pos2 =i*5+2,
- not pos2 = i*5 + 1.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -103,7 +85,6 @@ extern "C"
     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const Word16 dgray[];
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -151,22 +132,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -176,6 +141,7 @@ extern "C"
 void decode_4i40_17bits(
     Word16 sign,   /* i : signs of 4 pulses.                       */
     Word16 index,  /* i : Positions of the 4 pulses.               */
+    const Word16* dgray_ptr, /* i : Pointer to read-only table         */
     Word16 cod[]   /* o : algebraic (fixed) codebook excitation    */
 )
 {
@@ -198,7 +164,7 @@ void decode_4i40_17bits(
 
     i = index & 0x7;
 
-    i = dgray[i];
+    i = dgray_ptr[i];
 
     pos[0] = i * 5; /* pos0 =i*5 */
 
@@ -207,7 +173,7 @@ void decode_4i40_17bits(
 
     i = index & 0x7;
 
-    i = dgray[i];
+    i = dgray_ptr[i];
 
     pos[1] = i * 5 + 1;  /* pos1 =i*5+1 */
 
@@ -217,7 +183,7 @@ void decode_4i40_17bits(
 
     i = index & 0x7;
 
-    i = dgray[i];
+    i = dgray_ptr[i];
 
     pos[2] = i * 5 + 2; /* pos2 =i*5+2 */
 
@@ -233,7 +199,7 @@ void decode_4i40_17bits(
 
     i = index & 0x7;
 
-    i = dgray[i];
+    i = dgray_ptr[i];
 
     pos[3] = i * 5 + 3 + j; /* pos3 =i*5+3+j */
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.h
index 5dc43f3..b69cfae 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d4_17pf.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/d4_17pf.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: d4_17pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -105,6 +94,7 @@ extern "C"
     void decode_4i40_17bits(
         Word16 sign,   /* i : signs of 4 pulses.                       */
         Word16 index,  /* i : Positions of the 4 pulses.               */
+        const Word16* dgray_ptr, /* i : Pointer to read-only table         */
         Word16 cod[]   /* o : algebraic (fixed) codebook excitation    */
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.cpp
index 917c47f..6195896 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.cpp
@@ -31,28 +31,10 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d8_31pf.c
- Functions:
-
-
-     Date: 01/28/2002
+ Filename: d8_31pf.cpp
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified to pass overflow flag through to basic math function.
- The flag is passed back to the calling function by pointer reference.
-
- Description: Per review comments...
- (1) Removed include of "count.h" and "basic_op.h"
- (2) Added includes of mult.h, shl.h, shr.h, add.h, sub.h, negate.h,
-     L_mult.h, and L_shr.h
 
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 */
 
@@ -138,22 +120,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -256,11 +222,7 @@ static void decompress10(
             1,
             pOverflow);
 
-    pos_indx[index3] =
-        add(
-            ib,
-            ic,
-            pOverflow);
+    pos_indx[index3] = add_16(ib, ic, pOverflow);
 
     return;
 }
@@ -317,22 +279,6 @@ static void decompress10(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -469,7 +415,7 @@ static void decompress_code(
     ia = LSBs & 0x1;
 
     pos_indx[3] =
-        add(
+        add_16(
             ib,
             ia,
             pOverflow);
@@ -533,22 +479,6 @@ static void decompress_code(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.h
index 162685f..d46e236 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d8_31pf.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/d2_9pf.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: d8_31pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_c.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_c.cpp
index b6c62f8..9cc14c0 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_c.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_c.cpp
@@ -31,26 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d_gain_c.c
+ Filename: d_gain_c.cpp
  Functions: d_gain_c
 
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated include files and intput/output section. Changed .tab
-              files to .c files.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
-
  ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
@@ -97,28 +80,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -176,8 +137,6 @@ extern "C"
     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const Word16 qua_gain_code[];
-
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -192,6 +151,7 @@ void d_gain_code(
     enum Mode mode,           /* i   : AMR mode (MR795 or MR122)        */
     Word16 index,             /* i   : received quantization index      */
     Word16 code[],            /* i   : innovation codevector            */
+    const Word16* qua_gain_code_ptr, /* i : Pointer to read-only table      */
     Word16 *gain_code,        /* o   : decoded innovation gain          */
     Flag   *pOverflow
 )
@@ -220,7 +180,7 @@ void d_gain_code(
     index &= 31;                    /* index < 32, to avoid buffer overflow */
     tbl_tmp = index + (index << 1);
 
-    p = &qua_gain_code[tbl_tmp];
+    p = &qua_gain_code_ptr[tbl_tmp];
 
     /* Different scalings between MR122 and the other modes */
     temp = sub((Word16)mode, (Word16)MR122, pOverflow);
@@ -235,7 +195,7 @@ void d_gain_code(
         gcode0 = (Word16)(Pow2(14, frac, pOverflow));
         L_tmp = L_mult(*p++, gcode0, pOverflow);
         L_tmp = L_shr(L_tmp, sub(9, exp, pOverflow), pOverflow);
-        *gain_code = extract_h(L_tmp);          /* Q1 */
+        *gain_code = (Word16)(L_tmp >> 16);        /* Q1 */
     }
 
     /*-------------------------------------------------------------------*
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_p.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_p.cpp
index 99446db..ac39950 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_p.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_gain_p.cpp
@@ -31,26 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d_gain_p.c
+ Filename: d_gain_p.cpp
  Functions: d_gain_p
 
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
- (1) Removed extra includes
- (2) Replaced function calls to basic math operations with ANSI C standard
-     mathemtical operations.
- (3) Placed code in the proper software template.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
-
  ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
@@ -92,28 +75,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -162,7 +123,6 @@ extern "C"
     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const Word16 qua_gain_pitch[];
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -175,12 +135,13 @@ extern "C"
 
 Word16 d_gain_pitch(       /* return value: gain (Q14)                */
     enum Mode mode,        /* i   : AMR mode                          */
-    Word16 index           /* i   : index of quantization             */
+    Word16 index,          /* i   : index of quantization             */
+    const Word16* qua_gain_pitch_ptr /* i : pointer to read-only tables   */
 )
 {
     Word16 gain;
 
-    gain = qua_gain_pitch[index];
+    gain = qua_gain_pitch_ptr[index];
 
     if (mode == MR122)
     {
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf.cpp
index 0dab255..7ac56b4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf.cpp
@@ -31,28 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d_plsf.c
- Functions:
-
-
-     Date: 04/14/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Removed the functions d_plsf_init and d_plsf_exit.
- The d_plsf related structure is no longer dynamically allocated.
-
- Description: Removed q_plsf_5.tab from Include section and added
-			  q_plsf_5_tbl.h to Include section. Changed "mean_lsf"
-              to "mean_lsf_5" in D_plsf_reset().
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: d_plsf.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -68,7 +47,7 @@ terms listed above has been obtained from the copyright holder.
 #include "typedef.h"
 #include "basic_op.h"
 #include "cnst.h"
-#include "copy.h"
+#include "oscl_mem.h"
 #include "d_plsf.h"
 #include "q_plsf_5_tbl.h"
 
@@ -162,29 +141,13 @@ int D_plsf_reset (D_plsfState *state)
   return 0;
 }
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-Word16 D_plsf_reset(D_plsfState *state)
+Word16 D_plsf_reset(D_plsfState *state, const Word16* mean_lsf_5_ptr)
 {
     Word16 i;
 
@@ -200,7 +163,7 @@ Word16 D_plsf_reset(D_plsfState *state)
     }
 
     /* Past dequantized lsfs */
-    Copy(mean_lsf_5, &state->past_lsf_q[0], M);
+    oscl_memmove((void *)&state->past_lsf_q[0], mean_lsf_5_ptr, M*sizeof(*mean_lsf_5_ptr));
 
     return 0;
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_3.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_3.cpp
index 7b31d04..2d3a4ef 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_3.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_3.cpp
@@ -31,7 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d_plsf_3.c
+ Filename: d_plsf_3.cpp
  Functions: D_plsf_3
 
  ------------------------------------------------------------------------------
@@ -81,28 +81,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -114,7 +92,7 @@ terms listed above has been obtained from the copyright holder.
 #include "basic_op.h"
 #include "lsp_lsf.h"
 #include "reorder.h"
-#include "copy.h"
+#include "oscl_mem.h"
 #include "q_plsf_3_tbl.h"
 
 
@@ -165,6 +143,7 @@ void D_plsf_3(
     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               */
 )
@@ -176,6 +155,14 @@ void D_plsf_3(
     Word16 lsf1_r[M];
     Word16 lsf1_q[M];
 
+    const Word16* mean_lsf_3_ptr = common_amr_tbls->mean_lsf_3_ptr;
+    const Word16* pred_fac_3_ptr = common_amr_tbls->pred_fac_3_ptr;
+    const Word16* dico1_lsf_3_ptr = common_amr_tbls->dico1_lsf_3_ptr;
+    const Word16* dico2_lsf_3_ptr = common_amr_tbls->dico2_lsf_3_ptr;
+    const Word16* dico3_lsf_3_ptr = common_amr_tbls->dico3_lsf_3_ptr;
+    const Word16* mr515_3_lsf_ptr = common_amr_tbls->mr515_3_lsf_ptr;
+    const Word16* mr795_1_lsf_ptr = common_amr_tbls->mr795_1_lsf_ptr;
+
     if (bfi != 0)   /* if bad frame */
     {
         /* use the past LSFs slightly shifted towards their mean */
@@ -191,12 +178,12 @@ void D_plsf_3(
 
             index =
                 mult(
-                    mean_lsf_3[i],
+                    mean_lsf_3_ptr[i],
                     ONE_ALPHA,
                     pOverflow);
 
             lsf1_q[i] =
-                add(
+                add_16(
                     index,
                     temp,
                     pOverflow);
@@ -212,12 +199,12 @@ void D_plsf_3(
                 temp =
                     mult(
                         st->past_r_q[i],
-                        pred_fac_3[i],
+                        pred_fac_3_ptr[i],
                         pOverflow);
 
                 temp =
-                    add(
-                        mean_lsf_3[i],
+                    add_16(
+                        mean_lsf_3_ptr[i],
                         temp,
                         pOverflow);
 
@@ -236,8 +223,8 @@ void D_plsf_3(
                 /* temp  = mean_lsf[i] +  past_r2_q[i]; */
 
                 temp =
-                    add(
-                        mean_lsf_3[i],
+                    add_16(
+                        mean_lsf_3_ptr[i],
                         st->past_r_q[i],
                         pOverflow);
 
@@ -264,12 +251,12 @@ void D_plsf_3(
         const Word16 *p_dico;
 
 
-        p_cb2 = dico2_lsf_3;    /* size DICO2_SIZE*3 */
+        p_cb2 = dico2_lsf_3_ptr;    /* size DICO2_SIZE*3 */
 
         if ((mode == MR475) || (mode == MR515))
         {   /* MR475, MR515 */
-            p_cb1 = dico1_lsf_3;    /* size DICO1_SIZE*3 */
-            p_cb3 = mr515_3_lsf;    /* size MR515_3_SIZE*4 */
+            p_cb1 = dico1_lsf_3_ptr;    /* size DICO1_SIZE*3 */
+            p_cb3 = mr515_3_lsf_ptr;    /* size MR515_3_SIZE*4 */
 
             index_limit_1 = (DICO1_SIZE - 1) * 3;
             index_limit_3 = (MR515_3_SIZE - 1) * 4;
@@ -277,8 +264,8 @@ void D_plsf_3(
         }
         else if (mode == MR795)
         {   /* MR795 */
-            p_cb1 = mr795_1_lsf;    /* size MR795_1_SIZE*3 */
-            p_cb3 = dico3_lsf_3;    /* size DICO3_SIZE*4 */
+            p_cb1 = mr795_1_lsf_ptr;    /* size MR795_1_SIZE*3 */
+            p_cb3 = dico3_lsf_3_ptr;    /* size DICO3_SIZE*4 */
 
             index_limit_1 = (MR795_1_SIZE - 1) * 3;
             index_limit_3 = (DICO3_SIZE - 1) * 4;
@@ -286,8 +273,8 @@ void D_plsf_3(
         }
         else
         {   /* MR59, MR67, MR74, MR102, MRDTX */
-            p_cb1 = dico1_lsf_3;    /* size DICO1_SIZE*3 */
-            p_cb3 = dico3_lsf_3;    /* size DICO3_SIZE*4 */
+            p_cb1 = dico1_lsf_3_ptr;    /* size DICO1_SIZE*3 */
+            p_cb3 = dico3_lsf_3_ptr;    /* size DICO3_SIZE*4 */
 
             index_limit_1 = (DICO1_SIZE - 1) * 3;
             index_limit_3 = (DICO3_SIZE - 1) * 4;
@@ -359,17 +346,17 @@ void D_plsf_3(
                 temp =
                     mult(
                         st->past_r_q[i],
-                        pred_fac_3[i],
+                        pred_fac_3_ptr[i],
                         pOverflow);
 
                 temp =
-                    add(
-                        mean_lsf_3[i],
+                    add_16(
+                        mean_lsf_3_ptr[i],
                         temp,
                         pOverflow);
 
                 lsf1_q[i] =
-                    add(
+                    add_16(
                         lsf1_r[i],
                         temp,
                         pOverflow);
@@ -382,13 +369,13 @@ void D_plsf_3(
             for (i = 0; i < M; i++)
             {
                 temp =
-                    add(
-                        mean_lsf_3[i],
+                    add_16(
+                        mean_lsf_3_ptr[i],
                         st->past_r_q[i],
                         pOverflow);
 
                 lsf1_q[i] =
-                    add(
+                    add_16(
                         lsf1_r[i],
                         temp,
                         pOverflow);
@@ -407,10 +394,10 @@ void D_plsf_3(
         M,
         pOverflow);
 
-    Copy(
+    oscl_memmove(
+        (void *)st->past_lsf_q,
         lsf1_q,
-        st->past_lsf_q,
-        M);
+        M*sizeof(*lsf1_q));
 
     /*  convert LSFs to the cosine domain */
 
@@ -464,22 +451,6 @@ void D_plsf_3(
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -487,10 +458,11 @@ void D_plsf_3(
 */
 void Init_D_plsf_3(
     D_plsfState *st,      /* i/o: State struct                */
-    Word16       index    /* i  : past_rq_init[] index [0, 7] */)
+    Word16       index,   /* i  : past_rq_init[] index [0, 7] */
+    const Word16* past_rq_init_ptr /* ptr to read-only table */)
 {
-    Copy(
-        &past_rq_init[index * M],
-        st->past_r_q,
-        M);
+    oscl_memmove(
+        (void *)st->past_r_q,
+        &past_rq_init_ptr[index * M],
+        M*sizeof(*past_rq_init_ptr));
 }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp
index 08b690d..8a4e763 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/d_plsf_5.cpp
@@ -31,29 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/d_plsf_5.c
-
-     Date: 04/24/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Made changes based on review meeting.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Updated to accept new parameter, Flag *pOverflow.
-
- Description:
- (1) Removed "count.h" and "basic_op.h" and replaced with individual include
-     files (add.h, sub.h, etc.)
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
+ Filename: d_plsf_5.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -67,7 +45,7 @@ terms listed above has been obtained from the copyright holder.
 #include "lsp_lsf.h"
 #include "reorder.h"
 #include "cnst.h"
-#include "copy.h"
+#include "oscl_mem.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -101,14 +79,6 @@ extern "C"
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
 
-    /* These tables are defined in q_plsf_5_tbl.c */
-    extern const Word16 mean_lsf_5[];
-    extern const Word16 dico1_lsf_5[];
-    extern const Word16 dico2_lsf_5[];
-    extern const Word16 dico3_lsf_5[];
-    extern const Word16 dico4_lsf_5[];
-    extern const Word16 dico5_lsf_5[];
-
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
 }
@@ -276,22 +246,6 @@ int D_plsf_5 (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -303,6 +257,7 @@ void D_plsf_5(
     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                */
@@ -319,6 +274,14 @@ void D_plsf_5(
     Word16 lsf1_q[M];
     Word16 lsf2_q[M];
 
+    /* These tables are defined in q_plsf_5_tbl.c */
+    const Word16* mean_lsf_5_ptr = common_amr_tbls->mean_lsf_5_ptr;
+    const Word16* dico1_lsf_5_ptr = common_amr_tbls->dico1_lsf_5_ptr;
+    const Word16* dico2_lsf_5_ptr = common_amr_tbls->dico2_lsf_5_ptr;
+    const Word16* dico3_lsf_5_ptr = common_amr_tbls->dico3_lsf_5_ptr;
+    const Word16* dico4_lsf_5_ptr = common_amr_tbls->dico4_lsf_5_ptr;
+    const Word16* dico5_lsf_5_ptr = common_amr_tbls->dico5_lsf_5_ptr;
+
     if (bfi != 0)                               /* if bad frame */
     {
         /* use the past LSFs slightly shifted towards their mean */
@@ -330,23 +293,11 @@ void D_plsf_5(
              *  ONE_ALPHA*mean_lsf[i];
              */
 
-            temp =
-                mult(
-                    st->past_lsf_q[i],
-                    ALPHA,
-                    pOverflow);
+            temp = (Word16)(((Word32)  st->past_lsf_q[i] * ALPHA) >> 15);
 
-            sign =
-                mult(
-                    *(mean_lsf_5 + i),
-                    ONE_ALPHA,
-                    pOverflow);
+            sign = (Word16)(((Word32)  * (mean_lsf_5_ptr + i) * ONE_ALPHA) >> 15);
 
-            *(lsf1_q + i) =
-                add(
-                    sign,
-                    temp,
-                    pOverflow);
+            *(lsf1_q + i) = add_16(sign, temp,  pOverflow);
 
             *(lsf2_q + i) = *(lsf1_q + i);
 
@@ -360,23 +311,11 @@ void D_plsf_5(
              * st->past_r_q[i] * LSP_PRED_FAC_MR122;
              */
 
-            temp =
-                mult(
-                    st->past_r_q[i],
-                    LSP_PRED_FAC_MR122,
-                    pOverflow);
+            temp = (Word16)(((Word32)  st->past_r_q[i] * LSP_PRED_FAC_MR122) >> 15);
 
-            temp =
-                add(
-                    *(mean_lsf_5 + i),
-                    temp,
-                    pOverflow);
+            temp = add_16(*(mean_lsf_5_ptr + i), temp, pOverflow);
 
-            st->past_r_q[i] =
-                sub(
-                    *(lsf2_q + i),
-                    temp,
-                    pOverflow);
+            st->past_r_q[i] = sub(*(lsf2_q + i), temp, pOverflow);
         }
     }
     else
@@ -390,20 +329,16 @@ void D_plsf_5(
                 2,
                 pOverflow);
 
-        p_dico = &dico1_lsf_5[temp];
+        p_dico = &dico1_lsf_5_ptr[temp];
 
         *(lsf1_r + 0) = *p_dico++;
         *(lsf1_r + 1) = *p_dico++;
         *(lsf2_r + 0) = *p_dico++;
         *(lsf2_r + 1) = *p_dico++;
 
-        temp =
-            shl(
-                *(indice + 1),
-                2,
-                pOverflow);
+        temp = shl(*(indice + 1), 2, pOverflow);
 
-        p_dico = &dico2_lsf_5[temp];
+        p_dico = &dico2_lsf_5_ptr[temp];
 
         *(lsf1_r + 2) = *p_dico++;
         *(lsf1_r + 3) = *p_dico++;
@@ -421,13 +356,9 @@ void D_plsf_5(
             i = *(indice + 2) >> 1;
         }
 
-        temp =
-            shl(
-                i,
-                2,
-                pOverflow);
+        temp = shl(i, 2, pOverflow);
 
-        p_dico = &dico3_lsf_5[temp];
+        p_dico = &dico3_lsf_5_ptr[temp];
 
         if (sign == 0)
         {
@@ -444,26 +375,18 @@ void D_plsf_5(
             *(lsf2_r + 5) = negate(*p_dico++);
         }
 
-        temp =
-            shl(
-                *(indice + 3),
-                2,
-                pOverflow);
+        temp = shl(*(indice + 3), 2, pOverflow);
 
-        p_dico = &dico4_lsf_5[temp];
+        p_dico = &dico4_lsf_5_ptr[temp];
 
         *(lsf1_r + 6) = *p_dico++;
         *(lsf1_r + 7) = *p_dico++;
         *(lsf2_r + 6) = *p_dico++;
         *(lsf2_r + 7) = *p_dico++;
 
-        temp =
-            shl(
-                *(indice + 4),
-                2,
-                pOverflow);
+        temp = shl(*(indice + 4), 2, pOverflow);
 
-        p_dico = &dico5_lsf_5[temp];
+        p_dico = &dico5_lsf_5_ptr[temp];
 
         *(lsf1_r + 8) = *p_dico++;
         *(lsf1_r + 9) = *p_dico++;
@@ -481,19 +404,19 @@ void D_plsf_5(
                     pOverflow);
 
             temp =
-                add(
-                    *(mean_lsf_5 + i),
+                add_16(
+                    *(mean_lsf_5_ptr + i),
                     temp,
                     pOverflow);
 
             *(lsf1_q + i) =
-                add(
+                add_16(
                     *(lsf1_r + i),
                     temp,
                     pOverflow);
 
             *(lsf2_q + i) =
-                add(
+                add_16(
                     *(lsf2_r + i),
                     temp,
                     pOverflow);
@@ -516,10 +439,7 @@ void D_plsf_5(
         M,
         pOverflow);
 
-    Copy(
-        lsf2_q,
-        st->past_lsf_q,
-        M);
+    oscl_memmove((void *)st->past_lsf_q, lsf2_q, M*sizeof(*lsf2_q));
 
     /*  convert LSFs to the cosine domain */
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.cpp
index 3241354..1e62c15 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.cpp
@@ -29,7 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
- Pathname: ./audio/gsm-amr/c/src/dec_amr.c
+ Filename: dec_amr.cpp
  Funtions: Decoder_amr_init
            Decoder_amr_reset
            Decoder_amr
@@ -50,7 +50,6 @@ terms listed above has been obtained from the copyright holder.
 #include "dec_amr.h"
 #include "typedef.h"
 #include "cnst.h"
-#include "copy.h"
 #include "set_zero.h"
 #include "syn_filt.h"
 #include "d_plsf.h"
@@ -79,7 +78,6 @@ terms listed above has been obtained from the copyright holder.
 #include "ex_ctrl.h"
 #include "sqrt_l.h"
 #include "frame.h"
-#include "bitno_tab.h"
 #include "b_cn_cod.h"
 #include "basic_op.h"
 #include "oscl_mem.h"
@@ -202,22 +200,6 @@ int Decoder_amr_init (Decoder_amrState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -234,6 +216,8 @@ Word16 Decoder_amr_init(Decoder_amrState *s)
         return(-1);
     }
 
+    get_const_tbls(&s->common_amr_tbls);
+
     s->T0_lagBuff = 40;
     s->inBackgroundNoise = 0;
     s->voicedHangover = 0;
@@ -247,11 +231,11 @@ Word16 Decoder_amr_init(Decoder_amrState *s)
         s->ltpGainHistory[i] = 0;
     }
 
-    D_plsf_reset(&s->lsfState);
+    D_plsf_reset(&s->lsfState, s->common_amr_tbls.mean_lsf_5_ptr);
     ec_gain_pitch_reset(&s->ec_gain_p_st);
     ec_gain_code_reset(&s->ec_gain_c_st);
     Cb_gain_average_reset(&s->Cb_gain_averState);
-    lsp_avg_reset(&s->lsp_avg_st);
+    lsp_avg_reset(&s->lsp_avg_st, s->common_amr_tbls.mean_lsf_5_ptr);
     Bgn_scd_reset(&s->background_state);
     ph_disp_reset(&s->ph_disp_st);
     dtx_dec_reset(&s->dtxDecoderState);
@@ -369,22 +353,6 @@ int Decoder_amr_reset (Decoder_amrState *state, enum Mode mode)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -445,7 +413,7 @@ Word16 Decoder_amr_reset(Decoder_amrState *state, enum Mode mode)
     state->voicedHangover = 0;
     if (mode != MRDTX)
     {
-        for (i = 0;i < EXC_ENERGY_HIST_LEN;i++)
+        for (i = 0; i < EXC_ENERGY_HIST_LEN; i++)
         {
             state->excEnergyHist[i] = 0;
         }
@@ -459,9 +427,9 @@ Word16 Decoder_amr_reset(Decoder_amrState *state, enum Mode mode)
     Cb_gain_average_reset(&(state->Cb_gain_averState));
     if (mode != MRDTX)
     {
-        lsp_avg_reset(&(state->lsp_avg_st));
+        lsp_avg_reset(&(state->lsp_avg_st), state->common_amr_tbls.mean_lsf_5_ptr);
     }
-    D_plsf_reset(&(state->lsfState));
+    D_plsf_reset(&(state->lsfState), state->common_amr_tbls.mean_lsf_5_ptr);
     ec_gain_pitch_reset(&(state->ec_gain_p_st));
     ec_gain_code_reset(&(state->ec_gain_c_st));
 
@@ -618,10 +586,10 @@ int Decoder_amr (
        if ((sub(frame_type, RX_NO_DATA) == 0) ||
            (sub(frame_type, RX_ONSET) == 0))
        {
-	  build_CN_param(&st->nodataSeed,
-			 prmno[mode],
-			 bitno[mode],
-			 parm);
+      build_CN_param(&st->nodataSeed,
+             prmno[mode],
+             bitno[mode],
+             parm);
        }
     }
     else if (sub(frame_type, RX_SPEECH_DEGRADED) == 0)
@@ -1307,22 +1275,6 @@ the_end:
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1413,7 +1365,7 @@ void Decoder_amr(
                 &(st->Cb_gain_averState),
                 newDTXState,
                 mode,
-                parm, synth, A_t, pOverflow);
+                parm, &(st->common_amr_tbls), synth, A_t, pOverflow);
 
         /* update average lsp */
         Lsf_lsp(
@@ -1439,9 +1391,10 @@ void Decoder_amr(
         if ((frame_type == RX_NO_DATA) || (frame_type == RX_ONSET))
         {
             build_CN_param(&st->nodataSeed,
-                           prmno[mode],
-                           bitno[mode],
+                           st->common_amr_tbls.prmno_ptr[mode],
+                           st->common_amr_tbls.bitno_ptr[mode],
                            parm,
+                           st->common_amr_tbls.window_200_40_ptr,
                            pOverflow);
         }
     }
@@ -1492,7 +1445,7 @@ void Decoder_amr(
     }
 
     /* save old LSFs for CB gain smoothing */
-    Copy(st->lsfState.past_lsf_q, prev_lsf, M);
+    oscl_memmove((void *)prev_lsf, st->lsfState.past_lsf_q, M*sizeof(*st->lsfState.past_lsf_q));
 
     /* decode LSF parameters and generate interpolated lpc coefficients
        for the 4 subframes */
@@ -1504,6 +1457,7 @@ void Decoder_amr(
             mode,
             bfi,
             parm,
+            &st->common_amr_tbls,
             lsp_new,
             pOverflow);
 
@@ -1522,6 +1476,7 @@ void Decoder_amr(
             &(st->lsfState),
             bfi,
             parm,
+            &(st->common_amr_tbls),
             lsp_mid,
             lsp_new,
             pOverflow);
@@ -1610,13 +1565,13 @@ void Decoder_amr(
                 delta_frc_range = 19;
             }
 
-            t0_min = sub(st->old_T0, delta_frc_low, pOverflow);
+            t0_min = st->old_T0 - delta_frc_low;
 
             if (t0_min < PIT_MIN)
             {
                 t0_min = PIT_MIN;
             }
-            t0_max = add(t0_min, delta_frc_range, pOverflow);
+            t0_max = t0_min + delta_frc_range;
 
             if (t0_max > PIT_MAX)
             {
@@ -1673,7 +1628,7 @@ void Decoder_amr(
             index = *parm++;        /* index of position */
             i = *parm++;            /* signs             */
 
-            decode_2i40_9bits(subfrNr, i, index, code, pOverflow);
+            decode_2i40_9bits(subfrNr, i, index, st->common_amr_tbls.startPos_ptr, code, pOverflow);
 
             L_temp = (Word32)st->sharp << 1;
             if (L_temp != (Word32)((Word16) L_temp))
@@ -1724,7 +1679,7 @@ void Decoder_amr(
             index = *parm++;        /* index of position */
             i = *parm++;            /* signs             */
 
-            decode_4i40_17bits(i, index, code);
+            decode_4i40_17bits(i, index, st->common_amr_tbls.dgray_ptr, code);
 
             L_temp = (Word32)st->sharp << 1;
             if (L_temp != (Word32)((Word16) L_temp))
@@ -1765,7 +1720,7 @@ void Decoder_amr(
             }
             else
             {
-                gain_pit = d_gain_pitch(mode, index);
+                gain_pit = d_gain_pitch(mode, index, st->common_amr_tbls.qua_gain_pitch_ptr);
             }
             ec_gain_pitch_update(
                 &(st->ec_gain_p_st),
@@ -1775,7 +1730,7 @@ void Decoder_amr(
                 pOverflow);
 
 
-            dec_10i40_35bits(parm, code);
+            dec_10i40_35bits(parm, code, st->common_amr_tbls.dgray_ptr);
             parm += 10;
 
             /* pit_sharp = gain_pit;                   */
@@ -1797,7 +1752,7 @@ void Decoder_amr(
         for (i = T0; i < L_SUBFR; i++)
         {
             temp = mult(*(code + i - T0), pit_sharp, pOverflow);
-            *(code + i) = add(*(code + i), temp, pOverflow);
+            *(code + i) = add_16(*(code + i), temp, pOverflow);
 
         }
 
@@ -1825,6 +1780,7 @@ void Decoder_amr(
                     evenSubfr,
                     &gain_pit,
                     &gain_code,
+                    &(st->common_amr_tbls),
                     pOverflow);
             }
             else
@@ -1879,6 +1835,7 @@ void Decoder_amr(
                     evenSubfr,
                     &gain_pit,
                     &gain_code,
+                    &(st->common_amr_tbls),
                     pOverflow);
             }
             else
@@ -1951,7 +1908,7 @@ void Decoder_amr(
                 }
                 else
                 {
-                    gain_pit = d_gain_pitch(mode, index);
+                    gain_pit = d_gain_pitch(mode, index, st->common_amr_tbls.qua_gain_pitch_ptr);
                 }
                 ec_gain_pitch_update(
                     &(st->ec_gain_p_st),
@@ -1970,6 +1927,7 @@ void Decoder_amr(
                         mode,
                         index,
                         code,
+                        st->common_amr_tbls.qua_gain_code_ptr,
                         &gain_code,
                         pOverflow);
                 }
@@ -2007,6 +1965,7 @@ void Decoder_amr(
                         mode,
                         index,
                         code,
+                        st->common_amr_tbls.qua_gain_code_ptr,
                         &gain_code,
                         pOverflow);
                 }
@@ -2201,6 +2160,7 @@ void Decoder_amr(
             code,
             pitch_fac,
             tmp_shift,
+            &(st->common_amr_tbls),
             pOverflow);
 
         /*-------------------------------------------------------*
@@ -2272,7 +2232,7 @@ void Decoder_amr(
         {
             for (i = 0; i < L_SUBFR; i++)
             {
-                *(excp + i) = add(*(excp + i), *(exc_enhanced + i), pOverflow);
+                *(excp + i) = add_16(*(excp + i), *(exc_enhanced + i), pOverflow);
 
             }
             agc2(exc_enhanced, excp, L_SUBFR, pOverflow);
@@ -2317,7 +2277,7 @@ void Decoder_amr(
         }
         else
         {
-            Copy(&synth[i_subfr+L_SUBFR-M], st->mem_syn, M);
+            oscl_memmove((void *)st->mem_syn, &synth[i_subfr+L_SUBFR-M], M*sizeof(synth[0]));
         }
 
         /*--------------------------------------------------*
@@ -2325,7 +2285,7 @@ void Decoder_amr(
          * -> shift to the left by L_SUBFR  st->exc[]       *
          *--------------------------------------------------*/
 
-        Copy(&st->old_exc[L_SUBFR], &st->old_exc[0], PIT_MAX + L_INTERPOL);
+        oscl_memmove((void *)&st->old_exc[0], &st->old_exc[L_SUBFR], (PIT_MAX + L_INTERPOL)*sizeof(st->old_exc[0]));
 
         /* interpolated LPC parameters for next subframe */
         Az += MP1;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.h
index a229243..3066ff7 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_amr.h
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/dec_amr.h
-
-     Date: 02/06/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Update function prototype for Decoder_amr(). Include overflow
-              flag in Decode_amrState structure
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: dec_amr.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -77,6 +63,7 @@ terms listed above has been obtained from the copyright holder.
 #include "bgnscd.h"
 #include "lsp_avg.h"
 #include "frame.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -155,6 +142,7 @@ extern "C"
         ph_dispState ph_disp_st;
         dtx_decState dtxDecoderState;
         Flag overflow;
+        CommonAmrTbls common_amr_tbls;
     } Decoder_amrState;
 
     /*----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.cpp
index ceab48d..7fd54c1 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.cpp
@@ -31,33 +31,8 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/dec_gain.c
- Funtions: dec_gain
-
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updating include file lists, and other things as per review
-              comments.
-
- Description: Added fixes to the code as per review comments. Removed nested
-              function calls and declared temp2 as a variable.
-
- Description: A Word32 was being stored improperly in a Word16.
-
- Description: Removed qua_gain.tab and qgain475.tab from Include section and
-              added qua_gain_tbl.h and qgain475_tab.h to Include section.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:  Added casting to eliminate warnings
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: dec_gain.cpp
+ Functions: dec_gain
 
 ------------------------------------------------------------------------------
 */
@@ -155,22 +130,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -186,6 +145,7 @@ void Dec_gain(
     Word16 evenSubfr,         /* i  : Flag for even subframes      */
     Word16 * gain_pit,        /* o  : Pitch gain.                  */
     Word16 * gain_cod,        /* o  : Code gain.                   */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tbls ptrs */
     Flag   * pOverflow
 )
 {
@@ -205,7 +165,7 @@ void Dec_gain(
 
     if (mode == MR102 || mode == MR74 || mode == MR67)
     {
-        p = &table_gain_highrates[index];
+        p = &(common_amr_tbls->table_gain_highrates_ptr[index]);
 
         *gain_pit = *p++;
         g_code = *p++;
@@ -238,13 +198,13 @@ void Dec_gain(
              *---------------------------------------------------------*/
 
             /* Log2(x Q12) = log2(x) + 12 */
-            temp1 = (Word16) L_deposit_l(g_code);
+            temp1 = g_code;
             Log2(temp1, &exp, &frac, pOverflow);
-            exp = sub(exp, 12, pOverflow);
+            exp -= 12;
 
             temp1 = shr_r(frac, 5, pOverflow);
             temp2 = shl(exp, 10, pOverflow);
-            qua_ener_MR122 = add(temp1, temp2, pOverflow);
+            qua_ener_MR122 = add_16(temp1, temp2, pOverflow);
 
             /* 24660 Q12 ~= 6.0206 = 20*log10(2) */
             L_tmp = Mpy_32_16(exp, frac, 24660, pOverflow);
@@ -254,7 +214,7 @@ void Dec_gain(
         }
         else
         {
-            p = &table_gain_lowrates[index];
+            p = &(common_amr_tbls->table_gain_lowrates_ptr[index]);
 
             *gain_pit = *p++;
             g_code = *p++;
@@ -286,9 +246,9 @@ void Dec_gain(
      *------------------------------------------------------------------*/
 
     L_tmp = L_mult(g_code, gcode0, pOverflow);
-    temp1 = sub(10, exp, pOverflow);
+    temp1 = 10 - exp;
     L_tmp = L_shr(L_tmp, temp1, pOverflow);
-    *gain_cod = extract_h(L_tmp);
+    *gain_cod = (Word16)(L_tmp >> 16);
 
     /* update table of past quantized energies */
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.h
index b9c6a8d..ceb6bba 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_gain.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/dec_gain.h
-
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: dec_gain.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -61,6 +52,7 @@ terms listed above has been obtained from the copyright holder.
 #include "typedef.h"
 #include "gc_pred.h"
 #include "mode.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -112,6 +104,7 @@ extern "C"
         Word16 evenSubfr,         /* i  : Flag for even subframes      */
         Word16 * gain_pit,        /* o  : Pitch gain.                  */
         Word16 * gain_cod,        /* o  : Code gain.                   */
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tbls ptrs */
         Flag   * pOverflow
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_input_format_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_input_format_tab.cpp
index aaf5c25..8caec8a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_input_format_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_input_format_tab.cpp
@@ -30,27 +30,7 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 
 
- Pathname: .audio/gsm-amr/c/src/dec_input_format_tab.c
-
-     Date: 03/01/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Renamed BytesThisFrame to WmfBytesPerFrame, changed its type
-              from 'const short' to 'const int'. Added If2BytesPerFrame
-              table for IF2 input format. Updated copyright year and I/O
-              definition sections, and added reference document for IF2.
-
- Description: Renamed WmfBytesPerFrame to WmfDecBytesPerFrame, and
-              If2BytesPerFrame to If2DecBytesPerFrame.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Description:
+ Filename: dec_input_format_tab.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -92,28 +72,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -152,7 +110,7 @@ extern "C"
     ----------------------------------------------------------------------------*/
     /* Table containing the number of core AMR data bytes for                */
     /* each codec mode for WMF input format(number excludes frame type byte) */
-    const Word16 WmfDecBytesPerFrame[16] =
+    extern const Word16 WmfDecBytesPerFrame[16] =
     {
         12, /* 4.75 */
         13, /* 5.15 */
@@ -174,7 +132,7 @@ extern "C"
 
     /* Table containing the number of core AMR data bytes for   */
     /* each codec mode for IF2 input format.                    */
-    const Word16 If2DecBytesPerFrame[16] =
+    extern const Word16 If2DecBytesPerFrame[16] =
     {
         13, /* 4.75 */
         14, /* 5.15 */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.cpp
index 70baaba..07d58ad 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.cpp
@@ -31,31 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/dec_lag3.c
+ Filename: dec_lag3.cpp
  Functions: Dec_lag3
 
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
- (1) Updated to accept new parameter, Flag *pOverflow.
- (2) Placed file in the proper PV Software template.
-
- Description:
- (1) Removed "count.h" and "basic_op.h" and replaced with individual include
-     files (add.h, sub.h, etc.)
-
- Description:
- (1) Removed optimization -- mult(i, 3, pOverflow) is NOT the same as adding
-     i to itself 3 times.  The reason is because the mult function does a
-     right shift by 15, which will obliterate smaller numbers.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
  ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
@@ -114,28 +92,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -212,30 +168,18 @@ void Dec_lag3(Word16 index,     /* i : received pitch index                 */
                     10923,
                     pOverflow);
 
-            i =
-                add(
-                    tmp_lag,
-                    19,
-                    pOverflow);
+            i = tmp_lag + 19;
 
             *T0 = i;
 
             /* i = 3 * (*T0) */
 
-            i = add(i, i, pOverflow);
-            i = add(i, *T0, pOverflow);
+            i <<=  1;
+            i += *T0;
 
-            tmp_lag =
-                sub(
-                    index,
-                    i,
-                    pOverflow);
+            tmp_lag = index - i;
 
-            *T0_frac =
-                add(
-                    tmp_lag,
-                    58,
-                    pOverflow);
+            *T0_frac = tmp_lag + 58;
         }
         else
         {
@@ -253,44 +197,21 @@ void Dec_lag3(Word16 index,     /* i : received pitch index                 */
 
             /* 'normal' decoding: either with 5 or 6 bit resolution */
 
-            i =
-                add(
-                    index,
-                    2,
-                    pOverflow);
+            i = index + 2;
 
-            i =
-                mult(
-                    i,
-                    10923,
-                    pOverflow);
+            i = ((Word32) i * 10923) >> 15;
 
-            i =
-                sub(
-                    i,
-                    1,
-                    pOverflow);
 
-            *T0 =
-                add(
-                    i,
-                    t0_min,
-                    pOverflow);
+            i -= 1;
+
+            *T0 = i + t0_min;
 
             /* i = 3* (*T0) */
-            i = add(add(i, i, pOverflow), i, pOverflow);
+            i = i + (i << 1);
 
-            tmp_lag =
-                sub(
-                    index,
-                    2,
-                    pOverflow);
+            tmp_lag = index - 2;
 
-            *T0_frac =
-                sub(
-                    tmp_lag,
-                    i,
-                    pOverflow);
+            *T0_frac = tmp_lag - i;
         }
         else
         {
@@ -307,41 +228,21 @@ void Dec_lag3(Word16 index,     /* i : received pitch index                 */
 
             if (i > 5)
             {
-                tmp_lag =
-                    add(
-                        t0_min,
-                        5,
-                        pOverflow);
+                tmp_lag = t0_min + 5;
             }
 
-            i =
-                sub(
-                    t0_max,
-                    tmp_lag,
-                    pOverflow);
+            i = t0_max - tmp_lag;
 
             if (i > 4)
             {
-                tmp_lag =
-                    sub(
-                        t0_max,
-                        4,
-                        pOverflow);
+                tmp_lag = t0_max - 4;
             }
 
             if (index < 4)
             {
-                i =
-                    sub(
-                        tmp_lag,
-                        5,
-                        pOverflow);
-
-                *T0 =
-                    add(
-                        i,
-                        index,
-                        pOverflow);
+                i = tmp_lag - 5;
+
+                *T0 = i + index;
 
                 *T0_frac = 0;
             }
@@ -351,50 +252,26 @@ void Dec_lag3(Word16 index,     /* i : received pitch index                 */
                 if (index < 12)
                 {
                     i = index - 5;
+                    i = ((Word32) i * 10923) >> 15;
 
-                    i = mult(
-                            i,
-                            10923,
-                            pOverflow);
 
                     i--;
 
-                    *T0 = add(
-                              i,
-                              tmp_lag,
-                              pOverflow);
+                    *T0 =  i + tmp_lag;
 
-                    i = add(
-                            add(
-                                i,
-                                i,
-                                pOverflow),
-                            i,
-                            pOverflow);
+                    i = i + (i << 1);
 
                     tmp_lag = index - 9;
 
-                    *T0_frac =
-                        sub(
-                            tmp_lag,
-                            i,
-                            pOverflow);
+                    *T0_frac = tmp_lag - i;
                 }
                 else
                 {
                     i = index - 12;
 
-                    i =
-                        add(
-                            i,
-                            tmp_lag,
-                            pOverflow);
-
-                    *T0 =
-                        add(
-                            i,
-                            1,
-                            pOverflow);
+                    i = i + tmp_lag;
+
+                    *T0 = i + 1;
 
                     *T0_frac = 0;
                 }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.h
index 0679973..c90e459 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag3.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/dec_lag3.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: dec_lag3.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -105,15 +93,15 @@ extern "C"
     ----------------------------------------------------------------------------*/
 
     void Dec_lag3(Word16 index,     /* i : received pitch index                 */
-                  Word16 T0_min,    /* i : minimum of search range              */
-                  Word16 T0_max,    /* i : maximum of search range              */
-                  Word16 i_subfr,   /* i : subframe flag                        */
-                  Word16 T0_prev,   /* i : integer pitch delay of last subframe
+    Word16 T0_min,    /* i : minimum of search range              */
+    Word16 T0_max,    /* i : maximum of search range              */
+    Word16 i_subfr,   /* i : subframe flag                        */
+    Word16 T0_prev,   /* i : integer pitch delay of last subframe
                                        used in 2nd and 4th subframes        */
-                  Word16 * T0,      /* o : integer part of pitch lag            */
-                  Word16 * T0_frac, /* o : fractional part of pitch lag         */
-                  Word16 flag4,     /* i : flag for encoding with 4 bits        */
-                  Flag   * pOverflow  /* o : Flag set when overflow occurs      */
+    Word16 * T0,      /* o : integer part of pitch lag            */
+    Word16 * T0_frac, /* o : fractional part of pitch lag         */
+    Word16 flag4,     /* i : flag for encoding with 4 bits        */
+    Flag   * pOverflow  /* o : Flag set when overflow occurs      */
                  );
 
     /*----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.cpp
index 7dc7a8d..8d580ad 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.cpp
@@ -31,31 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/dec_lag6.c
+ Filename: dec_lag6.cpp
  Functions: Dec_lag6
 
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
- (1) Updated to accept new parameter, Flag *pOverflow.
- (2) Placed file in the proper PV Software template.
-
- Description:
- (1) Removed "count.h" and "basic_op.h" and replaced with individual include
-     files (add.h, sub.h, etc.)
-
- Description:
- (1) Removed optimization -- mult(i, 3, pOverflow) is NOT the same as adding
-     i to itself 3 times.  The reason is because the mult function does a
-     right shift by 15, which will obliterate smaller numbers.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
  ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
@@ -113,28 +91,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -196,7 +152,6 @@ void Dec_lag6(
     Word16 T0_min;
     Word16 T0_max;
     Word16 k;
-    Word16 w;
 
     if (i_subfr == 0)          /* if 1st or 3rd subframe */
     {
@@ -204,52 +159,29 @@ void Dec_lag6(
         {
             /* T0 = (index+5)/6 + 17 */
             i = index + 5;
-            i =
-                mult(
-                    i,
-                    5462,
-                    pOverflow);
-
-            i =
-                add(
-                    i,
-                    17,
-                    pOverflow);
+            i = ((Word32) i * 5462) >> 15;
+
+
+            i += 17;
 
             *T0 = i;
 
             /* i = 3* (*T0) */
 
-            i = add(i, i, pOverflow);
-            i = add(i, *T0, pOverflow);
+            i <<= 1;
+            i += *T0;
 
             /* *T0_frac = index - T0*6 + 105 */
 
-            i =
-                add(
-                    i,
-                    i,
-                    pOverflow);
-
-            i =
-                sub(
-                    index,
-                    i,
-                    pOverflow);
-
-            *T0_frac =
-                add(
-                    i,
-                    105,
-                    pOverflow);
+            i <<= 1;
+
+            i = index - i;
+
+            *T0_frac = i + 105;
         }
         else
         {
-            *T0 =
-                sub(
-                    index,
-                    368,
-                    pOverflow);
+            *T0 = index - 368;
 
             *T0_frac = 0;
         }
@@ -258,80 +190,40 @@ void Dec_lag6(
     {
         /* find T0_min and T0_max for 2nd (or 4th) subframe */
 
-        T0_min =
-            sub(
-                *T0,
-                5,
-                pOverflow);
+        T0_min = *T0 - 5;
 
         if (T0_min < pit_min)
         {
             T0_min = pit_min;
         }
 
-        T0_max =
-            add(
-                T0_min,
-                9,
-                pOverflow);
+        T0_max = T0_min + 9;
 
         if (T0_max > pit_max)
         {
             T0_max = pit_max;
 
-            T0_min =
-                sub(
-                    T0_max,
-                    9,
-                    pOverflow);
+            T0_min = T0_max - 9;
         }
 
         /* i = (index+5)/6 - 1 */
-        i =
-            add(
-                index,
-                5,
-                pOverflow);
-
-        i =
-            mult(
-                i,
-                5462,
-                pOverflow);
-
-        i =
-            sub(
-                i,
-                1,
-                pOverflow);
-
-        *T0 =
-            add(
-                i,
-                T0_min,
-                pOverflow);
+        i = index + 5;
+
+        i = ((Word32) i * 5462) >> 15;
+
+
+        i -= 1;
+
+        *T0 = i + T0_min;
 
         /* i = 3* (*T0) */
 
-        w = add(i, i, pOverflow);
-        i = add(i, w, pOverflow);
-
-        i =
-            add(
-                i,
-                i,
-                pOverflow);
-
-        k =
-            sub(
-                index,
-                3,
-                pOverflow);
-
-        *T0_frac =
-            sub(
-                k,
-                i,
-                pOverflow);
+        i = i + (i << 1);
+
+        i <<= 1;
+
+        k = index - 3;
+
+        *T0_frac = k - i;
     }
 }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.h
index 7322bc8..5b0073d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dec_lag6.h
@@ -31,19 +31,8 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/dec_lag6.h
+ Filename: dec_lag6.h
 
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.cpp
index 6565270..665a6ec 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.cpp
@@ -31,7 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/dtx_dec.c
+ Filename: dtx_dec.cpp
  Functions:
            dtx_dec_reset
            dtx_dec
@@ -53,7 +53,6 @@ terms listed above has been obtained from the copyright holder.
 #include "dtx_dec.h"
 #include "typedef.h"
 #include "basic_op.h"
-#include "copy.h"
 #include "set_zero.h"
 #include "mode.h"
 #include "log2.h"
@@ -64,7 +63,6 @@ terms listed above has been obtained from the copyright holder.
 #include "syn_filt.h"
 #include "lsp_lsf.h"
 #include "reorder.h"
-#include "lsp_tab.h"
 #include "oscl_mem.h"
 
 /*----------------------------------------------------------------------------
@@ -221,22 +219,6 @@ int dtx_dec_reset (dtx_decState *st)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -304,7 +286,7 @@ Word16 dtx_dec_reset(dtx_decState *st)
 
     for (i = 1; i < DTX_HIST_SIZE; i++)
     {
-        Copy(&st->lsf_hist[0], &st->lsf_hist[M*i], M);
+        oscl_memmove((void *)&st->lsf_hist[M*i], &st->lsf_hist[0], M*sizeof(st->lsf_hist[0]));
     }
     oscl_memset(st->lsf_hist_mean, 0, sizeof(Word16)*M*DTX_HIST_SIZE);
 
@@ -814,22 +796,6 @@ int dtx_dec(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -845,6 +811,7 @@ void dtx_dec(
     enum DTXStateType new_state,     /* i   : new DTX state                   */
     enum Mode mode,                  /* i   : AMR mode                        */
     Word16 parm[],                   /* i   : Vector of synthesis parameters  */
+    CommonAmrTbls* common_amr_tbls,  /* i   : Ptr to struct of table ptrs     */
     Word16 synth[],                  /* o   : synthesised speech              */
     Word16 A_t[],                    /* o   : decoded LP filter in 4 subframes*/
     Flag   *pOverflow
@@ -908,7 +875,7 @@ void dtx_dec(
         {
             ptr = 0;
         }
-        Copy(&st->lsf_hist[st->lsf_hist_ptr], &st->lsf_hist[ptr], M);
+        oscl_memmove((void *)&st->lsf_hist[ptr], &st->lsf_hist[st->lsf_hist_ptr], M*sizeof(*st->lsf_hist));
 
         ptr = st->log_en_hist_ptr + 1;
 
@@ -938,11 +905,11 @@ void dtx_dec(
             {
                 temp = st->log_en_hist[i] >> 3;
             }
-            st->log_en = add(st->log_en, temp, pOverflow);
+            st->log_en = add_16(st->log_en, temp, pOverflow);
             for (j = M - 1; j >= 0; j--)
             {
                 L_lsf[j] = L_add(L_lsf[j],
-                                 L_deposit_l(st->lsf_hist[i * M + j]), pOverflow);
+                                 (Word32)(st->lsf_hist[i * M + j]), pOverflow);
             }
         }
 
@@ -965,7 +932,7 @@ void dtx_dec(
         st->log_en = sub(st->log_en, st->log_en_adjust, pOverflow);
 
         /* compute lsf variability vector */
-        Copy(st->lsf_hist, st->lsf_hist_mean, 80);
+        oscl_memmove((void *)st->lsf_hist_mean, st->lsf_hist, 80*sizeof(*st->lsf_hist));
 
         for (i = M - 1; i >= 0; i--)
         {
@@ -974,7 +941,7 @@ void dtx_dec(
             for (j = 8 - 1; j >= 0; j--)
             {
                 L_lsf_mean = L_add(L_lsf_mean,
-                                   L_deposit_l(st->lsf_hist_mean[i+j*M]), pOverflow);
+                                   (Word32)(st->lsf_hist_mean[i+j*M]), pOverflow);
             }
 
             if (L_lsf_mean < 0)
@@ -1034,7 +1001,7 @@ void dtx_dec(
     {
         /* Set old SID parameters, always shift */
         /* even if there is no new valid_data   */
-        Copy(st->lsp, st->lsp_old, M);
+        oscl_memmove((void *)st->lsp_old, st->lsp, M*sizeof(*st->lsp));
         st->old_log_en = st->log_en;
 
         if (st->valid_data != 0)   /* new data available (no CRC) */
@@ -1067,9 +1034,10 @@ void dtx_dec(
                 st->true_sid_period_inv = 1 << 14; /* 0.5 it Q15 */
             }
 
-            Init_D_plsf_3(lsfState, parm[0]);
-            D_plsf_3(lsfState, MRDTX, 0, &parm[1], st->lsp, pOverflow);
-            Set_zero(lsfState->past_r_q, M);   /* reset for next speech frame */
+            Init_D_plsf_3(lsfState, parm[0], common_amr_tbls->past_rq_init_ptr);
+            D_plsf_3(lsfState, MRDTX, 0, &parm[1], common_amr_tbls, st->lsp, pOverflow);
+            /* reset for next speech frame */
+            oscl_memset((void *)lsfState->past_r_q, 0, M*sizeof(*lsfState->past_r_q));
 
             log_en_index = parm[4];
             /* Q11 and divide by 4 */
@@ -1083,7 +1051,7 @@ void dtx_dec(
             }
 
             /* Subtract 2.5 in Q11 */
-            st->log_en = sub(st->log_en, (2560 * 2), pOverflow);
+            st->log_en -= (2560 * 2);
 
             /* Index 0 is reserved for silence */
             if (log_en_index == 0)
@@ -1097,7 +1065,7 @@ void dtx_dec(
             if ((st->data_updated == 0) ||
                     (st->dtxGlobalState == SPEECH))
             {
-                Copy(st->lsp, st->lsp_old, M);
+                oscl_memmove((void *)st->lsp_old, st->lsp, M*sizeof(*st->lsp));
                 st->old_log_en = st->log_en;
             }
         } /* endif valid_data */
@@ -1111,7 +1079,7 @@ void dtx_dec(
         {
             temp = st->log_en >> 1;
         }
-        ma_pred_init = sub(temp, 9000, pOverflow);
+        ma_pred_init = temp - 9000;
 
         if (ma_pred_init > 0)
         {
@@ -1128,7 +1096,8 @@ void dtx_dec(
         predState->past_qua_en[3] = ma_pred_init;
 
         /* past_qua_en for other modes than MR122 */
-        ma_pred_init = mult(5443, ma_pred_init, pOverflow);
+        ma_pred_init = ((Word32) ma_pred_init * 5443) >> 15;
+
         /* scale down by factor 20*log10(2) in Q15 */
         predState->past_qua_en_MR122[0] = ma_pred_init;
         predState->past_qua_en_MR122[1] = ma_pred_init;
@@ -1150,7 +1119,9 @@ void dtx_dec(
     }
     else
     {
-        temp = mult((Word16)((Word32)dtx_log_en_adjust[mode] << 5), 3277, pOverflow);
+        temp = (((Word32) dtx_log_en_adjust[mode] << 5) * 3277) >> 15;
+
+
     }
 
     if (temp < 0)
@@ -1161,10 +1132,11 @@ void dtx_dec(
     {
         temp >>= 5;
     }
-    st->log_en_adjust = add(mult(st->log_en_adjust, 29491, pOverflow), temp, pOverflow);
+    st->log_en_adjust = add_16(((Word32)st->log_en_adjust * 29491) >> 15, temp, pOverflow);
+
 
     /* Interpolate SID info */
-    int_fac = shl(add(1, st->since_last_sid, pOverflow), 10, pOverflow); /* Q10 */
+    int_fac = shl((st->since_last_sid + 1), 10, pOverflow); /* Q10 */
     int_fac = mult(int_fac, st->true_sid_period_inv, pOverflow); /* Q10 * Q15 -> Q10 */
 
     /* Maximize to 1.0 in Q10 */
@@ -1187,14 +1159,14 @@ void dtx_dec(
         lsp_int[i] = mult(int_fac, st->lsp[i], pOverflow);/* Q14 * Q15 -> Q14 */
     }
 
-    int_fac = sub(16384, int_fac, pOverflow); /* 1-k in Q14 */
+    int_fac = 16384 - int_fac; /* 1-k in Q14 */
 
     /* (Q14 * Q11 -> Q26) + Q26 -> Q26 */
     L_log_en_int = L_mac(L_log_en_int, int_fac, st->old_log_en, pOverflow);
     for (i = M - 1; i >= 0; i--)
     {
         /* Q14 + (Q14 * Q15 -> Q14) -> Q14 */
-        lsp_int[i] = add(lsp_int[i], mult(int_fac, st->lsp_old[i], pOverflow), pOverflow);
+        lsp_int[i] = add_16(lsp_int[i], mult(int_fac, st->lsp_old[i], pOverflow), pOverflow);
 
         L_temp = ((Word32) lsp_int[i]) << 1;    /* Q14 -> Q15 */
         if (L_temp != (Word32)((Word16) L_temp))
@@ -1206,9 +1178,9 @@ void dtx_dec(
     }
 
     /* compute the amount of lsf variability */
-    lsf_variab_factor = sub(st->log_pg_mean, 2457, pOverflow); /* -0.6 in Q12 */
+    lsf_variab_factor = st->log_pg_mean - 2457; /* -0.6 in Q12 */
     /* *0.3 Q12*Q15 -> Q12 */
-    lsf_variab_factor = sub(4096, mult(lsf_variab_factor, 9830, pOverflow), pOverflow);
+    lsf_variab_factor = 4096 - mult(lsf_variab_factor, 9830, pOverflow);
 
     /* limit to values between 0..1 in Q12 */
     if (lsf_variab_factor > 4095)
@@ -1231,13 +1203,13 @@ void dtx_dec(
     Lsp_lsf(lsp_int, lsf_int, M, pOverflow);
 
     /* apply lsf variability */
-    Copy(lsf_int, lsf_int_variab, M);
+    oscl_memmove((void *)lsf_int_variab, lsf_int, M*sizeof(*lsf_int));
     for (i = M - 1; i >= 0; i--)
     {
-        lsf_int_variab[i] = add(lsf_int_variab[i],
-                                mult(lsf_variab_factor,
-                                     st->lsf_hist_mean[i+lsf_variab_index*M], pOverflow)
-                                , pOverflow);
+        lsf_int_variab[i] = add_16(lsf_int_variab[i],
+                                   mult(lsf_variab_factor,
+                                        st->lsf_hist_mean[i+lsf_variab_index*M], pOverflow)
+                                   , pOverflow);
     }
 
     /* make sure that LSP's are ordered */
@@ -1245,7 +1217,7 @@ void dtx_dec(
     Reorder_lsf(lsf_int_variab, LSF_GAP, M, pOverflow);
 
     /* copy lsf to speech decoders lsf state */
-    Copy(lsf_int, lsfState->past_lsf_q, M);
+    oscl_memmove((void *)lsfState->past_lsf_q, lsf_int, M*sizeof(*lsf_int));
 
     /* convert to lsp */
     Lsf_lsp(lsf_int, lsp_int, M, pOverflow);
@@ -1261,10 +1233,10 @@ void dtx_dec(
     Lsp_Az(lsp_int_variab, acoeff_variab, pOverflow);
 
     /* For use in postfilter */
-    Copy(acoeff, &A_t[0],           M + 1);
-    Copy(acoeff, &A_t[M + 1],       M + 1);
-    Copy(acoeff, &A_t[2 * (M + 1)], M + 1);
-    Copy(acoeff, &A_t[3 * (M + 1)], M + 1);
+    oscl_memmove((void *)&A_t[0],          acoeff, (M + 1)*sizeof(*acoeff));
+    oscl_memmove((void *)&A_t[M + 1],      acoeff, (M + 1)*sizeof(*acoeff));
+    oscl_memmove((void *)&A_t[2 *(M + 1)], acoeff, (M + 1)*sizeof(*acoeff));
+    oscl_memmove((void *)&A_t[3 *(M + 1)], acoeff, (M + 1)*sizeof(*acoeff));
 
     /* Compute reflection coefficients Q15 */
     A_Refl(&acoeff[1], refl, pOverflow);
@@ -1287,14 +1259,14 @@ void dtx_dec(
     }
 
     /* compute logarithm of prediction gain */
-    Log2(L_deposit_l(pred_err), &log_pg_e, &log_pg_m, pOverflow);
+    Log2((Word32)(pred_err), &log_pg_e, &log_pg_m, pOverflow);
 
     /* convert exponent and mantissa to Word16 Q12 */
-    log_pg = shl(sub(log_pg_e, 15, pOverflow), 12, pOverflow); /* Q12 */
-    log_pg = shr(sub(0, add(log_pg, shr(log_pg_m, 15 - 12, pOverflow),
-                            pOverflow), pOverflow), 1, pOverflow);
-    st->log_pg_mean = add(mult(29491, st->log_pg_mean, pOverflow),
-                          mult(3277, log_pg, pOverflow), pOverflow);
+    log_pg = shl((log_pg_e - 15), 12, pOverflow); /* Q12 */
+    log_pg = shr(sub(0, add_16(log_pg, shr(log_pg_m, 15 - 12, pOverflow),
+                               pOverflow), pOverflow), 1, pOverflow);
+    st->log_pg_mean = add_16(mult(29491, st->log_pg_mean, pOverflow),
+                             mult(3277, log_pg, pOverflow), pOverflow);
 
     /* Compute interpolated log energy */
     L_log_en_int = L_shr(L_log_en_int, 10, pOverflow); /* Q26 -> Q16 */
@@ -1303,16 +1275,16 @@ void dtx_dec(
     L_log_en_int = L_add(L_log_en_int, 4 * 65536L, pOverflow);
 
     /* subtract prediction gain */
-    L_log_en_int = L_sub(L_log_en_int, L_shl(L_deposit_l(log_pg), 4, pOverflow), pOverflow);
+    L_log_en_int = L_sub(L_log_en_int, L_shl((Word32)(log_pg), 4, pOverflow), pOverflow);
 
     /* adjust level to speech coder mode */
     L_log_en_int = L_add(L_log_en_int,
-                         L_shl(L_deposit_l(st->log_en_adjust), 5, pOverflow), pOverflow);
+                         L_shl((Word32)(st->log_en_adjust), 5, pOverflow), pOverflow);
 
     log_en_int_e = (Word16)(L_log_en_int >> 16);
 
     log_en_int_m = (Word16)(L_shr(L_sub(L_log_en_int,
-                                        L_deposit_h(log_en_int_e), pOverflow), 1, pOverflow));
+                                        ((Word32)log_en_int_e << 16), pOverflow), 1, pOverflow));
     level = (Word16)(Pow2(log_en_int_e, log_en_int_m, pOverflow));  /* Q4 */
 
     for (i = 0; i < 4; i++)
@@ -1361,10 +1333,10 @@ void dtx_dec(
         st->true_sid_period_inv = div_s(1 << 10, temp);
 
         st->since_last_sid = 0;
-        Copy(st->lsp, st->lsp_old, M);
+        oscl_memmove((void *)st->lsp_old, st->lsp, M*sizeof(*st->lsp));
         st->old_log_en = st->log_en;
         /* subtract 1/8 in Q11 i.e -6/8 dB */
-        st->log_en = sub(st->log_en, 256, pOverflow);
+        st->log_en = st->log_en - 256;
     }
 
     /* reset interpolation length timer
@@ -1467,22 +1439,6 @@ void dtx_dec_activity_update(dtx_decState *st,
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1499,8 +1455,8 @@ void dtx_dec_activity_update(dtx_decState *st,
     Word32 L_frame_en;
     Word32 L_temp;
     Word16 log_en_e;
-    Word16 log_en_m;
-    Word16 log_en;
+    Word16 log_en_m = 0;
+    Word16 log_en = 0;
 
     /* update lsp history */
     st->lsf_hist_ptr += M;
@@ -1509,7 +1465,7 @@ void dtx_dec_activity_update(dtx_decState *st,
     {
         st->lsf_hist_ptr = 0;
     }
-    Copy(lsf, &st->lsf_hist[st->lsf_hist_ptr], M);
+    oscl_memmove((void *)&st->lsf_hist[st->lsf_hist_ptr], lsf, M*sizeof(*lsf));
 
     /* compute log energy based on frame energy */
     L_frame_en = 0;     /* Q0 */
@@ -1546,10 +1502,10 @@ void dtx_dec_activity_update(dtx_decState *st,
     {
         log_en_m >>= 5;
     }
-    log_en = add(log_en_e, log_en_m, pOverflow);
+    log_en = log_en_e + log_en_m;
 
     /* divide with L_FRAME i.e subtract with log2(L_FRAME) = 7.32193 */
-    log_en = sub(log_en, 7497 + 1024, pOverflow);
+    log_en -= 7497 + 1024;
 
     /* insert into log energy buffer, no division by two as  *
     * log_en in decoder is Q11                              */
@@ -1778,22 +1734,6 @@ enum DTXStateType rx_dtx_handler(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1833,7 +1773,7 @@ enum DTXStateType rx_dtx_handler(
 
         /* evaluate if noise parameters are too old                     */
         /* since_last_sid is reset when CN parameters have been updated */
-        st->since_last_sid = add(st->since_last_sid, 1, pOverflow);
+        st->since_last_sid += 1;
 
         /* no update of sid parameters in DTX for a long while      */
         /* Due to the delayed update of  st->since_last_sid counter */
@@ -1865,7 +1805,7 @@ enum DTXStateType rx_dtx_handler(
 
     /* update the SPE-SPD DTX hangover synchronization */
     /* to know when SPE has added dtx hangover         */
-    st->decAnaElapsedCount = add(st->decAnaElapsedCount, 1, pOverflow);
+    st->decAnaElapsedCount = add_16(st->decAnaElapsedCount, 1, pOverflow);
     st->dtxHangoverAdded = 0;
 
     if ((frame_type == RX_SID_FIRST)  ||
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.h
index 2b5a614..af462f7 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/dtx_dec.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/dtx_dec.h
-
-     Date: 02/06/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: dtx_dec.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -162,6 +151,7 @@ extern "C"
         enum DTXStateType new_state,     /* i   : new DTX state                   */
         enum Mode mode,                  /* i   : AMR mode                        */
         Word16 parm[],                   /* i   : Vector of synthesis parameters  */
+        CommonAmrTbls* common_amr_tbls,  /* i   : Ptr to struct of table ptrs     */
         Word16 synth[],                  /* o   : synthesised speech              */
         Word16 A_t[],                    /* o   : decoded LP filter in 4 subframes*/
         Flag   *pOverflow
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.cpp
index e73db62..f5d4a9d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.cpp
@@ -32,29 +32,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/ec_gain.c
- Funtions:
-
-     Date: 01/28/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Removed the functions ec_gain_code_init, ec_gain_pitch_init,
- ech_gain_code_exit, and ec_gain_pitch_exit.
-
- The ec_gains related structures are no longer dynamically allocated.
-
- Description: Updated include files and input/output sections.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
+ Filename: ec_gains.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -107,10 +85,6 @@ extern "C"
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
 
-    extern const Word16 qua_gain_pitch[];
-    extern const Word16 qua_gain_code[];
-
-
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
 }
@@ -174,22 +148,6 @@ int ec_gain_code_reset (ec_gain_codeState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -291,22 +249,6 @@ only in BFI (instead of normal gain decoding function).
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -428,22 +370,6 @@ void ec_gain_code(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -553,22 +479,6 @@ void ec_gain_code_update(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -662,22 +572,6 @@ int ec_gain_pitch_reset (ec_gain_pitchState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -782,22 +676,6 @@ Word16 ec_gain_pitch_reset(ec_gain_pitchState *state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.h
index e05a0af..6a16e0f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ec_gains.h
@@ -29,20 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
-
-
- Filename: /audio/gsm_amr/c/src/include/ec_gains.h
-
-     Date: 01/28/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: ec_gains.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.cpp
index f18054b..9fae32a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.cpp
@@ -31,17 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/ex_ctrl.c
- Funtions: ex_ctrl
-
-     Date: 02/08/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: ex_ctrl.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -52,7 +42,6 @@ terms listed above has been obtained from the copyright holder.
 #include "ex_ctrl.h"
 #include "typedef.h"
 #include "cnst.h"
-#include "copy.h"
 #include "set_zero.h"
 #include "gmed_n.h"
 #include "sqrt_l.h"
@@ -127,22 +116,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -164,8 +137,7 @@ Word16 Ex_ctrl(Word16 excitation[],    /*i/o: Current subframe excitation   */
     /* get target level */
     avgEnergy = gmed_n(exEnergyHist, 9);
 
-    prevEnergy = shr(add(exEnergyHist[7], exEnergyHist[8], pOverflow) , 1, pOverflow);
-
+    prevEnergy = (exEnergyHist[7] + exEnergyHist[8]) >> 1;
     if (exEnergyHist[8] < prevEnergy)
     {
         prevEnergy = exEnergyHist[8];
@@ -198,7 +170,7 @@ Word16 Ex_ctrl(Word16 excitation[],    /*i/o: Current subframe excitation   */
         {
             t0 = 32767; /* saturate  */
         }
-        scaleFactor = extract_l(t0);
+        scaleFactor = (Word16)(t0);
 
         /* test if scaleFactor > 3.0 */
         if (carefulFlag != 0 && (scaleFactor > 3072))
@@ -211,7 +183,7 @@ Word16 Ex_ctrl(Word16 excitation[],    /*i/o: Current subframe excitation   */
         {
             t0 = L_mult(scaleFactor, excitation[i], pOverflow);
             t0 = L_shr(t0, 11, pOverflow);
-            excitation[i] = extract_l(t0);
+            excitation[i] = (Word16)(t0);
         }
     }
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.h
index e055035..8f6472f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ex_ctrl.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/ex_ctrl.h
-
-     Date: 02/08/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: ex_ctrl.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -106,12 +97,12 @@ extern "C"
      *  Returns     : background noise decision; 0 = bgn, 1 = no bgn
      */
     Word16 Ex_ctrl(Word16 excitation[],    /*i/o: Current subframe excitation   */
-                   Word16 excEnergy,      /* i : Exc. Energy, sqrt(totEx*totEx)*/
-                   Word16 exEnergyHist[], /* i : History of subframe energies  */
-                   Word16 voicedHangover, /* i : # of fr. after last voiced fr.*/
-                   Word16 prevBFI,        /* i : Set i previous BFI            */
-                   Word16 carefulFlag,    /* i : Restrict dymamic in scaling   */
-                   Flag   *pOverflow
+    Word16 excEnergy,      /* i : Exc. Energy, sqrt(totEx*totEx)*/
+    Word16 exEnergyHist[], /* i : History of subframe energies  */
+    Word16 voicedHangover, /* i : # of fr. after last voiced fr.*/
+    Word16 prevBFI,        /* i : Set i previous BFI            */
+    Word16 carefulFlag,    /* i : Restrict dymamic in scaling   */
+    Flag   *pOverflow
                   );
 
     /*----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/gsmamr_dec.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/gsmamr_dec.h
index 673a94a..4b43c9b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/gsmamr_dec.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/gsmamr_dec.h
@@ -31,44 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm-amr/c/include/gsmamr_dec.h
-
-     Date: 09/10/2001
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Adding comments and removing some tables as per review comments.
-
- Description: Replace enum Mode with enum Frame_Type_3GPP and updated function
-              prototype of AMRDecode().
-
- Description: Added back the enum Mode type definition, removed RXFrameType
-              type definition, and updated AMRDecode and GSMInitDecode function
-              prototypes.
-
- Description: Added #defines for WMF and IF2. Updated AMRDecode function
-              prototype.
-
- Description: Removed enum Mode type definition and updated AMRDecode function
-              prototype.
-
- Description: Renamed WMF and IF2 to AMR_WMF and AMR_IF2, respectively. Added
-              #define for AMR_ETS format.
-
- Description: Rename input format defines to make it unique to the decoder.
-
- Description: Added comment to describe L_FRAME.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description: Included file "typedefs.h" to avoid re-declaring similar typedef
-              this for OSCL-ed compatibility
-
- Description: Included file "gsm_amr_typedefs.h" and eliminated re-definition
-              of types UWord8, Word8, Word16
-
- Description:
+ Filename: gsmamr_dec.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.cpp
index 0d24fc8..6463bec 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.cpp
@@ -29,7 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
- Pathname: ./audio/gsm-amr/c/src/if2_to_ets.c
+ Filename: if2_to_ets.cpp
  Funtions: if2_to_ets
 
 */
@@ -40,7 +40,6 @@ terms listed above has been obtained from the copyright holder.
 #include "frame_type_3gpp.h"
 #include "if2_to_ets.h"
 #include "typedef.h"
-#include "bitreorder_tab.h"
 /*----------------------------------------------------------------------------
 ; MACROS
 ; Define module specific macros here
@@ -115,22 +114,6 @@ AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0 Release 4, June
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -140,12 +123,16 @@ AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0 Release 4, June
 void if2_to_ets(
     enum Frame_Type_3GPP frame_type_3gpp,
     UWord8   *if2_input_ptr,
-    Word16   *ets_output_ptr)
+    Word16   *ets_output_ptr,
+    CommonAmrTbls* common_amr_tbls)
 {
 
     Word16 i;
     Word16 j;
     Word16 x = 0;
+    const Word16* numCompressedBytes_ptr = common_amr_tbls->numCompressedBytes_ptr;
+    const Word16* numOfBits_ptr = common_amr_tbls->numOfBits_ptr;
+    const Word16* const* reorderBits_ptr = common_amr_tbls->reorderBits_ptr;
 
     /*
      * The following section of code accesses bits in the IF2 method of
@@ -157,34 +144,34 @@ void if2_to_ets(
 
     if (frame_type_3gpp < AMR_SID)
     {
-        for (j = 4;j < 8;j++)
+        for (j = 4; j < 8; j++)
         {
-            ets_output_ptr[reorderBits[frame_type_3gpp][x++]] =
+            ets_output_ptr[reorderBits_ptr[frame_type_3gpp][x++]] =
                 (if2_input_ptr[0] >> j) & 0x01;
         }
-        for (i = 1; i < numCompressedBytes[frame_type_3gpp]; i++)
+        for (i = 1; i < numCompressedBytes_ptr[frame_type_3gpp]; i++)
         {
-            for (j = 0;j < 8;j++)
+            for (j = 0; j < 8; j++)
             {
-                if (x >= numOfBits[frame_type_3gpp])
+                if (x >= numOfBits_ptr[frame_type_3gpp])
                 {
                     break;
                 }
-                ets_output_ptr[reorderBits[frame_type_3gpp][x++]] =
+                ets_output_ptr[reorderBits_ptr[frame_type_3gpp][x++]] =
                     (if2_input_ptr[i] >> j) & 0x01;
             }
         }
     }
     else
     {
-        for (j = 4;j < 8;j++)
+        for (j = 4; j < 8; j++)
         {
             ets_output_ptr[x++] =
                 (if2_input_ptr[0] >> j) & 0x01;
         }
-        for (i = 1; i < numCompressedBytes[frame_type_3gpp]; i++)
+        for (i = 1; i < numCompressedBytes_ptr[frame_type_3gpp]; i++)
         {
-            for (j = 0;j < 8;j++)
+            for (j = 0; j < 8; j++)
             {
                 ets_output_ptr[x++] =
                     (if2_input_ptr[i] >> j) & 0x01;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.h
index df3d289..4994991 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/if2_to_ets.h
@@ -31,22 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/include/src/if2_to_ets.h
-
-     Date: 01/22/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed mode to frame_type_3gpp
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
-
+ Filename: if2_to_ets.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -68,6 +53,7 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 #include "frame_type_3gpp.h"
 #include "typedef.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -109,8 +95,9 @@ extern "C"
     ----------------------------------------------------------------------------*/
 
     void if2_to_ets(enum Frame_Type_3GPP frame_type_3gpp,
-                    UWord8   *if2_input_ptr,
-                    Word16   *ets_output_ptr);
+    UWord8   *if2_input_ptr,
+    Word16   *ets_output_ptr,
+    CommonAmrTbls* common_amr_tbls);
 
 
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp
index c5aefe4..e50eb6c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/int_lsf.cpp
@@ -31,33 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/int_lsf.c
-
-     Date: 04/20/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Put file into template and first pass at optimization.
-
- Description: Made changes based on comments from the review meeting. Used
-    pointers instead of index addressing in the arrays.
-
- Description: Added type definition to the input/output section. Fixed tabs.
-              Deleted pseudo-code.
-
- Description: Synchronized file with UMTS versin 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Modified FOR loops to count down.
-              2. Made some cosmetic changes in the Pseudo-code section.
-
- Description: Changed to pass in overflow flag pointer to the add() routine.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: int_lsf.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -188,22 +162,6 @@ void Int_lsf(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -242,9 +200,9 @@ void Int_lsf(
             {
                 temp2 = *(lsf_new + i) >> 2;
             }
-            *(lsf_out + i) = add((Word16)(*(lsf_old + i) - temp1),
-                                 (Word16)temp2,
-                                 pOverflow);
+            *(lsf_out + i) = add_16((Word16)(*(lsf_old + i) - temp1),
+                                    (Word16)temp2,
+                                    pOverflow);
         }
     }
 
@@ -268,10 +226,7 @@ void Int_lsf(
             {
                 temp2 = *(lsf_new + i) >> 1;
             }
-            *(lsf_out + i) = add(
-                                 temp1,
-                                 temp2,
-                                 pOverflow);
+            *(lsf_out + i) = temp1 + temp2;
         }
     }
 
@@ -295,9 +250,9 @@ void Int_lsf(
             {
                 temp2 = *(lsf_new + i) >> 2;
             }
-            *(lsf_out + i) = add((Word16)temp1,
-                                 (Word16)(*(lsf_new + i) - temp2),
-                                 pOverflow);
+            *(lsf_out + i) = add_16((Word16)temp1,
+                                    (Word16)(*(lsf_new + i) - temp2),
+                                    pOverflow);
 
         }
     }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.cpp
index 790ba95..2850d6e 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.cpp
@@ -31,42 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/lsp_avg.c
- Functions:
-
-
-     Date: 04/14/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Removed the functions lsp_avg_init and lsp_avg_exit.
- The lsp_avg related structure is no longer dynamically allocated.
-
- Also, placed code in the proper PV Software Template.
-
- Description: Per review comments, updated the inputs/outputs section
- for the function lsp_avg.
-
- Description: Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description: Per review comments, I added a description of pOverflow
- to the input/output section of the template.  I also removed an unnecessary
- include file, <stdio.h>
-
- Description: Removed q_plsf_5.tab from Include section and added
-			  q_plsf_5_tbl.h to Include section. Changed "mean_lsf"
-              to "mean_lsf_5" in lsp_avg_reset().
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:
+ Filename: lsp_avg.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -81,7 +46,7 @@ terms listed above has been obtained from the copyright holder.
 #include "lsp_avg.h"
 #include "basic_op.h"
 #include "oper_32b.h"
-#include "copy.h"
+#include "oscl_mem.h"
 #include "q_plsf_5_tbl.h"
 
 /*----------------------------------------------------------------------------
@@ -166,29 +131,13 @@ int lsp_avg_reset (lsp_avgState *st)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-Word16 lsp_avg_reset(lsp_avgState *st)
+Word16 lsp_avg_reset(lsp_avgState *st, const Word16* mean_lsf_5_ptr)
 {
     if (st == (lsp_avgState *) NULL)
     {
@@ -196,7 +145,7 @@ Word16 lsp_avg_reset(lsp_avgState *st)
         return -1;
     }
 
-    Copy(mean_lsf_5, &st->lsp_meanSave[0], M);
+    oscl_memmove((void *)&st->lsp_meanSave[0], mean_lsf_5_ptr, M*sizeof(*mean_lsf_5_ptr));
 
     return 0;
 }
@@ -268,22 +217,6 @@ void lsp_avg (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -303,7 +236,7 @@ void lsp_avg(
     {
 
         /* mean = 0.84*mean */
-        L_tmp = L_deposit_h(st->lsp_meanSave[i]);
+        L_tmp = ((Word32)st->lsp_meanSave[i] << 16);
         L_tmp = L_msu(L_tmp, EXPCONST, st->lsp_meanSave[i], pOverflow);
 
         /* Add 0.16 of newest LSPs to mean */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.h
index b289c08..4b45b96 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/lsp_avg.h
@@ -31,24 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/lsp_avg.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Per review comments, I removed the prototype definition
- of lsp_avg_init and lsp_avg_exit.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: lsp_avg.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -115,7 +98,8 @@ extern "C"
     ----------------------------------------------------------------------------*/
 
     Word16 lsp_avg_reset(
-        lsp_avgState *state
+        lsp_avgState *state,
+        const Word16* mean_lsf_5_ptr
     );
 
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp
index da5445b..30631f4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.cpp
@@ -31,57 +31,13 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/ph_disp.c
+ Filename: ph_disp.cpp
  Functions:
             ph_disp_reset
             ph_disp_lock
             ph_disp_release
             ph_disp
 
-     Date: 04/05/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Updated file per comments gathered from Phase 2/3 review.
-
- Description: Clarified grouping in the equation to calculated L_temp from the
-          product of state->prevCbGain and ONFACTPLUS1 in the ph_disp
-          function.
-
- Description: Added setting of Overflow flag in inlined code.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              coding template. Removed unnecessary include files.
-
- Description: Replaced basic_op.h with the header file of the math functions
-              used in the file.
-
- Description: Removed the functions ph_disp_init and ph_disp_exit.
- The ph_disp related structure is no longer dynamically allocated.
-
- Description: Pass in pointer to overflow flag for EPOC compatibility.
-              Change code for ph_disp() function to reflect this. Remove
-              inclusion of ph_disp.tab. This table will now be referenced
-              externally.
-
- Description: Optimized ph_disp() to reduce clock cycle usage. Updated
-              copyright year and removed unused files in Include section.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with defined types.
-               Added proper casting (Word32) to some left shifting operations
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -183,22 +139,6 @@ int ph_disp_reset (ph_dispState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -274,22 +214,6 @@ void ph_disp_lock (ph_dispState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -351,22 +275,6 @@ void ph_disp_release (ph_dispState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -629,22 +537,6 @@ void ph_disp (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -664,6 +556,7 @@ void ph_disp(
     Word16 tmp_shift,       /* i   Q0  : shift factor applied to sum of
                                          scaled LTP ex & innov. before
                                          rounding                           */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs      */
     Flag   *pOverflow       /* i/o     : oveflow indicator                  */
 )
 {
@@ -685,6 +578,11 @@ void ph_disp(
     const Word16 *p_ph_imp;
     Word16 c_inno_sav;
 
+    const Word16* ph_imp_low_MR795_ptr = common_amr_tbls->ph_imp_low_MR795_ptr;
+    const Word16* ph_imp_mid_MR795_ptr = common_amr_tbls->ph_imp_mid_MR795_ptr;
+    const Word16* ph_imp_low_ptr = common_amr_tbls->ph_imp_low_ptr;
+    const Word16* ph_imp_mid_ptr = common_amr_tbls->ph_imp_mid_ptr;
+
     /* Update LTP gain memory */
     /* Unrolled FOR loop below since PHDGAINMEMSIZE is assumed to stay */
     /* the same.                                                       */
@@ -824,22 +722,22 @@ void ph_disp(
         {
             if (impNr == 0)
             {
-                ph_imp = ph_imp_low_MR795;
+                ph_imp = ph_imp_low_MR795_ptr;
             }
             else
             {
-                ph_imp = ph_imp_mid_MR795;
+                ph_imp = ph_imp_mid_MR795_ptr;
             }
         }
         else
         {
             if (impNr == 0)
             {
-                ph_imp = ph_imp_low;
+                ph_imp = ph_imp_low_ptr;
             }
             else
             {
-                ph_imp = ph_imp_mid;
+                ph_imp = ph_imp_mid_ptr;
             }
         }
 
@@ -858,7 +756,7 @@ void ph_disp(
                 /* inno[i1] += inno_sav[ppos] * ph_imp[i1-ppos] */
                 L_temp = ((Word32) c_inno_sav * *(p_ph_imp++)) >> 15;
                 tmp1 = (Word16) L_temp;
-                *(p_inno) = add(*(p_inno), tmp1, pOverflow);
+                *(p_inno) = add_16(*(p_inno), tmp1, pOverflow);
                 p_inno += 1;
             }
 
@@ -869,7 +767,7 @@ void ph_disp(
                 /* inno[i] += inno_sav[ppos] * ph_imp[L_SUBFR-ppos+i] */
                 L_temp = ((Word32) c_inno_sav * *(p_ph_imp++)) >> 15;
                 tmp1 = (Word16) L_temp;
-                *(p_inno) = add(*(p_inno), tmp1, pOverflow);
+                *(p_inno) = add_16(*(p_inno), tmp1, pOverflow);
                 p_inno += 1;
             }
         }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.h
index d0ffa2a..e48aea0 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/ph_disp.h
@@ -31,24 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/ph_disp.h
-
-
-     Date: 08/11/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Updated function prototype declaration for
-              ph_disp(). Included extern declaration for ph_imp_low_MR795 and
-              ph_imp_mid_MR795
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
-
+ Filename: ph_disp.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -59,14 +42,15 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 */
 
-#ifndef	PH_DISP_H
-#define	PH_DISP_H "$Id $"
+#ifndef PH_DISP_H
+#define PH_DISP_H "$Id $"
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"typedef.h"
+#include    "typedef.h"
 #include    "mode.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -93,10 +77,6 @@ extern "C"
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern Word16 ph_imp_low_MR795[];
-    extern Word16 ph_imp_mid_MR795[];
-    extern Word16 ph_imp_low[];
-    extern Word16 ph_imp_mid[];
 
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
@@ -178,6 +158,7 @@ extern "C"
         Word16 tmp_shift,       /* i   Q0  : shift factor applied to sum of
                                          scaled LTP ex & innov. before
                                          rounding                           */
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs      */
         Flag   *pOverflow       /* i/o     : oveflow indicator                  */
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.cpp
index ce31793..7bf5021 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.cpp
@@ -31,59 +31,11 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/post_pro.c
+ Filename: post_pro.cpp
  Functions:
            Post_Process_reset
            Post_Process
 
-     Date: 04/03/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Deleted variables listed in the Local Stores Needed/Modified
-          sections. Optimized the "else" portion of the first "if"
-          statement in Post_Process function.
-
- Description: Made grouping more explicit in the calculation of
-          signal[i] << 1 in the Post_Process function.
-
- Description: Added setting of Overflow flag in inlined code.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Replaced basic_op.h with the header file of the math functions
-              used in the file.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Updated copyright year.
-              2. Fixed typecasting issue with TI C compiler.
-              3. Used short-hand notation for math operations, e.g., "+=",
-                 in the code.
-
- Description: Removed the functions post_pro_init and post_pro_exit.
- The post_pro related structure is no longer dynamically allocated.
-
- Description: Added pOverflow as a passed in variable as per changes needed
-              for the EPOC release.
-
- Description: Optimized file to reduce clock cycle usage. Updated copyright
-              year and removed unused files in Include section.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -188,22 +140,6 @@ int Post_Process_reset (Post_ProcessState *state)
   return 0;
 }
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -319,22 +255,6 @@ int Post_Process (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.h
index 85e5888..820b79a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/post_pro.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/post_pro.h
-
-     Date: 02/04/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: post_pro.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.cpp
index 9864325..5f8d0e3 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.cpp
@@ -31,27 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/preemph.c
+ Filename: preemph.cpp
  Functions:
 
-     Date: 02/04/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Removed the functions preemphasis_init and preemphasis_exit.
- The preemphasis related structure is no longer dynamically allocated.
- Placed file in the appropriate PV Software Template format.
-
- Description: Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -131,22 +113,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -210,22 +176,6 @@ Word16 preemphasis_reset(preemphasisState *state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.h
index 20bab71..0798731 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/preemph.h
@@ -29,23 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
-
-
- Filename: /audio/gsm_amr/c/include/preemph.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: preemph.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp
index 8d5e85d..479ded7 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.cpp
@@ -31,49 +31,11 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/pstfilt.c
+ Filename: pstfilt.cpp
  Functions:
             Post_Filter_reset
             Post_Filter
 
-     Date: 04/14/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Updated file per comments gathered from Phase 2/3 review.
-
- Description: Added setting of Overflow flag in inlined code.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Replaced basic_op.h with the header file of the math functions
-              used in the file.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Updated copyright year.
-              2. Modified FOR loops to count down.
-              3. Fixed typecasting issue with TI C compiler.
-              4. Added "break" statement after overflow condition occurs.
-
- Description: Removed the functions pstfilt_init and pstfilt_exit.
- The pst_filt related structure is no longer dynamically allocated.
-
- Description: Modified code for EPOC changes where pOverflow is passed in
-              rather than allowing overflow to be a global variable.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with defined types.
-               Added proper casting (Word32) to some left shifting operations
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -94,7 +56,6 @@ terms listed above has been obtained from the copyright holder.
 #include "basic_op.h"
 #include "weight_a.h"
 #include "residu.h"
-#include "copy.h"
 #include "syn_filt.h"
 #include "preemph.h"
 #include "cnst.h"
@@ -212,22 +173,6 @@ int Post_Filter_reset (Post_FilterState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -413,22 +358,6 @@ int Post_Filter (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -462,7 +391,7 @@ void Post_Filter(
      * Post filtering                                      *
      *-----------------------------------------------------*/
 
-    Copy(syn, syn_work , L_FRAME);
+    oscl_memmove((void *)syn_work , syn, L_FRAME*sizeof(*syn));
 
     Az = Az_4;
 
@@ -489,7 +418,7 @@ void Post_Filter(
 
         /* impulse response of A(z/0.7)/A(z/0.75) */
 
-        Copy(Ap3, h, M + 1);
+        oscl_memmove((void *)h, Ap3, (M + 1)*sizeof(*Ap3));
         oscl_memset(&h[M + 1], 0, sizeof(Word16)*(L_H - M - 1));
         Syn_filt(Ap4, h, h, L_H, &h[M + 1], 0);
 
@@ -571,7 +500,7 @@ void Post_Filter(
 
     /* update syn_work[] buffer */
 
-    Copy(&syn_work[L_FRAME - M], &syn_work[-M], M);
+    oscl_memmove((void *)&syn_work[-M], &syn_work[L_FRAME - M], M*sizeof(*syn_work));
 
     return;
 }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.h
index 29c0d84..bdee89c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/pstfilt.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/pstfilt.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: pstfilt.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/qgain475_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/qgain475_tab.cpp
index 1395f22..be270de 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/qgain475_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/qgain475_tab.cpp
@@ -30,21 +30,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/qgain475_tab.c
-
-     Date: 12/09/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created this file from the reference, qgain475.tab.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Description:
+ Filename: qgain475_tab.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -92,7 +78,7 @@ extern "C"
      *    g_fac(2)          (Q12) // frame 1 and 3
      *
      */
-    const Word16 table_gain_MR475[MR475_VQ_SIZE*4] =
+    extern const Word16 table_gain_MR475[MR475_VQ_SIZE*4] =
     {
         /*g_pit(0), g_fac(0),      g_pit(1), g_fac(1) */
         812,          128,           542,      140,
@@ -366,13 +352,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -401,22 +387,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.cpp
index b685b5e..f597a23 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.cpp
@@ -31,56 +31,12 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/sp_dec.c
+ Filename: sp_dec.cpp
  Functions: GSMInitDecode
             Speech_Decode_Frame_reset
             GSMDecodeFrameExit
             GSMFrameDecode
 
-     Date: 08/03/2001
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Add PV coding template. Filled out template sections and
-              reformatted code to follow C coding standard. Removed code that
-              handles SID in GSMFrameDecode.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Updated to more recent PV C coding template.
-              2. Took out all the tabs in the file and replaced with spaces.
-              3. Deleted bit_offset from input list of GSMFrameDecode.
-
- Description: Changing several variables passed into these functions of type
-              Speech_Decode_FrameState to type void.
-
- Description: Cleaning up brackets and line spacing for statements with
-              brackets as per a review comments.
-
- Description: Synchronized file with UMTS version 3.2.0. Removed unnecessary
-              include files.
-
- Description: Removed all references to malloc/free, except for the top-level
- malloc in GSMInitDecode, and corresponding free in GSMDecodeFrameExit.
-
- Also, modified function calls throughout to reflect the fact that the members
- of the structure Decoder_amrState are no longer pointers to be set via
- malloc, but full-blown structures.  (Changes of the type D_plsfState *lsfState
- to D_plsfState lsfState)
-
- Description: Created overflow and pass the variable into the decoder.
-
- Description: Changed inititlaization of the pointer to overflow flag. Removed
-              code related to MOPS counter.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with defined types.
-               Added proper casting (Word32) to some left shifting operations
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -98,10 +54,10 @@ terms listed above has been obtained from the copyright holder.
 #include "cnst.h"
 #include "dec_amr.h"
 #include "pstfilt.h"
-#include "bits2prm.h"
 #include "mode.h"
 #include "post_pro.h"
 #include "oscl_mem.h"
+#include "bitno_tab.h"
 
 
 /*----------------------------------------------------------------------------
@@ -125,6 +81,190 @@ terms listed above has been obtained from the copyright holder.
 ; Variable declaration - defined here and used outside this module
 ----------------------------------------------------------------------------*/
 
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: Bin2int
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    no_of_bits = number of bits associated with value
+    bitstream = pointer to buffer where bits are read
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function    : Bin2int
+  Purpose     : Read "no_of_bits" bits from the array bitstream[]
+                and convert to integer.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ bits2prm.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+static Word16 Bin2int ( // Reconstructed parameter
+    Word16 no_of_bits,  // input : number of bits associated with value
+    Word16 *bitstream   // output: address where bits are written
+)
+{
+    Word16 value, i, bit;
+
+    value = 0;
+    for (i = 0; i < no_of_bits; i++)
+    {
+        value = shl (value, 1);
+        bit = *bitstream++;
+        if (sub (bit, BIT_1) == 0)
+            value = add (value, 1);
+    }
+    return (value);
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+static Word16 Bin2int(  /* Reconstructed parameter                      */
+    Word16 no_of_bits,  /* input : number of bits associated with value */
+    Word16 *bitstream   /* input: address where bits are read from      */
+)
+{
+    Word16 value;
+    Word16 i;
+    Word16 single_bit;
+
+    value = 0;
+    for (i = 0; i < no_of_bits; i++)
+    {
+        value <<= 1;
+        single_bit = *(bitstream++);
+        value |= single_bit;
+    }
+    return (value);
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: bits2prm
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    mode = AMR mode of type enum Mode
+    bits[] = pointer to serial bits of type Word16
+    prm[] = pointer to analysis parameters of type Word16
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+  Function    : Bits2prm
+  Purpose     : Retrieves the vector of encoder parameters from
+                the received serial bits in a frame.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ bits2prm.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+void Bits2prm (
+    enum Mode mode,     // i : AMR mode
+    Word16 bits[],      // i : serial bits       (size <= MAX_SERIAL_SIZE)
+    Word16 prm[]        // o : analysis parameters  (size <= MAX_PRM_SIZE)
+)
+{
+    Word16 i;
+
+    for (i = 0; i < prmno[mode]; i++)
+    {
+        prm[i] = Bin2int (bitno[mode][i], bits);
+        bits += bitno[mode][i];
+        add(0,0);       // account for above pointer update
+    }
+
+   return;
+}
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; FUNCTION CODE
+----------------------------------------------------------------------------*/
+void Bits2prm(
+    enum Mode mode,     /* i : AMR mode                                    */
+    Word16 bits[],      /* i : serial bits       (size <= MAX_SERIAL_SIZE) */
+    Word16 prm[],        /* o : analysis parameters  (size <= MAX_PRM_SIZE) */
+    CommonAmrTbls* common_amr_tbls /* i : ptr to strcut of table ptrs        */
+)
+{
+    Word16 i;
+    const Word16* prmno_ptr = common_amr_tbls->prmno_ptr;
+    const Word16* const* bitno_ptr = common_amr_tbls->bitno_ptr;
+
+
+    for (i = 0; i < prmno_ptr[mode]; i++)
+    {
+        prm[i] = Bin2int(bitno_ptr[mode][i], bits);
+        bits += bitno_ptr[mode][i];
+    }
+
+    return;
+}
+
+
+
 
 /*
 ------------------------------------------------------------------------------
@@ -219,22 +359,6 @@ int Speech_Decode_Frame_init (Speech_Decode_FrameState **state,
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -348,22 +472,6 @@ int Speech_Decode_Frame_reset (Speech_Decode_FrameState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -458,22 +566,6 @@ void Speech_Decode_Frame_exit (Speech_Decode_FrameState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -607,22 +699,6 @@ int Speech_Decode_Frame (
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -652,11 +728,11 @@ void GSMFrameDecode(
             (frame_type == RX_SID_UPDATE))
     {
         /* Override mode to MRDTX */
-        Bits2prm(MRDTX, serial, parm);
+        Bits2prm(MRDTX, serial, parm, &st->decoder_amrState.common_amr_tbls);
     }
     else
     {
-        Bits2prm(mode, serial, parm);
+        Bits2prm(mode, serial, parm, &st->decoder_amrState.common_amr_tbls);
     }
 
     /* Synthesis */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.h
index e61519d..3150feb 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/sp_dec.h
@@ -80,7 +80,7 @@ extern "C"
 {
 #endif
     Word16 GSMInitDecode(void **state_data,
-                         Word8 *id);
+    Word8 *id);
     /* initialize one instance of the speech decoder
        Stores pointer to filter status struct in *st. This pointer has to
        be passed to Speech_Decode_Frame in each call.
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/wmf_to_ets.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/wmf_to_ets.cpp
index 4dfbb67..c60c2cb 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/wmf_to_ets.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/wmf_to_ets.cpp
@@ -31,21 +31,8 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/wmf_to_ets.c
- Funtions: wmf_to_ets
-
-     Date: 01/21/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changing mode to frame_type_3gpp for DTX support. Modifying for
-              loops for optimized code. Updating as per review comments.
-
- Description: Changed MRDTX to AMR_SID in the code and added bitreorder_tab.h
-              in the Include section.
-
- Description:
+ Filename: wmf_to_ets.cpp
+ Functions: wmf_to_ets
 
 ------------------------------------------------------------------------------
 */
@@ -56,7 +43,6 @@ terms listed above has been obtained from the copyright holder.
 #include "frame_type_3gpp.h"
 #include "wmf_to_ets.h"
 #include "typedef.h"
-#include "bitreorder_tab.h"
 /*----------------------------------------------------------------------------
 ; MACROS
 ; Define module specific macros here
@@ -130,22 +116,6 @@ AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0 Release 4, June
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -155,10 +125,13 @@ AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0 Release 4, June
 void wmf_to_ets(
     enum Frame_Type_3GPP frame_type_3gpp,
     UWord8   *wmf_input_ptr,
-    Word16   *ets_output_ptr)
+    Word16   *ets_output_ptr,
+    CommonAmrTbls* common_amr_tbls)
 {
 
     Word16 i;
+    const Word16* const* reorderBits_ptr = common_amr_tbls->reorderBits_ptr;
+    const Word16* numOfBits_ptr = common_amr_tbls->numOfBits_ptr;
 
     /*
      * The following section of code accesses bits in the WMF method of
@@ -170,17 +143,17 @@ void wmf_to_ets(
     if (frame_type_3gpp < AMR_SID)
     {
         /* The table numOfBits[] can be found in bitreorder.c. */
-        for (i = numOfBits[frame_type_3gpp] - 1; i >= 0; i--)
+        for (i = numOfBits_ptr[frame_type_3gpp] - 1; i >= 0; i--)
         {
             /* The table reorderBits[][] can be found in bitreorder.c. */
-            ets_output_ptr[reorderBits[frame_type_3gpp][i]] =
+            ets_output_ptr[reorderBits_ptr[frame_type_3gpp][i]] =
                 (wmf_input_ptr[i>>3] >> ((~i) & 0x7)) & 0x01;
         }
     }
     else
     {
         /* The table numOfBits[] can be found in bitreorder.c. */
-        for (i = numOfBits[frame_type_3gpp] - 1; i >= 0; i--)
+        for (i = numOfBits_ptr[frame_type_3gpp] - 1; i >= 0; i--)
         {
             ets_output_ptr[i] = (wmf_input_ptr[i>>3] >> ((~i) & 0x7)) & 0x01;
         }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk
index 01810b3..0fd7864 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/Android.mk
@@ -20,6 +20,7 @@ LOCAL_SRC_FILES := \
  	src/cor_h_x.cpp \
  	src/cor_h_x2.cpp \
  	src/corrwght_tab.cpp \
+ 	src/div_32.cpp \
  	src/dtx_enc.cpp \
  	src/enc_lag3.cpp \
  	src/enc_lag6.cpp \
@@ -30,9 +31,11 @@ LOCAL_SRC_FILES := \
  	src/g_code.cpp \
  	src/g_pitch.cpp \
  	src/gain_q.cpp \
+ 	src/gsmamr_encoder_wrapper.cpp \
  	src/hp_max.cpp \
  	src/inter_36.cpp \
  	src/inter_36_tab.cpp \
+ 	src/l_abs.cpp \
  	src/l_comp.cpp \
  	src/l_extract.cpp \
  	src/l_negate.cpp \
@@ -59,7 +62,7 @@ LOCAL_SRC_FILES := \
  	src/spreproc.cpp \
  	src/spstproc.cpp \
  	src/ton_stab.cpp \
- 	src/gsmamr_encoder_wrapper.cpp
+ 	src/vad1.cpp
 
 
 LOCAL_MODULE := libpvencoder_gsmamr
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build/make/local.mk b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build/make/local.mk
index 6e2ec66..531e38a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build/make/local.mk
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/build/make/local.mk
@@ -12,12 +12,8 @@ XCXXFLAGS += $(FLAG_COMPILE_WARNINGS_AS_ERRORS)
 
 OPTIMIZE_FOR_PERFORMANCE_OVER_SIZE := true
 
-XCPPFLAGS += 
-
 XINCDIRS +=  ../../../common/include
 
-XLIBDIRS += 
-
 SRCDIR := ../../src
 INCSRCDIR := ../../include
 
@@ -39,6 +35,7 @@ SRCS := amrencode.cpp \
 	cor_h_x.cpp \
 	cor_h_x2.cpp \
 	corrwght_tab.cpp \
+	div_32.cpp \
 	dtx_enc.cpp \
 	enc_lag3.cpp \
 	enc_lag6.cpp \
@@ -49,9 +46,11 @@ SRCS := amrencode.cpp \
 	g_code.cpp \
 	g_pitch.cpp \
 	gain_q.cpp \
+	gsmamr_encoder_wrapper.cpp \
 	hp_max.cpp \
 	inter_36.cpp \
 	inter_36_tab.cpp \
+	l_abs.cpp \
 	l_comp.cpp \
 	l_extract.cpp \
 	l_negate.cpp \
@@ -78,12 +77,9 @@ SRCS := amrencode.cpp \
 	spreproc.cpp \
 	spstproc.cpp \
 	ton_stab.cpp \
-	gsmamr_encoder_wrapper.cpp 
+	vad1.cpp 
 
 HDRS := gsmamr_encoder_wrapper.h
 
-LIBS =
-
-
 include $(MK)/library.mk
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include/gsmamr_encoder_wrapper.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include/gsmamr_encoder_wrapper.h
index 6de9c69..7b54d28 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include/gsmamr_encoder_wrapper.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/include/gsmamr_encoder_wrapper.h
@@ -49,10 +49,10 @@ class TInputAudioStream
         int32 iMode;
 
         // Start time when samples were taken
-        uint32 iStartTime;
+        uint64 iStartTime;
 
         // End time when samples were taken
-        uint32 iStopTime;
+        uint64 iStopTime;
 };
 
 
@@ -226,7 +226,7 @@ class CPvGsmAmrEncoder
         *  This function initializes the GSM-AMR encoder.
         * @param "aMaxOutputBufferSize" "the maximum buffer size for the output buffer when Encode() gets called"
         * @param "aProps" "TEncodeProperties based pointer for the input encoding setting. if aProps=NULL, then
-        *		 default settings will be set"
+        *        default settings will be set"
         * @return 0 for the correct operation, and -1 for the wrong operation
         */
         OSCL_IMPORT_REF int32 InitializeEncoder(int32 aMaxOutputBufferSize,
@@ -308,14 +308,14 @@ class CPvGsmAmrEncoder
 
 typedef enum
 {
-    GSMAMR_ENC_NO_ERROR					= 0,
-    GSMAMR_ENC_NO_MEMORY_ERROR			= -1,
-    GSMAMR_ENC_CODEC_INIT_FAILURE		= -2,
-    GSMAMR_ENC_CODEC_NOT_INITIALIZED	= -3,
-    GSMAMR_ENC_INVALID_PARAM			= -4,
-    GSMAMR_ENC_INVALID_MODE				= -5,
-    GSMAMR_ENC_CODEC_ENCODE_FAILURE		= -6,
-    GSMAMR_ENC_MEMORY_OVERFLOW			= -7
+    GSMAMR_ENC_NO_ERROR                 = 0,
+    GSMAMR_ENC_NO_MEMORY_ERROR          = -1,
+    GSMAMR_ENC_CODEC_INIT_FAILURE       = -2,
+    GSMAMR_ENC_CODEC_NOT_INITIALIZED    = -3,
+    GSMAMR_ENC_INVALID_PARAM            = -4,
+    GSMAMR_ENC_INVALID_MODE             = -5,
+    GSMAMR_ENC_CODEC_ENCODE_FAILURE     = -6,
+    GSMAMR_ENC_MEMORY_OVERFLOW          = -7
 } GSMAMR_ENC_STATUS;
 
 #endif  // __GSMAMR_ENCODER_WRAPPER_H__
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.cpp
index d07c846..5ef9b15 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.cpp
@@ -31,44 +31,12 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename:  /audio/gsm-amr/c/src/amrencode.c
+ Filename: amrencode.cpp
  Functions: AMREncode
             AMREncodeInit
             AMREncodeReset
             AMREncodeExit
 
-     Date: 01/26/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added input_type in the parameter list and updated code to
-              check the type of output formatting to use.
-
- Description: Corrected typo in Include section.
-
- Description: Added code to support ETS format.
-
- Description: Modified file by adding the return of the number of encoder
-              frame bytes.
-
- Description: Added call to sid_sync function to support TX_NO_DATA case.
-              Added SID type and mode info to ets_output_bfr for ETS SID
-              frames. Created AMREncodeInit, AMREncodeReset, and AMREncodeExit
-              functions.
-
- Description: Modified design of handling of ETS outputs such that the ETS
-              testvectors could be compared directly to the output of this
-              function.
-
- Description: Added conditional compile around calls to AMR Encoder interface
-              functions to allow amrencode.c to be used in the ETS reference
-              console.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -184,22 +152,6 @@ terms listed above has been obtained from the copyright holder.
  RETURN(init_status)
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -318,22 +270,6 @@ Word16 AMREncodeInit(
  RETURN(reset_status)
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -424,22 +360,6 @@ Word16 AMREncodeReset(
  RETURN(nothing)
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -722,22 +642,6 @@ void AMREncodeExit(
  RETURN (num_enc_bytes)
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -816,7 +720,7 @@ Word16 AMREncode(
         if (output_format == AMR_TX_WMF)
         {
             /* Change output data format to WMF */
-            ets_to_wmf(*p3gpp_frame_type, ets_output_bfr, pEncOutput);
+            ets_to_wmf(*p3gpp_frame_type, ets_output_bfr, pEncOutput, &(((Speech_Encode_FrameState*)pEncState)->cod_amr_state->common_amr_tbls));
 
             /* Set up the number of encoded WMF bytes */
             num_enc_bytes = WmfEncBytesPerFrame[(Word16) *p3gpp_frame_type];
@@ -825,7 +729,7 @@ Word16 AMREncode(
         else if (output_format == AMR_TX_IF2)
         {
             /* Change output data format to IF2 */
-            ets_to_if2(*p3gpp_frame_type, ets_output_bfr, pEncOutput);
+            ets_to_if2(*p3gpp_frame_type, ets_output_bfr, pEncOutput, &(((Speech_Encode_FrameState*)pEncState)->cod_amr_state->common_amr_tbls));
 
             /* Set up the number of encoded IF2 bytes */
             num_enc_bytes = If2EncBytesPerFrame[(Word16) *p3gpp_frame_type];
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.h
index 1e85db1..3929a60 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/amrencode.h
@@ -31,33 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm-amr/c/include/amrencode.h
-
-     Date: 02/01/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Removed hard tabs from file.
-
- Description: Added #define for WMF and IF2, and updated function prototype.
-
- Description: Renamed WMF to AMR_WMF, IF2 to AMR_IF2, and added AMR_ETS.
-
- Description: Changed output_type to output_format.
-
- Description: Added external reference to WmfEncBytesPerFrame and
-              If2EncBytesPerFrame tables.
-
- Description: Updated function prototype for AMREncode(). Added function
-              prototype for AMREncodeInit, AMREncodeReset, and AMREncodeExit.
-              Added #defines for TX SID frame formatting.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: amrencode.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp
index 0d3acac..033c93a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.cpp
@@ -31,73 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/autocorr.c
-
-     Date: 05/15/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Put into template...starting optimization.
-
- Description: Removed call to mult_r routine.
-
- Description: Modified Input/Output Definitions section to comply with the
-          current template. Fixed tabs.
-
- Description: Updated Input/Output definitions by making them more
-          descriptive.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Added full pathname of file.
-              2. Fixed typecasting issue with TI compiler.
-              3. Modified FOR loops to count down.
-              4. Added comment to the code.
-
- Description: Removed extern to global paramter (Flag Overflow) and replaced
- by passing in a pointer to Overflow.  Also, made several small changes to
- bring code more in line with PV Standards.
-
- Description:
-            1. Added pointer to avoid adding offsets in every pass
-            2. Break last loop in two nested loop to speed up processing
-            3. Removed extra check for overflow by doing scaling right
-               after overflow is detected.
-            4. Eliminated calls to basic operations (like extract) not
-               needed because of the nature of the number (all bounded)
-
- Description:
-              1. Fixed for:
-                overflow check was looking for positive number before a left
-                shift. When numbers were big enough, positive numbers after
-                shifted became negative, causing a 1/0 division).
-                Fixed so now it checks for numbers lesser than 0x40000000
-                before the left shift
-
- Description:
-              1.Modified check for saturation to match bit exact test.
-                Also, when saturation is reached, a faster loop is used
-                (with no energy accumulation) to speed up processing
-
-
- Description:
-              1.Added pointer initialization to for loop when saturation
-                is found. This because some compiler ( like Vcpp in release
-                mode) when optimizing code, may remove pointer information
-                once the loop is broken.
-
- Description:  Added casting to eliminate warnings
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Using inlines from fxp_arithmetic.h.
-
- Description: Replacing fxp_arithmetic.h with basic_op.h.
-
- Description:
+ Filename: autocorr.cpp
 
 ----------------------------------------------------------------------------*/
 
@@ -275,22 +209,6 @@ Word16 Autocorr (
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -340,7 +258,7 @@ Word16 Autocorr(
 
     for (i = L_WINDOW; i != 0; i--)
     {
-        temp = (amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_wind++), 0x04000)) >> 15;
+        temp = (Word16)((amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_wind++), 0x04000)) >> 15);
         *(p_y++) = temp;
 
         sum += ((Word32)temp * temp) << 1;
@@ -367,7 +285,7 @@ Word16 Autocorr(
 
         for (; i != 0; i--)
         {
-            temp = (amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_wind++), 0x04000)) >> 15;
+            temp = (Word16)((amrnb_fxp_mac_16_by_16bb((Word32) * (p_x++), (Word32) * (p_wind++), 0x04000)) >> 15);
             *(p_y++) = temp;
         }
     }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.h
index 6045d6e..c7f2786 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/autocorr.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/autocorr.h
-
-     Date: 01/23/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: autocorr.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.cpp
index 83c7a71..e3e428d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.cpp
@@ -31,38 +31,11 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/c1035pf.c
+ Filename: c1035pf.cpp
  Functions: q_p
             build_code
             code_10i40_35bits
 
-
-     Date: 09/28/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Cleaned up code. Passing in a pointer to
-              overflow flag for build_code() and code_10i40_35bits() functions.
-              Removed unnecessary header files.
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation
-              4. Replaced for-loops with memset()
-
- Description: Changed function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -169,22 +142,6 @@ void q_p (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -197,7 +154,8 @@ void q_p (
 
 void q_p(
     Word16 *pInd,       /* Pulse position */
-    Word16 n            /* Pulse number   */
+    Word16 n,            /* Pulse number   */
+    const Word16* gray_ptr
 )
 {
     Word16 tmp;
@@ -206,11 +164,11 @@ void q_p(
 
     if (n < 5)
     {
-        *pInd = (tmp & 0x8) | gray[tmp & 0x7];
+        *pInd = (tmp & 0x8) | gray_ptr[tmp & 0x7];
     }
     else
     {
-        *pInd = gray[tmp & 0x7];
+        *pInd = gray_ptr[tmp & 0x7];
     }
 }
 
@@ -370,22 +328,6 @@ static void build_code (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -432,7 +374,7 @@ static void build_code(
 
         /* track = pos%5 */
         /* track = sub (i, extract_l (L_shr (L_mult (index, 5), 1))); */
-        track = i - (index * 5);
+        track = i - (index + (index << 2));
 
         if (sign[i] > 0)
         {
@@ -618,22 +560,6 @@ void code_10i40_35bits (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -651,6 +577,7 @@ void code_10i40_35bits(
     Word16 cod[],   /* (o)   : algebraic (fixed) codebook excitation        */
     Word16 y[],     /* (o)   : filtered fixed codebook excitation           */
     Word16 indx[],  /* (o)   : index of 10 pulses (sign + position)         */
+    const Word16* gray_ptr, /* (i) : ptr to read-only table                 */
     Flag *pOverflow /* (i/o) : overflow Flag                                */
 )
 {
@@ -668,7 +595,7 @@ void code_10i40_35bits(
     build_code(codvec, sign, cod, h, y, indx, pOverflow);
     for (i = 0; i < 10; i++)
     {
-        q_p(&indx[i], i);
+        q_p(&indx[i], i, gray_ptr);
     }
     return;
 }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.h
index be45cbb..4bd970a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c1035pf.h
@@ -31,20 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/c1035pf.h
-
-     Date: 09/28/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Updated function prototype for
-              code_10i40_35bits(). Added extern declaration for gray[] defined
-              in gray_tbl.c
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: c1035pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -85,7 +72,7 @@ extern "C"
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern Word16 gray[];
+
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
     ----------------------------------------------------------------------------*/
@@ -111,6 +98,7 @@ extern "C"
         Word16 cod[],   /* (o)   : algebraic (fixed) codebook excitation        */
         Word16 y[],     /* (o)   : filtered fixed codebook excitation           */
         Word16 indx[],  /* (o)   : index of 10 pulses (sign + position)         */
+        const Word16* gray_ptr, /* (i) : ptr to read-only table                 */
         Flag *pOverflow /* (i/o) : overflow Flag                                */
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.cpp
index 87fa9b8..95f8d5f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.cpp
@@ -31,34 +31,12 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/c2_11pf.c
+ Filename: c2_11pf.cpp
  Functions:
             code_2i40_11bits
             search_2i40
             build_code
 
-     Date: 01/28/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified to pass overflow flag through to basic math function.
- The flag is passed back to the calling function by pointer reference.
-
- Description: Fixed tabs prior to optimization to make diff'ing easier.
-              Optimized search_2i40() to reduce clock cycle usage.
-
- Description: Optimized build_code() to reduce clock cycle usage.
-
- Description: Changed function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:  Added casting to eliminate warnings
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -203,22 +181,6 @@ const Word16 startPos2[4] = {0, 1, 2, 4};
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -261,7 +223,7 @@ Word16 code_2i40_11bits(
                     pOverflow);
 
             h[i] =
-                add(
+                add_16(
                     h[i],
                     tempWord,
                     pOverflow);
@@ -322,7 +284,7 @@ Word16 code_2i40_11bits(
                     pOverflow);
 
             code[i] =
-                add(
+                add_16(
                     code[i],
                     tempWord,
                     pOverflow);
@@ -379,22 +341,6 @@ Word16 code_2i40_11bits(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -480,7 +426,7 @@ static void search_2i40(
                 for (i1 = ipos[1]; i1 < L_CODE; i1 += STEP)
                 {
                     /* idx increment = STEP */
-                    ps1 = add(ps0, dn[i1], pOverflow);
+                    ps1 = add_16(ps0, dn[i1], pOverflow);
 
                     /* alp1 = alp0 + rr[i0][i1] + 1/2*rr[i1][i1]; */
 
@@ -590,22 +536,6 @@ static void search_2i40(
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -659,7 +589,7 @@ static Word16 build_code(
             index,
             5,
             pOverflow); */
-        tempWord = ((Word32) index * 5) << 1;
+        tempWord = (index << 3) + (index << 1);
 
         /* tempWord =
             L_shr(
@@ -789,7 +719,7 @@ static Word16 build_code(
                     pOverflow);
 
             rsign =
-                add(
+                add_16(
                     rsign,
                     tempWord,
                     pOverflow);
@@ -801,7 +731,7 @@ static Word16 build_code(
         }
 
         indx =
-            add(
+            add_16(
                 indx,
                 index,
                 pOverflow);
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.h
index f963ae1..391f640 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_11pf.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/c2_11pf.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: c2_11pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp
index a33cdf7..052a53f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.cpp
@@ -31,49 +31,13 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/c2_9pf.c
- Funtions: code_2i40_9bits
+ Filename: c2_9pf.cpp
+ Functions: code_2i40_9bits
            search_2i40
            Test_search_2i40
            build_code
            Test_build_code
 
-     Date: 05/26/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Updated file per comments gathered from Phase 2/3 review.
-
- Description: Added setting of Overflow flag in inlined code.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template.
-
- Description: Replaced basic_op.h with the header files of the math functions
-              used by the file.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Defined one local variable per line.
-
- Description: Passed in pOverflow flag for EPOC compatibility.
-
- Description: Optimized search_2i40() to reduce clock cycle usage.
-
- Description: Removed unnecessary include files and #defines.
-
- Description: Changed function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -121,6 +85,7 @@ extern "C"
         Word16 subNr,       /* i : subframe number                               */
         Word16 dn[],        /* i : correlation between target and h[]            */
         Word16 rr[][L_CODE],/* i : matrix of autocorrelation                     */
+        const Word16* startPos_ptr, /* i: ptr to read only table                 */
         Word16 codvec[],    /* o : algebraic codebook vector                     */
         Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
     );
@@ -156,7 +121,6 @@ extern "C"
     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const Word16 startPos[];
 
     /*
     ------------------------------------------------------------------------------
@@ -277,22 +241,6 @@ extern "C"
     }
 
     ------------------------------------------------------------------------------
-     RESOURCES USED [optional]
-
-     When the code is written for a specific target processor the
-     the resources used should be documented below.
-
-     HEAP MEMORY USED: x bytes
-
-     STACK MEMORY USED: x bytes
-
-     CLOCK CYCLES: (cycle count equation for this function) + (variable
-                    used to represent cycle count for each subroutine
-                    called)
-         where: (cycle count variable) = cycle count for [subroutine
-                                         name]
-
-    ------------------------------------------------------------------------------
      CAUTION [optional]
      [State any special notes, constraints or cautions for users of this function]
 
@@ -309,6 +257,7 @@ extern "C"
         Word16 code[],      /* o : Innovative codebook                      */
         Word16 y[],         /* o : filtered fixed codebook excitation       */
         Word16 * sign,      /* o : Signs of 2 pulses                        */
+        const Word16* startPos_ptr, /* ptr to read-only table              */
         Flag   * pOverflow  /* o : Flag set when overflow occurs            */
     )
     {
@@ -349,7 +298,7 @@ extern "C"
                         pOverflow);
 
                 *(h + i) =
-                    add(
+                    add_16(
                         *(h + i),
                         temp,
                         pOverflow);
@@ -381,6 +330,7 @@ extern "C"
             subNr,
             dn,
             rr,
+            startPos_ptr,
             codvec,
             pOverflow);
 
@@ -411,7 +361,7 @@ extern "C"
                         pOverflow);
 
                 *(code + i) =
-                    add(
+                    add_16(
                         *(code + i),
                         temp,
                         pOverflow);
@@ -562,22 +512,6 @@ extern "C"
     }
 
     ------------------------------------------------------------------------------
-     RESOURCES USED [optional]
-
-     When the code is written for a specific target processor the
-     the resources used should be documented below.
-
-     HEAP MEMORY USED: x bytes
-
-     STACK MEMORY USED: x bytes
-
-     CLOCK CYCLES: (cycle count equation for this function) + (variable
-                    used to represent cycle count for each subroutine
-                    called)
-         where: (cycle count variable) = cycle count for [subroutine
-                                         name]
-
-    ------------------------------------------------------------------------------
      CAUTION [optional]
      [State any special notes, constraints or cautions for users of this function]
 
@@ -588,6 +522,7 @@ extern "C"
         Word16 subNr,        /* i : subframe number                    */
         Word16 dn[],         /* i : correlation between target and h[] */
         Word16 rr[][L_CODE], /* i : matrix of autocorrelation          */
+        const Word16* startPos_ptr, /* i: ptr to read only table       */
         Word16 codvec[],     /* o : algebraic codebook vector          */
         Flag   * pOverflow   /* o : Flag set when overflow occurs      */
     )
@@ -631,8 +566,8 @@ extern "C"
             /* fix starting position */
 
             i = (subNr << 1) + (track1 << 3);
-            *ipos = *(startPos + i);
-            *(ipos + 1) = *(startPos + i + 1);
+            *ipos = *(startPos_ptr + i);
+            *(ipos + 1) = *(startPos_ptr + i + 1);
 
 
             /*----------------------------------------------------------*
@@ -779,22 +714,6 @@ extern "C"
        RETURNING(nothing)
 
     ------------------------------------------------------------------------------
-     RESOURCES USED [optional]
-
-     When the code is written for a specific target processor the
-     the resources used should be documented below.
-
-     HEAP MEMORY USED: x bytes
-
-     STACK MEMORY USED: x bytes
-
-     CLOCK CYCLES: (cycle count equation for this function) + (variable
-                    used to represent cycle count for each subroutine
-                    called)
-         where: (cycle count variable) = cycle count for [subroutine
-                                         name]
-
-    ------------------------------------------------------------------------------
      CAUTION [optional]
      [State any special notes, constraints or cautions for users of this function]
 
@@ -805,6 +724,7 @@ extern "C"
         Word16 subNr,        /* i : subframe number                    */
         Word16 dn[],         /* i : correlation between target and h[] */
         Word16 rr[][L_CODE], /* i : matrix of autocorrelation          */
+        const Word16* startPos_ptr, /* i : ptr to read-only table      */
         Word16 codvec[],     /* o : algebraic codebook vector          */
         Flag   * pOverflow   /* o : Flag set when overflow occurs      */
     )
@@ -821,6 +741,7 @@ extern "C"
             subNr,
             dn,
             rr,
+            startPos_ptr,
             codvec,
             pOverflow);
 
@@ -959,22 +880,6 @@ extern "C"
     }
 
     ------------------------------------------------------------------------------
-     RESOURCES USED [optional]
-
-     When the code is written for a specific target processor the
-     the resources used should be documented below.
-
-     HEAP MEMORY USED: x bytes
-
-     STACK MEMORY USED: x bytes
-
-     CLOCK CYCLES: (cycle count equation for this function) + (variable
-                    used to represent cycle count for each subroutine
-                    called)
-         where: (cycle count variable) = cycle count for [subroutine
-                                         name]
-
-    ------------------------------------------------------------------------------
      CAUTION [optional]
      [State any special notes, constraints or cautions for users of this function]
 
@@ -1153,22 +1058,6 @@ extern "C"
        RETURNING(indx)
 
     ------------------------------------------------------------------------------
-     RESOURCES USED [optional]
-
-     When the code is written for a specific target processor the
-     the resources used should be documented below.
-
-     HEAP MEMORY USED: x bytes
-
-     STACK MEMORY USED: x bytes
-
-     CLOCK CYCLES: (cycle count equation for this function) + (variable
-                    used to represent cycle count for each subroutine
-                    called)
-         where: (cycle count variable) = cycle count for [subroutine
-                                         name]
-
-    ------------------------------------------------------------------------------
      CAUTION [optional]
      [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.h
index 203e1d9..0009352 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c2_9pf.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/c2_9pf.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: c2_9pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -109,6 +100,7 @@ extern "C"
         Word16 code[],      /* o : Innovative codebook                           */
         Word16 y[],         /* o : filtered fixed codebook excitation            */
         Word16 * sign,      /* o : Signs of 2 pulses                             */
+        const Word16* startPos_ptr, /* ptr to read-only table                    */
         Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.cpp
index 58ab2fa..0b8a596 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.cpp
@@ -31,28 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/c3_14pf.c
- Functions:
-
-     Date: 05/26/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified to pass overflow flag through to basic math function.
- The flag is passed back to the calling function by pointer reference.
-
- Description: Optimized file to reduce clock cycle usage. Updated copyright
-              year. Removed unneccesary include files and added only the
-              include files for the math functions used. Removed unused
-              #defines.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: c3_14pf.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -177,22 +156,6 @@ static Word16 build_code(
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -235,7 +198,7 @@ Word16 code_3i40_14bits(
                     pOverflow);
 
             h[i] =
-                add(
+                add_16(
                     h[i],
                     tempWord,
                     pOverflow);
@@ -295,7 +258,7 @@ Word16 code_3i40_14bits(
                     pOverflow);
 
             code[i] =
-                add(
+                add_16(
                     code[i],
                     tempWord,
                     pOverflow);
@@ -349,22 +312,6 @@ Word16 code_3i40_14bits(
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -642,22 +589,6 @@ static void search_3i40(
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.h
index 15e2f1a..85cf47b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c3_14pf.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/c3_14pf.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: c3_14pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.cpp
index d52b43b..e511092 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.cpp
@@ -31,29 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/c4_17pf.c
- Functions:
-
-     Date: 05/26/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified to pass overflow flag through to basic math function.
- The flag is passed back to the calling function by pointer reference.
-
- Description: Optimized functions to further reduce clock cycle usage.
-              Updated copyright year, removed unnecessary include files,
-              and removed unused #defines.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
+ Filename: c4_17pf.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -112,6 +90,7 @@ extern "C"
         Word16 h[],         /* i : impulse response of weighted synthesis filter */
         Word16 y[],         /* o : filtered fixed codebook excitation            */
         Word16 sign[],      /* o : index of 4 pulses (position+sign+ampl)*4      */
+        const Word16* gray_ptr,   /* i : ptr to read-only table                        */
         Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
     );
 
@@ -124,8 +103,6 @@ extern "C"
     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const Word16 gray[];
-    extern const Word16 dgray[];
 
     /*
     ------------------------------------------------------------------------------
@@ -187,22 +164,6 @@ extern "C"
      PSEUDO-CODE
 
     ------------------------------------------------------------------------------
-     RESOURCES USED [optional]
-
-     When the code is written for a specific target processor the
-     the resources used should be documented below.
-
-     HEAP MEMORY USED: x bytes
-
-     STACK MEMORY USED: x bytes
-
-     CLOCK CYCLES: (cycle count equation for this function) + (variable
-                    used to represent cycle count for each subroutine
-                    called)
-         where: (cycle count variable) = cycle count for [subroutine
-                                         name]
-
-    ------------------------------------------------------------------------------
      CAUTION [optional]
      [State any special notes, constraints or cautions for users of this function]
 
@@ -218,6 +179,7 @@ extern "C"
         Word16 code[],      /* o : Innovative codebook                           */
         Word16 y[],         /* o : filtered fixed codebook excitation            */
         Word16 * sign,      /* o : Signs of 4 pulses                             */
+        const Word16* gray_ptr,   /* i : ptr to read-only table                  */
         Flag   * pOverflow  /* o : Flag set when overflow occurs                 */
     )
     {
@@ -245,7 +207,7 @@ extern "C"
                         pOverflow);
 
                 h[i] =
-                    add(
+                    add_16(
                         h[i],
                         tempWord,
                         pOverflow);
@@ -287,6 +249,7 @@ extern "C"
                 h,
                 y,
                 sign,
+                gray_ptr,
                 pOverflow);
 
         /*-----------------------------------------------------------------*
@@ -307,7 +270,7 @@ extern "C"
                         pOverflow);
 
                 code[i] =
-                    add(
+                    add_16(
                         code[i],
                         tempWord,
                         pOverflow);
@@ -362,22 +325,6 @@ extern "C"
      PSEUDO-CODE
 
     ------------------------------------------------------------------------------
-     RESOURCES USED [optional]
-
-     When the code is written for a specific target processor the
-     the resources used should be documented below.
-
-     HEAP MEMORY USED: x bytes
-
-     STACK MEMORY USED: x bytes
-
-     CLOCK CYCLES: (cycle count equation for this function) + (variable
-                    used to represent cycle count for each subroutine
-                    called)
-         where: (cycle count variable) = cycle count for [subroutine
-                                         name]
-
-    ------------------------------------------------------------------------------
      CAUTION [optional]
      [State any special notes, constraints or cautions for users of this function]
 
@@ -572,7 +519,7 @@ extern "C"
                          *----------------------------------------------------------------*/
 
                         ps0 = ps;
-                        alp0 = L_deposit_h(alp);
+                        alp0 = ((Word32)alp << 16);
 
                         sq = -1;
                         alp = 1;
@@ -712,22 +659,6 @@ extern "C"
      PSEUDO-CODE
 
     ------------------------------------------------------------------------------
-     RESOURCES USED [optional]
-
-     When the code is written for a specific target processor the
-     the resources used should be documented below.
-
-     HEAP MEMORY USED: x bytes
-
-     STACK MEMORY USED: x bytes
-
-     CLOCK CYCLES: (cycle count equation for this function) + (variable
-                    used to represent cycle count for each subroutine
-                    called)
-         where: (cycle count variable) = cycle count for [subroutine
-                                         name]
-
-    ------------------------------------------------------------------------------
      CAUTION [optional]
      [State any special notes, constraints or cautions for users of this function]
 
@@ -742,6 +673,7 @@ extern "C"
         Word16 h[],       /* i : impulse response of weighted synthesis filter */
         Word16 y[],       /* o : filtered innovative code                      */
         Word16 sign[],    /* o : index of 4 pulses (sign+position)             */
+        const Word16* gray_ptr, /* i : ptr to read-only table                  */
         Flag   * pOverflow  /* o : Flag set when overflow occurs               */
     )
     {
@@ -789,7 +721,7 @@ extern "C"
             /* track = sub(i, (Word16) s, pOverflow); */
             track = i - (Word16) s;
 
-            index = gray[index];
+            index = gray_ptr[index];
 
             if (track == 1)
             {
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.h
index 4dc66a9..5237595 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c4_17pf.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/c4_17pf.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: c4_17pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -108,6 +99,7 @@ extern "C"
         Word16 code[],      /* (o)   : Innovative codebook                   */
         Word16 y[],         /* (o)   : filtered fixed codebook excitation    */
         Word16 * sign,      /* (o)   : Signs of 4 pulses                     */
+        const Word16* gray_ptr,   /* i : ptr to read-only table                  */
         Flag   * pOverflow  /* (o)   : Flag set when overflow occurs         */
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.cpp
index 07c2efd..9245ce4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.cpp
@@ -31,26 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/c8_31pf.c
- Functions:
-
-     Date: 05/26/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified to pass overflow flag through to basic math function.
- The flag is passed back to the calling function by pointer reference.
-
- Description: Optimized file to reduce clock cycle usage. Updated copyright
-              year. Removed unnecessary include files and unused #defines.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: c8_31pf.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -153,22 +134,6 @@ terms listed above has been obtained from the copyright holder.
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -411,22 +376,6 @@ static void build_code(
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -540,22 +489,6 @@ static Word16 compress10(
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -723,22 +656,6 @@ static void compress_code(
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.h
index 03225ce..2dbf63e 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/c8_31pf.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/c8_31pf.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: c8_31pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.cpp
index db786a6..b6a4132 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.cpp
@@ -31,38 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/calc_cor.c
-
-     Date: 06/12/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Initial Optimization
-
- Description: Optimize code by calculating two correlation per iteration
-              of the outer loop.
-
- Description: Delete psedocode
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Defined one local variable per line.
-
- Description:
-              1. Eliminated unused include file typedef.h.
-              2. Replaced array addressing by pointers
-              3. Unrolled loops to save extra accesses to memory
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Using inline functions from fxp_arithmetic.h for mac operations.
-
- Description: Replacing fxp_arithmetic.h with basic_op.h.
-
- Description:
+ Filename: calc_cor.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -175,22 +144,6 @@ void comp_corr (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.h
index d96a70e..d4a694b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_cor.h
@@ -74,10 +74,10 @@ extern "C"
      *
      *************************************************************************/
     void comp_corr(Word16 scal_sig[],   /* i   : scaled signal.                     */
-                   Word16 L_frame,     /* i   : length of frame to compute pitch   */
-                   Word16 lag_max,     /* i   : maximum lag                        */
-                   Word16 lag_min,     /* i   : minimum lag                        */
-                   Word32 corr[]       /* o   : correlation of selected lag        */
+    Word16 L_frame,     /* i   : length of frame to compute pitch   */
+    Word16 lag_max,     /* i   : maximum lag                        */
+    Word16 lag_min,     /* i   : minimum lag                        */
+    Word32 corr[]       /* o   : correlation of selected lag        */
                   );
 
 #ifdef __cplusplus
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.cpp
index 6cf6867..539df11 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.cpp
@@ -31,7 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/calc_en.c
+ Filename: calc_en.cpp
  Funtions: calc_unfilt_energies
            calc_filt_energies
            calc_target_energy
@@ -239,22 +239,6 @@ calc_unfilt_energies(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -349,7 +333,7 @@ void calc_unfilt_energies(
 
     exp = norm_l(s2);
     frac_en[1] = (Word16)(L_shl(s2, exp, pOverflow) >> 16);
-    exp_en[1] = sub(15, exp, pOverflow);
+    exp_en[1] = 15 - exp;
 
     /*  s3 is not always sum of squares */
     exp = norm_l(s3);
@@ -358,7 +342,7 @@ void calc_unfilt_energies(
 
     exp = norm_l(s4);
     ltp_res_en = (Word16)(L_shl(s4, exp, pOverflow) >> 16);
-    exp = sub(15, exp, pOverflow);
+    exp = 15 - exp;
 
     frac_en[3] = ltp_res_en;
     exp_en[3] = exp;
@@ -380,7 +364,7 @@ void calc_unfilt_energies(
         Log2(L_temp, &ltpg_exp, &ltpg_frac, pOverflow);
 
         /* ltpg = log2(LtpGain) * 2^13 --> range: +- 4 = +- 12 dB */
-        L_temp = L_Comp(sub(ltpg_exp, 27, pOverflow), ltpg_frac, pOverflow);
+        L_temp = L_Comp((ltpg_exp - 27), ltpg_frac, pOverflow);
         *ltpg = pv_round(L_shl(L_temp, 13, pOverflow), pOverflow);   /* Q13 */
     }
     else
@@ -567,22 +551,6 @@ calc_filt_energies(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -618,7 +586,7 @@ void calc_filt_energies(
     frac_coeff[0] = g_coeff[0];
     exp_coeff[0]  = g_coeff[1];
     frac_coeff[1] = negate(g_coeff[2]);    /* coeff[1] = -2 xn y1 */
-    exp_coeff[1]  = add(g_coeff[3], 1, pOverflow);
+    exp_coeff[1]  = g_coeff[3] + 1;
 
     if ((mode == MR795) || (mode == MR475))
     {
@@ -659,7 +627,7 @@ void calc_filt_energies(
 
     exp = norm_l(s3);
     frac_coeff[4] = (Word16)(L_shl(s3, exp, pOverflow) >> 16);
-    exp_coeff[4] = sub(7, exp, pOverflow);
+    exp_coeff[4] = (7 - exp);
 
 
     if ((mode == MR795) || (mode == MR475))
@@ -768,22 +736,6 @@ calc_target_energy(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.h
index 052f5b4..e74253b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/calc_en.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/c_g_aver.h
-
-     Date: 12/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: calc_en.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.cpp
index a02b891..a566ea0 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.cpp
@@ -31,23 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/cbsearch.c
+ Filename: cbsearch.cpp
  Functions: D_plsf_3
 
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
- (1) Removed "count.h" and "basic_op.h" and replaced with individual include
-     files (add.h, sub.h, etc.)
- (2) Added pOverflow parameter to code_10i40_35bits()
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
  ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
@@ -103,28 +89,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -195,6 +159,7 @@ void cbsearch(Word16 x[],        /* i : target vector, Q0                     */
               Word16 **anap,     /* o : Signs of the pulses                   */
               enum Mode mode,    /* i : coder mode                            */
               Word16 subNr,      /* i : subframe number                       */
+              CommonAmrTbls* common_amr_tbls, /* ptr to struct of tables    */
               Flag  *pOverflow)  /* o : Flag set when overflow occurs         */
 {
     Word16 index;
@@ -219,6 +184,7 @@ void cbsearch(Word16 x[],        /* i : target vector, Q0                     */
                 code,
                 y,
                 &index,
+                common_amr_tbls->startPos_ptr,
                 pOverflow);
 
         *(*anap)++ = index;    /* sign index */
@@ -264,6 +230,7 @@ void cbsearch(Word16 x[],        /* i : target vector, Q0                     */
                 code,
                 y,
                 &index,
+                common_amr_tbls->gray_ptr,
                 pOverflow);
 
         *(*anap)++ = index;    /* sign index */
@@ -291,7 +258,7 @@ void cbsearch(Word16 x[],        /* i : target vector, Q0                     */
                     pOverflow);
 
             h[i] =
-                add(
+                add_16(
                     h[i],
                     temp,
                     pOverflow);
@@ -323,7 +290,7 @@ void cbsearch(Word16 x[],        /* i : target vector, Q0                     */
                     pOverflow);
 
             code[i] =
-                add(
+                add_16(
                     code[i],
                     temp,
                     pOverflow);
@@ -350,7 +317,7 @@ void cbsearch(Word16 x[],        /* i : target vector, Q0                     */
                             pOverflow);
             */
             h[i] =
-                add(
+                add_16(
                     h[i],
                     temp,
                     pOverflow);
@@ -366,6 +333,7 @@ void cbsearch(Word16 x[],        /* i : target vector, Q0                     */
             code,
             y,
             *anap,
+            common_amr_tbls->gray_ptr,
             pOverflow);
 
         *anap += 10;
@@ -382,7 +350,7 @@ void cbsearch(Word16 x[],        /* i : target vector, Q0                     */
                     pOverflow);
 
             code[i] =
-                add(
+                add_16(
                     code[i],
                     temp,
                     pOverflow);
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.h
index 4e28007..caad735 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cbsearch.h
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/dec_lag3.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: cbsearch.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -68,6 +54,7 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
 #include "mode.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -108,19 +95,20 @@ extern "C"
     ----------------------------------------------------------------------------*/
 
     void cbsearch(Word16 x[],     /* i : target vector, Q0                      */
-                  Word16 h[],     /* i : impulse response of weighted synthesis */
-                  /*     filter h[-L_subfr..-1] must be set to  */
-                  /*    zero. Q12                               */
-                  Word16 T0,      /* i : Pitch lag                              */
-                  Word16 pitch_sharp, /* i : Last quantized pitch gain, Q14     */
-                  Word16 gain_pit,/* i : Pitch gain, Q14                        */
-                  Word16 res2[],  /* i : Long term prediction residual, Q0      */
-                  Word16 code[],  /* o : Innovative codebook, Q13               */
-                  Word16 y[],     /* o : filtered fixed codebook excitation, Q12 */
-                  Word16 **anap,  /* o : Signs of the pulses                    */
-                  enum Mode mode, /* i : coder mode                             */
-                  Word16 subNr,   /* i : subframe number                        */
-                  Flag  *pOverflow  /* o : Flag set when overflow occurs        */
+    Word16 h[],     /* i : impulse response of weighted synthesis */
+    /*     filter h[-L_subfr..-1] must be set to  */
+    /*    zero. Q12                               */
+    Word16 T0,      /* i : Pitch lag                              */
+    Word16 pitch_sharp, /* i : Last quantized pitch gain, Q14     */
+    Word16 gain_pit,/* i : Pitch gain, Q14                        */
+    Word16 res2[],  /* i : Long term prediction residual, Q0      */
+    Word16 code[],  /* o : Innovative codebook, Q13               */
+    Word16 y[],     /* o : filtered fixed codebook excitation, Q12 */
+    Word16 **anap,  /* o : Signs of the pulses                    */
+    enum Mode mode, /* i : coder mode                             */
+    Word16 subNr,   /* i : subframe number                        */
+    CommonAmrTbls* common_amr_tbls, /* ptr to struct of tables    */
+    Flag  *pOverflow  /* o : Flag set when overflow occurs        */
                  );
 
     /*----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp
index c9cc350..50eb6b9 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.cpp
@@ -31,41 +31,12 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/cl_ltp.c
+ Filename: cl_ltp.cpp
  Funtions: cl_ltp_init
            cl_ltp_reset
            cl_ltp_exit
            cl_ltp
 
-     Date: 06/07/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:   Placed into PV template and optimized.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Removed basic_op.h and oper_32b.h in the include section, and
-              added basicop_malloc.h.
-
- Description: Fixed typecasting issue in TI C compiler.
-
- Description: Added pOverflow parameter -- fixed minor template problem.
-
- Description:
-              1. Eliminated unused include file typedef.h.
-              2. Replaced array addressing by pointers
-              3. Eliminated if-else checks for saturation
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -186,22 +157,6 @@ int cl_ltp_init (clLtpState **state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -293,22 +248,6 @@ int cl_ltp_reset (clLtpState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -388,22 +327,6 @@ void cl_ltp_exit (clLtpState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -593,22 +516,6 @@ int cl_ltp (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -634,6 +541,7 @@ void cl_ltp(
     Word16 g_coeff[],    /* o   : Correlations between xn, y1, & y2         */
     Word16 **anap,       /* o   : Analysis parameters                       */
     Word16 *gp_limit,    /* o   : pitch gain limit                          */
+    const Word16* qua_gain_pitch_ptr, /* i : ptr to read-only table         */
     Flag   *pOverflow    /* o   : overflow indicator                        */
 )
 {
@@ -737,6 +645,7 @@ void cl_ltp(
                     gain_pit,
                     NULL,
                     NULL,
+                    qua_gain_pitch_ptr,
                     pOverflow);
         }
     }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.h
index 3e9b587..22da3fb 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cl_ltp.h
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/cl_ltp.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: cl_ltp.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -149,6 +135,7 @@ extern "C"
         Word16 g_coeff[],    /* o   : Correlations between xn, y1, & y2         */
         Word16 **anap,       /* o   : Analysis parameters                       */
         Word16 *gp_limit,    /* o   : pitch gain limit                          */
+        const Word16* qua_gain_pitch_ptr, /* i : ptr to read-only table         */
         Flag   *pOverflow    /* o   : overflow indicator                        */
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.cpp
index 1be361a..f1c101c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.cpp
@@ -31,42 +31,13 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/cod_amr.c
- Funtions: cod_amr_init
+ Filename: cod_amr.cpp
+ Functions: cod_amr_init
            cod_amr_reset
            cod_amr_exit
            cod_amr_first
            cod_amr
 
-     Date: 06/09/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Made changes based on comments from the review meeting.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Added initialization of the overflow flag in cod_amr_init()
-              and in cod_amr_reset(). This overflow flag is now part of
-              the cod_amrState structure.
-
- Description: Cleaned up INCLUDES. removed inclusion of basic_op.h and repeat
-              inclusion of copy.h
-
- Description: Updated function call to dtx_enc
-
- Description:  For cod_amr_first() and cod_amr()
-              1. Replaced copy() function with memcpy()
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -82,7 +53,6 @@ terms listed above has been obtained from the copyright holder.
 #include "cod_amr.h"
 #include "typedef.h"
 #include "cnst.h"
-#include "copy.h"
 #include "qua_gain.h"
 #include "lpc.h"
 #include "lsp.h"
@@ -101,6 +71,10 @@ terms listed above has been obtained from the copyright holder.
 #include "dtx_enc.h"
 #include "oscl_mem.h"
 
+#ifdef VAD2
+#include "vad2.h"
+#endif
+
 /*----------------------------------------------------------------------------
 ; MACROS
 ; Define module specific macros here
@@ -238,22 +212,6 @@ int cod_amr_init (cod_amrState **state, Flag dtx)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -279,6 +237,8 @@ Word16 cod_amr_init(cod_amrState **state, Flag dtx)
         return(-1);
     }
 
+    get_const_tbls(&s->common_amr_tbls);
+
     s->lpcSt = NULL;
     s->lspSt = NULL;
     s->clLtpSt = NULL;
@@ -305,7 +265,7 @@ Word16 cod_amr_init(cod_amrState **state, Flag dtx)
 #else
             vad2_init(&s->vadSt) ||
 #endif
-            dtx_enc_init(&s->dtx_encSt) ||
+            dtx_enc_init(&s->dtx_encSt, s->common_amr_tbls.lsp_init_data_ptr) ||
             lpc_init(&s->lpcSt))
     {
         cod_amr_exit(&s);
@@ -436,22 +396,6 @@ int cod_amr_reset (cod_amrState *st)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -529,7 +473,7 @@ Word16 cod_amr_reset(cod_amrState *st)
     vad2_reset(st->vadSt);
 #endif
 
-    dtx_enc_reset(st->dtx_encSt);
+    dtx_enc_reset(st->dtx_encSt, st->common_amr_tbls.lsp_init_data_ptr);
 
     st->sharp = SHARPMIN;
 
@@ -604,22 +548,6 @@ void cod_amr_exit (cod_amrState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -711,22 +639,6 @@ int cod_amr_first(cod_amrState *st,     // i/o : State struct
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1188,22 +1100,6 @@ the_end:
    return 0;
 }
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1301,7 +1197,7 @@ Word16 cod_amr(
     *------------------------------------------------------------------------*/
 
     /* LP analysis */
-    lpc(st->lpcSt, mode, st->p_window, st->p_window_12k2, A_t, pOverflow);
+    lpc(st->lpcSt, mode, st->p_window, st->p_window_12k2, A_t, &(st->common_amr_tbls), pOverflow);
 
     /* From A(z) to lsp. LSP quantization and interpolation */
     lsp(st->lspSt, mode, *usedMode, A_t, Aq_t, lsp_new, &ana, pOverflow);
@@ -1484,7 +1380,7 @@ Word16 cod_amr(
         cl_ltp(st->clLtpSt, st->tonStabSt, *usedMode, i_subfr, T_op, st->h1,
                &st->exc[i_subfr], res2, xn, lsp_flag, xn2, y1,
                &T0, &T0_frac, &gain_pit, gCoeff, &ana,
-               &gp_limit, pOverflow);
+               &gp_limit, st->common_amr_tbls.qua_gain_pitch_ptr, pOverflow);
 
         /* update LTP lag history */
 
@@ -1503,7 +1399,7 @@ Word16 cod_amr(
         * - Inovative codebook search (find index and gain)               *
         *-----------------------------------------------------------------*/
         cbsearch(xn2, st->h1, T0, st->sharp, gain_pit, res2,
-                 code, y2, &ana, *usedMode, subfrNr, pOverflow);
+                 code, y2, &ana, *usedMode, subfrNr, &(st->common_amr_tbls), pOverflow);
 
         /*------------------------------------------------------*
         * - Quantization of gains.                             *
@@ -1511,7 +1407,7 @@ Word16 cod_amr(
         gainQuant(st->gainQuantSt, *usedMode, res, &st->exc[i_subfr], code,
                   xn, xn2,  y1, y2, gCoeff, evenSubfr, gp_limit,
                   &gain_pit_sf0, &gain_code_sf0,
-                  &gain_pit, &gain_code, &ana, pOverflow);
+                  &gain_pit, &gain_code, &ana, &(st->common_amr_tbls), pOverflow);
 
         /* update gain history */
         update_gp_clipping(st->tonStabSt, gain_pit, pOverflow);
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.h
index 7360c0a..4eb6015 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cod_amr.h
@@ -31,22 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/cod_amr.h
-
-     Date: 02/07/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added overflow flag as an element to the cod_amrState data
-              structure. Corrected the function prototype declaration for
-              cod_amr().
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: cod_amr.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -74,6 +59,7 @@ terms listed above has been obtained from the copyright holder.
 #include "ton_stab.h"
 #include "vad.h"
 #include "dtx_enc.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -167,6 +153,9 @@ extern "C"
 
         Word16 sharp;
 
+        /* tables from amr common lib */
+        CommonAmrTbls common_amr_tbls;
+
         /* Overflow flag */
         Flag   overflow;
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp
index e9ce7ba..e1471d6 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/convolve.cpp
@@ -31,48 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/convolve.c
-
-     Date: 06/19/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Optimize for speed. Update to code template.
-
- Description: Added author name and date, fixed tabs, and added missing
-          sections. Updated Input/Output section.
-
- Description: Optimized code by calculating two convolution sums per iteration
-          of the outer loop, thereby, decreasing outer loop count by 2.
-          Updated input/output definitions to be the same as the assembly
-          file (convolve.asm). Left Pseudo-code section blank.
-
- Description: Deleted semi-colon in the Pointers modified section.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Fixed typecasting issue with TI C compiler.
-              2. Modified FOR loop to count down, wherever applicable.
-
- Description: Made the following changes
-              1. Unrolled the correlation loop.
-              2. Performed 2 correlation per pass per sample to avoid recalling
-                 the same data twice.
-              3. Eliminated math operations that check for saturation.
-
- Description:
-              1. Modified loop counter, extra unrolling did speed up code
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Using inlines from fxp_arithmetic.h .
-
- Description: Replacing fxp_arithmetic.h with basic_op.h.
-
- Description:
+ Filename: convolve.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -183,22 +142,6 @@ void Convolve (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp
index e46d99f..32fbdd1 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp
@@ -31,70 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/cor_h.c
-
-     Date: 06/12/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Used MAX_16 and MIN_16 when checking the result of Inv_sqrt.
-          Synced up to the new template.
-
- Description: Added setting of Overflow flag in inlined code.
-
- Description: Took out cor_h_x function and put it in its own file. Sync'ed
-          up with the single_func_template.c template. Delete version
-          ID variable.
-
- Description: Synchronized file with UTMS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Fixed portion of the code that builds the rr[] matrix. There
-              was an error in the original inlining of code that caused
-              the code to be not bit-exact with UMTS version 3.2.0.
-
- Description: Added calls to L_add() and mult() in the code to handle overflow
-              scenario. Moved cor_h.h after cnst.h in the Include section.
-              Doing this allows the unit test to build using the cnst.h in the
-              /test/include directory. Fixed initialization of the accumulator
-              in the first calculation of the sum of squares.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Used #define value instead of hard-coded numbers in the code.
-              2. Fixed typecasting issue with TI C compiler.
-              3. Removed typecasting of 0x00008000L in the call to L_add.
-
- Description: Changed pOverflow from a global variable into a function
- parameter.
-
- Description:
-            1. Added pointer to avoid adding offsets in every pass
-            2. Eliminate variables defined as registers
-            3. Removed extra check for overflow by doing scaling right
-               after overflow is detected.
-            4. Eliminated calls to basic operations (like extract) not
-               needed because of the nature of the number (all bounded)
-            5. Eliminated duplicate loop accessing same data
-            6. Simplified matrix addressing by use of pointers
-
- Description:
-              1. Eliminated unused include files.
-              2. Access twice the number of points when delaing with matrices
-                 and in the process only 3 pointers (instead of 4) are needed
-              3. Replaced array addressing (array sign[]) by pointers
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description: Using inlines from fxp_arithmetic.h .
-
- Description: Replacing fxp_arithmetic.h with basic_op.h.
-
- Description:
+ Filename: cor_h.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -242,22 +179,6 @@ void cor_h (
 }
 
 ---------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.h
index 2132859..59b9d68 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.h
@@ -29,16 +29,16 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	COR_H_H
-#define	COR_H_H
+#ifndef COR_H_H
+#define COR_H_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
 
-#include "cor_h_x.h"				/* Used by legacy files */
-#include "cor_h_x2.h"				/* Used by legacy files */
+#include "cor_h_x.h"                /* Used by legacy files */
+#include "cor_h_x2.h"               /* Used by legacy files */
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp
index beb2aec..7bb54bb 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.cpp
@@ -31,38 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/cor_h_x.c
-
-     Date: 09/07/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created a separate file for cor_h_x function.
-
- Description: Synchronized file with UMTS versin 3.2.0. Updated coding
-              template.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Modified FOR loop in the code to count down.
-              2. Fixed typecasting issue with TI C compiler.
-
- Description: Added call to round() and L_shl() functions in the last FOR
-              loop to make code bit-exact. Updated copyright year.
-
- Description: Modified to pass pOverflow in via a pointer, rather than
- invoking it as a global variable.
-
- Description: Made the following changes
-              1. Unrolled the correlation loop and add mechanism control
-                 to compute odd or even number of computations.
-              2. Use pointer to avoid continuos addresses calculation
-              2. Eliminated math operations that check for saturation.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:
+ Filename: cor_h_x.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -219,22 +188,6 @@ void cor_h_x2 (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.h
index 0073ff5..66ada72 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x.h
@@ -38,13 +38,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	COR_H_X_H
-#define	COR_H_X_H
+#ifndef COR_H_X_H
+#define COR_H_X_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"typedef.h"
+#include    "typedef.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp
index da60640..9d72ab3 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.cpp
@@ -31,34 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/cor_h_x2.c
-
-     Date: 11/07/2001
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created a separate file for cor_h_x2 function.
-
- Description: Fixed typecasting issue with TI C compiler and defined one
-              local variable per line. Updated copyright year.
-
- Description: Added #define for log2(32) = 5.
-
- Description: Added call to round() and L_shl() functions in the last FOR
-              loop to make code bit-exact.
-
- Description: Added pOverflow as a variable that's passed in for the EPOC
-              modifications.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description: Using intrinsics from fxp_arithmetic.h .
-
- Description: Replacing fxp_arithmetic.h with basic_op.h.
-
- Description:
+ Filename: cor_h_x2.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -71,6 +44,7 @@ terms listed above has been obtained from the copyright holder.
 #include "cor_h_x.h"
 #include "cor_h_x2.h" // BX
 #include "basic_op.h"
+#include "l_abs.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -203,22 +177,6 @@ void cor_h_x2 (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -271,7 +229,7 @@ void cor_h_x2(
         tot = (tot + (max >> 1));
     }
 
-    j = sub(norm_l(tot), sf, pOverflow);
+    j = norm_l(tot) - sf;
 
     for (i = 0; i < L_CODE; i++)
     {
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.h
index f2b482c..8f43b99 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h_x2.h
@@ -31,20 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/include/cor_h_x2.h
-
-     Date: 11/07/2001
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for cor_h_x2.
-
- Description: Added pOverflow for EPOC modifications
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: cor_h_x2.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/corrwght_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/corrwght_tab.cpp
index 91c4ece..b699679 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/corrwght_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/corrwght_tab.cpp
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/corrwght_tab.c
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Description:
+ Filename: corrwght_tab.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -84,44 +72,44 @@ extern "C"
     ; LOCAL VARIABLE DEFINITIONS
     ; [Variable declaration - defined here and used outside this module]
     ----------------------------------------------------------------------------*/
-    const Word16 corrweight[251] =
+    extern const Word16 corrweight[251] =
     {
-        20473,	20506,	20539,	20572,	20605,	20644,	20677,
-        20716,	20749,	20788,	20821,	20860,	20893,	20932,
-        20972,	21011,	21050,	21089,	21129,	21168,	21207,
-        21247,	21286,	21332,	21371,	21417,	21456,	21502,
-        21542,	21588,	21633,	21679,	21725,	21771,	21817,
-        21863,	21909,	21961,	22007,	22059,	22105,	22158,
-        22210,	22263,	22315,	22367,	22420,	22472,	22531,
-        22584,	22643,	22702,	22761,	22820,	22879,	22938,
-        23003,	23062,	23128,	23193,	23252,	23324,	23390,
-        23455,	23527,	23600,	23665,	23744,	23816,	23888,
-        23967,	24045,	24124,	24202,	24288,	24366,	24451,
-        24537,	24628,	24714,	24805,	24904,	24995,	25094,
-        25192,	25297,	25395,	25500,	25611,	25723,	25834,
-        25952,	26070,	26188,	26313,	26444,	26575,	26706,
-        26844,	26988,	27132,	27283,	27440,	27597,	27761,
-        27931,	28108,	28285,	28475,	28665,	28869,	29078,
-        29295,	29524,	29760,	30002,	30258,	30527,	30808,
-        31457,	32767,	32767,	32767,	32767,	32767,
-        32767,	32767,	31457,	30808,	30527,	30258,	30002,
-        29760,	29524,	29295,	29078,	28869,	28665,	28475,
-        28285,	28108,	27931,	27761,	27597,	27440,	27283,
-        27132,	26988,	26844,	26706,	26575,	26444,	26313,
-        26188,	26070,	25952,	25834,	25723,	25611,	25500,
-        25395,	25297,	25192,	25094,	24995,	24904,	24805,
-        24714,	24628,	24537,	24451,	24366,	24288,	24202,
-        24124,	24045,	23967,	23888,	23816,	23744,	23665,
-        23600,	23527,	23455,	23390,	23324,	23252,	23193,
-        23128,	23062,	23003,	22938,	22879,	22820,	22761,
-        22702,	22643,	22584,	22531,	22472,	22420,	22367,
-        22315,	22263,	22210,	22158,	22105,	22059,	22007,
-        21961,	21909,	21863,	21817,	21771,	21725,	21679,
-        21633,	21588,	21542,	21502,	21456,	21417,	21371,
-        21332,	21286,	21247,	21207,	21168,	21129,	21089,
-        21050,	21011,	20972,	20932,	20893,	20860,	20821,
-        20788,	20749,	20716,	20677,	20644,	20605,	20572,
-        20539,	20506,	20473,	20434,	20401,	20369,	20336
+        20473,  20506,  20539,  20572,  20605,  20644,  20677,
+        20716,  20749,  20788,  20821,  20860,  20893,  20932,
+        20972,  21011,  21050,  21089,  21129,  21168,  21207,
+        21247,  21286,  21332,  21371,  21417,  21456,  21502,
+        21542,  21588,  21633,  21679,  21725,  21771,  21817,
+        21863,  21909,  21961,  22007,  22059,  22105,  22158,
+        22210,  22263,  22315,  22367,  22420,  22472,  22531,
+        22584,  22643,  22702,  22761,  22820,  22879,  22938,
+        23003,  23062,  23128,  23193,  23252,  23324,  23390,
+        23455,  23527,  23600,  23665,  23744,  23816,  23888,
+        23967,  24045,  24124,  24202,  24288,  24366,  24451,
+        24537,  24628,  24714,  24805,  24904,  24995,  25094,
+        25192,  25297,  25395,  25500,  25611,  25723,  25834,
+        25952,  26070,  26188,  26313,  26444,  26575,  26706,
+        26844,  26988,  27132,  27283,  27440,  27597,  27761,
+        27931,  28108,  28285,  28475,  28665,  28869,  29078,
+        29295,  29524,  29760,  30002,  30258,  30527,  30808,
+        31457,  32767,  32767,  32767,  32767,  32767,
+        32767,  32767,  31457,  30808,  30527,  30258,  30002,
+        29760,  29524,  29295,  29078,  28869,  28665,  28475,
+        28285,  28108,  27931,  27761,  27597,  27440,  27283,
+        27132,  26988,  26844,  26706,  26575,  26444,  26313,
+        26188,  26070,  25952,  25834,  25723,  25611,  25500,
+        25395,  25297,  25192,  25094,  24995,  24904,  24805,
+        24714,  24628,  24537,  24451,  24366,  24288,  24202,
+        24124,  24045,  23967,  23888,  23816,  23744,  23665,
+        23600,  23527,  23455,  23390,  23324,  23252,  23193,
+        23128,  23062,  23003,  22938,  22879,  22820,  22761,
+        22702,  22643,  22584,  22531,  22472,  22420,  22367,
+        22315,  22263,  22210,  22158,  22105,  22059,  22007,
+        21961,  21909,  21863,  21817,  21771,  21725,  21679,
+        21633,  21588,  21542,  21502,  21456,  21417,  21371,
+        21332,  21286,  21247,  21207,  21168,  21129,  21089,
+        21050,  21011,  20972,  20932,  20893,  20860,  20821,
+        20788,  20749,  20716,  20677,  20644,  20605,  20572,
+        20539,  20506,  20473,  20434,  20401,  20369,  20336
     };
 
     /*--------------------------------------------------------------------------*/
@@ -136,13 +124,13 @@ extern "C"
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	None
+    None
 
  Outputs:
-	None
+    None
 
  Returns:
-	None
+    None
 
  Global Variables Used:
     None
@@ -170,22 +158,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.cpp
similarity index 80%
copy from opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp
copy to opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.cpp
index 143e37c..0214987 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/div_32.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.cpp
@@ -28,28 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/src/div_32.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Changed function interface to pass in a
-              pointer to overflow flag into the function instead of using a
-              global flag. Removed inclusion of unwanted header files. Changed
-              the name of input and output variables for clarity.
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced l_extract functionality, code size and speed
-                 do not justify calling this function
-              3. Eliminated sub() function call, replace by (-), this knowing
-                 that the result will not saturate.
-
- Description:  Added casting to eliminate warnings
-
- Who:                           Date:
- Description:
-
+ Filename: div_32.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -58,6 +37,7 @@ terms listed above has been obtained from the copyright holder.
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 #include    "basic_op.h"
+#include    "div_32.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -140,22 +120,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.h
similarity index 91%
copy from opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h
copy to opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.h
index fe43cbb..281be6a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/bytesused.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/div_32.h
@@ -28,20 +28,13 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: .audio/gsm-amr/c/include/BytesUsed.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus after Include section.
-
- Who:						Date:
- Description:
+ Filename: div_32.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
- This file declares a table BytesUsed.
+ This file contains all the constant definitions and prototype definitions
+ needed by the Div_32 function.
 
 ------------------------------------------------------------------------------
 */
@@ -49,13 +42,15 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	BYTESUSED_H
-#define	BYTESUSED_H
+#ifndef DIV_32_H
+#define DIV_32_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
 
+#include        "basicop_malloc.h"
+
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
 extern "C"
@@ -76,7 +71,6 @@ extern "C"
     ; EXTERNAL VARIABLES REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const short BytesUsed[];
 
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
@@ -90,12 +84,14 @@ extern "C"
     ; STRUCTURES TYPEDEF'S
     ----------------------------------------------------------------------------*/
 
-
     /*----------------------------------------------------------------------------
     ; GLOBAL FUNCTION DEFINITIONS
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
-
+    Word32 Div_32(Word32 L_num,
+    Word16 L_denom_hi,
+    Word16 L_denom_lo,
+    Flag   *pOverflow) ;
 
     /*----------------------------------------------------------------------------
     ; END
@@ -104,6 +100,4 @@ extern "C"
 }
 #endif
 
-#endif
-
-
+#endif /* _DIV_32_H_ */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp
index 0e2b8f4..f4f25f9 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.cpp
@@ -31,75 +31,14 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/dtx_enc.c
- Funtions: dtx_enc_init
+ Filename: dtx_enc.cpp
+ Functions: dtx_enc_init
            dtx_enc_reset
            dtx_enc_exit
            dtx_enc
            dtx_buffer
            tx_dtx_handler
 
-     Date: 06/08/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template. First attempt at
-          optimizing C code.
-
- Description: Updated file per comments gathered from Phase 2/3 review.
-          Synched up with new template (Inputs/Outputs section). Deleted
-          lines leftover from original code prior to the code section of
-          dtx_enc_exit function. Deleted confusing comment in the log_en
-          calculation in dtx_enc function. Restructured IF statement in
-          the calculation of the sum of squares of speech signals in
-          dtx_buffer.
-
- Description: Added setting of Overflow flag in inlined code.
-
- Description: Synchronized file with UTMS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Modified FOR loops to count down.
-              2. Fixed typecasting issue with TI C compiler.
-              3. Fixed comment in dtx_enc pseudo-code.
-              4. Added dtx_enc code comment pertaining to possible assembly
-                 implementation.
-
- Description: Added calls to add() in tx_dtx_handler. Updated copyright year.
-
- Description: Pass in pointer to overflow flag to all functions requiring this
-              flag. This is to make the library EPOC compatible.
-
- Description:  For dtx_enc_reset() only
-              1. Replaced copy() with memcpy.
-              2. Eliminated include file copy.h
-              3. Eliminated printf statement
-              For dtx_buffer()
-              1. Replaced copy() with memcpy.
-              2. Eliminated math operations that unnecessary checked for
-                 saturation, in some cases this by shifting before adding and
-                 in other cases by evaluating the operands
-              3. Unrolled loop to speed up execution
-
- Description:  For dtx_buffer()
-              1. Modified scaling and added check for saturation. Previous
-                 scaling was correct but altered precision, this cause bit
-                 exactness test failure.
-
- Description:  For dtx_buffer()
-              1. Modified scaling and saturation checks. Previous
-                 scaling was correct but altered precision, this cause bit
-                 exactness test failure for dtx vad2.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -212,29 +151,13 @@ int dtx_enc_init (dtx_encState **st)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-Word16 dtx_enc_init(dtx_encState **st)
+Word16 dtx_enc_init(dtx_encState **st, const Word16* lsp_init_data_ptr)
 {
     dtx_encState* s;
 
@@ -251,7 +174,7 @@ Word16 dtx_enc_init(dtx_encState **st)
         return(-1);
     }
 
-    dtx_enc_reset(s);
+    dtx_enc_reset(s, lsp_init_data_ptr);
     *st = s;
 
     return(0);
@@ -333,29 +256,13 @@ int dtx_enc_reset (dtx_encState *st)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
 ------------------------------------------------------------------------------
 */
 
-Word16 dtx_enc_reset(dtx_encState *st)
+Word16 dtx_enc_reset(dtx_encState *st, const Word16* lsp_init_data_ptr)
 {
     Word16 i;
 
@@ -374,7 +281,7 @@ Word16 dtx_enc_reset(dtx_encState *st)
     /* Init lsp_hist[] */
     for (i = 0; i < DTX_HIST_SIZE; i++)
     {
-        oscl_memcpy(&st->lsp_hist[i * M], lsp_init_data, M*sizeof(Word16));
+        oscl_memcpy(&st->lsp_hist[i * M], lsp_init_data_ptr, M*sizeof(Word16));
     }
 
     /* Reset energy history */
@@ -440,22 +347,6 @@ void dtx_enc_exit (dtx_encState **st)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -639,22 +530,6 @@ int dtx_enc(dtx_encState *st,        // i/o : State struct
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -701,7 +576,7 @@ void dtx_enc(dtx_encState *st,        /* i/o : State struct                  */
             {
                 temp = st->log_en_hist[i] >> 2;
             }
-            log_en = add(log_en, temp, pOverflow);
+            log_en = add_16(log_en, temp, pOverflow);
 
             for (j = M - 1; j >= 0; j--)
             {
@@ -735,9 +610,9 @@ void dtx_enc(dtx_encState *st,        /* i/o : State struct                  */
 
         /*  quantize logarithmic energy to 6 bits */
         /* +2.5 in Q10 */
-        st->log_en_index = add(log_en, 2560, pOverflow);
+        st->log_en_index = log_en + 2560;
         /* add 0.5/4 in Q10 */
-        st->log_en_index = add(st->log_en_index, 128, pOverflow);
+        st->log_en_index += 128;
         if (st->log_en_index < 0)
         {
             st->log_en_index = ~((~st->log_en_index) >> 8);
@@ -912,22 +787,6 @@ int dtx_buffer(dtx_encState *st,   // i/o : State struct
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1092,22 +951,6 @@ Word16 tx_dtx_handler(dtx_encState *st,      // i/o : State struct
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1124,7 +967,7 @@ Word16 tx_dtx_handler(dtx_encState *st,      /* i/o : State struct           */
     Word16 count;
 
     /* this state machine is in synch with the GSMEFR txDtx machine */
-    st->decAnaElapsedCount = add(st->decAnaElapsedCount, 1, pOverflow);
+    st->decAnaElapsedCount = add_16(st->decAnaElapsedCount, 1, pOverflow);
 
     compute_new_sid_possible = 0;
 
@@ -1146,8 +989,8 @@ Word16 tx_dtx_handler(dtx_encState *st,      /* i/o : State struct           */
 
             /* decAnaElapsedCount + dtxHangoverCount < */
             /* DTX_ELAPSED_FRAMES_THRESH               */
-            count = add(st->decAnaElapsedCount, st->dtxHangoverCount,
-                        pOverflow);
+            count = add_16(st->decAnaElapsedCount, st->dtxHangoverCount,
+                           pOverflow);
             if (count < DTX_ELAPSED_FRAMES_THRESH)
             {
                 *usedMode = MRDTX;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.h
index 5bb168d..8142b15 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/dtx_enc.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/dtx_enc.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: dtx_enc.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -86,7 +75,7 @@ extern "C"
     ; EXTERNAL VARIABLES REFERENCES
     ; [Declare variables used in this module but defined elsewhere]
     ----------------------------------------------------------------------------*/
-    extern const Word16 lsp_init_data[];
+
     /*----------------------------------------------------------------------------
     ; SIMPLE TYPEDEF'S
     ----------------------------------------------------------------------------*/
@@ -127,7 +116,7 @@ extern "C"
     *
     **************************************************************************
     */
-    Word16 dtx_enc_init(dtx_encState **st);
+    Word16 dtx_enc_init(dtx_encState **st, const Word16* lsp_init_data_ptr);
 
     /*
     **************************************************************************
@@ -138,7 +127,7 @@ extern "C"
     *
     **************************************************************************
     */
-    Word16 dtx_enc_reset(dtx_encState *st);
+    Word16 dtx_enc_reset(dtx_encState *st, const Word16* lsp_init_data_ptr);
 
     /*
     **************************************************************************
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.cpp
index a1fc008..0d604a7 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.cpp
@@ -31,17 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/enc_lag3.c
- Functions:
-
-     Date: 01/28/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: enc_lag3.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -225,22 +215,6 @@ terms listed above has been obtained from the copyright holder.
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -270,18 +244,15 @@ Word16 Enc_lag3(         /* o  : Return index of encoding             */
     {  /* if 1st or 3rd subframe */
 
         /* encode pitch delay (with fraction) */
-        temp1 = sub(T0, 85, pOverflow);
+        temp1 = T0 - 85;
         if (temp1 <= 0)
         {
             /* index = T0*3 - 58 + T0_frac   */
-            temp2 = add(T0, T0, pOverflow);
-            i = add(temp2, T0, pOverflow);
-            temp2 = sub(i, 58, pOverflow);
-            index = add(temp2, T0_frac, pOverflow);
+            index = (T0 << 1) + T0 -  58 + T0_frac;
         }
         else
         {
-            index = add(T0, 112, pOverflow);
+            index = T0 + 112;
         }
     }
     else
@@ -292,11 +263,8 @@ Word16 Enc_lag3(         /* o  : Return index of encoding             */
             /* 'normal' encoding: either with 5 or 6 bit resolution */
 
             /* index = 3*(T0 - T0_min) + 2 + T0_frac */
-            i = sub(T0, T0_min, pOverflow);
-            temp2 = add(i, i, pOverflow);
-            i = add(temp2, i, pOverflow);
-            temp2 = add(i, 2, pOverflow);
-            index = add(temp2, T0_frac, pOverflow);
+            i = T0 - T0_min;
+            index = i + (i << 1) + 2 + T0_frac;
         }
         else
         {
@@ -304,45 +272,42 @@ Word16 Enc_lag3(         /* o  : Return index of encoding             */
             /* encoding with 4 bit resolution */
 
             tmp_lag = T0_prev;
-            temp1 = sub(tmp_lag, T0_min, pOverflow);
-            temp2 = sub(temp1, 5, pOverflow);
+            temp1 = tmp_lag - T0_min;
+            temp2 = temp1 - 5;
             if (temp2 > 0)
-                tmp_lag = add(T0_min, 5, pOverflow);
-            temp1 = sub(T0_max, tmp_lag, pOverflow);
-            temp2 = sub(temp1, 4, pOverflow);
+            {
+                tmp_lag = T0_min + 5;
+            }
+            temp1 = T0_max - tmp_lag;
+            temp2 = temp1 - 4;
             if (temp2 > 0)
-                tmp_lag = sub(T0_max, 4, pOverflow);
-
-            temp1 = add(T0, T0, pOverflow);
-            temp2 = add(temp1, T0, pOverflow);
-            uplag = add(temp2, T0_frac, pOverflow);
+            {
+                tmp_lag = T0_max - 4;
+            }
+            uplag  = T0 + (T0 << 1);
+            uplag += T0_frac;
+            i = tmp_lag - 2;
 
-            i = sub(tmp_lag, 2, pOverflow);
-            temp1 = add(i, i, pOverflow);
-            tmp_ind = add(temp1, i, pOverflow);
+            tmp_ind  = i + (i << 1);
+            temp1    = tmp_ind - uplag;
 
-            temp1 = sub(tmp_ind, uplag, pOverflow);
             if (temp1 >= 0)
             {
-                temp1 = sub(T0, tmp_lag, pOverflow);
-                index = add(temp1, 5, pOverflow);
+                index = T0 - tmp_lag + 5;
             }
             else
             {
+                i = tmp_lag + 1;
 
-                i = add(tmp_lag, 1, pOverflow);
-                temp1 = add(i, i, pOverflow);
-                i = add(temp1, i, pOverflow);
+                i += i << 1;
 
-                if (sub(i, uplag, pOverflow) > 0)
+                if (i > uplag)
                 {
-                    temp1 = sub(uplag, tmp_ind, pOverflow);
-                    index = add(temp1, 3, pOverflow);
+                    index = uplag - tmp_ind + 3;
                 }
                 else
                 {
-                    temp1 = sub(T0, tmp_lag, pOverflow);
-                    index = add(temp1, 11, pOverflow);
+                    index = T0 - tmp_lag + 11;
                 }
             }
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.h
index 949cd97..b3dbaa4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag3.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/enc_lag3.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: enc_lag3.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.cpp
index 2c7863e..6b81ff5 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.cpp
@@ -31,25 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/enc_lag6.c
- Functions:
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description:
- (1) Removed optimization -- mult(i, 6, pOverflow) is NOT the same as adding
-     i to itself 6 times.  The reason is because the mult function does a
-     right shift by 15, which will obliterate smaller numbers.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: enc_lag6.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -161,22 +143,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -201,13 +167,13 @@ Word16 Enc_lag6(         /* o : Return index of encoding             */
         if (T0 <= 94)
         {
             /* index = T0*6 - 105 + T0_frac */
-            i = 6 * T0 - 105;
+            i = (T0 << 3) - (T0 << 1) - 105;
 
-            index = add(i, T0_frac, pOverflow);
+            index = i + T0_frac;
         }
         else
         {
-            index = add(T0, 368, pOverflow);
+            index = T0 + 368;
         }
 
     }
@@ -215,15 +181,12 @@ Word16 Enc_lag6(         /* o : Return index of encoding             */
         /* if second or fourth subframe */
     {
         /* index = 6*(T0-T0_min) + 3 + T0_frac  */
-        temp = sub(T0, T0_min, pOverflow);
-
-        i = add(temp, temp, pOverflow);
-        i = add(temp, i, pOverflow);
-        i = add(i, i, pOverflow);
+        temp = (T0 - T0_min);
 
-        i = add(i, 3, pOverflow);
+        i = (temp << 3) - (temp << 1);
+        i += 3;
 
-        index = add(i, T0_frac, pOverflow);
+        index = i + T0_frac;
     }
 
     return index;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.h
index 0438321..d9d0f5c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_lag6.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/enc_lag6.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: enc_lag6.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_output_format_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_output_format_tab.cpp
index 4bce4e5..7dccce0 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_output_format_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/enc_output_format_tab.cpp
@@ -30,23 +30,7 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 
 
- Pathname: .audio/gsm-amr/c/src/enc_output_format_tab.c
-
-     Date: 03/08/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved WMFBytesUsed and IF2BytesUsed tables from gsmamr_enc.h.
-              Changed their type definition to 'const int'. Renamed tables to
-              WmfEncBytesPerFrame and If2EncBytesPerFrame.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition.
-
- Description: Put "extern" back.
-
- Description:
+ Filename: enc_output_format_tab.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -88,28 +72,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -150,7 +112,7 @@ extern "C"
     /* for WMF output format.                                       */
     /* Each entry is the sum of the 3GPP frame type byte and the    */
     /* number of packed core AMR data bytes                         */
-    const Word16 WmfEncBytesPerFrame[16] =
+    extern const Word16 WmfEncBytesPerFrame[16] =
     {
         13, /* 4.75 */
         14, /* 5.15 */
@@ -173,7 +135,7 @@ extern "C"
 
     /* Number of data bytes in an encoder frame for each codec mode */
     /* for IF2 output format                                        */
-    const Word16 If2EncBytesPerFrame[16] =
+    extern const Word16 If2EncBytesPerFrame[16] =
     {
         13, /* 4.75 */
         14, /* 5.15 */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.cpp
index 01b8627..dc9b7aa 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.cpp
@@ -29,7 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
- Pathname: ./audio/gsm-amr/c/src/ets_to_if2.c
+ Filename: ets_to_if2.cpp
  Funtions: ets_to_if2
 
 */
@@ -40,7 +40,6 @@ terms listed above has been obtained from the copyright holder.
 #include "frame_type_3gpp.h"
 #include "ets_to_if2.h"
 #include "typedef.h"
-#include "bitreorder_tab.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -114,22 +113,6 @@ AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0 Release 4, June
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -139,7 +122,8 @@ AMR Speech Codec Frame Structure", 3GPP TS 26.101 version 4.1.0 Release 4, June
 void ets_to_if2(
     enum Frame_Type_3GPP frame_type_3gpp,
     Word16 *ets_input_ptr,
-    UWord8 *if2_output_ptr)
+    UWord8 *if2_output_ptr,
+    CommonAmrTbls* common_amr_tbls)
 {
     Word16  i;
     Word16  k;
@@ -147,37 +131,39 @@ void ets_to_if2(
     Word16 *ptr_temp;
     Word16  bits_left;
     UWord8  accum;
+    const Word16* const* reorderBits_ptr = common_amr_tbls->reorderBits_ptr;
+    const Word16* numOfBits_ptr = common_amr_tbls->numOfBits_ptr;
 
     if (frame_type_3gpp < AMR_SID)
     {
         if2_output_ptr[j++] = (UWord8)(frame_type_3gpp) |
-                              (ets_input_ptr[reorderBits[frame_type_3gpp][0]] << 4) |
-                              (ets_input_ptr[reorderBits[frame_type_3gpp][1]] << 5) |
-                              (ets_input_ptr[reorderBits[frame_type_3gpp][2]] << 6) |
-                              (ets_input_ptr[reorderBits[frame_type_3gpp][3]] << 7);
+                              (ets_input_ptr[reorderBits_ptr[frame_type_3gpp][0]] << 4) |
+                              (ets_input_ptr[reorderBits_ptr[frame_type_3gpp][1]] << 5) |
+                              (ets_input_ptr[reorderBits_ptr[frame_type_3gpp][2]] << 6) |
+                              (ets_input_ptr[reorderBits_ptr[frame_type_3gpp][3]] << 7);
 
-        for (i = 4; i < numOfBits[frame_type_3gpp] - 7;)
+        for (i = 4; i < numOfBits_ptr[frame_type_3gpp] - 7;)
         {
             if2_output_ptr[j]  =
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]];
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]];
             if2_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 1;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 1;
             if2_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 2;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 2;
             if2_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 3;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 3;
             if2_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 4;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 4;
             if2_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 5;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 5;
             if2_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 6;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 6;
             if2_output_ptr[j++] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 7;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 7;
         }
 
-        bits_left = 4 + numOfBits[frame_type_3gpp] -
-                    ((4 + numOfBits[frame_type_3gpp]) & 0xFFF8);
+        bits_left = 4 + numOfBits_ptr[frame_type_3gpp] -
+                    ((4 + numOfBits_ptr[frame_type_3gpp]) & 0xFFF8);
 
         if (bits_left != 0)
         {
@@ -186,7 +172,7 @@ void ets_to_if2(
             for (k = 0; k < bits_left; k++)
             {
                 if2_output_ptr[j] |=
-                    (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << k;
+                    (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << k;
             }
         }
     }
@@ -201,7 +187,7 @@ void ets_to_if2(
                                   (ets_input_ptr[2] << 6) | (ets_input_ptr[3] << 7);
             ptr_temp = &ets_input_ptr[4];
 
-            bits_left = ((4 + numOfBits[frame_type_3gpp]) & 0xFFF8);
+            bits_left = ((4 + numOfBits_ptr[frame_type_3gpp]) & 0xFFF8);
 
             for (i = (bits_left - 7) >> 3; i > 0; i--)
             {
@@ -217,7 +203,7 @@ void ets_to_if2(
                 if2_output_ptr[j++] = accum;
             }
 
-            bits_left = 4 + numOfBits[frame_type_3gpp] - bits_left;
+            bits_left = 4 + numOfBits_ptr[frame_type_3gpp] - bits_left;
 
             if (bits_left != 0)
             {
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.h
index 5503706..cbdfde5 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_if2.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/include/src/ets_to_if2.h
-
-     Date: 01/23/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: ets_to_if2.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -65,6 +53,7 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 #include "mode.h"
 #include "typedef.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -106,8 +95,9 @@ extern "C"
     ----------------------------------------------------------------------------*/
 
     void ets_to_if2(enum Frame_Type_3GPP mode,
-                    Word16   *ets_input_ptr,
-                    UWord8   *if2_output_ptr);
+    Word16   *ets_input_ptr,
+    UWord8   *if2_output_ptr,
+    CommonAmrTbls* common_amr_tbls);
 
 
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.cpp
index 9da3fb8..48c6325 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.cpp
@@ -31,24 +31,8 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/ets_to_wmf.c
- Funtions: ets_to_wmf
-
-     Date: 01/23/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Modified code as per review comments regarding things such as
-              adding the tables in bitreorder_tab.c to the Global section of
-              the input/output section of the template and removing the #define
-              of 244 since it wasn't needed in this function.
-
- Description: Fixed the loop that packs the last octet of the WMF output.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: ets_to_wmf.cpp
+ Functions: ets_to_wmf
 
 ------------------------------------------------------------------------------
 */
@@ -58,7 +42,6 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 #include "ets_to_wmf.h"
 #include "typedef.h"
-#include "bitreorder_tab.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -139,22 +122,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -164,7 +131,8 @@ terms listed above has been obtained from the copyright holder.
 void ets_to_wmf(
     enum Frame_Type_3GPP frame_type_3gpp,
     Word16 *ets_input_ptr,
-    UWord8 *wmf_output_ptr)
+    UWord8 *wmf_output_ptr,
+    CommonAmrTbls* common_amr_tbls)
 {
     Word16  i;
     Word16  k = 0;
@@ -172,40 +140,42 @@ void ets_to_wmf(
     Word16 *ptr_temp;
     Word16  bits_left;
     UWord8  accum;
+    const Word16* const* reorderBits_ptr = common_amr_tbls->reorderBits_ptr;
+    const Word16* numOfBits_ptr = common_amr_tbls->numOfBits_ptr;
 
     if (frame_type_3gpp < AMR_SID)
     {
         wmf_output_ptr[j++] = (UWord8)(frame_type_3gpp) & 0x0f;
 
-        for (i = 0; i < numOfBits[frame_type_3gpp] - 7;)
+        for (i = 0; i < numOfBits_ptr[frame_type_3gpp] - 7;)
         {
             wmf_output_ptr[j]  =
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 7;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 7;
             wmf_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 6;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 6;
             wmf_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 5;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 5;
             wmf_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 4;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 4;
             wmf_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 3;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 3;
             wmf_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 2;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 2;
             wmf_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << 1;
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << 1;
             wmf_output_ptr[j++] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]];
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]];
         }
 
-        bits_left = numOfBits[frame_type_3gpp] -
-                    (numOfBits[frame_type_3gpp] & 0xFFF8);
+        bits_left = numOfBits_ptr[frame_type_3gpp] -
+                    (numOfBits_ptr[frame_type_3gpp] & 0xFFF8);
 
         wmf_output_ptr[j] = 0;
 
         for (k = 0; k < bits_left; k++)
         {
             wmf_output_ptr[j] |=
-                (UWord8) ets_input_ptr[reorderBits[frame_type_3gpp][i++]] << (7 - k);
+                (UWord8) ets_input_ptr[reorderBits_ptr[frame_type_3gpp][i++]] << (7 - k);
 
         }
     }
@@ -215,7 +185,7 @@ void ets_to_wmf(
 
         ptr_temp = &ets_input_ptr[0];
 
-        for (i = numOfBits[frame_type_3gpp] - 7; i > 0; i -= 8)
+        for (i = numOfBits_ptr[frame_type_3gpp] - 7; i > 0; i -= 8)
         {
             accum  = (UWord8) * (ptr_temp++) << 7;
             accum |= (UWord8) * (ptr_temp++) << 6;
@@ -229,8 +199,8 @@ void ets_to_wmf(
             wmf_output_ptr[j++] = accum;
         }
 
-        bits_left = numOfBits[frame_type_3gpp] -
-                    (numOfBits[frame_type_3gpp] & 0xFFF8);
+        bits_left = numOfBits_ptr[frame_type_3gpp] -
+                    (numOfBits_ptr[frame_type_3gpp] & 0xFFF8);
 
         wmf_output_ptr[j] = 0;
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.h
index 3ff6f27..2147b86 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ets_to_wmf.h
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/include/src/ets_to_wmf.h
-
-     Date: 02/22/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Corrected the copyright year.
-
- Description: Updated template to make it build in Symbian. Updated copyright
-              year.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: ets_to_wmf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -67,6 +53,7 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 #include "frame_type_3gpp.h"
 #include "typedef.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -108,8 +95,9 @@ extern "C"
     ----------------------------------------------------------------------------*/
 
     void ets_to_wmf(enum Frame_Type_3GPP frame_type_3gpp,
-                    Word16   *ets_input_ptr,
-                    UWord8   *wmf_output_ptr);
+    Word16   *ets_input_ptr,
+    UWord8   *wmf_output_ptr,
+    CommonAmrTbls* common_amr_tbls);
 
 
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.cpp
index 73114f2..9d8e670 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.cpp
@@ -31,24 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/g_adapt.c
+ Filename: g_adapt.cpp
  Functions:
 
-     Date: 02/04/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -133,22 +118,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -219,22 +188,6 @@ Word16 gain_adapt_init(GainAdaptState **st)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -304,22 +257,6 @@ Word16 gain_adapt_reset(GainAdaptState *st)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -383,22 +320,6 @@ void gain_adapt_exit(GainAdaptState **st)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -455,7 +376,7 @@ void gain_adapt(
     {
         if (st->onset != 0)
         {
-            st->onset = sub(st->onset, 1, pOverflow);
+            st->onset--;
         }
     }
 
@@ -465,7 +386,7 @@ void gain_adapt(
      */
     if ((st->onset != 0) && (adapt < 2))
     {
-        adapt = add(adapt, 1, pOverflow);
+        adapt += 1;
     }
 
     st->ltpg_mem[0] = ltpg;
@@ -488,7 +409,7 @@ void gain_adapt(
                 /* result (Q15) = 16384 - 24660 * (filt << 2) */
                 filt = shl(filt, 2, pOverflow);  /* Q15 */
                 result = mult(24660, filt, pOverflow);
-                result = sub(16384, result, pOverflow);
+                result = 16384 - result;
             }
         }
     }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.h
index 2ea508b..f63d41e 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_adapt.h
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/g_adapt.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: g_adapt.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.cpp
index f937cb7..595935c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.cpp
@@ -31,36 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/g_code.c
-
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: The return of L_mult was being stored in a Word16 before it was
-              being operated on (extract_h). Data loss happened here.
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation, in some cases this by shifting before adding and
-                 in other cases by evaluating the operands
-              4. Unrolled loops to speed up processing
-              5. Eliminated calls to shifts left and right functions by adding
-                 if-else statements that do the same faster.
-
- Description:  Added casting to eliminate warnings
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: 1. Using inlines from fxp_arithmetic.h
-              2. Removing a compiler warning.
-
- Description: Replacing fxp_arithmetic.h with basic_op.h.
-
- Description:
+ Filename: g_code.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -201,22 +172,6 @@ Word16 G_code (         // out   : Gain of innovation code
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.h
index c62cba6..e7b8407 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_code.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/g_code.h
-
-
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
-
+ Filename: g_code.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.cpp
index f6235ad..2ed3608 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.cpp
@@ -31,45 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/g_pitch.c
-
-     Date: 06/12/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Placed into template and began to optimize.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Replaced basic_op.h and oper_32b.h with the header files of the
-              math functions used in the file. Fixed typecasting issue with
-              TI compiler.
-
- Description: Passing in pointer to overflow flag for EPOC compatibility. .
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation, in some cases this by shifting before adding and
-                 in other cases by evaluating the operands
-              4. Unrolled loops to speed up processing
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description: Using inlines from fxp_arithmetic.h .
-
- Description: Replacing fxp_arithmetic.h with basic_op.h.
-
- Description:
+ Filename: g_pitch.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -273,22 +235,6 @@ Word16 G_pitch     (    // o : Gain of pitch lag saturated to 1.2
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.h
index 6ea06ea..fb33f66 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/g_pitch.h
-
-
-     Date: 02/01/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
-
+ Filename: g_pitch.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.cpp
index 67510e8..b9b191b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.cpp
@@ -31,32 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/gain_q.c
- Functions:
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description: Removed everything associated with gc_pred_init
- and gc_pred_exit.  gc_pred_exit was simply removed -- gc_pred_init
- was replaced with calls to gc_pred_reset.  This is because the gc_pred
- related structures are no longer dynamically allocated via malloc.
-
- Description:  For gainQuant()
-              1. Replaced gc_pred_copy() with memcpy.
-              2. Eliminated unused include file gc_pred.h.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: gain_q.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -147,22 +122,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -247,22 +206,6 @@ Word16 gainQuant_init(gainQuantState **state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -283,8 +226,10 @@ Word16 gainQuant_reset(gainQuantState *state)
     state->sf0_exp_target_en = 0;
     state->sf0_frac_target_en = 0;
 
-    Set_zero(state->sf0_exp_coeff, 5);
-    Set_zero(state->sf0_frac_coeff, 5);
+
+    oscl_memset((void *)state->sf0_exp_coeff,  0, 5*sizeof(*state->sf0_exp_coeff));
+    oscl_memset((void *)state->sf0_frac_coeff, 0, 5*sizeof(*state->sf0_frac_coeff));
+
     state->gain_idx_ptr = NULL;
 
     gc_pred_reset(&(state->gc_predSt));
@@ -334,22 +279,6 @@ Word16 gainQuant_reset(gainQuantState *state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -438,22 +367,6 @@ void gainQuant_exit(gainQuantState **state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -484,6 +397,7 @@ void gainQuant(
     /*       MR475: gain_* unquantized in even */
     /*       subframes, quantized otherwise    */
     Word16 **anap,        /* o   : Index of quantization             */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tbl ptrs */
     Flag   *pOverflow     /* o   : overflow indicator                */
 )
 {
@@ -546,11 +460,7 @@ void gainQuant(
                 pOverflow);
 
             /* store optimum codebook gain (Q1) */
-            temp =
-                add(
-                    cod_gain_exp,
-                    1,
-                    pOverflow);
+            temp = cod_gain_exp + 1;
 
             *gain_cod =
                 shl(
@@ -667,6 +577,7 @@ void gainQuant(
                     gain_cod,
                     &qua_ener_MR122,
                     &qua_ener,
+                    common_amr_tbls->qua_gain_code_ptr,
                     pOverflow);
         }
         else
@@ -707,6 +618,7 @@ void gainQuant(
                     &qua_ener_MR122,
                     &qua_ener,
                     anap,
+                    common_amr_tbls,
                     pOverflow);
             }
             else
@@ -723,6 +635,7 @@ void gainQuant(
                         gain_cod,
                         &qua_ener_MR122,
                         &qua_ener,
+                        common_amr_tbls,
                         pOverflow);
             }
         }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.h
index a5c7f4e..a0a7c2c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gain_q.h
@@ -31,30 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/gain_q.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow.
-
- Description: Changed definition of...
-
-    gc_predState     gc_predSt;
-    gc_predState     gc_predUnqSt;
-
-  in the structure typedef.  These are no longer pointers, which avoids
-  the need to malloc memory for the pointers.  They are, rather, the actual
-  structure declared within the gainQuantState structure.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: gain_q.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -78,6 +55,7 @@ terms listed above has been obtained from the copyright holder.
 #include "mode.h"
 #include "gc_pred.h"
 #include "g_adapt.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -167,6 +145,7 @@ extern "C"
         /*       MR475: gain_* unquantized in even */
         /*       subframes, quantized otherwise    */
         Word16 **anap,        /* o   : Index of quantization             */
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tbl ptrs */
         Flag   *pOverflow     /* o   : overflow indicator                */
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_enc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_enc.h
index 390a44d..478ffc2 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_enc.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_enc.h
@@ -31,44 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm-amr/c/include/gsmamr_enc.h
-
-     Date: 09/26/2001
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changing code as per review comments. These changes include
-              removing unnecessary tables and changing function descriptions.
-              The comments were changed to "slash-star" rather than double
-              slash, and some wordings of comments were corrected.
-
- Description: Replaced GSMEncodeFrame function prototype with that of
-              AMREncode. Updated copyright year.
-
- Description: Added #define for WMF and IF2, and updated function prototype
-              of AMREncode.
-
- Description: Renamed WMF and IF2 to AMR_WMF and AMR_IF2, respectively. Added
-              AMR_ETS, and changed output_type to output_format in the
-              function prototype of AMREncode(). Removed function prototypes
-              for frame_header_move() and reverse_bits() since they are not
-              needed anymore.
-
- Description: Moved WMFBytesUsed and IF2BytesUsed tables to
-              enc_output_format_tab.c.
-
- Description: Added function prototypes for init, reset, and exit functions
-              in amrencode.c. Renamed output format #defines so that it it
-              unique to the encoder.
-
- Description: Added comment to describe L_FRAME.
-
- Description: Added Frame_Type_3GPP type definition.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: gsmamr_enc.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_encoder_wrapper.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_encoder_wrapper.cpp
index 20021b0..f753901 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_encoder_wrapper.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/gsmamr_encoder_wrapper.cpp
@@ -171,7 +171,7 @@ OSCL_EXPORT_REF int32 CPvGsmAmrEncoder::Encode(TInputAudioStream& aInStream,
         // encode this frame
         // //////////////////////////////////////////
         int32 * temp = & iLastModeUsed;
-        Word16 nStatus = AMREncode(iEncState, iSidState, 	// BX, Word16 instead of int32 to avoid wierd case(IF2 format): the function returns 31, but nStatus ends up with a big wierd number
+        Word16 nStatus = AMREncode(iEncState, iSidState,    // BX, Word16 instead of int32 to avoid wierd case(IF2 format): the function returns 31, but nStatus ends up with a big wierd number
                                    (Mode)iGsmAmrMode,
                                    (Word16 *)pFrameIn,
                                    (unsigned char *)pFrameOut,
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.cpp
index d086594..e2a67f9 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.cpp
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/hp_max.c
-
-     Date: 02/01/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: hp_max.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -51,6 +42,7 @@ terms listed above has been obtained from the copyright holder.
 #include    "hp_max.h"
 #include    "basic_op.h"
 #include    "cnst.h"
+#include    "l_abs.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -209,22 +201,6 @@ Word16 hp_max (
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -298,7 +274,7 @@ Word16 hp_max(
         t016 =  extract_h(L_shl(t0, shift2));   */
 
     t016 = norm_l(max);
-    shift1 = sub(t016, 1, pOverflow);
+    shift1 = t016 - 1;
 
     L_temp = L_shl(max, shift1, pOverflow);
     max16  = (Word16)(L_temp >> 16);
@@ -316,7 +292,7 @@ Word16 hp_max(
         cor_max = 0;
     }
 
-    shift = sub(shift1, shift2, pOverflow);
+    shift = shift1 - shift2;
 
     if (shift >= 0)
     {
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.h
index b668924..67df2aa 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/hp_max.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/hp_max.h
-
-     Date: 02/01/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: hp_max.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.cpp
index 87766a9..d8cf978 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.cpp
@@ -31,33 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/inter_36.c
-
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation
-              4. Unrolled loops to speed up processing, use decrement loops
-              5. Eliminated call to round by proper initialization
-
- Description:  Added casting to eliminate warnings
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description: Using intrinsics from fxp_arithmetic.h .
-
- Description: Replacing fxp_arithmetic.h with basic_op.h.
-
- Description:
+ Filename: inter_36.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -170,22 +144,6 @@ terms listed above has been obtained from the copyright holder.
     return pv_round (s);
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.h
index f35a5c5..7c96471 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/inter_36.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: inter_36.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.cpp
index fcfd865..8b2a966 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.cpp
@@ -29,22 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
- Pathname: .audio/gsm-amr/c/src/inter_36_tab.c
-
-     Date: 02/01/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed tables from static const to just const.
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition. Removed corresponding header file from Include
-              section.
-
- Description: Put "extern" back.
-
- Description:
+ Filename: inter_36_tab.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -93,28 +78,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -162,7 +125,7 @@ extern "C"
              inter_3[k] = inter_6[2*k], 0 <= k <= 3*L_INTER_SRCH
      */
 
-    const Word16 inter_6[FIR_SIZE] =
+    extern const Word16 inter_6[FIR_SIZE] =
     {
         29519,
         28316, 24906, 19838, 13896, 7945, 2755,
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.h
index 21ade69..a99140a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/inter_36_tab.h
@@ -29,16 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
- Pathname: .audio/gsm-amr/c/include/inter_36_tab.h
-
-     Date: 02/01/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus after Include section.
-
- Description:
+ Filename: inter_36_tab.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.cpp
similarity index 78%
copy from opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp
copy to opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.cpp
index bcde5fa..eed4fc3 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/l_abs.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.cpp
@@ -27,43 +27,32 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./gsm-amr/c/src/l_abs.c
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate file for the L_abs function. Sync'ed up
-	      with the current template and fixed tabs.
-
- Description: Removed conditional code that updates WMOPS counter
-
- Who: 						Date:
- Description:
+ Filename: l_abs.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	L_var1 = 32 bit long signed integer (Word32 ) whose value falls
-	         in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+    L_var1 = 32 bit long signed integer (Word32 ) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
 
  Local Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Global Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Outputs:
-	L_var1 = absolute value of input (Word32)
+    L_var1 = absolute value of input (Word32)
 
  Pointers and Buffers Modified:
-	None
+    None
 
  Local Stores Modified:
-	None
+    None
 
  Global Stores Modified:
-	None
+    None
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
@@ -112,35 +101,13 @@ Word32 L_abs (Word32 L_var1)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-		  stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-		 name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-		   used to represent cycle count for each subroutine
-		   called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-		name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "l_abs.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
@@ -176,7 +143,7 @@ Word32 L_abs (Word32 L_var1)
 /*----------------------------------------------------------------------------
 ; FUNCTION CODE
 ----------------------------------------------------------------------------*/
-Word32 L_abs(register Word32 L_var1)
+Word32 L_abs(Word32 L_var1)
 {
     /*----------------------------------------------------------------------------
     ; Define all local variables
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_abs.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.h
similarity index 91%
rename from opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_abs.h
rename to opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.h
index aa8ca0a..9a1eaa9 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_abs.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_abs.h
@@ -28,17 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Pathname: ./gsm-amr/c/include/l_abs.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Created separate header file for L_abs function.
-
- Description: Moved _cplusplus #ifdef after Include section..
-
- Who:						Date:
- Description:
+ Filename: l_abs.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -52,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 /*----------------------------------------------------------------------------
 ; CONTINUE ONLY IF NOT ALREADY DEFINED
 ----------------------------------------------------------------------------*/
-#ifndef	L_ABS_H
-#define	L_ABS_H
+#ifndef L_ABS_H
+#define L_ABS_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_comp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_comp.cpp
index 64be4dd..bd6c6f6 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_comp.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_comp.cpp
@@ -73,28 +73,6 @@ terms listed above has been obtained from the copyright holder.
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -151,7 +129,7 @@ Word32 L_Comp(Word16 hi, Word16 lo, Flag *pOverflow)
     ; Function body here
     ----------------------------------------------------------------------------*/
 
-    L_32 = L_deposit_h(hi);
+    L_32 = ((Word32)hi << 16);
 
     temp32 = L_mac(L_32, lo, 1, pOverflow);
     /*----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_extract.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_extract.cpp
index 39155db..ba348d3 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_extract.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_extract.cpp
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/l_extract.c
-
-     Date: 09/07/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Changed function interface to pass in a
-              pointer to overflow flag into the function instead of using a
-              global flag. Changed names of function parameters for clarity.
-              Removed inclusion of unwanted header files.
-
- Description:
+ Filename: l_extract.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -82,8 +70,8 @@ terms listed above has been obtained from the copyright holder.
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	L_var = 32 bit signed integer (Word32) whose value falls
-	       in the range : 0x8000 0000 <= L_32 <= 0x7fff ffff.
+    L_var = 32 bit signed integer (Word32) whose value falls
+           in the range : 0x8000 0000 <= L_32 <= 0x7fff ffff.
 
     pL_var_hi =  pointer to the most significant word of L_var (Word16).
 
@@ -94,8 +82,8 @@ terms listed above has been obtained from the copyright holder.
 
  Outputs:
     pOverflow -> 1 if the 32 bit add operation resulted in overflow
-	pL_var_hi -> MS word of L_32.
-	pL_var_lo -> LS word of L_32 shifted left by 1.
+    pL_var_hi -> MS word of L_32.
+    pL_var_lo -> LS word of L_32 shifted left by 1.
 
  Returns:
     None
@@ -130,22 +118,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp
index 2986a7d..9699095 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/l_negate.cpp
@@ -31,26 +31,26 @@ terms listed above has been obtained from the copyright holder.
  INPUT AND OUTPUT DEFINITIONS
 
  Inputs:
-	L_var1 = 32 bit long signed integer (Word32) whose value falls
-	         in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
+    L_var1 = 32 bit long signed integer (Word32) whose value falls
+             in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
 
  Local Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Global Stores/Buffers/Pointers Needed:
-	None
+    None
 
  Outputs:
-	L_var1 = 32-bit negation of input
+    L_var1 = 32-bit negation of input
 
  Pointers and Buffers Modified:
-	None
+    None
 
  Local Stores Modified:
-	None
+    None
 
  Global Stores Modified:
-	None
+    None
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
@@ -83,35 +83,13 @@ Word32 L_negate (Word32 L_var1)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-		  stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-		 name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-		   used to represent cycle count for each subroutine
-		   called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-		name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basic_op.h"
+#include    "basic_op.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.cpp
index 0b2d2a1..9b733d8 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.cpp
@@ -31,23 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/lag_wind.c
-
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated l_extract() function call
-
- Description:  Added casting to eliminate warnings
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: lag_wind.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -148,22 +132,6 @@ terms listed above has been obtained from the copyright holder.
     return;
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.h
index 4928ac4..b533c42 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/lag_wind.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: lag_wind.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.cpp
index 91af39b..85f5286 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.cpp
@@ -29,20 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
- Pathname: .audio/gsm-amr/c/src/lag_wind_tab.c
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus and removed "extern" from table
-              definition. Removed corresponding header file from Include
-              section.
-
- Description: Put "extern" back.
-
- Description:
+ Filename: lag_wind_tab.cpp
 
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
@@ -109,28 +96,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED
-   When the code is written for a specific target processor the
-     the resources used should be documented below.
-
- STACK USAGE: [stack count for this module] + [variable to represent
-          stack usage for each subroutine called]
-
-     where: [stack usage variable] = stack usage for [subroutine
-         name] (see [filename].ext)
-
- DATA MEMORY USED: x words
-
- PROGRAM MEMORY USED: x words
-
- CLOCK CYCLES: [cycle count equation for this module] + [variable
-           used to represent cycle count for each subroutine
-           called]
-
-     where: [cycle count variable] = cycle count for [subroutine
-        name] (see [filename].ext)
-
-------------------------------------------------------------------------------
 */
 
 
@@ -167,7 +132,7 @@ extern "C"
     ; LOCAL STORE/BUFFER/POINTER DEFINITIONS
     ; Variable declaration - defined here and used outside this module
     ----------------------------------------------------------------------------*/
-    const Word16 lag_h[10] =
+    extern const Word16 lag_h[10] =
     {
         32728,
         32619,
@@ -181,7 +146,7 @@ extern "C"
         29321
     };
 
-    const Word16 lag_l[10] =
+    extern const Word16 lag_l[10] =
     {
         11904,
         17280,
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.h
index c210932..ed04706 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lag_wind_tab.h
@@ -29,16 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 ------------------------------------------------------------------------------
 
- Pathname: .audio/gsm-amr/c/include/lag_wind_tab.h
-
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added #ifdef __cplusplus after Include section.
-
- Description:
+ Filename: lag_wind_tab.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp
index 207a6be..cbd27d7 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.cpp
@@ -31,7 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/levinson.c
+ Filename: levinson.cpp
  Funtions: Levinson_init
            Levinson_reset
            Levinson_exit
@@ -53,6 +53,7 @@ terms listed above has been obtained from the copyright holder.
 #include "levinson.h"
 #include "basicop_malloc.h"
 #include "basic_op.h"
+#include "l_abs.h"
 #include "div_32.h"
 #include "cnst.h"
 #include "oscl_mem.h"
@@ -144,22 +145,6 @@ int Levinson_init (LevinsonState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -252,22 +237,6 @@ int Levinson_reset (LevinsonState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -348,22 +317,6 @@ void Levinson_exit (LevinsonState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -605,22 +558,6 @@ int Levinson (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.h
index 65ba481..dec6718 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/levinson.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/levinson.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
- Description: 1. Modified "int" definition by Word16
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: levinson.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lflg_upd.cpp
similarity index 63%
copy from opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp
copy to opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lflg_upd.cpp
index b922de5..0e2e5bd 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lflg_upd.cpp
@@ -18,73 +18,42 @@
 /****************************************************************************************
 Portions of this file are derived from the following 3GPP standard:
 
-    3GPP TS 26.173
-    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
     Available from http://www.3gpp.org
 
-(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
 Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
-------------------------------------------------------------------------------
-
-
-
- Filename: median5.cpp
-
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
-------------------------------------------------------------------------------
- INPUT AND OUTPUT DEFINITIONS
-
-   INPUT
-       X[-2:2]   16-bit integers.
-
-   RETURN VALUE
-       The median of {X[-2], X[-1],..., X[2]}.
-
-------------------------------------------------------------------------------
- FUNCTION DESCRIPTION
-
-      Returns the median of the set {X[-2], X[-1],..., X[2]},
-      whose elements are 16-bit integers.
-
-------------------------------------------------------------------------------
- REQUIREMENTS
 
+ Filename: lflg_upd.cpp
+ Functions: LTP_flag_update
 
 ------------------------------------------------------------------------------
- REFERENCES
-
-------------------------------------------------------------------------------
- PSEUDO-CODE
+ MODULE DESCRIPTION
 
+ LTP_flag update for AMR VAD option 2
 ------------------------------------------------------------------------------
 */
 
-
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
+#include "typedef.h"
+#include "cnst.h"
+#include "l_extract.h"
+#include "mpy_32_16.h"
 
-#include "pv_amr_wb_type_defs.h"
-#include "pvamrwbdecoder_basic_op.h"
-#include "pvamrwbdecoder_acelp.h"
-#include "pvamrwb_math_op.h"
+#include "vad2.h"
+#include "mode.h"
 
 /*----------------------------------------------------------------------------
 ; MACROS
 ; Define module specific macros here
 ----------------------------------------------------------------------------*/
 
-
 /*----------------------------------------------------------------------------
 ; DEFINES
 ; Include all pre-processor statements here. Include conditional
@@ -97,84 +66,118 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 
 /*----------------------------------------------------------------------------
-; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; LOCAL VARIABLE DEFINITIONS
 ; Variable declaration - defined here and used outside this module
 ----------------------------------------------------------------------------*/
 
-/*----------------------------------------------------------------------------
-; EXTERNAL FUNCTION REFERENCES
-; Declare functions defined elsewhere and referenced in this module
-----------------------------------------------------------------------------*/
 
-/*----------------------------------------------------------------------------
-; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
-; Declare variables used in this module but defined elsewhere
-----------------------------------------------------------------------------*/
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME:
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
 
-/*----------------------------------------------------------------------------
-; FUNCTION CODE
-----------------------------------------------------------------------------*/
+ Inputs:
+    st -- Pointer to vadState2
+    mode -- Word16 -- AMR mode
 
-int16 median5(int16 x[])
-{
-    int16 x1, x2, x3, x4, x5;
-    int16 tmp;
+ Outputs:
+    st -- Pointer to vadState2
+    pOverflow -- Pointer to Flag -- overflow indicator
 
-    x1 = x[-2];
-    x2 = x[-1];
-    x3 = x[0];
-    x4 = x[1];
-    x5 = x[2];
+ Returns:
+    None
 
+ Global Variables Used:
+    None
 
+ Local Variables Needed:
+    None
 
-    if (x2 < x1)
-    {
-        tmp = x1;
-        x1 = x2;
-        x2 = tmp;
-    }
-    if (x3 < x1)
-    {
-        tmp = x1;
-        x1 = x3;
-        x3 = tmp;
-    }
-    if (x4 < x1)
-    {
-        tmp = x1;
-        x1 = x4;
-        x4 = tmp;
-    }
-    if (x5 < x1)
-    {
-        x5 = x1;
-    }
-    if (x3 < x2)
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ LTP_flag update for AMR VAD option 2
+
+
+ PURPOSE:
+   Set LTP_flag if the LTP gain > LTP_THRESHOLD, where the value of
+   LTP_THRESHOLD depends on the LTP analysis window length.
+
+ INPUTS:
+
+   mode
+                   AMR mode
+   vadState->L_R0
+                   LTP energy
+   vadState->L_Rmax
+                   LTP maximum autocorrelation
+ OUTPUTS:
+
+   vadState->LTP_flag
+                   Set if LTP gain > LTP_THRESHOLD
+
+ RETURN VALUE:
+
+   none
+
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ lflg_upd.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void LTP_flag_update(
+    vadState2 * st,
+    Word16 mode,
+    Flag   *pOverflow)
+{
+    Word16 thresh;
+    Word16 hi1;
+    Word16 lo1;
+    Word32 Ltmp;
+
+    if ((mode == MR475) || (mode == MR515))
     {
-        tmp = x2;
-        x2 = x3;
-        x3 = tmp;
+        thresh = 18022; /* (Word16)(32768.0*0.55); */
     }
-    if (x4 < x2)
+    else if (mode == MR102)
     {
-        tmp = x2;
-        x2 = x4;
-        x4 = tmp;
+        thresh = 19660; /* (Word16)(32768.0*0.60); */
     }
-    if (x5 < x2)
+    else
     {
-        x5 = x2;
+        thresh = 21299; /* (Word16)(32768.0*0.65); */
     }
-    if (x4 < x3)
+
+    L_Extract(st->L_R0, &hi1, &lo1, pOverflow);
+
+    Ltmp = Mpy_32_16(hi1, lo1, thresh, pOverflow);
+
+    if (st->L_Rmax > Ltmp)
     {
-        x3 = x4;
+        st->LTP_flag = TRUE;
     }
-    if (x5 < x3)
+    else
     {
-        x3 = x5;
+        st->LTP_flag = FALSE;
     }
-    return (x3);
-}
-
 
+    return;
+}
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.cpp
index 3f2b3f4..bd0e990 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.cpp
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/lpc.c
-
-     Date: 01/31/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updating includes and making code more simple as per comments.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: lpc.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -61,7 +47,6 @@ terms listed above has been obtained from the copyright holder.
 #include "levinson.h"
 #include "cnst.h"
 #include "mode.h"
-#include "window_tab.h"
 #include "sub.h"
 #include "oscl_mem.h"
 
@@ -158,22 +143,6 @@ terms listed above has been obtained from the copyright holder.
   return 0;
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -261,22 +230,6 @@ Word16 lpc_init(lpcState **state)
   return 0;
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -349,22 +302,6 @@ Word16 lpc_reset(lpcState *state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -462,22 +399,6 @@ void lpc_exit(lpcState **state)
    return 0;
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -489,6 +410,7 @@ void lpc(
     Word16 x[],       /* i  : Input signal           Q15  */
     Word16 x_12k2[],  /* i  : Input signal (EFR)     Q15  */
     Word16 a[],       /* o  : predictor coefficients Q12  */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct with table ptrs */
     Flag   *pOverflow
 )
 {
@@ -497,17 +419,21 @@ void lpc(
     /* No fixed Q value but normalized  */
     /* so that overflow is avoided      */
 
+    const Word16* window_160_80_ptr = common_amr_tbls->window_160_80_ptr;
+    const Word16* window_232_8_ptr = common_amr_tbls->window_232_8_ptr;
+    const Word16* window_200_40_ptr = common_amr_tbls->window_200_40_ptr;
+
     if (mode == MR122)
     {
         /* Autocorrelations */
-        Autocorr(x_12k2, M, rHigh, rLow, window_160_80, pOverflow);
+        Autocorr(x_12k2, M, rHigh, rLow, window_160_80_ptr, pOverflow);
         /* Lag windowing    */
         Lag_window(M, rHigh, rLow, pOverflow);
         /* Levinson Durbin  */
         Levinson(st->levinsonSt, rHigh, rLow, &a[MP1], rc, pOverflow);
 
         /* Autocorrelations */
-        Autocorr(x_12k2, M, rHigh, rLow, window_232_8, pOverflow);
+        Autocorr(x_12k2, M, rHigh, rLow, window_232_8_ptr, pOverflow);
         /* Lag windowing    */
         Lag_window(M, rHigh, rLow, pOverflow);
         /* Levinson Durbin  */
@@ -516,7 +442,7 @@ void lpc(
     else
     {
         /* Autocorrelations */
-        Autocorr(x, M, rHigh, rLow, window_200_40, pOverflow);
+        Autocorr(x, M, rHigh, rLow, window_200_40_ptr, pOverflow);
         /* Lag windowing    */
         Lag_window(M, rHigh, rLow, pOverflow);
         /* Levinson Durbin  */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.h
index 705a1d4..e0b40b2 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/lpc.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/lpc.h
-
-     Date: 01/29/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: lpc.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -66,6 +55,7 @@ terms listed above has been obtained from the copyright holder.
 #include "typedef.h"
 #include "levinson.h"
 #include "mode.h"
+#include "get_const_tbls.h"
 
 
 /*--------------------------------------------------------------------------*/
@@ -132,6 +122,7 @@ extern "C"
         Word16 x[],       /* i  : Input signal           Q15  */
         Word16 x_12k2[],  /* i  : Input signal (EFR)     Q15  */
         Word16 a[],       /* o  : predictor coefficients Q12  */
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct with table ptrs */
         Flag   *pOverflow
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.cpp
index 7d034e0..43b3f02 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.cpp
@@ -31,23 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/ol_ltp.c
- Funtions: ol_ltp
+ Filename: ol_ltp.cpp
+ Functions: ol_ltp
 
-     Date: 04/18/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Adding pOverflow to the functions to remove global variables.
-              These changes are needed for the EPOC releases. Cleaned up code.
-              Updated template.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
-------------------------------------------------------------------------------
 */
 
 /*----------------------------------------------------------------------------
@@ -172,22 +158,6 @@ int ol_ltp(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.h
index f8c1481..044e1c4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ol_ltp.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/ol_ltp.h
-
-     Date: 02/06/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: ol_ltp.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/p_ol_wgh.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/p_ol_wgh.cpp
index 36ed9db..3a239e3 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/p_ol_wgh.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/p_ol_wgh.cpp
@@ -31,29 +31,13 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/p_ol_wgh.c
- Funtions: p_ol_wgh_init
+ Filename: p_ol_wgh.cpp
+ Functions: p_ol_wgh_init
            p_ol_wgh_reset
            p_ol_wgh_exit
            Lag_max
            Pitch_ol_wgh
 
-     Date: 02/05/2002
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: t0 was not being declared as Word32.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -163,22 +147,6 @@ int p_ol_wgh_init (pitchOLWghtState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -270,22 +238,6 @@ int p_ol_wgh_reset (pitchOLWghtState *st)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -365,22 +317,6 @@ void p_ol_wgh_exit (pitchOLWghtState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -545,22 +481,6 @@ static Word16 Lag_max ( // o : lag found
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -834,22 +754,6 @@ Word16 Pitch_ol_wgh (     // o   : open loop pitch lag
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -949,7 +853,7 @@ Word16 Pitch_ol_wgh(      /* o   : open loop pitch lag
     {
         st->old_T0_med = p_max1;
         /* = ada_w = ada_w * 0.9 */
-        st->ada_w = mult(st->ada_w, 29491, pOverflow);
+        st->ada_w = (Word16)((Word32)(st->ada_w * 29491) >> 15);
     }
 
     if (sub(st->ada_w, 9830, pOverflow) < 0)  /* ada_w - 0.3 */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.cpp
index 1b28397..5f70021 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.cpp
@@ -31,47 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/pitch_fr.c
- Functions:
-
-
-     Date: 02/04/2002
+ Filename: pitch_fr.cpp
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added pOverflow as a passed in value to searchFrac and made
-              other fixes to the code regarding simple syntax fixes. Removed
-              the include of stio.h.
-
- Description: *lag-- decrements the pointer.  (*lag)-- decrements what is
- pointed to.  The latter is what the coder intended, but the former is
- the coding instruction that was used.
-
- Description: A common problem -- a comparison != 0 was inadvertantly replaced
- by a comparison == 0.
-
-
- Description:  For Norm_Corr() and getRange()
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation, in some cases this by shifting before adding and
-                 in other cases by evaluating the operands
-              4. Unrolled loops to speed up processing, use decrement loops
-              5. Replaced extract_l() call with equivalent code
-              6. Modified scaling threshold and group all shifts (avoiding
-                 successive shifts)
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Removed compiler warnings.
-
- Description:
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
       File             : pitch_fr.c
@@ -286,22 +248,6 @@ static void Norm_Corr (Word16 exc[], Word16 xn[], Word16 h[], Word16 L_subfr,
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -539,22 +485,6 @@ static void searchFrac (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -694,22 +624,6 @@ static void getRange (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -814,22 +728,6 @@ int Pitch_fr_init (Pitch_frState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -917,22 +815,6 @@ int Pitch_fr_reset (Pitch_frState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1009,22 +891,6 @@ void Pitch_fr_exit (Pitch_frState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1338,22 +1204,6 @@ Word16 Pitch_fr (        // o   : pitch period (integer)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1468,8 +1318,8 @@ Word16 Pitch_fr(         /* o   : pitch period (integer)                    */
      *           Find interval to compute normalized correlation             *
      *-----------------------------------------------------------------------*/
 
-    t_min = sub(t0_min, L_INTER_SRCH, pOverflow);
-    t_max = add(t0_max, L_INTER_SRCH, pOverflow);
+    t_min = t0_min - L_INTER_SRCH;
+    t_max = t0_max + L_INTER_SRCH;
 
     corr = &corr_v[-t_min];
 
@@ -1522,10 +1372,14 @@ Word16 Pitch_fr(         /* o   : pitch period (integer)                    */
             /* or only on left or right side */
 
             tmp_lag = st->T0_prev_subframe;
-            if (sub(sub(tmp_lag, t0_min, pOverflow), 5, pOverflow) > 0)
-                tmp_lag = add(t0_min, 5, pOverflow);
-            if (sub(sub(t0_max, tmp_lag, pOverflow), 4, pOverflow) > 0)
-                tmp_lag = sub(t0_max, 4, pOverflow);
+            if ((tmp_lag - t0_min) > 5)
+            {
+                tmp_lag = t0_min + 5;
+            }
+            if ((t0_max - tmp_lag) > 4)
+            {
+                tmp_lag = t0_max - 4;
+            }
 
             if ((lag == tmp_lag) || (lag == (tmp_lag - 1)))
             {
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.h
index 5e87cc9..f48d171 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_fr.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/pitch_fr.h
-
-     Date: 02/04/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: pitch_fr.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp
index 70f00ba..d8efa1e 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.cpp
@@ -31,7 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/pitch_ol.c
+ Filename: pitch_ol.cpp
  Funtions: Pitch_ol
            Lag_max
 
@@ -266,22 +266,6 @@ static Word16 Lag_max ( // o   : lag found
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -582,22 +566,6 @@ static Word16 Lag_max(  /* o   : lag found                               */
 #endif
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -913,22 +881,6 @@ Word16 Pitch_ol (      // o   : open loop pitch lag
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1167,7 +1119,7 @@ Word16 Pitch_ol(       /* o   : open loop pitch lag                         */
      * Compare the 3 sections maximum, and favor small lag.               *
      *--------------------------------------------------------------------*/
 
-    i =  mult(max1, THRESHOLD, pOverflow);
+    i = (Word16)(((Word32)max1 * THRESHOLD) >> 15);
 
     if (i < max2)
     {
@@ -1183,7 +1135,8 @@ Word16 Pitch_ol(       /* o   : open loop pitch lag                         */
 #endif
     }
 
-    i =  mult(max1, THRESHOLD, pOverflow);
+    i = (Word16)(((Word32)max1 * THRESHOLD) >> 15);
+
 
     if (i < max3)
     {
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.h
index df7f307..9b25895 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pitch_ol.h
@@ -31,16 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/pitch_ol.h
-
-     Date: 02/06/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: pitch_ol.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.cpp
index 02544cf..b0fcf75 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.cpp
@@ -31,20 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/pre_big.c
- Functions:
-
-     Date: 02/04/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: pre_big.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -133,22 +120,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -185,7 +156,7 @@ void pre_big(
 
     if (frameOffset > 0)
     {
-        aOffset = 2 * MP1;
+        aOffset = MP1 << 1;
     }
     else
     {
@@ -201,9 +172,9 @@ void pre_big(
 
         Syn_filt(Ap2, &wsp[frameOffset], &wsp[frameOffset], L_SUBFR, mem_w, 1);
 
-        aOffset = add(aOffset, MP1, pOverflow);
+        aOffset += MP1;
 
-        frameOffset = add(frameOffset, L_SUBFR, pOverflow);
+        frameOffset += L_SUBFR;
     }
 
     return;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.h
index 6b47bfe..590750d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_big.h
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/pre_big.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: pre_big.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp
index 0526c0f..93d23b5 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/pre_proc.cpp
@@ -31,53 +31,12 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/pre_proc.c
+ Filename: pre_proc.cpp
  Funtions: Pre_Process_init
            Pre_Process_reset
            Pre_Process_exit
            Pre_Process
 
-     Date: 05/17/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Put the file into our template structure.
-
- Description: First pass optimization.
-
- Description: Made changes based on comments from review meeting.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Removed basic_op.h from the Include section. It is not used.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Fixed typecasting issue with TI C compiler.
-              2. Modified FOR loop to count down.
-              3. Cosmetic changes to the code to make address post-increment
-                 clearer.
-              4. Removed unnecessary typecasting in the multiply-accumulate
-                 portion of FOR loop body.
-              5. Removed "static" in table definitions.
-              6. Updated copyright year.
-
- Description:  For Pre_Process()
-              1. Replaced variables (containing filter coefficients) with
-                 constants, to avoid extra register swaping.
-              2. Changed to decrement loop
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -186,22 +145,6 @@ int Pre_Process_init (Pre_ProcessState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -294,22 +237,6 @@ int Pre_Process_reset (Pre_ProcessState *state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -390,22 +317,6 @@ void Pre_Process_exit (Pre_ProcessState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -508,22 +419,6 @@ int Pre_Process (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.cpp
index 9088f7d..198ea4f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.cpp
@@ -31,23 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/prm2bits.c
-
-     Date: 02/04/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Improved the code as per review comments.
-
- Description:  For Int2bin() and Prm2bits()
-              1. Eliminated unused include file typedef.h.
-              2. Replaced array addressing by pointers
-              3. Changed to decrement loops
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: prm2bits.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -57,7 +41,6 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 #include "prm2bits.h"
 #include "mode.h"
-#include "bitno_tab.h"
 
 
 /*----------------------------------------------------------------------------
@@ -150,22 +133,6 @@ static void Int2bin (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -261,22 +228,6 @@ void Prm2bits (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -289,17 +240,19 @@ void Prm2bits (
 void Prm2bits(
     enum Mode mode,    /* i : AMR mode                                      */
     Word16 prm[],      /* i : analysis parameters (size <= MAX_PRM_SIZE)    */
-    Word16 bits[]      /* o : serial bits         (size <= MAX_SERIAL_SIZE) */
+    Word16 bits[],      /* o : serial bits         (size <= MAX_SERIAL_SIZE) */
+    CommonAmrTbls* common_amr_tbls /* i : ptr to strcut of table ptrs        */
 )
 {
     Word16 i;
     const Word16 *p_mode;
     Word16 *p_prm;
+    const Word16* prmno_ptr = common_amr_tbls->prmno_ptr;
 
-    p_mode = &bitno[mode][0];
+    p_mode = &common_amr_tbls->bitno_ptr[mode][0];
     p_prm  = &prm[0];
 
-    for (i = prmno[mode]; i != 0; i--)
+    for (i = prmno_ptr[mode]; i != 0; i--)
     {
         Int2bin(*(p_prm++), *(p_mode), bits);
         bits += *(p_mode++);
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.h
index 8ad11a8..a515df2 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/prm2bits.h
@@ -51,6 +51,7 @@ terms listed above has been obtained from the copyright holder.
 */
 #include "typedef.h"
 #include "mode.h"
+#include "get_const_tbls.h"
 
 #ifdef __cplusplus
 extern "C"
@@ -71,7 +72,8 @@ extern "C"
     void Prm2bits(
         enum Mode mode,    /* i : AMR mode */
         Word16 prm[],      /* input : analysis parameters                       */
-        Word16 bits[]      /* output: serial bits                               */
+        Word16 bits[],      /* output: serial bits                              */
+        CommonAmrTbls* common_amr_tbls /* i : ptr to strcut of table ptrs       */
     );
 
 #ifdef __cplusplus
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.cpp
index c58b687..fcaf18a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.cpp
@@ -31,33 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/q_gain_c.c
+ Filename: q_gain_c.cpp
  Functions: q_gain_code
 
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description:
- (1) Removed optimization -- mult(i, 3, pOverflow) is NOT the same as adding
-     i to itself 3 times.  The reason is because the mult function does a
-     right shift by 15, which will obliterate smaller numbers.
-
- Description:
-              1. Eliminated unused include files.
-              2. Eliminated math operations that unnecessary checked for
-                 saturation by evaluating the operands
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -108,7 +84,6 @@ extern "C"
     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const Word16 qua_gain_code[NB_QUA_CODE*3];
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -166,22 +141,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -197,6 +156,7 @@ Word16 q_gain_code(         /* o  : quantization index,            Q0  */
     /*      (for MR122 MA predictor update)    */
     Word16 *qua_ener,       /* o  : quantized energy error,        Q10 */
     /*      (for other MA predictor update)    */
+    const Word16* qua_gain_code_ptr, /* i : ptr to read-only table           */
     Flag   *pOverflow
 )
 {
@@ -241,7 +201,7 @@ Word16 q_gain_code(         /* o  : quantization index,            Q0  */
      *                   Search for best quantizer                        *
      *-------------------------------------------------------------------*/
 
-    p = &qua_gain_code[0];
+    p = &qua_gain_code_ptr[0];
     err_min = ((Word32)gcode0 * *(p++)) >> 15;
     err_min =  g_q0 - err_min;
     if (err_min < 0)
@@ -273,7 +233,7 @@ Word16 q_gain_code(         /* o  : quantization index,            Q0  */
 
     temp = index + (index << 1);
 
-    p = &qua_gain_code[temp];
+    p = &qua_gain_code_ptr[temp];
 
     temp  = (gcode0 * *(p++)) >> 15;
     if (mode == MR122)
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.h
index 621143d..6482963 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_c.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/q_gain.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: q_gain_c.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -121,6 +109,7 @@ extern "C"
         /*      (for MR122 MA predictor update)    */
         Word16 *qua_ener,       /* o  : quantized energy error,        Q10 */
         /*      (for other MA predictor update)    */
+        const Word16* qua_gain_code_ptr, /* i : ptr to read-only table           */
         Flag   *pOverflow
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.cpp
index c1aff6b..7748115 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.cpp
@@ -31,23 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/q_gain_p.c
+ Filename: q_gain_p.cpp
  Functions: q_gain_pitch
 
-     Date: 02/04/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -97,7 +83,6 @@ extern "C"
     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const Word16 qua_gain_pitch[NB_QUA_PITCH];
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -154,22 +139,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -182,6 +151,7 @@ Word16 q_gain_pitch(    /* Return index of quantization                      */
     Word16 *gain,       /* i/o: Pitch gain (unquant/quant),              Q14 */
     Word16 gain_cand[], /* o  : pitch gain candidates (3),   MR795 only, Q14 */
     Word16 gain_cind[], /* o  : pitch gain cand. indices (3),MR795 only, Q0  */
+    const Word16* qua_gain_pitch_ptr, /* i : ptr to read-only table          */
     Flag   *pOverflow
 )
 {
@@ -190,16 +160,16 @@ Word16 q_gain_pitch(    /* Return index of quantization                      */
     Word16 err;
     Word16 err_min;
 
-    err_min = sub(*gain, qua_gain_pitch[0], pOverflow);
+    err_min = sub(*gain, qua_gain_pitch_ptr[0], pOverflow);
     err_min = abs_s(err_min);
 
     index = 0;
 
     for (i = 1; i < NB_QUA_PITCH; i++)
     {
-        if (qua_gain_pitch[i] <= gp_limit)
+        if (qua_gain_pitch_ptr[i] <= gp_limit)
         {
-            err = sub(*gain, qua_gain_pitch[i], pOverflow);
+            err = sub(*gain, qua_gain_pitch_ptr[i], pOverflow);
             err = abs_s(err);
 
             if (err < err_min)
@@ -226,7 +196,7 @@ Word16 q_gain_pitch(    /* Return index of quantization                      */
         else
         {
             if (index == (NB_QUA_PITCH - 1) ||
-                    (qua_gain_pitch[index+1] > gp_limit))
+                    (qua_gain_pitch_ptr[index+1] > gp_limit))
             {
                 ii = index - 2;
             }
@@ -240,12 +210,12 @@ Word16 q_gain_pitch(    /* Return index of quantization                      */
         for (i = 0; i < 3; i++)
         {
             gain_cind[i] = ii;
-            gain_cand[i] = qua_gain_pitch[ii];
+            gain_cand[i] = qua_gain_pitch_ptr[ii];
 
-            ii = add(ii, 1, pOverflow);
+            ii += 1;
         }
 
-        *gain = qua_gain_pitch[index];
+        *gain = qua_gain_pitch_ptr[index];
     }
     else
     {
@@ -256,11 +226,11 @@ Word16 q_gain_pitch(    /* Return index of quantization                      */
         if (mode == MR122)
         {
             /* clear 2 LSBits */
-            *gain = qua_gain_pitch[index] & 0xFFFC;
+            *gain = qua_gain_pitch_ptr[index] & 0xFFFC;
         }
         else
         {
-            *gain = qua_gain_pitch[index];
+            *gain = qua_gain_pitch_ptr[index];
         }
     }
     return index;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.h
index 233ccb0..ceaaa9b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/q_gain_p.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/q_gain_p.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: q_gain_p.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -110,6 +98,7 @@ extern "C"
         Word16 *gain,       /* i/o: Pitch gain (unquant/quant),              Q14 */
         Word16 gain_cand[], /* o  : pitch gain candidates (3),   MR795 only, Q14 */
         Word16 gain_cind[], /* o  : pitch gain cand. indices (3),MR795 only, Q0  */
+        const Word16* qua_gain_pitch_ptr, /* i : ptr to read-only table          */
         Flag   *pOverflow
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.cpp
index f8da589..e5af47f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.cpp
@@ -31,7 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/qgain475.c
+ Filename: qgain475.cpp
  Funtions: MR475_quant_store_results
            MR475_update_unq_pred
            MR475_gain_quant
@@ -449,22 +449,6 @@ static void MR475_quant_store_results(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -668,22 +652,6 @@ MR475_update_unq_pred(
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1121,22 +1089,6 @@ MR475_gain_quant(              // o  : index of quantization.
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.h
index 45682d5..0dd3f46 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain475.h
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm-amr/c/include/qgain475.h
-
-     Date: 01/04/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template and copied #defines from qgain475.c file.
-
- Description: Changed to include pOverflow as a function parameter for all
- functions in qgain475.c
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: qgain475.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -55,8 +41,8 @@ terms listed above has been obtained from the copyright holder.
 
 ------------------------------------------------------------------------------
 */
-#ifndef	_QGAIN475_H_
-#define	_QGAIN475_H_
+#ifndef _QGAIN475_H_
+#define _QGAIN475_H_
 #define qgain475_h "$Id $"
 
 /*----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.cpp
index d09fbe3..9bd4952 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.cpp
@@ -31,36 +31,11 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/qgain795.c
+ Filename: qgain795.cpp
  Functions: MR795_gain_code_quant3
             MR795_gain_code_quant_mod
             MR795_gain_quant
 
-     Date: 02/04/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description:
- (1) Removed optimization -- mult(i, 3, pOverflow) is NOT the same as adding
-     i to itself 3 times.  The reason is because the mult function does a
-     right shift by 15, which will obliterate smaller numbers.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -115,8 +90,6 @@ extern "C"
     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const Word16 qua_gain_code[NB_QUA_CODE*3];
-
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -180,22 +153,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -219,6 +176,7 @@ MR795_gain_code_quant3(
     /*      (for MR122 MA predictor update)   */
     Word16 *qua_ener,         /* o  : quantized energy error,       Q10 */
     /*      (for other MA predictor update)   */
+    const Word16* qua_gain_code_ptr, /* i : ptr to read-only table      */
     Flag   *pOverflow         /* o  : overflow indicator                */
 )
 {
@@ -255,14 +213,14 @@ MR795_gain_code_quant3(
      */
 
     /* determine the scaling exponent for g_code: ec = ec0 - 10 */
-    exp_code = sub(exp_gcode0, 10, pOverflow);
+    exp_code = exp_gcode0 - 10;
 
     /* calculate exp_max[i] = s[i]-1 */
-    exp_max[0] = sub(exp_coeff[0], 13, pOverflow);
-    exp_max[1] = sub(exp_coeff[1], 14, pOverflow);
-    exp_max[2] = add(exp_coeff[2], add(15, shl(exp_code, 1, pOverflow), pOverflow), pOverflow);
-    exp_max[3] = add(exp_coeff[3], exp_code, pOverflow);
-    exp_max[4] = add(exp_coeff[4], add(exp_code, 1, pOverflow), pOverflow);
+    exp_max[0] = exp_coeff[0] - 13;
+    exp_max[1] = exp_coeff[1] - 14;
+    exp_max[2] = exp_coeff[2] + shl(exp_code, 1, pOverflow) + 15;
+    exp_max[3] = exp_coeff[3] + exp_code;
+    exp_max[4] = exp_coeff[4] + (exp_code + 1);
 
 
     /*-------------------------------------------------------------------*
@@ -288,12 +246,12 @@ MR795_gain_code_quant3(
         }
     }
 
-    e_max = add(e_max, 1, pOverflow);      /* To avoid overflow */
+    e_max = add_16(e_max, 1, pOverflow);      /* To avoid overflow */
 
     for (i = 0; i < 5; i++)
     {
-        j = sub(e_max, exp_max[i], pOverflow);
-        L_tmp = L_deposit_h(frac_coeff[i]);
+        j = e_max - exp_max[i];
+        L_tmp = ((Word32)frac_coeff[i] << 16);
         L_tmp = L_shr(L_tmp, j, pOverflow);
         L_Extract(L_tmp, &coeff[i], &coeff_lo[i], pOverflow);
     }
@@ -325,7 +283,7 @@ MR795_gain_code_quant3(
         L_tmp0 = Mpy_32_16(coeff[0], coeff_lo[0], g2_pitch, pOverflow);
         L_tmp0 = Mac_32_16(L_tmp0, coeff[1], coeff_lo[1], g_pitch, pOverflow);
 
-        p = &qua_gain_code[0];
+        p = &qua_gain_code_ptr[0];
         for (i = 0; i < NB_QUA_CODE; i++)
         {
             g_code = *p++;                   /* this is g_fac        Q11 */
@@ -365,8 +323,7 @@ MR795_gain_code_quant3(
      *------------------------------------------------------------------*/
 
     /* Read the quantized gains */
-    p = &qua_gain_code[
-            add(add(cod_ind, cod_ind, pOverflow), cod_ind, pOverflow)];
+    p = &qua_gain_code_ptr[(cod_ind<<2) - cod_ind];
 
     g_code = *p++;
     *qua_ener_MR122 = *p++;
@@ -380,8 +337,8 @@ MR795_gain_code_quant3(
      *------------------------------------------------------------------*/
 
     L_tmp = L_mult(g_code, gcode0, pOverflow);
-    L_tmp = L_shr(L_tmp, sub(9, exp_gcode0, pOverflow), pOverflow);
-    *gain_cod = extract_h(L_tmp);
+    L_tmp = L_shr(L_tmp, 9 - exp_gcode0, pOverflow);
+    *gain_cod = (Word16)(L_tmp >> 16);
     *gain_cod_ind = cod_ind;
     *gain_pit = g_pitch_cand[pit_ind];
     *gain_pit_ind = g_pitch_cind[pit_ind];
@@ -449,22 +406,6 @@ MR795_gain_code_quant3(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -488,6 +429,7 @@ MR795_gain_code_quant_mod(  /* o  : index of quantization.            */
     /*      (for MR122 MA predictor update)   */
     Word16 *qua_ener,       /* o  : quantized energy error,       Q10 */
     /*      (for other MA predictor update)   */
+    const Word16* qua_gain_code_ptr, /* i : ptr to read-only ptr      */
     Flag   *pOverflow       /* o  : overflow indicator                */
 )
 {
@@ -553,36 +495,36 @@ MR795_gain_code_quant_mod(  /* o  : index of quantization.            */
     /*
      * calculate scalings of the constant terms
      */
-    gain_code = shl(*gain_cod, sub(10, exp_gcode0, pOverflow), pOverflow);   /* Q1  -> Q11 (-ec0) */
+    gain_code = shl(*gain_cod, (10 - exp_gcode0), pOverflow);   /* Q1  -> Q11 (-ec0) */
     g2_pitch = mult(gain_pit, gain_pit, pOverflow);               /* Q14 -> Q13        */
     /* 0 < alpha <= 0.5 => 0.5 <= 1-alpha < 1, i.e one_alpha is normalized  */
-    one_alpha = add(sub(32767, alpha, pOverflow), 1, pOverflow);   /* 32768 - alpha */
+    one_alpha = add_16((32767 - alpha), 1, pOverflow);   /* 32768 - alpha */
 
 
     /*  alpha <= 0.5 -> mult. by 2 to keep precision; compensate in exponent */
     L_t1 = L_mult(alpha, frac_en[1], pOverflow);
     L_t1 = L_shl(L_t1, 1, pOverflow);
-    tmp = extract_h(L_t1);
+    tmp = (Word16)(L_t1 >> 16);
 
     /* directly store in 32 bit variable because no further mult. required */
     L_t1 = L_mult(tmp, g2_pitch, pOverflow);
-    exp_coeff[1] = sub(exp_en[1], 15, pOverflow);
+    exp_coeff[1] = exp_en[1] - 15;
 
 
-    tmp = extract_h(L_shl(L_mult(alpha, frac_en[2], pOverflow), 1, pOverflow));
+    tmp = (Word16)(L_shl(L_mult(alpha, frac_en[2], pOverflow), 1, pOverflow) >> 16);
     coeff[2] = mult(tmp, gain_pit, pOverflow);
-    exp = sub(exp_gcode0, 10, pOverflow);
-    exp_coeff[2] = add(exp_en[2], exp, pOverflow);
+    exp = exp_gcode0 - 10;
+    exp_coeff[2] = add_16(exp_en[2], exp, pOverflow);
 
 
     /* alpha <= 0.5 -> mult. by 2 to keep precision; compensate in exponent */
-    coeff[3] = extract_h(L_shl(L_mult(alpha, frac_en[3], pOverflow), 1, pOverflow));
-    exp = sub(shl(exp_gcode0, 1, pOverflow), 7, pOverflow);
-    exp_coeff[3] = add(exp_en[3], exp, pOverflow);
+    coeff[3] = (Word16)(L_shl(L_mult(alpha, frac_en[3], pOverflow), 1, pOverflow) >> 16);
+    exp = shl(exp_gcode0, 1, pOverflow) - 7;
+    exp_coeff[3] = add_16(exp_en[3], exp, pOverflow);
 
 
     coeff[4] = mult(one_alpha, frac_en[3], pOverflow);
-    exp_coeff[4] = add(exp_coeff[3], 1, pOverflow);
+    exp_coeff[4] = add_16(exp_coeff[3], 1, pOverflow);
 
 
     L_tmp = L_mult(alpha, frac_en[0], pOverflow);
@@ -591,8 +533,8 @@ MR795_gain_code_quant_mod(  /* o  : index of quantization.            */
        exp_coeff holds 2*exponent for c[0]            */
     /* directly store in 32 bit variable because no further mult. required */
     L_t0 = sqrt_l_exp(L_tmp, &exp, pOverflow);  /* normalization included in sqrt_l_exp */
-    exp = add(exp, 47, pOverflow);
-    exp_coeff[0] = sub(exp_en[0], exp, pOverflow);
+    exp += 47;
+    exp_coeff[0] = exp_en[0] - exp;
 
     /*
      * Determine the maximum exponent occuring in the distance calculation
@@ -601,7 +543,7 @@ MR795_gain_code_quant_mod(  /* o  : index of quantization.            */
      */
 
     /* find max(e[1..4],e[0]+31) */
-    e_max = add(exp_coeff[0], 31, pOverflow);
+    e_max = exp_coeff[0] + 31;
     for (i = 1; i <= 4; i++)
     {
         if (exp_coeff[i] > e_max)
@@ -611,21 +553,21 @@ MR795_gain_code_quant_mod(  /* o  : index of quantization.            */
     }
 
     /* scale c[1]         (requires no further multiplication) */
-    tmp = sub(e_max, exp_coeff[1], pOverflow);
+    tmp = e_max - exp_coeff[1];
     L_t1 = L_shr(L_t1, tmp, pOverflow);
 
     /* scale c[2..4] (used in Mpy_32_16 in the quantizer loop) */
     for (i = 2; i <= 4; i++)
     {
-        tmp = sub(e_max, exp_coeff[i], pOverflow);
-        L_tmp = L_deposit_h(coeff[i]);
+        tmp = e_max - exp_coeff[i];
+        L_tmp = ((Word32)coeff[i] << 16);
         L_tmp = L_shr(L_tmp, tmp, pOverflow);
         L_Extract(L_tmp, &coeff[i], &coeff_lo[i], pOverflow);
     }
 
     /* scale c[0]         (requires no further multiplication) */
-    exp = sub(e_max, 31, pOverflow);              /* new exponent */
-    tmp = sub(exp, exp_coeff[0], pOverflow);
+    exp = e_max - 31;              /* new exponent */
+    tmp = exp - exp_coeff[0];
     L_t0 = L_shr(L_t0, shr(tmp, 1, pOverflow), pOverflow);
     /* perform correction by 1/sqrt(2) if exponent difference is odd */
     if ((tmp & 0x1) != 0)
@@ -639,7 +581,7 @@ MR795_gain_code_quant_mod(  /* o  : index of quantization.            */
        of the search criterion                           */
     dist_min = MAX_32;
     index = 0;
-    p = &qua_gain_code[0];
+    p = &qua_gain_code_ptr[0];
 
     for (i = 0; i < NB_QUA_CODE; i++)
     {
@@ -692,7 +634,7 @@ MR795_gain_code_quant_mod(  /* o  : index of quantization.            */
      *------------------------------------------------------------------*/
 
     /* Read the quantized gains */
-    p = &qua_gain_code[add(add(index, index, pOverflow), index, pOverflow)];
+    p = &qua_gain_code_ptr[(index<<2) - index];
     g_code = *p++;
     *qua_ener_MR122 = *p++;
     *qua_ener = *p;
@@ -705,8 +647,8 @@ MR795_gain_code_quant_mod(  /* o  : index of quantization.            */
      *------------------------------------------------------------------*/
 
     L_tmp = L_mult(g_code, gcode0, pOverflow);
-    L_tmp = L_shr(L_tmp, sub(9, exp_gcode0, pOverflow), pOverflow);
-    *gain_cod = extract_h(L_tmp);
+    L_tmp = L_shr(L_tmp, 9 - exp_gcode0, pOverflow);
+    *gain_cod = (Word16)(L_tmp >> 16);
 
     return index;
 }
@@ -782,22 +724,6 @@ MR795_gain_quant(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -829,6 +755,7 @@ MR795_gain_quant(
     /*      (for other MA predictor update)    */
     Word16 **anap,            /* o  : Index of quantization              */
     /*      (first gain pitch, then code pitch)*/
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs   */
     Flag   *pOverflow         /* o  : overflow indicator                */
 )
 {
@@ -847,7 +774,7 @@ MR795_gain_quant(
      * and corresponding quantization indices
      */
     gain_pit_index = q_gain_pitch(MR795, gp_limit, gain_pit,
-                                  g_pitch_cand, g_pitch_cind, pOverflow);
+                                  g_pitch_cand, g_pitch_cind, common_amr_tbls->qua_gain_pitch_ptr, pOverflow);
 
     /*-------------------------------------------------------------------*
      *  predicted codebook gain                                          *
@@ -866,7 +793,7 @@ MR795_gain_quant(
         exp_gcode0, gcode0, g_pitch_cand, g_pitch_cind,
         frac_coeff, exp_coeff,
         gain_pit, &gain_pit_index, gain_cod, &gain_cod_index,
-        qua_ener_MR122, qua_ener, pOverflow);
+        qua_ener_MR122, qua_ener, common_amr_tbls->qua_gain_code_ptr, pOverflow);
 
     /* calculation of energy coefficients and LTP coding gain */
     calc_unfilt_energies(res, exc, code, *gain_pit, L_subfr,
@@ -889,14 +816,15 @@ MR795_gain_quant(
         exp_en[3] = exp_code_en;
 
         /* store optimum codebook gain in Q(10-exp_gcode0) */
-        exp = add(sub(cod_gain_exp, exp_gcode0, pOverflow), 10, pOverflow);
+        exp = sub(cod_gain_exp, exp_gcode0, pOverflow) + 10;
         gain_cod_unq = shl(cod_gain_frac, exp, pOverflow);
 
         /* run quantization with modified criterion */
         gain_cod_index = MR795_gain_code_quant_mod(
                              *gain_pit, exp_gcode0, gcode0,
                              frac_en, exp_en, alpha, gain_cod_unq,
-                             gain_cod, qua_ener_MR122, qua_ener, pOverflow); /* function result */
+                             gain_cod, qua_ener_MR122, qua_ener, common_amr_tbls->qua_gain_code_ptr,
+                             pOverflow); /* function result */
     }
 
     *(*anap)++ = gain_pit_index;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.h
index b739dad..a4d9a5a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qgain795.h
@@ -31,19 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/qgain795.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: qgain795.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -65,6 +53,7 @@ terms listed above has been obtained from the copyright holder.
 ----------------------------------------------------------------------------*/
 #include "typedef.h"
 #include "g_adapt.h"
+#include "get_const_tbls.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -128,6 +117,7 @@ extern "C"
         /*      (for other MA predictor update)    */
         Word16 **anap,            /* o  : Index of quantization              */
         /*      (first gain pitch, then code pitch)*/
+        CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs   */
         Flag   *pOverflow         /* o  : overflow indicator                 */
     );
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qua_gain.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qua_gain.cpp
index 740abcb..5a4e1c8 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qua_gain.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/qua_gain.cpp
@@ -31,27 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/qua_gain.c
- Functions:
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description: Changed include files to lowercase.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Added #ifdef __cplusplus around extern'ed table.
-
- Description:
+ Filename: qua_gain.cpp
 
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
@@ -103,8 +83,6 @@ extern "C"
     ; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
     ; Declare variables used in this module but defined elsewhere
     ----------------------------------------------------------------------------*/
-    extern const Word16 table_gain_lowrates[];
-    extern const Word16 table_gain_highrates[];
 
     /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -166,22 +144,6 @@ extern "C"
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -205,6 +167,7 @@ Qua_gain(                   /* o  : index of quantization.                 */
     /*      (for MR122 MA predictor update)        */
     Word16 *qua_ener,       /* o  : quantized energy error,            Q10 */
     /*      (for other MA predictor update)        */
+    CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of tables ptrs    */
     Flag   *pOverflow       /* o  : overflow indicator                     */
 )
 {
@@ -233,12 +196,12 @@ Qua_gain(                   /* o  : index of quantization.                 */
     if (mode == MR102 || mode == MR74 || mode == MR67)
     {
         table_len = VQ_SIZE_HIGHRATES;
-        table_gain = table_gain_highrates;
+        table_gain = common_amr_tbls->table_gain_highrates_ptr;
     }
     else
     {
         table_len = VQ_SIZE_LOWRATES;
-        table_gain = table_gain_lowrates;
+        table_gain = common_amr_tbls->table_gain_lowrates_ptr;
     }
 
     /*-------------------------------------------------------------------*
@@ -268,20 +231,20 @@ Qua_gain(                   /* o  : index of quantization.                 */
      */
 
     /* determine the scaling exponent for g_code: ec = ec0 - 11 */
-    exp_code = sub(exp_gcode0, 11, pOverflow);
+    exp_code = exp_gcode0 - 11;
 
     /* calculate exp_max[i] = s[i]-1 */
-    exp_max[0] = sub(exp_coeff[0], 13, pOverflow);
-    exp_max[1] = sub(exp_coeff[1], 14, pOverflow);
+    exp_max[0] = exp_coeff[0] - 13;
+    exp_max[1] = exp_coeff[1] - 14;
 
     temp = shl(exp_code, 1, pOverflow);
-    temp = add(15, temp, pOverflow);
-    exp_max[2] = add(exp_coeff[2], temp, pOverflow);
+    temp += 15;
+    exp_max[2] = add_16(exp_coeff[2], temp, pOverflow);
 
-    exp_max[3] = add(exp_coeff[3], exp_code, pOverflow);
+    exp_max[3] = add_16(exp_coeff[3], exp_code, pOverflow);
 
-    temp = add(1, exp_code, pOverflow);
-    exp_max[4] = add(exp_coeff[4], temp, pOverflow);
+    temp = exp_code + 1;
+    exp_max[4] = add_16(exp_coeff[4], temp, pOverflow);
 
 
     /*-------------------------------------------------------------------*
@@ -307,12 +270,12 @@ Qua_gain(                   /* o  : index of quantization.                 */
         }
     }
 
-    e_max = add(e_max, 1, pOverflow);      /* To avoid overflow */
+    e_max++;
 
     for (i = 0; i < 5; i++)
     {
-        j = sub(e_max, exp_max[i], pOverflow);
-        L_tmp = L_deposit_h(frac_coeff[i]);
+        j = e_max - exp_max[i];
+        L_tmp = ((Word32)frac_coeff[i] << 16);
         L_tmp = L_shr(L_tmp, j, pOverflow);
         L_Extract(L_tmp, &coeff[i], &coeff_lo[i], pOverflow);
     }
@@ -391,10 +354,10 @@ Qua_gain(                   /* o  : index of quantization.                 */
      *------------------------------------------------------------------*/
 
     L_tmp = L_mult(g_code, gcode0, pOverflow);
-    temp  = sub(10, exp_gcode0, pOverflow);
+    temp  = 10 - exp_gcode0;
     L_tmp = L_shr(L_tmp, temp, pOverflow);
 
-    *gain_cod = extract_h(L_tmp);
+    *gain_cod = (Word16)(L_tmp >> 16);
 
     return index;
 }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/r_fft.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/r_fft.cpp
new file mode 100644
index 0000000..4675959
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/r_fft.cpp
@@ -0,0 +1,560 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+
+ Filename: r_fft.cpp
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+#include "typedef.h"
+#include "basic_op.h"
+#include "vad2.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+#define         SIZE            128
+#define         SIZE_BY_TWO     64
+#define         NUM_STAGE       6
+#define         TRUE            1
+#define         FALSE           0
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL STORE/BUFFER/POINTER DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+const Word16 phs_tbl[] =
+{
+
+    32767,       0,  32729,  -1608,  32610,  -3212,  32413,  -4808,
+    32138,   -6393,  31786,  -7962,  31357,  -9512,  30853, -11039,
+    30274,  -12540,  29622, -14010,  28899, -15447,  28106, -16846,
+    27246,  -18205,  26320, -19520,  25330, -20788,  24279, -22006,
+    23170,  -23170,  22006, -24279,  20788, -25330,  19520, -26320,
+    18205,  -27246,  16846, -28106,  15447, -28899,  14010, -29622,
+    12540,  -30274,  11039, -30853,   9512, -31357,   7962, -31786,
+    6393,  -32138,   4808, -32413,   3212, -32610,   1608, -32729,
+    0,  -32768,  -1608, -32729,  -3212, -32610,  -4808, -32413,
+    -6393, -32138,  -7962, -31786,  -9512, -31357, -11039, -30853,
+    -12540, -30274, -14010, -29622, -15447, -28899, -16846, -28106,
+    -18205, -27246, -19520, -26320, -20788, -25330, -22006, -24279,
+    -23170, -23170, -24279, -22006, -25330, -20788, -26320, -19520,
+    -27246, -18205, -28106, -16846, -28899, -15447, -29622, -14010,
+    -30274, -12540, -30853, -11039, -31357,  -9512, -31786,  -7962,
+    -32138,  -6393, -32413,  -4808, -32610,  -3212, -32729,  -1608
+
+};
+
+const Word16 ii_table[] =
+    {SIZE / 2, SIZE / 4, SIZE / 8, SIZE / 16, SIZE / 32, SIZE / 64};
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: c_fft
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    farray_ptr = pointer to complex array that the FFT operates on of type
+                 Word16.
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow = 1 if the math functions called by cor_h_x2 result in overflow
+    else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This is an implementation of decimation-in-time FFT algorithm for
+ real sequences.  The techniques used here can be found in several
+ books, e.g., i) Proakis and Manolakis, "Digital Signal Processing",
+ 2nd Edition, Chapter 9, and ii) W.H. Press et. al., "Numerical
+ Recipes in C", 2nd Ediiton, Chapter 12.
+
+ Input -  There is one input to this function:
+
+   1) An integer pointer to the input data array
+
+ Output - There is no return value.
+   The input data are replaced with transformed data.  If the
+   input is a real time domain sequence, it is replaced with
+   the complex FFT for positive frequencies.  The FFT value
+   for DC and the foldover frequency are combined to form the
+   first complex number in the array.  The remaining complex
+   numbers correspond to increasing frequencies.  If the input
+   is a complex frequency domain sequence arranged as above,
+   it is replaced with the corresponding time domain sequence.
+
+ Notes:
+
+   1) This function is designed to be a part of a VAD
+      algorithm that requires 128-point FFT of real
+      sequences.  This is achieved here through a 64-point
+      complex FFT.  Consequently, the FFT size information is
+      not transmitted explicitly.  However, some flexibility
+      is provided in the function to change the size of the
+      FFT by specifying the size information through "define"
+      statements.
+
+   2) The values of the complex sinusoids used in the FFT
+      algorithm are stored in a ROM table.
+
+   3) In the c_fft function, the FFT values are divided by
+      2 after each stage of computation thus dividing the
+      final FFT values by 64.  This is somewhat different
+          from the usual definition of FFT where the factor 1/N,
+          i.e., 1/64, used for the IFFT and not the FFT.  No factor
+          is used in the r_fft function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ r_fft.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+The original etsi reference code uses a global flag Overflow. However, in the
+actual implementation a pointer to a the overflow flag is passed in.
+
+void c_fft(Word16 * farray_ptr)
+{
+    Word16 i, j, k, ii, jj, kk, ji, kj, ii2;
+    Word32 ftmp, ftmp_real, ftmp_imag;
+    Word16 tmp, tmp1, tmp2;
+
+    // Rearrange the input array in bit reversed order
+    for (i = 0, j = 0; i < SIZE - 2; i = i + 2)
+    {
+        if (sub(j, i) > 0)
+        {
+            ftmp = *(farray_ptr + i);
+            *(farray_ptr + i) = *(farray_ptr + j);
+            *(farray_ptr + j) = ftmp;
+
+            ftmp = *(farray_ptr + i + 1);
+            *(farray_ptr + i + 1) = *(farray_ptr + j + 1);
+            *(farray_ptr + j + 1) = ftmp;
+        }
+
+        k = SIZE_BY_TWO;
+        while (sub(j, k) >= 0)
+        {
+            j = sub(j, k);
+            k = shr(k, 1);
+        }
+        j = add(j, k);
+    }
+
+    // The FFT part
+    for (i = 0; i < NUM_STAGE; i++)
+    {               // i is stage counter
+        jj = shl(2, i);     // FFT size
+        kk = shl(jj, 1);    // 2 * FFT size
+        ii = ii_table[i];   // 2 * number of FFT's
+        ii2 = shl(ii, 1);
+        ji = 0;         // ji is phase table index
+
+        for (j = 0; j < jj; j = j + 2)
+        {                   // j is sample counter
+
+            for (k = j; k < SIZE; k = k + kk)
+            {               // k is butterfly top
+                kj = add(k, jj);    // kj is butterfly bottom
+
+                // Butterfly computations
+                ftmp_real = L_mult(*(farray_ptr + kj), phs_tbl[ji]);
+                ftmp_real = L_msu(ftmp_real, *(farray_ptr + kj + 1), phs_tbl[ji + 1]);
+
+                ftmp_imag = L_mult(*(farray_ptr + kj + 1), phs_tbl[ji]);
+                ftmp_imag = L_mac(ftmp_imag, *(farray_ptr + kj), phs_tbl[ji + 1]);
+
+                tmp1 = pv_round(ftmp_real);
+                tmp2 = pv_round(ftmp_imag);
+
+                tmp = sub(*(farray_ptr + k), tmp1);
+                *(farray_ptr + kj) = shr(tmp, 1);
+
+                tmp = sub(*(farray_ptr + k + 1), tmp2);
+                *(farray_ptr + kj + 1) = shr(tmp, 1);
+
+                tmp = add(*(farray_ptr + k), tmp1);
+                *(farray_ptr + k) = shr(tmp, 1);
+
+                tmp = add(*(farray_ptr + k + 1), tmp2);
+                *(farray_ptr + k + 1) = shr(tmp, 1);
+            }
+
+            ji =  add(ji, ii2);
+        }
+    }
+}                               // end of c_fft ()
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/* FFT function for complex sequences */
+/*
+ * The decimation-in-time complex FFT is implemented below.
+ * The input complex numbers are presented as real part followed by
+ * imaginary part for each sample.  The counters are therefore
+ * incremented by two to access the complex valued samples.
+ */
+
+void c_fft(Word16 * farray_ptr, Flag *pOverflow)
+{
+
+    Word16 i;
+    Word16 j;
+    Word16 k;
+    Word16 ii;
+    Word16 jj;
+    Word16 kk;
+    Word16 ji;
+    Word16 kj;
+    Word16 ii2;
+    Word32 ftmp;
+    Word32 ftmp_real;
+    Word32 ftmp_imag;
+    Word16 tmp;
+    Word16 tmp1;
+    Word16 tmp2;
+
+    /* Rearrange the input array in bit reversed order */
+    for (i = 0, j = 0; i < SIZE - 2; i = i + 2)
+    {
+        if (j > i)
+        {
+            ftmp = *(farray_ptr + i);
+            *(farray_ptr + i) = *(farray_ptr + j);
+            *(farray_ptr + j) = (Word16)ftmp;
+
+            ftmp = *(farray_ptr + i + 1);
+            *(farray_ptr + i + 1) = *(farray_ptr + j + 1);
+            *(farray_ptr + j + 1) = (Word16)ftmp;
+        }
+
+        k = SIZE_BY_TWO;
+        while (j >= k)
+        {
+            j = sub(j, k, pOverflow);
+            k = shr(k, 1, pOverflow);
+        }
+        j = add_16(j, k, pOverflow);
+    }
+
+    /* The FFT part */
+    for (i = 0; i < NUM_STAGE; i++)
+    {               /* i is stage counter */
+        jj = shl(2, i, pOverflow);     /* FFT size */
+        kk = shl(jj, 1, pOverflow);    /* 2 * FFT size */
+        ii = ii_table[i];   /* 2 * number of FFT's */
+        ii2 = shl(ii, 1, pOverflow);
+        ji = 0;         /* ji is phase table index */
+
+        for (j = 0; j < jj; j = j + 2)
+        {                   /* j is sample counter */
+
+            for (k = j; k < SIZE; k = k + kk)
+            {               /* k is butterfly top */
+                kj = add_16(k, jj, pOverflow);    /* kj is butterfly bottom */
+
+                /* Butterfly computations */
+                ftmp_real = L_mult(*(farray_ptr + kj), phs_tbl[ji], pOverflow);
+                ftmp_real = L_msu(ftmp_real, *(farray_ptr + kj + 1),
+                                  phs_tbl[ji + 1], pOverflow);
+
+                ftmp_imag = L_mult(*(farray_ptr + kj + 1),
+                                   phs_tbl[ji], pOverflow);
+                ftmp_imag = L_mac(ftmp_imag, *(farray_ptr + kj),
+                                  phs_tbl[ji + 1], pOverflow);
+
+                tmp1 = pv_round(ftmp_real, pOverflow);
+                tmp2 = pv_round(ftmp_imag, pOverflow);
+
+                tmp = sub(*(farray_ptr + k), tmp1, pOverflow);
+                *(farray_ptr + kj) = shr(tmp, 1, pOverflow);
+
+                tmp = sub(*(farray_ptr + k + 1), tmp2, pOverflow);
+                *(farray_ptr + kj + 1) = shr(tmp, 1, pOverflow);
+
+                tmp = add_16(*(farray_ptr + k), tmp1, pOverflow);
+                *(farray_ptr + k) = shr(tmp, 1, pOverflow);
+
+                tmp = add_16(*(farray_ptr + k + 1), tmp2, pOverflow);
+                *(farray_ptr + k + 1) = shr(tmp, 1, pOverflow);
+            }
+
+            ji =  add_16(ji, ii2, pOverflow);
+        }
+    }
+}                               /* end of c_fft () */
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: r_fft
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    farray_ptr = pointer to complex array that the FFT operates on of type
+                 Word16.
+    pOverflow = pointer to overflow (Flag)
+
+ Outputs:
+    pOverflow = 1 if the math functions called by cor_h_x2 result in overflow
+    else zero.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This is an implementation of decimation-in-time FFT algorithm for
+ real sequences.  The techniques used here can be found in several
+ books, e.g., i) Proakis and Manolakis, "Digital Signal Processing",
+ 2nd Edition, Chapter 9, and ii) W.H. Press et. al., "Numerical
+ Recipes in C", 2nd Ediiton, Chapter 12.
+
+ Input -  There is one input to this function:
+
+   1) An integer pointer to the input data array
+
+ Output - There is no return value.
+   The input data are replaced with transformed data.  If the
+   input is a real time domain sequence, it is replaced with
+   the complex FFT for positive frequencies.  The FFT value
+   for DC and the foldover frequency are combined to form the
+   first complex number in the array.  The remaining complex
+   numbers correspond to increasing frequencies.  If the input
+   is a complex frequency domain sequence arranged as above,
+   it is replaced with the corresponding time domain sequence.
+
+ Notes:
+
+   1) This function is designed to be a part of a VAD
+      algorithm that requires 128-point FFT of real
+      sequences.  This is achieved here through a 64-point
+      complex FFT.  Consequently, the FFT size information is
+      not transmitted explicitly.  However, some flexibility
+      is provided in the function to change the size of the
+      FFT by specifying the size information through "define"
+      statements.
+
+   2) The values of the complex sinusoids used in the FFT
+      algorithm are stored in a ROM table.
+
+   3) In the c_fft function, the FFT values are divided by
+      2 after each stage of computation thus dividing the
+      final FFT values by 64.  This is somewhat different
+          from the usual definition of FFT where the factor 1/N,
+          i.e., 1/64, used for the IFFT and not the FFT.  No factor
+          is used in the r_fft function.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ r_fft.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+The original etsi reference code uses a global flag Overflow. However, in the
+actual implementation a pointer to a the overflow flag is passed in.
+
+void r_fft(Word16 * farray_ptr)
+{
+
+    Word16 ftmp1_real, ftmp1_imag, ftmp2_real, ftmp2_imag;
+    Word32 Lftmp1_real, Lftmp1_imag;
+    Word16 i, j;
+    Word32 Ltmp1;
+
+    // Perform the complex FFT
+    c_fft(farray_ptr);
+
+    // First, handle the DC and foldover frequencies
+    ftmp1_real = *farray_ptr;
+    ftmp2_real = *(farray_ptr + 1);
+    *farray_ptr = add(ftmp1_real, ftmp2_real);
+    *(farray_ptr + 1) = sub(ftmp1_real, ftmp2_real);
+
+    // Now, handle the remaining positive frequencies
+    for (i = 2, j = SIZE - i; i <= SIZE_BY_TWO; i = i + 2, j = SIZE - i)
+    {
+        ftmp1_real = add(*(farray_ptr + i), *(farray_ptr + j));
+        ftmp1_imag = sub(*(farray_ptr + i + 1), *(farray_ptr + j + 1));
+        ftmp2_real = add(*(farray_ptr + i + 1), *(farray_ptr + j + 1));
+        ftmp2_imag = sub(*(farray_ptr + j), *(farray_ptr + i));
+
+        Lftmp1_real = L_deposit_h(ftmp1_real);
+        Lftmp1_imag = L_deposit_h(ftmp1_imag);
+
+        Ltmp1 = L_mac(Lftmp1_real, ftmp2_real, phs_tbl[i]);
+        Ltmp1 = L_msu(Ltmp1, ftmp2_imag, phs_tbl[i + 1]);
+        *(farray_ptr + i) = pv_round(L_shr(Ltmp1, 1));
+
+        Ltmp1 = L_mac(Lftmp1_imag, ftmp2_imag, phs_tbl[i]);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_real, phs_tbl[i + 1]);
+        *(farray_ptr + i + 1) = pv_round(L_shr(Ltmp1, 1));
+
+        Ltmp1 = L_mac(Lftmp1_real, ftmp2_real, phs_tbl[j]);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_imag, phs_tbl[j + 1]);
+        *(farray_ptr + j) = pv_round(L_shr(Ltmp1, 1));
+
+        Ltmp1 = L_negate(Lftmp1_imag);
+        Ltmp1 = L_msu(Ltmp1, ftmp2_imag, phs_tbl[j]);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_real, phs_tbl[j + 1]);
+        *(farray_ptr + j + 1) = pv_round(L_shr(Ltmp1, 1));
+
+    }
+}                               // end r_fft ()
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+/* FFT function for complex sequences */
+/*
+ * The decimation-in-time complex FFT is implemented below.
+ * The input complex numbers are presented as real part followed by
+ * imaginary part for each sample.  The counters are therefore
+ * incremented by two to access the complex valued samples.
+ */
+void r_fft(Word16 * farray_ptr, Flag *pOverflow)
+{
+
+    Word16 ftmp1_real;
+    Word16 ftmp1_imag;
+    Word16 ftmp2_real;
+    Word16 ftmp2_imag;
+    Word32 Lftmp1_real;
+    Word32 Lftmp1_imag;
+    Word16 i;
+    Word16 j;
+    Word32 Ltmp1;
+
+    /* Perform the complex FFT */
+    c_fft(farray_ptr, pOverflow);
+
+    /* First, handle the DC and foldover frequencies */
+    ftmp1_real = *farray_ptr;
+    ftmp2_real = *(farray_ptr + 1);
+    *farray_ptr = add_16(ftmp1_real, ftmp2_real, pOverflow);
+    *(farray_ptr + 1) = sub(ftmp1_real, ftmp2_real, pOverflow);
+
+    /* Now, handle the remaining positive frequencies */
+    for (i = 2, j = SIZE - i; i <= SIZE_BY_TWO; i = i + 2, j = SIZE - i)
+    {
+        ftmp1_real = add_16(*(farray_ptr + i), *(farray_ptr + j), pOverflow);
+        ftmp1_imag = sub(*(farray_ptr + i + 1),
+                         *(farray_ptr + j + 1), pOverflow);
+        ftmp2_real = add_16(*(farray_ptr + i + 1),
+                            *(farray_ptr + j + 1), pOverflow);
+        ftmp2_imag = sub(*(farray_ptr + j),
+                         *(farray_ptr + i), pOverflow);
+
+        Lftmp1_real = ((Word32) ftmp1_real << 16);
+        Lftmp1_imag = ((Word32) ftmp1_imag << 16);
+
+        Ltmp1 = L_mac(Lftmp1_real, ftmp2_real, phs_tbl[i], pOverflow);
+        Ltmp1 = L_msu(Ltmp1, ftmp2_imag, phs_tbl[i + 1], pOverflow);
+        *(farray_ptr + i) = pv_round(L_shr(Ltmp1, 1, pOverflow), pOverflow);
+
+        Ltmp1 = L_mac(Lftmp1_imag, ftmp2_imag, phs_tbl[i], pOverflow);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_real, phs_tbl[i + 1], pOverflow);
+        *(farray_ptr + i + 1) = pv_round(L_shr(Ltmp1, 1, pOverflow), pOverflow);
+
+        Ltmp1 = L_mac(Lftmp1_real, ftmp2_real, phs_tbl[j], pOverflow);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_imag, phs_tbl[j + 1], pOverflow);
+        *(farray_ptr + j) = pv_round(L_shr(Ltmp1, 1, pOverflow), pOverflow);
+
+        Ltmp1 = L_negate(Lftmp1_imag);
+        Ltmp1 = L_msu(Ltmp1, ftmp2_imag, phs_tbl[j], pOverflow);
+        Ltmp1 = L_mac(Ltmp1, ftmp2_real, phs_tbl[j + 1], pOverflow);
+        *(farray_ptr + j + 1) = pv_round(L_shr(Ltmp1, 1, pOverflow), pOverflow);
+
+    }
+}                               /* end r_fft () */
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.cpp
index 117f78a..f8bf23f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.cpp
@@ -31,66 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/s10_8pf.c
+ Filename: s10_8pf.cpp
  Funtions: search_10and8i40
 
-     Date: 04/18/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Adding pOverflow to the functions to remove global variables.
-              These changes are needed for the EPOC releases. Cleaned up code.
-              Updated template.
-
- Description: Changed temp to temp32. When temp was only 16 bits it was not
-              holding the 32 bit value returned from the functions. Some
-              variables were also being declared as Word16 rather than Word32
-              as they were suposed to be.
-
- Description: Changed copyright year. Removed all calls to math functions by
-              inlining them, and removed all unnecessary files in the Include
-              section.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Removed all #defines.
-              2. Used a pointer to &codvec[0] instead of array indexing.
-              3. Removed multiple data casting in the code.
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers, this by taking
-                 advantage of the fact that the autocrrelation  matrix is
-                 a toeplitz matrix, so r[i][j] = r[j][i], then a single
-                 pointer can be used to address a matrix. The use of this
-                 is not uniform along the function (due to compiler limitations:
-                 handling so many variables in this file) so the use
-                 of this is pointer optimizations is limited to places
-                 where the ARM compiler provides the lesses numer of cycles
-              3. Eliminated use of intermediate variables to accelerate
-                 comparisons (like in the nested loops)
-              4. Introduced array temp1[], to pre-calculate the elements
-                 used in the nested loops, in this way the calculation is
-                 not repeated in every loop iteration. This is done for
-                 loops i3-i5-i7 and i9
-              5. Use array Index[] to store indexes i1:i9, and then use memcpy
-                 to update indexes.
-              6. Eliminated shifts by modifying the way number are rounded,
-                 this does not have any effect in ARM processors but may help
-                 other compilers
-
- Description:
-              1. When storing indexes, added memcpy() to support the rates
-                 that use this function: 12.2 (already done) and 10.2 (missing).
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:
-
 ------------------------------------------------------------------------------
 */
 
@@ -526,22 +469,6 @@ void search_10and8i40 (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.h
index fe98493..5e84b76 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/s10_8pf.h
@@ -31,26 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/s10_8pf.h
-
-
-
-
-     Date: 08/11/2000
-
-
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Changed function prototype; pointer to  overflow flag is passed
-			  in as a parameter. Updated template
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
-
+ Filename: s10_8pf.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -60,13 +41,13 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 */
 
-#ifndef	S10_8PF_H
-#define	S10_8PF_H
+#ifndef S10_8PF_H
+#define S10_8PF_H
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 #include    "cnst.h"
 
 /*--------------------------------------------------------------------------*/
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp
index dedf91a..8f3783c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.cpp
@@ -31,48 +31,10 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/set_sign.c
+ Filename: set_sign.cpp
  Funtions: set_sign
            set_sign12k2
 
-     Date: 05/26/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Placed into PV template and optimized.
-
- Description: Synchronized file with UMTS version 3.2.0. Updated coding
-              template. Removed unnecessary include files.
-
- Description: Replaced basic_op.h with the header files of the math functions
-              used in the file.
-
- Description: Made the following changes per comments from Phase 2/3 review:
-              1. Modified certain FOR loops to count down.
-              2. Modified code for further optimization.
-
- Description: Modified FOR loops in set_sign12k2 to count up. The FOR loops
-              affected are the loop that calculates the starting position of
-              each incoming pulse, and the loop that calculates the position
-              of the max correlation. Updated copyright year.
-
- Description: Passing in pointer to overflow flag for EPOC compatibility.
-
- Description:  For set_sign12k2()
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation, this by evaluating the operands
-              4. Replaced loop counter with decrement loops
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -220,22 +182,6 @@ void set_sign(Word16 dn[],    i/o : correlation between target and h[]
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -461,22 +407,6 @@ void set_sign12k2 (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.h
index d0de0a3..9ca482c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/set_sign.h
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/set_sign.h
-
-     Date: 08/11/2000
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description: Changed function prototype for set_sign12k2(); pointer to
-                overflow flag is passed in as a parameter.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
-
+ Filename: set_sign.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
@@ -56,13 +42,13 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
 */
 
-#ifndef	SET_SIGN_H
-#define	SET_SIGN_H "@(#)$Id $"
+#ifndef SET_SIGN_H
+#define SET_SIGN_H "@(#)$Id $"
 
 /*----------------------------------------------------------------------------
 ; INCLUDES
 ----------------------------------------------------------------------------*/
-#include	"basicop_malloc.h"
+#include    "basicop_malloc.h"
 
 /*--------------------------------------------------------------------------*/
 #ifdef __cplusplus
@@ -102,9 +88,9 @@ extern "C"
     ; Function Prototype declaration
     ----------------------------------------------------------------------------*/
     void set_sign(Word16 dn[],   /* i/o : correlation between target and h[]    */
-                  Word16 sign[], /* o   : sign of dn[]                          */
-                  Word16 dn2[],  /* o   : maximum of correlation in each track. */
-                  Word16 n       /* i   : # of maximum correlations in dn2[]    */
+    Word16 sign[], /* o   : sign of dn[]                          */
+    Word16 dn2[],  /* o   : maximum of correlation in each track. */
+    Word16 n       /* i   : # of maximum correlations in dn2[]    */
                  );
 
     void set_sign12k2(
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.cpp
index dd9e022..2981e7b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.cpp
@@ -31,29 +31,13 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm-amr/c/src/sid_sync.c
+ Filename: sid_sync.cpp
  Functions: sid_sync_init
             sid_sync_reset
             sid_sync_exit
             sid_sync_set_handover_debt
             sid_sync
 
-     Date: 03/13/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Changed type definition of state pointer to 'void' for
-              sid_sync_init, sid_sync_reset, sid_sync_exit, and sid_sync.
-              Updated to PV coding template.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -140,22 +124,6 @@ terms listed above has been obtained from the copyright holder.
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -233,22 +201,6 @@ Word16 sid_sync_init(void **state)
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -310,22 +262,6 @@ Word16 sid_sync_reset(void *st)
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -394,22 +330,6 @@ void sid_sync_exit(void **state)
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -470,22 +390,6 @@ void sid_sync_set_handover_debt(sid_syncState *st,
  PSEUDO-CODE
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.h
index c3cb1cf..e5c33cf 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sid_sync.h
@@ -31,20 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm-amr/c/include/sid_sync.h
-
-     Date: 03/13/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Added PV coding template sections to 3GPP version 3.2.0.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: sid_sync.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.cpp
index 124673f..7a7f368 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.cpp
@@ -31,31 +31,13 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/sp_enc.c
+ Filename: sp_enc.cpp
  Funtions: GSMInitEncode
            Speech_Encode_Frame_reset
            GSMEncodeFrameExit
            Speech_Encode_Frame_First
            GSMEncodeFrame
 
-     Date: 02/07/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Cleaned up INCLUDES. removed inclusion of basic_op.h and count.h.
-
-
- Description: Revert back to Speech_Encode_Frame_reset() and
-              Speech_Encode_Frame_First
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -189,22 +171,6 @@ int Speech_Encode_Frame_init (void **state_data,
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -315,22 +281,6 @@ int Speech_Encode_Frame_reset (void *state_data)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -424,22 +374,6 @@ void Speech_Encode_Frame_exit (void **state_data)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -541,22 +475,6 @@ int Speech_Encode_Frame_First (
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -689,22 +607,6 @@ int Speech_Encode_Frame (
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -747,7 +649,7 @@ void GSMEncodeFrame(
     cod_amr(st->cod_amr_state, mode, new_speech, prm, usedMode, syn);
 
     /* Parameters to serial bits */
-    Prm2bits(*usedMode, prm, &serial[0]);
+    Prm2bits(*usedMode, prm, &serial[0], &(st->cod_amr_state->common_amr_tbls));
 
     return;
 }
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.h
index 8eb2a9b..ba6abac 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/sp_enc.h
@@ -31,26 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/src/include/sp_enc.h
-
-     Date: 02/07/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template. Changed the function names of
-              Speech_Encode_Frame_reset and Speech_Encode_Frame_first to
-              GSMEncodeFrameReset and GSMEncodeFrameFirst respectively for
-              consistency.
-
- Description: Reverted back to old function names Speech_Encode_Frame_reset()
-              and Speech_Encode_Frame_First()
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: sp_enc.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.cpp
index 3ca6c23..ca827ae 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.cpp
@@ -31,28 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/spreproc.c
+ Filename: spreproc.cpp
  Functions: subframePreProc
 
-     Date: 02/06/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Eliminated unnecessary use of the sub() function.
-
- Description:
-              1. Replaced copy() and for-loop with more efficient memcpy().
-              2. Eliminated unused include file copy.h.
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -145,22 +126,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.h
index 77d35fc..ee283dc 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spreproc.h
@@ -31,20 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/spreproc.h
-
-     Date: 02/06/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: spreproc.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.cpp
index b9574aa..3e2c234 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.cpp
@@ -31,30 +31,9 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/spstproc.c
+ Filename: spstproc.cpp
  Functions: subframePostProc
 
-     Date: 02/06/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description:
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation
-              4. Replaced loop counter with decrement loops
-
- Description:  Added casting to eliminate warnings
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
-
 ------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
@@ -147,22 +126,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.h
index edc43e4..4c12279 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/spstproc.h
@@ -31,21 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/spstproc.h
-
-     Date: 02/06/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: spstproc.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.cpp
index ec20bf3..8418c70 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.cpp
@@ -31,29 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Pathname: ./audio/gsm-amr/c/src/ton_stab.c
- Funtions:
-
-     Date: 02/06/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  For check_lsp()
-              1. Eliminated unused include files.
-              2. Replaced array addressing by pointers
-              3. Eliminated math operations that unnecessary checked for
-                 saturation this by evaluating the operands
-               For update_gp_clipping()
-              1. Replaced copy() with more efficient memcpy()
-              2. Replaced right shift function with right shift
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description:
+ Filename: ton_stab.cpp
 
 ------------------------------------------------------------------------------
 */
@@ -158,22 +136,6 @@ int ton_stab_init (tonStabState **state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -263,22 +225,6 @@ int ton_stab_reset (tonStabState *st)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -295,7 +241,9 @@ Word16 ton_stab_reset(tonStabState *st)
 
     /* initialize tone stabilizer state */
     st->count = 0;
-    Set_zero(st->gp, N_FRAME);    /* Init Gp_Clipping */
+    /* Init Gp_Clipping */
+    oscl_memset((void *)st->gp,  0, N_FRAME*sizeof(*st->gp));
+
 
     return 0;
 }
@@ -355,22 +303,6 @@ void ton_stab_exit (tonStabState **state)
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -499,22 +431,6 @@ Word16 check_lsp(tonStabState *st, // i/o : State struct
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -664,22 +580,6 @@ Word16 check_gp_clipping(tonStabState *st, // i/o : State struct
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -697,7 +597,7 @@ Word16 check_gp_clipping(tonStabState *st, /* i/o : State struct            */
     sum = shr(g_pitch, 3, pOverflow);        /* Division by 8 */
     for (i = 0; i < N_FRAME; i++)
     {
-        sum = add(sum, st->gp[i], pOverflow);
+        sum = add_16(sum, st->gp[i], pOverflow);
     }
 
     if (sum > GP_CLIP)
@@ -762,22 +662,6 @@ void update_gp_clipping(tonStabState *st, // i/o : State struct
 }
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.h
index fb06e64..90e5378 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/ton_stab.h
@@ -31,18 +31,7 @@ terms listed above has been obtained from the copyright holder.
 
 
 
- Filename: /audio/gsm_amr/c/include/ton_stab.h
-
-     Date: 02/05/2002
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: ton_stab.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.cpp
similarity index 80%
copy from opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp
copy to opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.cpp
index 7597d22..d949b6c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/vad1.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.cpp
@@ -27,32 +27,10 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Pathname: ./audio/gsm-amr/c/src/vad1.c
+ Filename: vad1.cpp
  Functions:
 
 ------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Updated template used to PV coding template.
- Changed to accept the pOverflow flag for EPOC compatibility.
-
- Description: Made changes per review comments
- (1) Removed include of "count.h"
- (2) Replaced "basic_op.h" with individual include files
- (3) Removed some unnecessary instances of sub().
-
- Description:  Replaced OSCL mem type functions and eliminated include
-               files that now are chosen by OSCL definitions
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Changed round function name to pv_round to avoid conflict with
-              round function in C standard library.
-
- Who:                           Date:
- Description:
-
-------------------------------------------------------------------------------
  MODULE DESCRIPTION
 
 
@@ -138,22 +116,6 @@ terms listed above has been obtained from the copyright holder.
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -182,39 +144,51 @@ static void first_filter_stage(
 
     for (i = 0; i < FRAME_LEN / 4; i++)
     {
-        temp0 = mult(COEFF5_1, data0, pOverflow);
-        temp1 = shr(in[4*i+0], 2, pOverflow);
+//        temp0 = mult(COEFF5_1, data0, pOverflow);
+        temp0 = (Word16)(((Word32)COEFF5_1 * data0) >> 15);
+        temp1 = in[4*i+0] >> 2;
         temp0 = sub(temp1, temp0, pOverflow);
 
-        temp1 = mult(COEFF5_1, temp0, pOverflow);
-        temp1 = add(data0, temp1, pOverflow);
+//        temp1 = mult(COEFF5_1, temp0, pOverflow);
+        temp1 = (Word16)(((Word32)COEFF5_1 * temp0) >> 15);
+        temp1 = add_16(data0, temp1, pOverflow);
 
-        temp3 = mult(COEFF5_2, data1, pOverflow);
-        temp2 = shr(in[4*i+1], 2, pOverflow);
+//        temp3 = mult(COEFF5_2, data1, pOverflow);
+        temp3 = (Word16)(((Word32)COEFF5_2 * data1) >> 15);
+
+        temp2 = in[4*i+1] >> 2;
 
         temp3 = sub(temp2, temp3, pOverflow);
 
-        temp2 = mult(COEFF5_2, temp3, pOverflow);
-        temp2 = add(data1, temp2, pOverflow);
+//        temp2 = mult(COEFF5_2, temp3, pOverflow);
+        temp2 = (Word16)(((Word32)COEFF5_2 * temp3) >> 15);
+
+        temp2 = add_16(data1, temp2, pOverflow);
 
-        out[4*i+0] = add(temp1, temp2, pOverflow);
+        out[4*i+0] = add_16(temp1, temp2, pOverflow);
         out[4*i+1] = sub(temp1, temp2, pOverflow);
 
-        temp1 = mult(COEFF5_1, temp0, pOverflow);
-        temp2 = shr(in[4*i+2], 2, pOverflow);
+//        temp1 = mult(COEFF5_1, temp0, pOverflow);
+        temp1 = (Word16)(((Word32)COEFF5_1 * temp0) >> 15);
+
+        temp2 = in[4*i+2] >> 2;
         data0 = sub(temp2, temp1, pOverflow);
 
-        temp1 = mult(COEFF5_1, data0, pOverflow);
-        temp1 = add(temp0, temp1, pOverflow);
+//        temp1 = mult(COEFF5_1, data0, pOverflow);
+        temp1 = (Word16)(((Word32)COEFF5_1 * data0) >> 15);
+
+        temp1 = add_16(temp0, temp1, pOverflow);
 
-        data1 = mult(COEFF5_2, temp3, pOverflow);
-        temp2 = shr(in[4*i+3], 2, pOverflow);
+//        data1 = mult(COEFF5_2, temp3, pOverflow);
+        data1 = (Word16)(((Word32)COEFF5_2 * temp3) >> 15);
+        temp2 = in[4*i+3] >> 2;
         data1 = sub(temp2, data1, pOverflow);
 
-        temp2 = mult(COEFF5_2, data1, pOverflow);
-        temp2 = add(temp3, temp2, pOverflow);
+//        temp2 = mult(COEFF5_2, data1, pOverflow);
+        temp2 = (Word16)(((Word32)COEFF5_2 * data1) >> 15);
+        temp2 = add_16(temp3, temp2, pOverflow);
 
-        out[4*i+2] = add(temp1, temp2, pOverflow);
+        out[4*i+2] = add_16(temp1, temp2, pOverflow);
         out[4*i+3] = sub(temp1, temp2, pOverflow);
     }
 
@@ -269,22 +243,6 @@ static void first_filter_stage(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -305,18 +263,18 @@ static void filter5(Word16 *in0,    /* i/o : input values; output low-pass part
     temp0 = sub(*in0, temp0, pOverflow);
 
     temp1 = mult(COEFF5_1, temp0, pOverflow);
-    temp1 = add(data[0], temp1, pOverflow);
+    temp1 = add_16(data[0], temp1, pOverflow);
     data[0] = temp0;
 
     temp0 = mult(COEFF5_2, data[1], pOverflow);
     temp0 = sub(*in1, temp0, pOverflow);
 
     temp2 = mult(COEFF5_2, temp0, pOverflow);
-    temp2 = add(data[1], temp2, pOverflow);
+    temp2 = add_16(data[1], temp2, pOverflow);
 
     data[1] = temp0;
 
-    temp0 = add(temp1, temp2, pOverflow);
+    temp0 = add_16(temp1, temp2, pOverflow);
     *in0 = shr(temp0, 1, pOverflow);
 
     temp0 = sub(temp1, temp2, pOverflow);
@@ -373,22 +331,6 @@ static void filter5(Word16 *in0,    /* i/o : input values; output low-pass part
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -409,7 +351,7 @@ static void filter3(
     temp1 = sub(*in1, temp1, pOverflow);
 
     temp2 = mult(COEFF3, temp1, pOverflow);
-    temp2 = add(*data, temp2, pOverflow);
+    temp2 = add_16(*data, temp2, pOverflow);
 
     *data = temp1;
 
@@ -417,7 +359,7 @@ static void filter3(
 
     *in1 = shr(temp1, 1, pOverflow);
 
-    temp1 = add(*in0, temp2, pOverflow);
+    temp1 = add_16(*in0, temp2, pOverflow);
 
     *in0 = shr(temp1, 1, pOverflow);
 }
@@ -477,22 +419,6 @@ static void filter3(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -526,13 +452,13 @@ static Word16 level_calculation(
     }
 
     l_temp2 = L_add(l_temp1, L_shl(*sub_level, sub(16, scale, pOverflow), pOverflow), pOverflow);
-    *sub_level = extract_h(L_shl(l_temp1, scale, pOverflow));
+    *sub_level = (Word16)(L_shl(l_temp1, scale, pOverflow) >> 16);
 
     for (i = 0; i < count1; i++)
     {
         l_temp2 = L_mac(l_temp2, 1, abs_s(data[ind_m*i+ind_a]), pOverflow);
     }
-    level = extract_h(L_shl(l_temp2, scale, pOverflow));
+    level = (Word16)(L_shl(l_temp2, scale, pOverflow) >> 16);
 
     return level;
 }
@@ -585,22 +511,6 @@ static Word16 level_calculation(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -722,22 +632,6 @@ static void filter_bank(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -818,7 +712,7 @@ static void update_cntrl(
                 temp = shr(num, 1, pOverflow);
                 temp = div_s(temp, denom);
 
-                stat_rat = add(stat_rat, shr(temp, sub(8, exp, pOverflow), pOverflow), pOverflow);
+                stat_rat = add_16(stat_rat, shr(temp, sub(8, exp, pOverflow), pOverflow), pOverflow);
             }
 
             /* compare stat_rat with a threshold and update stat_count */
@@ -856,7 +750,7 @@ static void update_cntrl(
         temp = mult_r(alpha, temp, pOverflow);
 
         st->ave_level[i] =
-            add(
+            add_16(
                 st->ave_level[i],
                 temp,
                 pOverflow);
@@ -916,22 +810,6 @@ static void update_cntrl(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1006,7 +884,7 @@ static Word16 hangover_addition(
     /* update the counters (hang_count, burst_count) */
     if ((st->vadreg & 0x4000) != 0)
     {
-        st->burst_count = add(st->burst_count, 1, pOverflow);
+        st->burst_count = add_16(st->burst_count, 1, pOverflow);
 
         if (st->burst_count >= burst_len)
         {
@@ -1075,22 +953,6 @@ static Word16 hangover_addition(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1147,9 +1009,9 @@ static void noise_estimate_update(
         if (temp < 0)
         { /* update downwards*/
             temp = mult_r(alpha_down, temp, pOverflow);
-            temp = add(st->bckr_est[i], temp, pOverflow);
+            temp = add_16(st->bckr_est[i], temp, pOverflow);
 
-            st->bckr_est[i] = add(-2, temp, pOverflow);
+            st->bckr_est[i] = add_16(-2, temp, pOverflow);
 
             /* limit minimum value of the noise estimate to NOISE_MIN */
             if (st->bckr_est[i] < NOISE_MIN)
@@ -1160,8 +1022,8 @@ static void noise_estimate_update(
         else
         { /* update upwards */
             temp = mult_r(alpha_up, temp, pOverflow);
-            temp = add(st->bckr_est[i], temp, pOverflow);
-            st->bckr_est[i] = add(bckr_add, temp, pOverflow);
+            temp = add_16(st->bckr_est[i], temp, pOverflow);
+            st->bckr_est[i] = add_16(bckr_add, temp, pOverflow);
 
             /* limit maximum value of the noise estimate to NOISE_MAX */
             if (st->bckr_est[i] > NOISE_MAX)
@@ -1225,22 +1087,6 @@ static void noise_estimate_update(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1281,7 +1127,7 @@ static void complex_estimate_adapt(
         }
     }
 
-    L_tmp = L_deposit_h(st->corr_hp_fast);
+    L_tmp = ((Word32)st->corr_hp_fast << 16);
     L_tmp = L_msu(L_tmp, alpha, st->corr_hp_fast, pOverflow);
     L_tmp = L_mac(L_tmp, alpha, st->best_corr_hp, pOverflow);
     st->corr_hp_fast = pv_round(L_tmp, pOverflow);           /* Q15 */
@@ -1343,22 +1189,6 @@ static void complex_estimate_adapt(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1389,7 +1219,7 @@ static Word16 complex_vad(
 
     if (st->corr_hp_fast > CVAD_THRESH_HANG)
     {
-        st->complex_hang_timer = add(st->complex_hang_timer, 1, pOverflow);
+        st->complex_hang_timer = add_16(st->complex_hang_timer, 1, pOverflow);
     }
     else
     {
@@ -1450,22 +1280,6 @@ static Word16 complex_vad(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1505,7 +1319,7 @@ static Word16 vad_decision(
         L_temp = L_mac(L_temp, temp, temp, pOverflow);
     }
 
-    snr_sum = extract_h(L_shl(L_temp, 6, pOverflow));
+    snr_sum = (Word16)(L_shl(L_temp, 6, pOverflow) >> 16);
     snr_sum = mult(snr_sum, INV_COMPLEN, pOverflow);
 
     /* Calculate average level of estimated background noise */
@@ -1515,12 +1329,12 @@ static Word16 vad_decision(
         L_temp = L_add(L_temp, st->bckr_est[i], pOverflow);
     }
 
-    noise_level = extract_h(L_shl(L_temp, 13, pOverflow));
+    noise_level = (Word16)(L_shl(L_temp, 13, pOverflow) >> 16);
 
     /* Calculate VAD threshold */
     temp1 = sub(noise_level, VAD_P1, pOverflow);
     temp1 = mult(VAD_SLOPE, temp1, pOverflow);
-    vad_thr = add(temp1, VAD_THR_HIGH, pOverflow);
+    vad_thr = add_16(temp1, VAD_THR_HIGH, pOverflow);
 
     if (vad_thr < VAD_THR_LOW)
     {
@@ -1607,22 +1421,6 @@ static Word16 vad_decision(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1693,22 +1491,6 @@ Word16 vad1_init(vadState1 **state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1818,22 +1600,6 @@ Word16 vad1_reset(vadState1 *state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1894,22 +1660,6 @@ void vad1_exit(vadState1 **state)
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -1971,22 +1721,6 @@ void vad_complex_detection_update(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -2060,22 +1794,6 @@ void vad_tone_detection(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -2148,22 +1866,6 @@ void vad_tone_detection_update(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
@@ -2189,7 +1891,7 @@ void vad_pitch_detection(
 
         if (temp < LTHRESH)
         {
-            lagcount = add(lagcount, 1, pOverflow);
+            lagcount += 1;
         }
 
         /* Save the current LTP lag */
@@ -2202,7 +1904,7 @@ void vad_pitch_detection(
     st->pitch = shr(st->pitch, 1, pOverflow);
 
     temp =
-        add(
+        add_16(
             st->oldlag_count,
             lagcount,
             pOverflow);
@@ -2260,22 +1962,6 @@ void vad_pitch_detection(
 
 
 ------------------------------------------------------------------------------
- RESOURCES USED [optional]
-
- When the code is written for a specific target processor the
- the resources used should be documented below.
-
- HEAP MEMORY USED: x bytes
-
- STACK MEMORY USED: x bytes
-
- CLOCK CYCLES: (cycle count equation for this function) + (variable
-                used to represent cycle count for each subroutine
-                called)
-     where: (cycle count variable) = cycle count for [subroutine
-                                     name]
-
-------------------------------------------------------------------------------
  CAUTION [optional]
  [State any special notes, constraints or cautions for users of this function]
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad1.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.h
similarity index 95%
rename from opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad1.h
rename to opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.h
index c144ea0..ab3438f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad1.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad1.h
@@ -28,19 +28,7 @@ terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
 
- Filename: /audio/gsm_amr/c/include/vad_1.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Description:
+ Filename: vad1.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad2.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad2.cpp
new file mode 100644
index 0000000..4c3527f
--- /dev/null
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad2.cpp
@@ -0,0 +1,1214 @@
+/* ------------------------------------------------------------------
+ * Copyright (C) 1998-2009 PacketVideo
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ * -------------------------------------------------------------------
+ */
+/****************************************************************************************
+Portions of this file are derived from the following 3GPP standard:
+
+    3GPP TS 26.073
+    ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
+    Available from http://www.3gpp.org
+
+(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
+Permission to distribute, modify and use this file under the standard license
+terms listed above has been obtained from the copyright holder.
+****************************************************************************************/
+/*
+ Filename: vad2.cpp
+ Functions:
+
+------------------------------------------------------------------------------
+ MODULE DESCRIPTION
+
+
+------------------------------------------------------------------------------
+*/
+
+/*----------------------------------------------------------------------------
+; INCLUDES
+----------------------------------------------------------------------------*/
+
+
+#include "typedef.h"
+#include "shr.h"
+#include "basic_op.h"
+#include "cnst_vad.h"
+#include "oscl_mem.h"
+#include "log2.h"
+#include "pow2.h"
+#include "vad2.h"
+
+
+/*----------------------------------------------------------------------------
+; MACROS
+; Define module specific macros here
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; DEFINES
+; Include all pre-processor statements here. Include conditional
+; compile variables also.
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL FUNCTION DEFINITIONS
+; Function Prototype declaration
+----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------
+; LOCAL VARIABLE DEFINITIONS
+; Variable declaration - defined here and used outside this module
+----------------------------------------------------------------------------*/
+
+/*
+ * The channel table is defined below.  In this table, the
+ * lower and higher frequency coefficients for each of the 16
+ * channels are specified.  The table excludes the coefficients
+ * with numbers 0 (DC), 1, and 64 (Foldover frequency).
+ */
+
+const Word16 ch_tbl[NUM_CHAN][2] =
+{
+
+    {2, 3},
+    {4, 5},
+    {6, 7},
+    {8, 9},
+    {10, 11},
+    {12, 13},
+    {14, 16},
+    {17, 19},
+    {20, 22},
+    {23, 26},
+    {27, 30},
+    {31, 35},
+    {36, 41},
+    {42, 48},
+    {49, 55},
+    {56, 63}
+
+};
+
+/* channel energy scaling table - allows efficient division by number
+     * of DFT bins in the channel: 1/2, 1/3, 1/4, etc.
+ */
+
+const Word16 ch_tbl_sh[NUM_CHAN] =
+{
+    16384, 16384, 16384, 16384, 16384, 16384, 10923, 10923,
+    10923, 8192, 8192, 6554, 5461, 4681, 4681, 4096
+};
+
+/*
+ * The voice metric table is defined below.  It is a non-
+ * linear table with a deadband near zero.  It maps the SNR
+ * index (quantized SNR value) to a number that is a measure
+ * of voice quality.
+ */
+
+const Word16 vm_tbl[90] =
+{
+    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+    3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7,
+    8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15,
+    15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 23, 24,
+    24, 25, 26, 27, 28, 28, 29, 30, 31, 32, 33, 34,
+    35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+    46, 47, 48, 49, 50, 50, 50, 50, 50, 50, 50, 50,
+    50, 50
+};
+
+/* hangover as a function of peak SNR (3 dB steps) */
+const Word16 hangover_table[20] =
+{
+    30, 30, 30, 30, 30, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 8, 8, 8
+};
+
+/* burst sensitivity as a function of peak SNR (3 dB steps) */
+const Word16 burstcount_table[20] =
+{
+    8, 8, 8, 8, 8, 8, 8, 8, 7, 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4
+};
+
+/* voice metric sensitivity as a function of peak SNR (3 dB steps) */
+const Word16 vm_threshold_table[20] =
+{
+    34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
+    34, 40, 51, 71, 100, 139, 191, 257, 337, 432
+};
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: fn10Log10
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+   L_Input -- Word32 -- (scaled as 31-fbits,fbits)
+   fbits   -- Word16 -- number of fractional bits on input
+
+ Outputs:
+   pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+   output -- Word16 -- (scaled as 7,8)
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ PURPOSE:
+   The purpose of this function is to take the 10*log base 10 of input and
+   divide by 128 and return; i.e. output = 10*log10(input)/128 (scaled as 7,8)
+
+ DESCRIPTION:
+
+   10*log10(x)/128 = 10*(log10(2) * (log2(x<<fbits)-log2(1<<fbits)) >> 7
+                   = 3.0103 * (log2(x<<fbits) - fbits) >> 7
+                   = ((3.0103/4.0 * (log2(x<<fbits) - fbits) << 2) >> 7
+                   = (3.0103/4.0 * (log2(x<<fbits) - fbits) >> 5
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 fn10Log10(Word32 L_Input, Word16 fbits, Flag *pOverflow)
+{
+
+    Word16 integer;     /* Integer part of Log2.   (range: 0<=val<=30) */
+    Word16 fraction;    /* Fractional part of Log2. (range: 0<=val<1) */
+
+    Word32 Ltmp;
+    Word16 tmp;
+
+    Log2(L_Input, &integer, &fraction, pOverflow);
+
+    integer = sub(integer, fbits, pOverflow);
+
+    /* 24660 = 10*log10(2)/4 scaled 0,15 */
+    Ltmp = Mpy_32_16(integer, fraction, 24660, pOverflow);
+
+    /* extra shift for 30,1 => 15,0 extract correction */
+    Ltmp = L_shr_r(Ltmp, 5 + 1, pOverflow);
+
+    tmp = (Word16) Ltmp;
+
+    return (tmp);
+}
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: block_norm
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    in -- array of type Word16 -- pointer to data sequence to be normalised
+    length -- Word16 -- number of elements in data sequence
+    headroom -- Word16 -- number of headroom bits
+
+ Outputs:
+    out -- array of type Word16 -- normalised output data sequence
+    pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    Word16 -- number of bits sequence was left shifted
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ The purpose of this function is block normalise the input data sequence
+
+ 1) Search for maximum absolute valued data element
+ 2) Normalise the max element with "headroom"
+ 3) Transfer/shift the input sequence to the output buffer
+ 4) Return the number of left shifts
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION
+
+     An input sequence of all zeros will return the maximum
+     number of left shifts allowed, NOT the value returned
+     by a norm_s(0) call, since it desired to associate an
+     all zeros sequence with low energy.
+------------------------------------------------------------------------------
+*/
+
+Word16 block_norm(
+    Word16 * in,
+    Word16 * out,
+    Word16 length,
+    Word16 headroom,
+    Flag *pOverflow)
+{
+
+    Word16 i;
+    Word16 max;
+    Word16 scnt;
+    Word16 adata;
+
+    max = abs_s(in[0]);
+
+    for (i = 1; i < length; i++)
+    {
+        adata = abs_s(in[i]);
+
+        if (adata > max)
+        {
+            max = adata;
+        }
+    }
+    if (max != 0)
+    {
+        scnt = sub(norm_s(max), headroom, pOverflow);
+        for (i = 0; i < length; i++)
+        {
+            out[i] = shl(in[i], scnt, pOverflow);
+        }
+    }
+    else
+    {
+        scnt = sub(16, headroom, pOverflow);
+        for (i = 0; i < length; i++)
+        {
+            out[i] = 0;
+        }
+    }
+    return (scnt);
+}
+
+
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad2
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    farray_ptr -- array of type Word16, length 80 (input array)
+    vadState2 -- pointer to vadState2 state structure
+
+ Outputs:
+    vadState2 -- pointer to vadState2 state structure --
+                        state variables are updated
+   pOverflow -- pointer to type Flag -- overflow indicator
+
+ Returns:
+    Word16
+                 VAD(m) - two successive calls to vad2() yield
+                 the VAD decision for the 20 ms frame:
+                 VAD_flag = VAD(m-1) || VAD(m)
+
+ Global Variables Used:
+
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ This function provides the Voice Activity Detection function option 2
+ for the Adaptive Multi-rate (AMR) codec.
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad2(Word16 * farray_ptr, vadState2 * st, Flag *pOverflow)
+{
+
+    /* State tables that use 22,9 or 27,4 scaling for ch_enrg[] */
+
+    const Word16 noise_floor_chan[2] = {NOISE_FLOOR_CHAN_0, NOISE_FLOOR_CHAN_1};
+    const Word16 min_chan_enrg[2] =    {MIN_CHAN_ENRG_0, MIN_CHAN_ENRG_1};
+    const Word16 ine_noise[2] =        {INE_NOISE_0, INE_NOISE_1};
+    const Word16 fbits[2] =        {FRACTIONAL_BITS_0, FRACTIONAL_BITS_1};
+    const Word16 state_change_shift_r[2] = {STATE_1_TO_0_SHIFT_R, STATE_0_TO_1_SHIFT_R};
+
+    /* Energy scale table given 30,1 input scaling (also account for -6 dB shift on input) */
+    const Word16 enrg_norm_shift[2] =  {(FRACTIONAL_BITS_0 - 1 + 2), (FRACTIONAL_BITS_1 - 1 + 2)};
+
+
+    /* Automatic variables */
+
+    Word32 Lenrg;               /* scaled as 30,1 */
+    Word32 Ltne;                /* scaled as 22,9 */
+    Word32 Ltce;                /* scaled as 22,9 or 27,4 */
+
+    Word16 tne_db;              /* scaled as 7,8 */
+    Word16 tce_db;              /* scaled as 7,8 */
+
+    Word16 input_buffer[FRM_LEN];       /* used for block normalising input data */
+    Word16 data_buffer[FFT_LEN];        /* used for in-place FFT */
+
+    Word16 ch_snr[NUM_CHAN];        /* scaled as 7,8 */
+    Word16 ch_snrq;             /* scaled as 15,0 (in 0.375 dB steps) */
+    Word16 vm_sum;              /* scaled as 15,0 */
+    Word16 ch_enrg_dev;         /* scaled as 7,8 */
+
+    Word32 Lpeak;               /* maximum channel energy */
+    Word16 p2a_flag;            /* flag to indicate spectral peak-to-average ratio > 10 dB */
+
+    Word16 ch_enrg_db[NUM_CHAN];        /* scaled as 7,8 */
+    Word16 ch_noise_db;         /* scaled as 7,8 */
+
+    Word16 alpha;               /* scaled as 0,15 */
+    Word16 one_m_alpha;         /* scaled as 0,15 */
+    Word16 update_flag;         /* set to indicate a background noise estimate update */
+
+    Word16 i;
+    Word16 j;
+    Word16 j1;
+    Word16 j2;            /* Scratch variables */
+
+    Word16 hi1;
+    Word16 lo1;
+
+    Word32 Ltmp;
+    Word32 Ltmp1;
+    Word32 Ltmp2;
+    Word16 tmp;
+
+    Word16 normb_shift;     /* block norm shift count */
+
+    Word16 ivad;            /* intermediate VAD decision (return value) */
+    Word16 tsnrq;           /* total signal-to-noise ratio (quantized 3 dB steps) scaled as 15,0 */
+    Word16 xt;          /* instantaneous frame SNR in dB, scaled as 7,8 */
+
+    Word16 state_change;
+
+
+    /* Increment frame counter */
+    st->Lframe_cnt = L_add(st->Lframe_cnt, 1, pOverflow);
+
+    /* Block normalize the input */
+    normb_shift = block_norm(farray_ptr, input_buffer, FRM_LEN, FFT_HEADROOM, pOverflow);
+
+    /* Pre-emphasize the input data and store in the data buffer with the appropriate offset */
+    for (i = 0; i < DELAY; i++)
+    {
+        data_buffer[i] = 0;
+    }
+
+    st->pre_emp_mem = shr_r(st->pre_emp_mem, sub(st->last_normb_shift, normb_shift, pOverflow), pOverflow);
+    st->last_normb_shift = normb_shift;
+
+    data_buffer[DELAY] = add(input_buffer[0], mult(PRE_EMP_FAC, st->pre_emp_mem, pOverflow), pOverflow);
+
+    for (i = DELAY + 1, j = 1; i < DELAY + FRM_LEN; i++, j++)
+    {
+        data_buffer[i] = add(input_buffer[j], mult(PRE_EMP_FAC, input_buffer[j-1], pOverflow), pOverflow);
+    }
+    st->pre_emp_mem = input_buffer[FRM_LEN-1];
+
+    for (i = DELAY + FRM_LEN; i < FFT_LEN; i++)
+    {
+        data_buffer[i] = 0;
+    }
+
+
+    /* Perform FFT on the data buffer */
+    r_fft(data_buffer, pOverflow);
+
+
+    /* Use normb_shift factor to determine the scaling of the energy estimates */
+    state_change = 0;
+    if (st->shift_state == 0)
+    {
+        if (normb_shift <= (-FFT_HEADROOM + 2))
+        {
+            state_change = 1;
+            st->shift_state = 1;
+        }
+    }
+    else
+    {
+        if (normb_shift >= (-FFT_HEADROOM + 5))
+        {
+            state_change = 1;
+            st->shift_state = 0;
+        }
+    }
+
+    /* Scale channel energy estimate */
+    if (state_change)
+    {
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            st->Lch_enrg[i] =
+                L_shr(
+                    st->Lch_enrg[i],
+                    state_change_shift_r[st->shift_state],
+                    pOverflow);
+        }
+    }
+
+
+    /* Estimate the energy in each channel */
+    if (st->Lframe_cnt == 1)
+    {
+        alpha = 32767;
+        one_m_alpha = 0;
+    }
+    else
+    {
+        alpha = CEE_SM_FAC;
+        one_m_alpha = ONE_MINUS_CEE_SM_FAC;
+    }
+
+    for (i = LO_CHAN; i <= HI_CHAN; i++)
+    {
+        Lenrg = 0;
+        j1 = ch_tbl[i][0];
+        j2 = ch_tbl[i][1];
+
+        for (j = j1; j <= j2; j++)
+        {
+            Lenrg = L_mac(
+                        Lenrg,
+                        data_buffer[2 * j],
+                        data_buffer[2 * j],
+                        pOverflow);
+
+            Lenrg = L_mac(
+                        Lenrg,
+                        data_buffer[2 * j + 1],
+                        data_buffer[2 * j + 1],
+                        pOverflow);
+        }
+
+        /* Denorm energy & scale 30,1 according to the state */
+        tmp = shl(normb_shift, 1, pOverflow);
+        tmp = sub(tmp, enrg_norm_shift[st->shift_state], pOverflow);
+        Lenrg = L_shr_r(Lenrg, tmp, pOverflow);
+
+        /* integrate over time:
+         * e[i] = (1-alpha)*e[i] + alpha*enrg/num_bins_in_chan
+         */
+        tmp = mult(alpha, ch_tbl_sh[i], pOverflow);
+        L_Extract(Lenrg, &hi1, &lo1, pOverflow);
+        Ltmp = Mpy_32_16(hi1, lo1, tmp, pOverflow);
+
+        L_Extract(st->Lch_enrg[i], &hi1, &lo1, pOverflow);
+
+        Ltmp1 = Mpy_32_16(hi1, lo1, one_m_alpha, pOverflow);
+        st->Lch_enrg[i] = L_add(Ltmp, Ltmp1, pOverflow);
+
+        if (st->Lch_enrg[i] < min_chan_enrg[st->shift_state])
+        {
+            st->Lch_enrg[i] = min_chan_enrg[st->shift_state];
+        }
+
+    }
+
+
+    /* Compute the total channel energy estimate (Ltce) */
+    Ltce = 0;
+    for (i = LO_CHAN; i <= HI_CHAN; i++)
+    {
+        Ltce =
+            L_add(
+                Ltce,
+                st->Lch_enrg[i],
+                pOverflow);
+    }
+
+
+    /* Calculate spectral peak-to-average ratio, set flag if p2a > 10 dB */
+    Lpeak = 0;
+
+    /* Sine waves not valid for low frequencies */
+    for (i = LO_CHAN + 2; i <= HI_CHAN; i++)
+    {
+        if (L_sub(st->Lch_enrg [i], Lpeak, pOverflow) > 0)
+        {
+            Lpeak = st->Lch_enrg [i];
+        }
+    }
+
+    /* Set p2a_flag if peak (dB) > average channel energy (dB) + 10 dB */
+    /*   Lpeak > Ltce/num_channels * 10^(10/10)                        */
+    /*   Lpeak > (10/16)*Ltce                                          */
+
+    L_Extract(Ltce, &hi1, &lo1, pOverflow);
+    Ltmp = Mpy_32_16(hi1, lo1, 20480, pOverflow);
+    if (L_sub(Lpeak, Ltmp, pOverflow) > 0)
+    {
+        p2a_flag = TRUE;
+    }
+    else
+    {
+        p2a_flag = FALSE;
+    }
+
+
+    /* Initialize channel noise estimate to either the channel energy or fixed level  */
+    /*   Scale the energy appropriately to yield state 0 (22,9) scaling for noise */
+    if (st->Lframe_cnt <= 4)
+    {
+        if (p2a_flag == TRUE)
+        {
+            for (i = LO_CHAN; i <= HI_CHAN; i++)
+            {
+                st->Lch_noise[i] = INE_NOISE_0;
+            }
+        }
+        else
+        {
+            for (i = LO_CHAN; i <= HI_CHAN; i++)
+            {
+                if (st->Lch_enrg[i] < ine_noise[st->shift_state])
+                {
+                    st->Lch_noise[i] = INE_NOISE_0;
+                }
+                else
+                {
+                    if (st->shift_state == 1)
+                    {
+                        st->Lch_noise[i] =
+                            L_shr(
+                                st->Lch_enrg[i],
+                                state_change_shift_r[0],
+                                pOverflow);
+                    }
+                    else
+                    {
+                        st->Lch_noise[i] = st->Lch_enrg[i];
+                    }
+                }
+            }
+        }
+    }
+
+
+    /* Compute the channel energy (in dB), the channel SNRs, and the sum of voice metrics */
+    vm_sum = 0;
+    for (i = LO_CHAN; i <= HI_CHAN; i++)
+    {
+        ch_enrg_db[i] =
+            fn10Log10(
+                st->Lch_enrg[i],
+                fbits[st->shift_state],
+                pOverflow);
+
+        ch_noise_db =
+            fn10Log10(
+                st->Lch_noise[i],
+                FRACTIONAL_BITS_0,
+                pOverflow);
+
+        ch_snr[i] = sub(ch_enrg_db[i], ch_noise_db, pOverflow);
+
+        /* quantize channel SNR in 3/8 dB steps (scaled 7,8 => 15,0) */
+        /*   ch_snr = pv_round((snr/(3/8))>>8)                          */
+        /*          = pv_round(((0.6667*snr)<<2)>>8)                    */
+        /*          = pv_round((0.6667*snr)>>6)                         */
+
+        tmp = mult(21845, ch_snr[i], pOverflow);
+
+        ch_snrq = shr_r(tmp, 6, pOverflow);
+
+        /* Accumulate the sum of voice metrics  */
+        if (ch_snrq < 89)
+        {
+            if (ch_snrq > 0)
+            {
+                j = ch_snrq;
+            }
+            else
+            {
+                j = 0;
+            }
+        }
+        else
+        {
+            j = 89;
+        }
+        vm_sum = add(vm_sum, vm_tbl[j], pOverflow);
+    }
+
+
+    /* Initialize NOMINAL peak voice energy and average noise energy, calculate instantaneous SNR */
+    if (st->Lframe_cnt <= 4 || st->fupdate_flag == TRUE)
+    {
+        /* tce_db = (96 - 22 - 10*log10(64) (due to FFT)) scaled as 7,8 */
+        tce_db = 14320;
+        st->negSNRvar = 0;
+        st->negSNRbias = 0;
+
+        /* Compute the total noise estimate (Ltne) */
+        Ltne = 0;
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            Ltne = L_add(Ltne, st->Lch_noise[i], pOverflow);
+        }
+
+        /* Get total noise in dB */
+        tne_db =
+            fn10Log10(
+                Ltne,
+                FRACTIONAL_BITS_0,
+                pOverflow);
+
+        /* Initialise instantaneous and long-term peak signal-to-noise ratios */
+        xt = sub(tce_db, tne_db, pOverflow);
+        st->tsnr = xt;
+    }
+    else
+    {
+        /* Calculate instantaneous frame signal-to-noise ratio */
+        /* xt = 10*log10( sum(2.^(ch_snr*0.1*log2(10)))/length(ch_snr) ) */
+        Ltmp1 = 0;
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            /* Ltmp2 = ch_snr[i] * 0.1 * log2(10); (ch_snr scaled as 7,8) */
+            Ltmp2 = L_mult(ch_snr[i], 10885, pOverflow);
+            Ltmp2 = L_shr(Ltmp2, 8, pOverflow);
+
+            L_Extract(Ltmp2, &hi1, &lo1, pOverflow);
+            hi1 = add(hi1, 3, pOverflow);  /* 2^3 to compensate for negative SNR */
+
+            Ltmp2 = Pow2(hi1, lo1, pOverflow);
+
+            Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+        }
+        xt =
+            fn10Log10(
+                Ltmp1,
+                4 + 3,
+                pOverflow);     /* average by 16, inverse compensation 2^3 */
+
+        /* Estimate long-term "peak" SNR */
+        if (xt > st->tsnr)
+        {
+            Ltmp1 = L_mult(29491, st->tsnr, pOverflow);
+            Ltmp2 = L_mult(3277, xt, pOverflow);
+            Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+
+            /* tsnr = 0.9*tsnr + 0.1*xt; */
+            st->tsnr = pv_round(Ltmp1, pOverflow);
+        }
+        /* else if (xt > 0.625*tsnr) */
+        else
+        {
+            tmp = mult(20480, st->tsnr, pOverflow);
+            tmp = sub(xt, tmp, pOverflow);
+
+            if (tmp > 0)
+            {
+                /* tsnr = 0.998*tsnr + 0.002*xt; */
+                Ltmp1 = L_mult(32702, st->tsnr, pOverflow);
+                Ltmp2 = L_mult(66, xt, pOverflow);
+                Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+
+                st->tsnr = pv_round(Ltmp1, pOverflow);
+            }
+        }
+    }
+
+    /* Quantize the long-term SNR in 3 dB steps, limit to 0 <= tsnrq <= 19 */
+    tmp = mult(st->tsnr, 10923, pOverflow);
+    tsnrq = shr(tmp, 8, pOverflow);
+
+    /* tsnrq = min(19, max(0, tsnrq)); */
+    if (tsnrq > 19)
+    {
+        tsnrq = 19;
+    }
+    else if (tsnrq < 0)
+    {
+        tsnrq = 0;
+    }
+
+    /* Calculate the negative SNR sensitivity bias */
+    if (xt < 0)
+    {
+        /* negSNRvar = 0.99*negSNRvar + 0.01*xt*xt; */
+        /*   xt scaled as 7,8 => xt*xt scaled as 14,17, shift to 7,8 and round */
+        Ltmp1 = L_mult(xt, xt, pOverflow);
+        Ltmp1 = L_shl(Ltmp1, 7, pOverflow);
+        tmp = pv_round(Ltmp1, pOverflow);
+
+        Ltmp1 = L_mult(32440, st->negSNRvar, pOverflow);
+        Ltmp2 = L_mult(328, tmp, pOverflow);
+        Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+
+        st->negSNRvar = pv_round(Ltmp1, pOverflow);
+
+        /* if (negSNRvar > 4.0) negSNRvar = 4.0;  */
+        if (st->negSNRvar > 1024)
+        {
+            st->negSNRvar = 1024;
+        }
+
+        /* negSNRbias = max(12.0*(negSNRvar - 0.65), 0.0); */
+        tmp = sub(st->negSNRvar, 166, pOverflow);
+        tmp = shl(tmp, 4, pOverflow);
+        tmp = mult_r(tmp, 24576, pOverflow);
+
+        if (tmp < 0)
+        {
+            st->negSNRbias = 0;
+        }
+        else
+        {
+            st->negSNRbias = shr(tmp, 8, pOverflow);
+        }
+    }
+
+
+    /* Determine VAD as a function of the voice metric sum and quantized SNR */
+
+    tmp = add(vm_threshold_table[tsnrq], st->negSNRbias, pOverflow);
+
+    if (vm_sum > tmp)
+    {
+        ivad = 1;
+        st->burstcount = add(st->burstcount, 1, pOverflow);
+        if (st->burstcount > burstcount_table[tsnrq])
+        {
+            st->hangover = hangover_table[tsnrq];
+        }
+    }
+    else
+    {
+        st->burstcount = 0;
+        st->hangover = sub(st->hangover, 1, pOverflow);
+        if (st->hangover <= 0)
+        {
+            ivad = 0;
+            st->hangover = 0;
+        }
+        else
+        {
+            ivad = 1;
+        }
+    }
+
+
+    /* Calculate log spectral deviation */
+    ch_enrg_dev = 0;
+    if (st->Lframe_cnt == 1)
+    {
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            st->ch_enrg_long_db[i] = ch_enrg_db[i];
+        }
+    }
+    else
+    {
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            tmp = sub(st->ch_enrg_long_db[i], ch_enrg_db[i], pOverflow);
+            tmp = abs_s(tmp);
+
+            ch_enrg_dev = add(ch_enrg_dev, tmp, pOverflow);
+        }
+    }
+
+    /*
+     * Calculate long term integration constant as
+     * a function of instantaneous SNR
+     * (i.e., high SNR (tsnr dB) -> slower integration (alpha = HIGH_ALPHA),
+     *         low SNR (0 dB) -> faster integration (alpha = LOW_ALPHA)
+     */
+
+    /* alpha = HIGH_ALPHA - ALPHA_RANGE * (tsnr - xt)
+     * ----------------------------------------------
+     *         tsnr, low <= alpha <= high
+     */
+    tmp = sub(st->tsnr, xt, pOverflow);
+    if (tmp <= 0 || st->tsnr <= 0)
+    {
+        alpha = HIGH_ALPHA;
+        one_m_alpha = 32768L - HIGH_ALPHA;
+    }
+    else if (tmp > st->tsnr)
+    {
+        alpha = LOW_ALPHA;
+        one_m_alpha = 32768L - LOW_ALPHA;
+    }
+    else
+    {
+        tmp = div_s(tmp, st->tsnr);
+        tmp = mult(ALPHA_RANGE, tmp, pOverflow);
+        alpha = sub(HIGH_ALPHA, tmp, pOverflow);
+        one_m_alpha = sub(32767, alpha, pOverflow);
+    }
+
+    /* Calc long term log spectral energy */
+    for (i = LO_CHAN; i <= HI_CHAN; i++)
+    {
+        Ltmp1 = L_mult(one_m_alpha, ch_enrg_db[i], pOverflow);
+        Ltmp2 = L_mult(alpha, st->ch_enrg_long_db[i], pOverflow);
+
+        Ltmp1 = L_add(Ltmp1, Ltmp2, pOverflow);
+        st->ch_enrg_long_db[i] = pv_round(Ltmp1, pOverflow);
+    }
+
+
+    /* Set or clear the noise update flags */
+    update_flag = FALSE;
+    st->fupdate_flag = FALSE;
+    if (vm_sum <= UPDATE_THLD)
+    {
+        if (st->burstcount == 0)
+        {
+            update_flag = TRUE;
+            st->update_cnt = 0;
+        }
+    }
+    else if (L_sub(Ltce, noise_floor_chan[st->shift_state], pOverflow) > 0)
+    {
+        if (ch_enrg_dev < DEV_THLD)
+        {
+            if (p2a_flag == FALSE)
+            {
+                if (st->LTP_flag == FALSE)
+                {
+                    st->update_cnt = add(st->update_cnt, 1, pOverflow);
+                    if (st->update_cnt >= UPDATE_CNT_THLD)
+                    {
+                        update_flag = TRUE;
+                        st->fupdate_flag = TRUE;
+                    }
+                }
+            }
+        }
+    }
+    if (st->update_cnt == st->last_update_cnt)
+    {
+        st->hyster_cnt = add(st->hyster_cnt, 1, pOverflow);
+    }
+    else
+    {
+        st->hyster_cnt = 0;
+    }
+
+    st->last_update_cnt = st->update_cnt;
+
+    if (st->hyster_cnt > HYSTER_CNT_THLD)
+    {
+        st->update_cnt = 0;
+    }
+
+
+    /* Conditionally update the channel noise estimates */
+    if (update_flag == TRUE)
+    {
+        /* Check shift state */
+        if (st->shift_state == 1)
+        {
+            /* get factor to shift ch_enrg[]
+             * from state 1 to 0 (noise always state 0)
+             */
+            tmp = state_change_shift_r[0];
+        }
+        else
+        {
+            /* No shift if already state 0 */
+            tmp = 0;
+        }
+
+        /* Update noise energy estimate */
+        for (i = LO_CHAN; i <= HI_CHAN; i++)
+        {
+            /* integrate over time: en[i] = (1-alpha)*en[i] + alpha*e[n] */
+            /* (extract with shift compensation for state 1) */
+
+            Ltmp1 = L_shr(st->Lch_enrg[i], tmp, pOverflow);
+            L_Extract(Ltmp1, &hi1, &lo1, pOverflow);
+
+            Ltmp = Mpy_32_16(hi1, lo1, CNE_SM_FAC, pOverflow);
+
+            L_Extract(st->Lch_noise[i], &hi1, &lo1, pOverflow);
+
+            Ltmp1 = Mpy_32_16(hi1, lo1, ONE_MINUS_CNE_SM_FAC, pOverflow);
+            st->Lch_noise[i] = L_add(Ltmp, Ltmp1, pOverflow);
+
+            /* Limit low level noise */
+            if (st->Lch_noise[i] <= MIN_NOISE_ENRG_0)
+            {
+                st->Lch_noise[i] = MIN_NOISE_ENRG_0;
+            }
+        }
+    }
+
+    return(ivad);
+}                               /* end of vad2 () */
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad2_init
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- double pointer to type vadState2 -- pointer to memory to
+                                                 be initialized.
+
+ Outputs:
+    state -- points to initalized area in memory.
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Allocates state memory and initializes state memory
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+Word16 vad2_init(vadState2 **state)
+{
+    vadState2* s;
+
+    if (state == (vadState2 **) NULL)
+    {
+        return -1;
+    }
+    *state = NULL;
+
+    /* allocate memory */
+    if ((s = (vadState2 *) oscl_malloc(sizeof(vadState2))) == NULL)
+    {
+        return -1;
+    }
+
+    vad2_reset(s);
+
+    *state = s;
+
+    return 0;
+}
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad2_reset
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+ Purpose:    Resets state memory to zero
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+Word16 vad2_reset(vadState2 * st)
+{
+    Word16  i;
+    Word16  *ptr;
+
+    if (st == (vadState2 *) NULL)
+    {
+        return -1;
+    }
+    ptr = (Word16 *)st;
+
+    for (i = 0; i < sizeof(vadState2) / 2; i++)
+    {
+        *ptr++ = 0;
+    }
+
+    return 0;
+}                       /* end of vad2_reset () */
+
+
+/*
+------------------------------------------------------------------------------
+ FUNCTION NAME: vad2_exit
+------------------------------------------------------------------------------
+ INPUT AND OUTPUT DEFINITIONS
+
+ Inputs:
+    state -- pointer to type vadState1 --  State struct
+
+ Outputs:
+    None
+
+ Returns:
+    None
+
+ Global Variables Used:
+    None
+
+ Local Variables Needed:
+    None
+
+------------------------------------------------------------------------------
+ FUNCTION DESCRIPTION
+
+    The memory used for state memory is freed
+
+------------------------------------------------------------------------------
+ REQUIREMENTS
+
+ None
+
+------------------------------------------------------------------------------
+ REFERENCES
+
+ vad2.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
+
+------------------------------------------------------------------------------
+ PSEUDO-CODE
+
+
+------------------------------------------------------------------------------
+ CAUTION [optional]
+ [State any special notes, constraints or cautions for users of this function]
+
+------------------------------------------------------------------------------
+*/
+
+void vad2_exit(vadState2 **state)
+{
+    if (state == NULL || *state == NULL)
+    {
+        return;
+    }
+
+    /* deallocate memory */
+    oscl_free(*state);
+    *state = NULL;
+
+    return;
+}
+
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad2.h b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad2.h
similarity index 93%
rename from opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad2.h
rename to opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad2.h
index 3197b3a..909801f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/vad2.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/vad2.h
@@ -27,24 +27,7 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 /*
- Filename: /audio/gsm_amr/c/include/vad2.h
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description: Placed header file in the proper template format.  Added
- parameter pOverflow for the basic math ops.
-
- Description: Added pOverflow to the r_fft function prototype.
-
- Description: Added pOverflow to the LTP_flag_update prototype.
-
- Description:  Replaced "int" and/or "char" with OSCL defined types.
-
- Description: Moved _cplusplus #ifdef after Include section.
-
- Who:                       Date:
- Description:
+ Filename: vad2.h
 
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/decoder_amr_wb.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/decoder_amr_wb.h
index 4b59dbd..d026c17 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/decoder_amr_wb.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/decoder_amr_wb.h
@@ -27,9 +27,9 @@ Permission to distribute, modify and use this file under the standard license
 terms listed above has been obtained from the copyright holder.
 ****************************************************************************************/
 //////////////////////////////////////////////////////////////////////////////////
-//																				//
-//	File: decoder_amr_wb.h	                                                    //
-//																				//
+//                                                                              //
+//  File: decoder_amr_wb.h                                                      //
+//                                                                              //
 //////////////////////////////////////////////////////////////////////////////////
 
 #ifndef _DECODER_AMR_WB_H
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/pvamrwbdecoder_api.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/pvamrwbdecoder_api.h
index 3b8578d..24fa429 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/pvamrwbdecoder_api.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/include/pvamrwbdecoder_api.h
@@ -31,14 +31,6 @@ terms listed above has been obtained from the copyright holder.
 
  Name: pvamrwbdecoder_api.h
 
-     Date: 05/02/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/agc2_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/agc2_amr_wb.cpp
index 2e53d13..0b01ef0 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/agc2_amr_wb.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/agc2_amr_wb.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: agc2_amr_wb.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/band_pass_6k_7k.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/band_pass_6k_7k.cpp
index 97c7402..5d12eab 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/band_pass_6k_7k.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/band_pass_6k_7k.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: band_pass_6k_7k.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_2p_in_64.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_2p_in_64.cpp
index 740bc16..d0b4c48 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_2p_in_64.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_2p_in_64.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: dec_acelp_2p_in_64.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_4p_in_64.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_4p_in_64.cpp
index 4868822..d02021a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_4p_in_64.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_acelp_4p_in_64.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: dec_acelp_4p_in_64.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_alg_codebook.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_alg_codebook.cpp
index 95860eb..76ad69c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_alg_codebook.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_alg_codebook.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: dec_alg_codebook.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
@@ -165,7 +157,7 @@ void dec_2p_2N1(int32 index, int16 N, int16 offset, int16 pos[])
         }
         else
         {
-            pos2 += NB_POS;      /* pos2 += NB_POS;	 */
+            pos2 += NB_POS;      /* pos2 += NB_POS;  */
         }
     }
     else
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_gain2_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_gain2_amr_wb.cpp
index 8cae559..927f7ca 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_gain2_amr_wb.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dec_gain2_amr_wb.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: dec_gain2_amr_wb.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/deemphasis_32.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/deemphasis_32.cpp
index b80555b..38cd619 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/deemphasis_32.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/deemphasis_32.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: deemphasis_32.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx.h
index ce80068..a87bf1c 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx.h
@@ -33,15 +33,9 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./cpp/include/dtx.h
 
-     Date: 01/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
-	Static memory, constants and frametypes for the DTX
+    Static memory, constants and frametypes for the DTX
 ------------------------------------------------------------------------------
 */
 #ifndef DTX_H
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx_decoder_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx_decoder_amr_wb.cpp
index 7c798cc..125b87a 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx_decoder_amr_wb.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/dtx_decoder_amr_wb.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: dtx_decoder_amr_wb.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/e_pv_amrwbdec.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/e_pv_amrwbdec.h
index 251a3ce..bd766e1 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/e_pv_amrwbdec.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/e_pv_amrwbdec.h
@@ -29,17 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*
 
  Filename: e_pv_amrwbdec.h
- Funtions:
 
-
-     Date: 05/03/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-------------------------------------------------------------------------------
 */
 
 /*----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.cpp
index d7287f3..d9842fc 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: get_amr_wb_bits.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.h
index 0a2e47b..48e43db 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/get_amr_wb_bits.h
@@ -29,7 +29,7 @@ terms listed above has been obtained from the copyright holder.
 /*--------------------------------------------------------------------------*
  *                       get_amr_wb_bits.h                                  *
  *--------------------------------------------------------------------------*
- *       Number of bits for different modes			                        *
+ *       Number of bits for different modes                                 *
  *--------------------------------------------------------------------------*/
 
 #ifndef GET_AMR_WB_BITS_H
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_400hz_at_12k8.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_400hz_at_12k8.cpp
index 6503454..d10a20d 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_400hz_at_12k8.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_400hz_at_12k8.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: highpass_400Hz_at_12k8.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_50hz_at_12k8.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_50hz_at_12k8.cpp
index c70c163..f78f5b4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_50hz_at_12k8.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/highpass_50hz_at_12k8.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: highpass_50Hz_at_12k8.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/homing_amr_wb_dec.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/homing_amr_wb_dec.cpp
index 9b4a870..987b700 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/homing_amr_wb_dec.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/homing_amr_wb_dec.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: homing_amr_wb_dec.cpp
 
-     Date: 4/25/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
 
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/interpolate_isp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/interpolate_isp.cpp
index 3ccebdb..08046c6 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/interpolate_isp.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/interpolate_isp.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: interpolate_isp.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isf_extrapolation.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isf_extrapolation.cpp
index e445615..b421e87 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isf_extrapolation.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isf_extrapolation.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: isf_extrapolation.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
@@ -49,8 +41,8 @@ terms listed above has been obtained from the copyright holder.
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
 
-  	Conversion of 16th-order 12.8kHz ISF vector
-  	into 20th-order 16kHz ISF vector
+    Conversion of 16th-order 12.8kHz ISF vector
+    into 20th-order 16kHz ISF vector
 
 ------------------------------------------------------------------------------
  REQUIREMENTS
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_az.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_az.cpp
index 40093f5..dbcf2f3 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_az.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_az.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: isp_az.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_isf.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_isf.cpp
index 0552733..8cc13b5 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_isf.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/isp_isf.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: isp_isf.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/lagconceal.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/lagconceal.cpp
index c699808..e409474 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/lagconceal.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/lagconceal.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: lagconceal.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/low_pass_filt_7k.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/low_pass_filt_7k.cpp
index ec1d6e0..bb21cd9 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/low_pass_filt_7k.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/low_pass_filt_7k.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: low_pass_filt_7k.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp
index b922de5..32d10af 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/median5.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: median5.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.cpp
index cb91d4a..beac1bb 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.cpp
@@ -32,14 +32,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./src/mime_io.cpp
 
-     Date: 05/07/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
@@ -707,15 +699,15 @@ void mime_unsorting(uint8 unsorted_bits[],
             /* set mode index */
             *mode = st->prev_mode;
             break;
-        case 14:		/* SPEECH_LOST */
+        case 14:        /* SPEECH_LOST */
             *frame_type = RX_SPEECH_LOST;
             *mode = st->prev_mode;
             break;
-        case 15:		/* NO_DATA */
+        case 15:        /* NO_DATA */
             *frame_type = RX_NO_DATA;
             *mode = st->prev_mode;
             break;
-        default:		/* replace frame with unused mode index by NO_DATA frame */
+        default:        /* replace frame with unused mode index by NO_DATA frame */
             *frame_type = RX_NO_DATA;
             *mode = st->prev_mode;
             break;
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.h
index 3be1d9c..9c040bc 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/mime_io.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./cpp/include/mime_io.h
 
-     Date: 01/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/noise_gen_amrwb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/noise_gen_amrwb.cpp
index 2c1059f..2c3f210 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/noise_gen_amrwb.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/noise_gen_amrwb.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: noise_gen_amrwb.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.cpp
index 0325311..25dcf13 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: normalize_amr_wb.cpp
 
-     Date: 12/10/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h
index e4c80ef..7c5fe22 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./c/include/normalize_amr_wb.h
 
-     Date: 12/10/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/oversamp_12k8_to_16k.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/oversamp_12k8_to_16k.cpp
index 6f01ba5..8e4534b 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/oversamp_12k8_to_16k.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/oversamp_12k8_to_16k.cpp
@@ -33,21 +33,13 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: oversamp_12k8_to_16k.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
      int16 signal[],             input signal / output is divided by 16
      int16 lg,                   lenght of signal
      int16 mem[]                 in/out: memory (size=30)
-	 int16 x[]                   scratch mem ( size= 60)
+     int16 x[]                   scratch mem ( size= 60)
 
 ------------------------------------------------------------------------------
  FUNCTION DESCRIPTION
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/phase_dispersion.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/phase_dispersion.cpp
index 7b08a40..55229db 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/phase_dispersion.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/phase_dispersion.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: phase_dispersion.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pit_shrp.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pit_shrp.cpp
index 4bfcf9c..abdef81 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pit_shrp.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pit_shrp.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: pit_shrp.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pred_lt4.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pred_lt4.cpp
index d5a7984..ab4ab21 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pred_lt4.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pred_lt4.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: pred_lt4.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/preemph_amrwb_dec.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/preemph_amrwb_dec.cpp
index 3eb5cda..78359e2 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/preemph_amrwb_dec.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/preemph_amrwb_dec.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: preemph_amrwb_dec.cpp
 
-     Date: 12/10/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pv_amr_wb_type_defs.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pv_amr_wb_type_defs.h
index 7c28612..4653b59 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pv_amr_wb_type_defs.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pv_amr_wb_type_defs.h
@@ -33,13 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./cpp/include/pv_amr_wb_type_defs.h
 
-     Date: 12/12/2006
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.h
index 8951e5c..e84ce90 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwb_math_op.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./src/pvamrwb_math_op.h
 
-     Date: 01/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.cpp
index b8cfefa..85edaa1 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: pvamrwbdecoder.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.h
index 7fc7495..d017d06 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder.h
@@ -31,14 +31,6 @@ terms listed above has been obtained from the copyright holder.
 
  Name: pvamrwbdecoder.h
 
-     Date: 05/02/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_acelp.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_acelp.h
index 5967115..52001ad 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_acelp.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_acelp.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./cpp/include/pvamrwbdecoder_acelp.h
 
-     Date: 01/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op.h
index 7c7e13b..11368fd 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./src/pvamrwbdecoder_basic_op.h
 
-     Date: 05/07/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
@@ -230,14 +224,14 @@ static inline int32 shr_int32(int32 L_var1, int16 var2)
 
 #include "pvamrwbdecoder_basic_op_armv5.h"
 
-#elif defined(PV_ARM_GCC_V5)
+#elif defined(xxPV_ARM_GCC_V5) //@TODO: Enable gcc-arm assembly
 
 #include "pvamrwbdecoder_basic_op_gcc_armv5.h"
 
 #else
 
 #ifndef C_EQUIVALENT
-#define C_EQUIVALENT		// default to C_EQUIVALENT
+#define C_EQUIVALENT        // default to C_EQUIVALENT
 #endif
 
 #include "pvamrwbdecoder_basic_op_cequivalent.h"
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h
index c800a2e..540a1a4 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./src/pvamrwbdecoder_basic_op_armv5.h
 
-     Date: 05/07/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_cequivalent.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_cequivalent.h
index 84bd652..3505fe5 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_cequivalent.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_cequivalent.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./src/pvamrwbdecoder_basic_op_cequivalent.h
 
-     Date: 05/07/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
@@ -306,7 +300,7 @@ extern "C"
         }
         else
         {
-            L_mul = MAX_32;		/* saturation */
+            L_mul = MAX_32;     /* saturation */
         }
 
         L_var_out = L_var3 + L_mul;
@@ -365,7 +359,7 @@ extern "C"
         }
         else
         {
-            L_mul = MAX_32;		/* saturation */
+            L_mul = MAX_32;     /* saturation */
         }
 
         L_var_out = L_var3 - L_mul;
@@ -419,7 +413,7 @@ extern "C"
         }
         else
         {
-            L_mul = MAX_32;		/* saturation */
+            L_mul = MAX_32;     /* saturation */
         }
 
         return (L_mul);
@@ -460,7 +454,7 @@ extern "C"
          Function Name : amr_wb_shl1_round
 
          Shift the 32 bit input number to the left by 1, round up the result and
-    	 shift down by 16
+         shift down by 16
                      amr_wb_shl1_round(L_var1) = round(L_shl(L_var1,1))
 
          Inputs :
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h
index 741b584..de3baba 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./src/pvamrwbdecoder_basic_op_gcc_armv5.h
 
-     Date: 05/07/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_cnst.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_cnst.h
index ecf1bf3..16b5127 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_cnst.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_cnst.h
@@ -31,14 +31,6 @@ terms listed above has been obtained from the copyright holder.
 
  Name: pvamrwbdecoder_cnst.h
 
-     Date: 05/02/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_mem_funcs.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_mem_funcs.h
index ac383cd..42e7491 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_mem_funcs.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_mem_funcs.h
@@ -32,17 +32,6 @@ terms listed above has been obtained from the copyright holder.
 
 
  Filename: pvamrwbdecoder_mem_funcs.h
- Funtions:
-
-
-     Date: 05/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-------------------------------------------------------------------------------
 
 
 ----------------------------------------------------------------------------
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_pulse.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_pulse.h
index 0ac52b3..172a6f9 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_pulse.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/q_pulse.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./cpp/include/q_pulse.h
 
-     Date: 01/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.cpp
index 07e342b..10483e8 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: qisf_ns.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.h
index 4e9f67e..eddf1f5 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qisf_ns.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./cpp/include/qisf_ns.h
 
-     Date: 01/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.cpp
index 0d465c6..0b63563 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: qpisf_2s.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.h
index 61f8c06..51e32b6 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/qpisf_2s.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./cpp/include/qpisf_2s.h
 
-     Date: 01/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/scale_signal.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/scale_signal.cpp
index b2b02b1..d225d28 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/scale_signal.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/scale_signal.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: scale_signal.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.cpp
index c3aa887..987729f 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: synthesis_amr_wb.cpp
 
-     Date: 05/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.h b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.h
index 4bfc3c5..2074aab 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.h
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/synthesis_amr_wb.h
@@ -33,12 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Pathname: ./cpp/include/synthesis_amr_wb.h
 
-     Date: 05/04/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
- Description:
 ------------------------------------------------------------------------------
  INCLUDE DESCRIPTION
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/voice_factor.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/voice_factor.cpp
index 6153c67..6163335 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/voice_factor.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/voice_factor.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: voice_factor.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/wb_syn_filt.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/wb_syn_filt.cpp
index e1af6d4..f307dee 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/wb_syn_filt.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/wb_syn_filt.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: wb_syn_filt.cpp
 
-     Date: 05/08/2004
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/weight_amrwb_lpc.cpp b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/weight_amrwb_lpc.cpp
index 63d2e00..726ef46 100644
--- a/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/weight_amrwb_lpc.cpp
+++ b/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/weight_amrwb_lpc.cpp
@@ -33,14 +33,6 @@ terms listed above has been obtained from the copyright holder.
 
  Filename: weight_amrwb_lpc.cpp
 
-     Date: 05/08/2007
-
-------------------------------------------------------------------------------
- REVISION HISTORY
-
-
- Description:
-
 ------------------------------------------------------------------------------
  INPUT AND OUTPUT DEFINITIONS
 
diff --git a/opencore/codecs_v2/audio/gsm_amr/common/dec/include/pvgsmamrdecoderinterface.h b/opencore/codecs_v2/audio/gsm_amr/common/dec/include/pvgsmamrdecoderinterface.h
index c80c0b3..33ddcf1 100644
--- a/opencore/codecs_v2/audio/gsm_amr/common/dec/include/pvgsmamrdecoderinterface.h
+++ b/opencore/codecs_v2/audio/gsm_amr/common/dec/include/pvgsmamrdecoderinterface.h
@@ -16,9 +16,9 @@
  * -------------------------------------------------------------------
  */
 //////////////////////////////////////////////////////////////////////////////////
-//																				//
-//	File: pvgsmamrdecoderinterface.h	                                        //
-//																				//
+//                                                                              //
+//  File: pvgsmamrdecoderinterface.h                                            //
+//                                                                              //
 //////////////////////////////////////////////////////////////////////////////////
 
 #ifndef _PVGSMAMR_DECODER_INTERFACE_H

-- 
opencore-amr packaging



More information about the pkg-multimedia-commits mailing list