Merge change I9a275773 into eclair-mr2

* changes:
  Initial check in of AMR (NB and WB) decoders based on PV source code.
This commit is contained in:
Android (Google) Code Review
2009-12-10 12:29:39 -08:00
289 changed files with 75184 additions and 0 deletions

View File

@@ -55,6 +55,9 @@ ifeq ($(BUILD_WITH_FULL_STAGEFRIGHT),true)
LOCAL_STATIC_LIBRARIES := \
libstagefright_aacdec \
libstagefright_amrnbdec \
libstagefright_amrnb_common \
libstagefright_amrwbdec \
libstagefright_mp3dec
endif

View File

@@ -20,6 +20,8 @@
#if BUILD_WITH_FULL_STAGEFRIGHT
#include "include/AACDecoder.h"
#include "include/AMRNBDecoder.h"
#include "include/AMRWBDecoder.h"
#include "include/MP3Decoder.h"
#endif
@@ -292,6 +294,10 @@ sp<MediaSource> OMXCodec::Create(
#if BUILD_WITH_FULL_STAGEFRIGHT
if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC)) {
return new AACDecoder(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_NB)) {
return new AMRNBDecoder(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_WB)) {
return new AMRWBDecoder(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_MPEG)) {
return new MP3Decoder(source);
}

View File

@@ -0,0 +1,4 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
include $(call all-makefiles-under,$(LOCAL_PATH))

View File

@@ -0,0 +1,74 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
src/add.cpp \
src/az_lsp.cpp \
src/bitno_tab.cpp \
src/bitreorder_tab.cpp \
src/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/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 \
src/log2_tbl.cpp \
src/lsfwt.cpp \
src/lsp.cpp \
src/lsp_az.cpp \
src/lsp_lsf.cpp \
src/lsp_lsf_tbl.cpp \
src/lsp_tab.cpp \
src/mult_r.cpp \
src/norm_l.cpp \
src/norm_s.cpp \
src/overflow_tbl.cpp \
src/ph_disp_tab.cpp \
src/pow2.cpp \
src/pow2_tbl.cpp \
src/pred_lt.cpp \
src/q_plsf.cpp \
src/q_plsf_3.cpp \
src/q_plsf_3_tbl.cpp \
src/q_plsf_5.cpp \
src/q_plsf_5_tbl.cpp \
src/qua_gain_tbl.cpp \
src/reorder.cpp \
src/residu.cpp \
src/round.cpp \
src/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
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include
LOCAL_CFLAGS := \
-DOSCL_UNUSED_ARG= -DOSCL_IMPORT_REF= -DOSCL_EXPORT_REF=
LOCAL_MODULE := libstagefright_amrnb_common
include $(BUILD_STATIC_LIBRARY)

View File

@@ -0,0 +1,113 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the abs_s function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef ABS_S_H
#define ABS_S_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 abs_s(Word16 var1);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* ABS_S_H */

View File

@@ -0,0 +1,116 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the add function.
------------------------------------------------------------------------------
*/
#ifndef ADD_H
#define ADD_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 add(Word16 var1, Word16 var2, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _ADD_H_ */

View File

@@ -0,0 +1,120 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the function Az_lsp()
------------------------------------------------------------------------------
*/
#ifndef AZ_LSP_H
#define AZ_LSP_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
#define grid_points 60
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern Word16 grid[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void Az_lsp(
Word16 a[], /* (i) : predictor coefficients (MP1) */
Word16 lsp[], /* (o) : line spectral pairs (M) */
Word16 old_lsp[], /* (i) : old lsp[] (in case not found 10 roots) (M) */
Flag *pOverflow /* (i/o): overflow flag */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _AZ_LSP_H */

View File

@@ -0,0 +1,448 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, 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: ./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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file includes all the basicop2.c functions' header files.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef BASIC_OP_H
#define BASIC_OP_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
#if defined(PV_ARM_V5)
#include "basic_op_arm_v5.h"
#elif defined(PV_ARM_GCC_V5)
#include "basic_op_arm_gcc_v5.h"
#else
#include "basic_op_c_equivalent.h"
#endif
#include "add.h"
#include "div_s.h"
#include "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"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*
------------------------------------------------------------------------------
FUNCTION NAME: mac_32
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var3 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
L_var1_hi = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
L_var1_lo = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
L_var2_hi = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
L_var2_lo = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit mac operation resulted in overflow
Returns:
L_var3 = 32-bit result of L_var3 + (L_var1 * L_var2)(Word32)
*/
static inline Word32 Mac_32(Word32 L_var3,
Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 L_var2_hi,
Word16 L_var2_lo,
Flag *pOverflow)
{
Word16 product;
L_var3 = L_mac(L_var3, L_var1_hi, L_var2_hi, pOverflow);
product = mult(L_var1_hi, L_var2_lo, pOverflow);
L_var3 = L_mac(L_var3, product, 1, pOverflow);
product = mult(L_var1_lo, L_var2_hi, pOverflow);
L_var3 = L_mac(L_var3, product, 1, pOverflow);
return (L_var3);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: mac_32_16
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var3 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
L_var1_hi = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
L_var1_lo = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
var2= 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit mac operation resulted in overflow
Returns:
L_var3 = 32-bit result of L_var3 + (L_var1 * var2)(Word32)
*/
static inline Word32 Mac_32_16(Word32 L_var3,
Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 var2,
Flag *pOverflow)
{
Word16 product;
L_var3 = L_mac(L_var3, L_var1_hi, var2, pOverflow);
product = mult(L_var1_lo, var2, pOverflow);
L_var3 = L_mac(L_var3, product, 1, pOverflow);
return (L_var3);
}
/*----------------------------------------------------------------------------
Function Name : negate
Negate var1 with saturation, saturate in the case where input is -32768:
negate(var1) = sub(0,var1).
Inputs :
var1
16 bit short signed integer (Word16) whose value falls in the
range : 0x8000 <= var1 <= 0x7fff.
Outputs :
none
Return Value :
16 bit short signed integer (Word16) whose value falls in the
range : 0x8000 <= var_out <= 0x7fff.
----------------------------------------------------------------------------*/
static inline Word16 negate(Word16 var1)
{
return (((var1 == MIN_16) ? MAX_16 : -var1));
}
/*----------------------------------------------------------------------------
Function Name : shl
Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill
the var2 LSB of the result. If var2 is negative, arithmetically shift
var1 right by -var2 with sign extension. Saturate the result in case of
underflows or overflows.
Inputs :
var1
16 bit short signed integer (Word16) whose value falls in the
range : 0x8000 <= var1 <= 0x7fff.
var2
16 bit short signed integer (Word16) whose value falls in the
range : 0x8000 <= var1 <= 0x7fff.
pOverflow : pointer to overflow (Flag)
Return Value :
var_out
16 bit short signed integer (Word16) whose value falls in the
range : 0x8000 <= var_out <= 0x7fff.
----------------------------------------------------------------------------*/
static inline Word16 shl(Word16 var1, Word16 var2, Flag *pOverflow)
{
Word16 var_out = 0;
OSCL_UNUSED_ARG(pOverflow);
if (var2 < 0)
{
var2 = -var2;
if (var2 < 15)
{
var_out = var1 >> var2;
}
}
else
{
var_out = var1 << var2;
if (var_out >> var2 != var1)
{
var_out = (var1 >> 15) ^ MAX_16;
}
}
return (var_out);
}
/*----------------------------------------------------------------------------
Function Name : L_shl
Arithmetically shift the 32 bit input L_var1 left var2 positions. Zero
fill the var2 LSB of the result. If var2 is negative, arithmetically
shift L_var1 right by -var2 with sign extension. Saturate the result in
case of underflows or overflows.
Inputs :
L_var1 32 bit long signed integer (Word32) whose value falls in the
range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
var2
16 bit short signed integer (Word16) whose value falls in the
range : 8000 <= var2 <= 7fff.
pOverflow : pointer to overflow (Flag)
Return Value :
32 bit long signed integer (Word32) whose value falls in the
range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
----------------------------------------------------------------------------*/
static inline Word32 L_shl(Word32 L_var1, Word16 var2, Flag *pOverflow)
{
Word32 L_var_out = 0;
OSCL_UNUSED_ARG(pOverflow);
if (var2 > 0)
{
L_var_out = L_var1 << var2;
if (L_var_out >> var2 != L_var1)
{
L_var_out = (L_var1 >> 31) ^ MAX_32;
}
}
else
{
var2 = -var2;
if (var2 < 31)
{
L_var_out = L_var1 >> var2;
}
}
return (L_var_out);
}
/*----------------------------------------------------------------------------
Function Name : L_shr
Arithmetically shift the 32 bit input L_var1 right var2 positions with
sign extension. If var2 is negative, arithmetically shift L_var1 left
by -var2 and zero fill the -var2 LSB of the result. Saturate the result
in case of underflows or overflows.
Inputs :
L_var1 32 bit long signed integer (Word32) whose value falls in the
range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
var2
16 bit short signed integer (Word16) whose value falls in the
range : 8000 <= var2 <= 7fff.
pOverflow : pointer to overflow (Flag)
Return Value :
32 bit long signed integer (Word32) whose value falls in the
range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
----------------------------------------------------------------------------*/
static inline Word32 L_shr(Word32 L_var1, Word16 var2, Flag *pOverflow)
{
Word32 L_var_out = 0;
OSCL_UNUSED_ARG(pOverflow);
if (var2 > 0)
{
if (var2 < 31)
{
L_var_out = L_var1 >> var2;
}
}
else
{
var2 = -var2;
L_var_out = L_var1 << (var2) ;
if ((L_var_out >> (var2)) != L_var1)
{
L_var_out = (L_var1 >> 31) ^ MAX_32;
}
}
return (L_var_out);
}
/*----------------------------------------------------------------------------
Function Name : abs_s
Absolute value of var1; abs_s(-32768) = 32767.
Inputs :
var1
16 bit short signed integer (Word16) whose value falls in the
range : 0x8000 <= var1 <= 0x7fff.
pOverflow : pointer to overflow (Flag)
Outputs :
none
Return Value :
16 bit short signed integer (Word16) whose value falls in the
range : 0x0000 <= var_out <= 0x7fff.
----------------------------------------------------------------------------*/
static inline Word16 abs_s(Word16 var1)
{
Word16 y = var1 - (var1 < 0);
y = y ^(y >> 15);
return (y);
}
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* BASIC_OP_H */

View File

@@ -0,0 +1,543 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, 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: ./include/basic_op_arm_gcc_v5.h
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file includes all the GCC-ARM V5 basicop.c functions.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef BASIC_OP_ARM_GCC_V5_H
#define BASIC_OP_ARM_GCC_V5_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_add
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
L_var2 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
*/
__inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
{
register Word32 ra = L_var1;
register Word32 rb = L_var2;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("qadd %0, %1, %2"
: "=r"(result)
: "r"(ra), "r"(rb)
);
return (result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_sub
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
L_var2 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
*/
__inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
{
register Word32 ra = L_var1;
register Word32 rb = L_var2;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("qsub %0, %1, %2"
: "=r"(result)
: "r"(ra), "r"(rb)
);
return (result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_mac
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var3 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
result = 32-bit result of L_var3 + (var1 * var2)(Word32)
*/
static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 ra = L_var3;
register Word32 rb = var1;
register Word32 rc = var2;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(result)
: "r"(rb), "r"(rc)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(rc)
: "r"(ra), "r"(result)
);
return (rc);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_mult
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
L_var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
L_product = 32-bit product of L_var1 and L_var2 (Word32)
*/
__inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 ra = var1;
register Word32 rb = var2;
Word32 result;
Word32 product;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(product)
: "r"(ra), "r"(rb)
);
asm volatile("qadd %0, %1, %2"
: "=r"(result)
: "r"(product), "r"(product)
);
return(result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_msu
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var3 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit operation resulted in overflow
Returns:
result = 32-bit result of L_var3 - (var1 * var2)
*/
__inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 ra = L_var3;
register Word32 rb = var1;
register Word32 rc = var2;
Word32 product;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(product)
: "r"(rb), "r"(rc)
);
asm volatile("qdsub %0, %1, %2"
: "=r"(result)
: "r"(ra), "r"(product)
);
return (result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: Mpy_32
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1_hi = most significant word of first input (Word16).
L_var1_lo = least significant word of first input (Word16).
L_var2_hi = most significant word of second input (Word16).
L_var2_lo = least significant word of second input (Word16).
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit multiply operation resulted in overflow
Returns:
L_product = 32-bit product of L_var1 and L_var2 (Word32)
*/
static inline Word32 Mpy_32(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 L_var2_hi,
Word16 L_var2_lo,
Flag *pOverflow)
{
register Word32 product32;
register Word32 L_sum;
register Word32 L_product, result;
register Word32 ra = L_var1_hi;
register Word32 rb = L_var1_lo;
register Word32 rc = L_var2_hi;
register Word32 rd = L_var2_lo;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(L_product)
: "r"(ra), "r"(rc)
);
asm volatile("mov %0, #0"
: "=r"(result)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(L_sum)
: "r"(result), "r"(L_product)
);
asm volatile("smulbb %0, %1, %2"
: "=r"(product32)
: "r"(ra), "r"(rd)
);
asm volatile("mov %0, %1, ASR #15"
: "=r"(ra)
: "r"(product32)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(L_product)
: "r"(L_sum), "r"(ra)
);
asm volatile("smulbb %0, %1, %2"
: "=r"(product32)
: "r"(rb), "r"(rc)
);
asm volatile("mov %0, %1, ASR #15"
: "=r"(rb)
: "r"(product32)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(L_sum)
: "r"(L_product), "r"(rb)
);
return (L_sum);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: Mpy_32_16
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1_hi = most significant 16 bits of 32-bit input (Word16).
L_var1_lo = least significant 16 bits of 32-bit input (Word16).
var2 = 16-bit signed integer (Word16).
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit product operation resulted in overflow
Returns:
product = 32-bit product of the 32-bit L_var1 and 16-bit var1 (Word32)
*/
static inline Word32 Mpy_32_16(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 var2,
Flag *pOverflow)
{
register Word32 ra = L_var1_hi;
register Word32 rb = L_var1_lo;
register Word32 rc = var2;
Word32 result, L_product;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(L_product)
: "r"(ra), "r"(rc)
);
asm volatile("mov %0, #0"
: "=r"(result)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(L_product)
: "r"(result), "r"(L_product)
);
asm volatile("smulbb %0, %1, %2"
: "=r"(result)
: "r"(rb), "r"(rc)
);
asm volatile("mov %0, %1, ASR #15"
: "=r"(ra)
: "r"(result)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(result)
: "r"(L_product), "r"(ra)
);
return (result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: mult
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the add operation resulted in overflow
Returns:
product = 16-bit limited product of var1 and var2 (Word16)
*/
__inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 ra = var1;
register Word32 rb = var2;
Word32 product;
Word32 temp;
OSCL_UNUSED_ARG(pOverflow);
asm volatile(
"smulbb %0, %1, %2"
: "=r"(temp)
: "r"(ra), "r"(rb)
);
asm volatile(
"qadd %0, %1, %2\n\t"
"mov %0, %0, asr #16"
: "=&r*i"(product)
: "r"(temp), "r"(temp)
);
return ((Word16) product);
}
__inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
{
register Word32 ra = L_var1;
register Word32 rb = L_var2;
register Word32 rc = L_var3;
Word32 result;
asm volatile("smlabb %0, %1, %2, %3"
: "=r"(result)
: "r"(ra), "r"(rb), "r"(rc)
);
return (result);
}
__inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
{
register Word32 ra = L_var1;
register Word32 rb = L_var2;
register Word32 rc = L_var3;
Word32 result;
asm volatile("rsb %0, %1, #0"
: "=r"(ra)
: "r"(ra)
);
asm volatile("smlabb %0, %1, %2, %3"
: "=r"(result)
: "r"(ra), "r"(rb), "r"(rc)
);
return (result);
}
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* BASIC_OP_ARM_GCC_V5_H */

View File

@@ -0,0 +1,440 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Pathname: ./include/basic_op_arm_v5.h
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file includes all the ARM-V5 based basicop.c functions.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef BASIC_OP_ARM_V5_H
#define BASIC_OP_ARM_V5_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_add
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
L_var2 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
*/
__inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
{
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
QADD result, L_var1, L_var2
}
return(result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_sub
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
L_var2 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
*/
__inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
{
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
QSUB result, L_var1, L_var2
}
return(result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_mac
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var3 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
result = 32-bit result of L_var3 + (var1 * var2)(Word32)
*/
__inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 result;
Word32 L_sum;
OSCL_UNUSED_ARG(pOverflow);
__asm {SMULBB result, var1, var2}
__asm {QDADD L_sum, L_var3, result}
return (L_sum);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_mult
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
L_var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
L_product = 32-bit product of L_var1 and L_var2 (Word32)
*/
__inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 result;
Word32 product;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
SMULBB product, var1, var2
QADD result, product, product
}
return (result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_msu
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var3 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit operation resulted in overflow
Returns:
result = 32-bit result of L_var3 - (var1 * var2)
*/
__inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 product;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
SMULBB product, var1, var2
QDSUB result, L_var3, product
}
return (result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: Mpy_32
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1_hi = most significant word of first input (Word16).
L_var1_lo = least significant word of first input (Word16).
L_var2_hi = most significant word of second input (Word16).
L_var2_lo = least significant word of second input (Word16).
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit multiply operation resulted in overflow
Returns:
L_product = 32-bit product of L_var1 and L_var2 (Word32)
*/
__inline Word32 Mpy_32(Word16 L_var1_hi, Word16 L_var1_lo, Word16 L_var2_hi,
Word16 L_var2_lo, Flag *pOverflow)
{
Word32 L_product;
Word32 L_sum;
Word32 product32;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
SMULBB L_product, L_var1_hi, L_var2_hi
QDADD L_product, 0, L_product
SMULBB product32, L_var1_hi, L_var2_lo
}
product32 >>= 15;
__asm
{
QDADD L_sum, L_product, product32
}
L_product = L_sum;
__asm
{
SMULBB product32, L_var1_lo, L_var2_hi
}
product32 >>= 15;
__asm
{
QDADD L_sum, L_product, product32
}
return (L_sum);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: Mpy_32_16
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1_hi = most significant 16 bits of 32-bit input (Word16).
L_var1_lo = least significant 16 bits of 32-bit input (Word16).
var2 = 16-bit signed integer (Word16).
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit product operation resulted in overflow
Returns:
product = 32-bit product of the 32-bit L_var1 and 16-bit var1 (Word32)
*/
__inline Word32 Mpy_32_16(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 var2,
Flag *pOverflow)
{
Word32 L_product;
Word32 L_sum;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
__asm {SMULBB L_product, L_var1_hi, var2}
__asm {QDADD L_product, 0, L_product}
__asm {SMULBB result, L_var1_lo, var2}
result >>= 15;
__asm {QDADD L_sum, L_product, result}
return (L_sum);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: mult
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the add operation resulted in overflow
Returns:
product = 16-bit limited product of var1 and var2 (Word16)
*/
__inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 product;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
SMULBB product, var1, var2
MOV product, product, ASR #15
CMP product, 0x7FFF
MOVGE product, 0x7FFF
}
return ((Word16) product);
}
__inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
{
Word32 result;
__asm
{
smlabb result, L_var1, L_var2, L_var3
}
return result;
}
__inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
{
Word32 result;
__asm
{
rsb L_var1, L_var1, #0
smlabb result, L_var1, L_var2, L_var3
}
return result;
}
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* BASIC_OP_ARM_V5_H */

View File

@@ -0,0 +1,505 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, 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: ./include/basic_op_c_equivalent.h
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file includes all the C-Equivalent basicop.c functions.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef BASIC_OP_C_EQUIVALENT_H
#define BASIC_OP_C_EQUIVALENT_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_add
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
L_var2 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
*/
static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
{
Word32 L_sum;
L_sum = L_var1 + L_var2;
if ((L_var1 ^ L_var2) >= 0)
{
if ((L_sum ^ L_var1) < 0)
{
L_sum = (L_var1 < 0) ? MIN_32 : MAX_32;
*pOverflow = 1;
}
}
return (L_sum);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_sub
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
L_var2 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
*/
static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2,
register Flag *pOverflow)
{
Word32 L_diff;
L_diff = L_var1 - L_var2;
if ((L_var1 ^ L_var2) < 0)
{
if ((L_diff ^ L_var1) & MIN_32)
{
L_diff = (L_var1 < 0L) ? MIN_32 : MAX_32;
*pOverflow = 1;
}
}
return (L_diff);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_mac
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var3 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
result = 32-bit result of L_var3 + (var1 * var2)(Word32)
*/
__inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 result;
Word32 L_sum;
result = (Word32) var1 * var2;
if (result != (Word32) 0x40000000L)
{
L_sum = (result << 1) + L_var3;
/* Check if L_sum and L_var_3 share the same sign */
if ((L_var3 ^ result) > 0)
{
if ((L_sum ^ L_var3) < 0)
{
L_sum = (L_var3 < 0) ? MIN_32 : MAX_32;
*pOverflow = 1;
}
}
}
else
{
*pOverflow = 1;
L_sum = MAX_32;
}
return (L_sum);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_mult
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
L_var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit add operation resulted in overflow
Returns:
L_product = 32-bit product of L_var1 and L_var2 (Word32)
*/
static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 L_product;
L_product = (Word32) var1 * var2;
if (L_product != (Word32) 0x40000000L)
{
L_product <<= 1; /* Multiply by 2 */
}
else
{
*pOverflow = 1;
L_product = MAX_32;
}
return (L_product);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: L_msu
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var3 = 32 bit long signed integer (Word32) whose value falls
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit operation resulted in overflow
Returns:
result = 32-bit result of L_var3 - (var1 * var2)
*/
static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 result;
result = L_mult(var1, var2, pOverflow);
result = L_sub(L_var3, result, pOverflow);
return (result);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: Mpy_32
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1_hi = most significant word of first input (Word16).
L_var1_lo = least significant word of first input (Word16).
L_var2_hi = most significant word of second input (Word16).
L_var2_lo = least significant word of second input (Word16).
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit multiply operation resulted in overflow
Returns:
L_product = 32-bit product of L_var1 and L_var2 (Word32)
*/
__inline Word32 Mpy_32(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 L_var2_hi,
Word16 L_var2_lo,
Flag *pOverflow)
{
Word32 L_product;
Word32 L_sum;
Word32 product32;
OSCL_UNUSED_ARG(pOverflow);
L_product = (Word32) L_var1_hi * L_var2_hi;
if (L_product != (Word32) 0x40000000L)
{
L_product <<= 1;
}
else
{
L_product = MAX_32;
}
/* result = mult (L_var1_hi, L_var2_lo, pOverflow); */
product32 = ((Word32) L_var1_hi * L_var2_lo) >> 15;
/* L_product = L_mac (L_product, result, 1, pOverflow); */
L_sum = L_product + (product32 << 1);
if ((L_product ^ product32) > 0)
{
if ((L_sum ^ L_product) < 0)
{
L_sum = (L_product < 0) ? MIN_32 : MAX_32;
}
}
L_product = L_sum;
/* result = mult (L_var1_lo, L_var2_hi, pOverflow); */
product32 = ((Word32) L_var1_lo * L_var2_hi) >> 15;
/* L_product = L_mac (L_product, result, 1, pOverflow); */
L_sum = L_product + (product32 << 1);
if ((L_product ^ product32) > 0)
{
if ((L_sum ^ L_product) < 0)
{
L_sum = (L_product < 0) ? MIN_32 : MAX_32;
}
}
return (L_sum);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: Mpy_32_16
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
L_var1_hi = most significant 16 bits of 32-bit input (Word16).
L_var1_lo = least significant 16 bits of 32-bit input (Word16).
var2 = 16-bit signed integer (Word16).
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the 32 bit product operation resulted in overflow
Returns:
product = 32-bit product of the 32-bit L_var1 and 16-bit var1 (Word32)
*/
__inline Word32 Mpy_32_16(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 var2,
Flag *pOverflow)
{
Word32 L_product;
Word32 L_sum;
Word32 result;
L_product = (Word32) L_var1_hi * var2;
if (L_product != (Word32) 0x40000000L)
{
L_product <<= 1;
}
else
{
*pOverflow = 1;
L_product = MAX_32;
}
result = ((Word32)L_var1_lo * var2) >> 15;
L_sum = L_product + (result << 1);
if ((L_product ^ result) > 0)
{
if ((L_sum ^ L_product) < 0)
{
L_sum = (L_product < 0) ? MIN_32 : MAX_32;
*pOverflow = 1;
}
}
return (L_sum);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: mult
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the add operation resulted in overflow
Returns:
product = 16-bit limited product of var1 and var2 (Word16)
*/
static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 product;
product = ((Word32) var1 * var2) >> 15;
/* Saturate result (if necessary). */
/* var1 * var2 >0x00007fff is the only case */
/* that saturation occurs. */
if (product > 0x00007fffL)
{
*pOverflow = 1;
product = (Word32) MAX_16;
}
/* Return the product as a 16 bit value by type casting Word32 to Word16 */
return ((Word16) product);
}
static inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
{
Word32 result;
result = L_var3 + L_var1 * L_var2;
return result;
}
static inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
{
Word32 result;
result = L_var3 - L_var1 * L_var2;
return result;
}
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* BASIC_OP_C_EQUIVALENT_H */

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Pathname: ./gsm-amr/c/include/basicop_malloc.h
------------------------------------------------------------------------------
REVISION HISTORY
Description: Added #ifdef __cplusplus after Include section.
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains constant definitions and external references to the stores
used by any arithmetic function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef BASICOP_MALLOC_H
#define BASICOP_MALLOC_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
#define MAX_32 (Word32)0x7fffffffL
#define MIN_32 (Word32)0x80000000L
#define MAX_16 (Word16)0x7fff
#define MIN_16 (Word16)0x8000
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern Flag Overflow;
extern Flag Carry;
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,146 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file declares a tables in bitno_tab.c.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef BITNO_TAB_H
#define BITNO_TAB_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
#define BIT_0 0
#define BIT_1 1
#define PRMNO_MR475 17
#define PRMNO_MR515 19
#define PRMNO_MR59 19
#define PRMNO_MR67 19
#define PRMNO_MR74 19
#define PRMNO_MR795 23
#define PRMNO_MR102 39
#define PRMNO_MR122 57
#define PRMNO_MRDTX 5
/* number of parameters to first subframe */
#define PRMNOFSF_MR475 7
#define PRMNOFSF_MR515 7
#define PRMNOFSF_MR59 7
#define PRMNOFSF_MR67 7
#define PRMNOFSF_MR74 7
#define PRMNOFSF_MR795 8
#define PRMNOFSF_MR102 12
#define PRMNOFSF_MR122 18
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern const Word16 prmno[];
extern const Word16 prmnofsf[];
extern const Word16 bitno_MR475[];
extern const Word16 bitno_MR515[];
extern const Word16 bitno_MR59[];
extern const Word16 bitno_MR67[];
extern const Word16 bitno_MR74[];
extern const Word16 bitno_MR95[];
extern const Word16 bitno_MR102[];
extern const Word16 bitno_MR122[];
extern const Word16 bitno_MRDTX[];
extern const Word16 *const bitno[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,125 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file declares a tables in bitreorder.c.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef BITREORDER_H
#define BITREORDER_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern const Word16 numOfBits[];
extern const Word16 reorderBits_MR475[];
extern const Word16 reorderBits_MR515[];
extern const Word16 reorderBits_MR59[];
extern const Word16 reorderBits_MR67[];
extern const Word16 reorderBits_MR74[];
extern const Word16 reorderBits_MR795[];
extern const Word16 reorderBits_MR102[];
extern const Word16 reorderBits_MR122[];
extern const Word16 *const reorderBits[];
extern const Word16 numCompressedBytes[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,91 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, 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"
#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

View File

@@ -0,0 +1,109 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Pathname: .audio/gsm-amr/c/include/BytesUsed.h
------------------------------------------------------------------------------
REVISION HISTORY
Description: Added #ifdef __cplusplus after Include section.
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file declares a table BytesUsed.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef BYTESUSED_H
#define BYTESUSED_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern const short BytesUsed[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,129 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
INCLUDE DESCRIPTION
This file contains the Speech code (encoder, decoder, and postfilter)
constant parameters.
NOTE: This file must be synchronized with /gsm-amr/asm/include/cnst.inc file.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef _CNST_H_
#define _CNST_H_
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
#define L_TOTAL 320 /* Total size of speech buffer. */
#define L_WINDOW 240 /* Window size in LP analysis */
#define L_FRAME 160 /* Frame size */
#define L_FRAME_BY2 80 /* Frame size divided by 2 */
#define L_SUBFR 40 /* Subframe size */
#define L_CODE 40 /* codevector length */
#define NB_TRACK 5 /* number of tracks */
#define STEP 5 /* codebook step size */
#define NB_TRACK_MR102 4 /* number of tracks mode mr102 */
#define STEP_MR102 4 /* codebook step size mode mr102 */
#define M 10 /* Order of LP filter */
#define MP1 (M+1) /* Order of LP filter + 1 */
#define LSF_GAP 205 /* Minimum distance between LSF after quan- */
/* tization; 50 Hz = 205 */
#define LSP_PRED_FAC_MR122 21299 /* MR122 LSP prediction factor (0.65 Q15) */
#define AZ_SIZE (4*M+4) /* Size of array of LP filters in 4 subfr.s */
#define PIT_MIN_MR122 18 /* Minimum pitch lag (MR122 mode) */
#define PIT_MIN 20 /* Minimum pitch lag (all other modes) */
#define PIT_MAX 143 /* Maximum pitch lag */
#define L_INTERPOL (10+1) /* Length of filter for interpolation */
#define L_INTER_SRCH 4 /* Length of filter for CL LTP search */
/* interpolation */
#define MU 26214 /* Factor for tilt compensation filter 0.8 */
#define AGC_FAC 29491 /* Factor for automatic gain control 0.9 */
#define L_NEXT 40 /* Overhead in LP analysis */
#define SHARPMAX 13017 /* Maximum value of pitch sharpening */
#define SHARPMIN 0 /* Minimum value of pitch sharpening */
#define MAX_PRM_SIZE 57 /* max. num. of params */
#define MAX_SERIAL_SIZE 244 /* max. num. of serial bits */
#define GP_CLIP 15565 /* Pitch gain clipping = 0.95 */
#define N_FRAME 7 /* old pitch gains in average calculation */
#define EHF_MASK 0x0008 /* encoder homing frame pattern */
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _CNST_H_ */

View File

@@ -0,0 +1,133 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
**-------------------------------------------------------------------------**
** **
** GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 **
** R99 Version 3.2.0 **
** REL-4 Version 4.0.0 **
** **
**-------------------------------------------------------------------------**
********************************************************************************
*
* File : cnst_vad.h
* Purpose : Constants and definitions for VAD
*
********************************************************************************
*/
#ifndef cnst_vad_h
#define cnst_vad_h "$Id $"
#define FRAME_LEN 160 /* Length (samples) of the input frame */
#define COMPLEN 9 /* Number of sub-bands used by VAD */
#define INV_COMPLEN 3641 /* 1.0/COMPLEN*2^15 */
#define LOOKAHEAD 40 /* length of the lookahead used by speech coder */
#define UNITY 512 /* Scaling used with SNR calculation */
#define UNIRSHFT 6 /* = log2(MAX_16/UNITY) */
#define TONE_THR (Word16)(0.65*MAX_16) /* Threshold for tone detection */
/* Constants for background spectrum update */
#define ALPHA_UP1 (Word16)((1.0 - 0.95)*MAX_16) /* Normal update, upwards: */
#define ALPHA_DOWN1 (Word16)((1.0 - 0.936)*MAX_16) /* Normal update, downwards */
#define ALPHA_UP2 (Word16)((1.0 - 0.985)*MAX_16) /* Forced update, upwards */
#define ALPHA_DOWN2 (Word16)((1.0 - 0.943)*MAX_16) /* Forced update, downwards */
#define ALPHA3 (Word16)((1.0 - 0.95)*MAX_16) /* Update downwards */
#define ALPHA4 (Word16)((1.0 - 0.9)*MAX_16) /* For stationary estimation */
#define ALPHA5 (Word16)((1.0 - 0.5)*MAX_16) /* For stationary estimation */
/* Constants for VAD threshold */
#define VAD_THR_HIGH 1260 /* Highest threshold */
#define VAD_THR_LOW 720 /* Lowest threshold */
#define VAD_P1 0 /* Noise level for highest threshold */
#define VAD_P2 6300 /* Noise level for lowest threshold */
#define VAD_SLOPE (Word16)(MAX_16*(float)(VAD_THR_LOW-VAD_THR_HIGH)/(float)(VAD_P2-VAD_P1))
/* Parameters for background spectrum recovery function */
#define STAT_COUNT 20 /* threshold of stationary detection counter */
#define STAT_COUNT_BY_2 10 /* threshold of stationary detection counter */
#define CAD_MIN_STAT_COUNT 5 /* threshold of stationary detection counter */
#define STAT_THR_LEVEL 184 /* Threshold level for stationarity detection */
#define STAT_THR 1000 /* Threshold for stationarity detection */
/* Limits for background noise estimate */
#define NOISE_MIN 40 /* minimum */
#define NOISE_MAX 16000 /* maximum */
#define NOISE_INIT 150 /* initial */
/* Constants for VAD hangover addition */
#define HANG_NOISE_THR 100
#define BURST_LEN_HIGH_NOISE 4
#define HANG_LEN_HIGH_NOISE 7
#define BURST_LEN_LOW_NOISE 5
#define HANG_LEN_LOW_NOISE 4
/* Thresholds for signal power */
#define VAD_POW_LOW (Word32)15000 /* If input power is lower, */
/* VAD is set to 0 */
#define POW_PITCH_THR (Word32)343040 /* If input power is lower, pitch */
/* detection is ignored */
#define POW_COMPLEX_THR (Word32)15000 /* If input power is lower, complex */
/* flags value for previous frame is un-set */
/* Constants for the filter bank */
#define LEVEL_SHIFT 0 /* scaling */
#define COEFF3 13363 /* coefficient for the 3rd order filter */
#define COEFF5_1 21955 /* 1st coefficient the for 5th order filter */
#define COEFF5_2 6390 /* 2nd coefficient the for 5th order filter */
/* Constants for pitch detection */
#define LTHRESH 4
#define NTHRESH 4
/* Constants for complex signal VAD */
#define CVAD_THRESH_ADAPT_HIGH (Word16)(0.6 * MAX_16) /* threshold for adapt stopping high */
#define CVAD_THRESH_ADAPT_LOW (Word16)(0.5 * MAX_16) /* threshold for adapt stopping low */
#define CVAD_THRESH_IN_NOISE (Word16)(0.65 * MAX_16) /* threshold going into speech on */
/* a short term basis */
#define CVAD_THRESH_HANG (Word16)(0.70 * MAX_16) /* threshold */
#define CVAD_HANG_LIMIT (Word16)(100) /* 2 second estimation time */
#define CVAD_HANG_LENGTH (Word16)(250) /* 5 second hangover */
#define CVAD_LOWPOW_RESET (Word16) (0.40 * MAX_16) /* init in low power segment */
#define CVAD_MIN_CORR (Word16) (0.40 * MAX_16) /* lowest adaptation value */
#define CVAD_BURST 20 /* speech burst length for speech reset */
#define CVAD_ADAPT_SLOW (Word16)(( 1.0 - 0.98) * MAX_16) /* threshold for slow adaption */
#define CVAD_ADAPT_FAST (Word16)((1.0 - 0.92) * MAX_16) /* threshold for fast adaption */
#define CVAD_ADAPT_REALLY_FAST (Word16)((1.0 - 0.80) * MAX_16) /* threshold for really fast */
/* adaption */
#endif

View File

@@ -0,0 +1,88 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, 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

View File

@@ -0,0 +1,125 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /audio/gsm_amr/c/src/include/d_gain_c.h
------------------------------------------------------------------------------
REVISION HISTORY
Description: Moved _cplusplus #ifdef after Include section.
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
File : d_gain_c.h
Purpose : Decode the fixed codebook gain using the received index.
------------------------------------------------------------------------------
*/
#ifndef _D_GAIN_C_H_
#define _D_GAIN_C_H_
#define d_gain_c_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "mode.h"
#include "gc_pred.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; [Define module specific macros here]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; [Include all pre-processor statements here.]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; [Declare variables used in this module but defined elsewhere]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; [List function prototypes here]
----------------------------------------------------------------------------*/
/*
* Function : d_gain_code
* Purpose : Decode the fixed codebook gain using the received index.
* Description : The received index gives the gain correction factor
* gamma. The quantized gain is given by g_q = g0 * gamma
* where g0 is the predicted gain. To find g0, 4th order
* MA prediction is applied to the mean-removed innovation
* energy in dB.
* Returns : void
*/
void d_gain_code(
gc_predState *pred_state, /* i/o : MA predictor state */
enum Mode mode, /* i : AMR mode */
Word16 index, /* i : received quantization index */
Word16 code[], /* i : innovation codevector */
Word16 *gain_code, /* o : decoded innovation gain */
Flag *pOverflow
);
#ifdef __cplusplus
}
#endif
#endif /* _D_GAIN_C_H_ */

View File

@@ -0,0 +1,80 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
********************************************************************************
*
* File : d_gain_p.h
* Purpose : Decodes the pitch gain using the received index.
*
********************************************************************************
*/
#ifndef d_gain_p_h
#define d_gain_p_h "$Id $"
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "typedef.h"
#include "mode.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*
**************************************************************************
*
* Function : d_gain_pitch
* Purpose : Decodes the pitch gain using the received index.
* Description : In case of no frame erasure, the gain is obtained
* from the quantization table at the given index;
* otherwise, a downscaled past gain is used.
* Returns : Quantized pitch gain
*
**************************************************************************
*/
Word16 d_gain_pitch( /* return value: gain (Q14) */
enum Mode mode, /* i : AMR mode */
Word16 index /* i : index of quantization */
);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,199 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, 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/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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the d_plsf_3.c and d_plsf_5.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef d_plsf_h
#define d_plsf_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "cnst.h"
#include "mode.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
typedef struct
{
Word16 past_r_q[M]; /* Past quantized prediction error, Q15 */
Word16 past_lsf_q[M]; /* Past dequantized lsfs, Q15 */
} D_plsfState;
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*
**************************************************************************
*
* Function : D_plsf_reset
* Purpose : Resets state memory
* Returns : 0 on success
*
**************************************************************************
*/
Word16 D_plsf_reset(D_plsfState *st);
/*
**************************************************************************
*
* Function : D_plsf_exit
* Purpose : The memory used for state memory is freed
* Description : Stores NULL in *st
* Returns : void
*
**************************************************************************
*/
void D_plsf_exit(D_plsfState **st);
/*
**************************************************************************
*
* Function : D_plsf_5
* Purpose : Decodes the 2 sets of LSP parameters in a frame
* using the received quantization indices.
* Description : The two sets of LSFs are quantized using split by
* 5 matrix quantization (split-MQ) with 1st order MA
* prediction.
* See "q_plsf_5.c" for more details about the
* quantization procedure
* Returns : 0
*
**************************************************************************
*/
void D_plsf_5(
D_plsfState *st, /* i/o: State variables */
Word16 bfi, /* i : bad frame indicator (set to 1 if a bad
frame is received) */
Word16 *indice, /* i : quantization indices of 5 submatrices, Q0 */
Word16 *lsp1_q, /* o : quantized 1st LSP vector (M) Q15 */
Word16 *lsp2_q, /* o : quantized 2nd LSP vector (M) Q15 */
Flag *pOverflow /* o : Flag set when overflow occurs */
);
/*************************************************************************
*
* FUNCTION: D_plsf_3()
*
* PURPOSE: Decodes the LSP parameters using the received quantization
* indices.1st order MA prediction and split by 3 matrix
* quantization (split-MQ)
*
*************************************************************************/
void D_plsf_3(
D_plsfState *st, /* i/o: State struct */
enum Mode mode, /* i : coder mode */
Word16 bfi, /* i : bad frame indicator (set to 1 if a */
/* bad frame is received) */
Word16 * indice, /* i : quantization indices of 3 submatrices, Q0 */
Word16 * lsp1_q, /* o : quantized 1st LSP vector, Q15 */
Flag *pOverflow /* o : Flag set when overflow occurs */
);
/*************************************************************************
*
* FUNCTION: Init_D_plsf_3()
*
* PURPOSE: Set the past_r_q[M] vector to one of the eight
* past_rq_init vectors.
*
*************************************************************************/
void Init_D_plsf_3(D_plsfState *st, /* i/o: State struct */
Word16 index /* i : past_rq_init[] index [0, 7] */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _Q_PLSF_H_ */

View File

@@ -0,0 +1,116 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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_ */

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the div_s function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef DIV_S_H
#define DIV_S_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 div_s(Word16 var1, Word16 var2);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,103 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /audio/gsm_amr/c/include/dtx_common_def.h
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
File : dtx_common_def.h
Purpose : DTX definitions common to encoder and decoder
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef DTX_COMMON_DEF_H
#define DTX_COMMON_DEF_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
#define DTX_MAX_EMPTY_THRESH 50
#define DTX_HIST_SIZE 8
#define DTX_ELAPSED_FRAMES_THRESH (24 + 7 -1)
#define DTX_HANG_CONST 7 /* yields eight frames of SP HANGOVER */
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* DTX_COMMON_DEF_H */

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
*****************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
*****************************************************************************
*
* File : frame.h
* Purpose : Declaration of received and transmitted frame types
*
*****************************************************************************
*/
#ifndef frame_h
#define frame_h "$Id $"
/*
*****************************************************************************
* INCLUDE FILES
*****************************************************************************
*/
#ifdef __cplusplus
extern "C"
{
#endif
/*
*****************************************************************************
* DEFINITION OF DATA TYPES
*****************************************************************************
* Note: The order of the TX and RX_Type identifiers has been chosen in
* the way below to be compatible to an earlier version of the
* AMR-NB C reference program.
*****************************************************************************
*/
enum RXFrameType { RX_SPEECH_GOOD = 0,
RX_SPEECH_DEGRADED,
RX_ONSET,
RX_SPEECH_BAD,
RX_SID_FIRST,
RX_SID_UPDATE,
RX_SID_BAD,
RX_NO_DATA,
RX_N_FRAMETYPES /* number of frame types */
};
enum TXFrameType { TX_SPEECH_GOOD = 0,
TX_SID_FIRST,
TX_SID_UPDATE,
TX_NO_DATA,
TX_SPEECH_DEGRADED,
TX_SPEECH_BAD,
TX_SID_BAD,
TX_ONSET,
TX_N_FRAMETYPES /* number of frame types */
};
/* Channel decoded frame type */
enum CHDECFrameType { CHDEC_SID_FIRST = 0,
CHDEC_SID_FIRST_INCOMPLETE,
CHDEC_SID_UPDATE_INCOMPLETE,
CHDEC_SID_UPDATE,
CHDEC_SPEECH,
CHDEC_SPEECH_ONSET,
CHDEC_ESCAPE_MARKER,
CHDEC_ESCAPE_DATA,
CHDEC_NO_DATA
};
/* Channel decoded frame quality */
enum CHDECFrameQuality { CHDEC_GOOD = 0,
CHDEC_PROBABLY_DEGRADED,
CHDEC_PROBABLY_BAD,
CHDEC_BAD
};
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,123 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains the definition of the 3GPP frame types.
------------------------------------------------------------------------------
*/
#ifndef FRAME_TYPE_3GPP_H
#define FRAME_TYPE_3GPP_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
enum Frame_Type_3GPP
{
AMR_475 = 0,
AMR_515,
AMR_59,
AMR_67,
AMR_74,
AMR_795,
AMR_102,
AMR_122,
AMR_SID,
GSM_EFR_SID,
TDMA_EFR_SID,
PDC_EFR_SID,
FOR_FUTURE_USE1,
FOR_FUTURE_USE2,
FOR_FUTURE_USE3,
AMR_NO_DATA
};
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _FRAME_TYPE_3GPP_H_ */

View File

@@ -0,0 +1,176 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
File : gc_pred.h
Purpose : codebook gain MA prediction
------------------------------------------------------------------------------
*/
#ifndef _GC_PRED_H_
#define _GC_PRED_H_
#define gc_pred_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "mode.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; [Define module specific macros here]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; [Include all pre-processor statements here.]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; [Declare variables used in this module but defined elsewhere]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
typedef struct
{
Word16 past_qua_en[4]; /* normal MA predictor memory, Q10 */
/* (contains 20*log10(qua_err)) */
Word16 past_qua_en_MR122[4]; /* MA predictor memory for MR122 mode, Q10 */
/* (contains log2(qua_err)) */
} gc_predState;
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; [List function prototypes here]
----------------------------------------------------------------------------*/
Word16 gc_pred_reset(gc_predState *st);
/* reset of codebook gain MA predictor state (i.e. set state memory to zero)
returns 0 on success
*/
void gc_pred_exit(gc_predState **st);
/* de-initialize codebook gain MA predictor state (i.e. free state struct)
stores NULL in *st
*/
void
gc_pred_copy(
gc_predState *st_src, /* i : State struct */
gc_predState *st_dest /* o : State struct */
);
/*
* FUNCTION: gc_pred()
* PURPOSE: MA prediction of the innovation energy
* (in dB/(20*log10(2))) with mean removed).
*/
void gc_pred(
gc_predState *st, /* i/o: State struct */
enum Mode mode, /* i : AMR mode */
Word16 *code, /* i : innovative codebook vector (L_SUBFR) */
/* MR122: Q12, other modes: Q13 */
Word16 *exp_gcode0, /* o : exponent of predicted gain factor, Q0 */
Word16 *frac_gcode0,/* o : fraction of predicted gain factor Q15 */
Word16 *exp_en, /* o : exponent of innovation energy, Q0 */
/* (only calculated for MR795) */
Word16 *frac_en, /* o : fraction of innovation energy, Q15 */
/* (only calculated for MR795) */
Flag *pOverflow
);
/*
* FUNCTION: gc_pred_update()
* PURPOSE: update MA predictor with last quantized energy
*/
void gc_pred_update(
gc_predState *st, /* i/o: State struct */
Word16 qua_ener_MR122, /* i : quantized energy for update, Q10 */
/* (log2(qua_err)) */
Word16 qua_ener /* i : quantized energy for update, Q10 */
/* (20*log10(qua_err)) */
);
/*
* FUNCTION: gc_pred_average_limited()
* PURPOSE: get average of MA predictor state values (with a lower limit)
* [used in error concealment]
*/
void gc_pred_average_limited(
gc_predState *st, /* i: State struct */
Word16 *ener_avg_MR122, /* o: averaged quantized energy, Q10 */
/* (log2(qua_err)) */
Word16 *ener_avg, /* o: averaged quantized energy, Q10 */
/* (20*log10(qua_err)) */
Flag *pOverflow
);
#ifdef __cplusplus
}
#endif
#endif /* _GC_PRED_H_ */

View File

@@ -0,0 +1,80 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
********************************************************************************
*
* File : gmed_n.h
* Purpose : calculates N-point median.
*
********************************************************************************
*/
#ifndef gmed_n_h
#define gmed_n_h "$Id $"
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "typedef.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*
********************************************************************************
* DEFINITION OF DATA TYPES
********************************************************************************
*/
/*
********************************************************************************
* DECLARATION OF PROTOTYPES
********************************************************************************
*/
Word16 gmed_n( /* o : index of the median value (0...N-1) */
Word16 ind[], /* i : Past gain values */
Word16 n /* i : The number of gains; this routine */
/* is only valid for a odd number of gains */
);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,133 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains the definition of the amr codec types.
------------------------------------------------------------------------------
*/
#ifndef GSM_AMR_TYPEDEFS_H
#define GSM_AMR_TYPEDEFS_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include <stdint.h>
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
typedef int8_t Word8;
typedef uint8_t UWord8;
/*----------------------------------------------------------------------------
; Define 16 bit signed and unsigned words
----------------------------------------------------------------------------*/
typedef int16_t Word16;
typedef uint16_t UWord16;
/*----------------------------------------------------------------------------
; Define 32 bit signed and unsigned words
----------------------------------------------------------------------------*/
typedef int32_t Word32;
typedef uint32_t UWord32;
/*----------------------------------------------------------------------------
; Define boolean type
----------------------------------------------------------------------------*/
typedef int Bool;
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef OFF
#define OFF 0
#endif
#ifndef ON
#define ON 1
#endif
#ifndef NO
#define NO 0
#endif
#ifndef YES
#define YES 1
#endif
#ifndef SUCCESS
#define SUCCESS 0
#endif
#ifndef NULL
#define NULL 0
#endif
typedef int32_t Flag;
#endif /* GSM_AMR_TYPEDEFS_H */

View File

@@ -0,0 +1,212 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the lsp_avg.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef int_lpc_h
#define int_lpc_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*
**************************************************************************
*
* Function : Int_lpc_1and3
* Purpose : Interpolates the LSPs and converts to LPC parameters
* to get a different LP filter in each subframe.
* Description : The 20 ms speech frame is divided into 4 subframes.
* The LSPs are quantized and transmitted at the 2nd and
* 4th subframes (twice per frame) and interpolated at the
* 1st and 3rd subframe.
*
* |------|------|------|------|
* sf1 sf2 sf3 sf4
* F0 Fm F1
*
* sf1: 1/2 Fm + 1/2 F0 sf3: 1/2 F1 + 1/2 Fm
* sf2: Fm sf4: F1
* Returns : void
*
**************************************************************************
*/
void Int_lpc_1and3(
Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
Word16 lsp_mid[], /* i : LSP vector at the 2nd subfr. of
present frame (M) */
Word16 lsp_new[], /* i : LSP vector at the 4th subfr. of
present frame (M) */
Word16 Az[], /* o : interpolated LP parameters in all subfr.
(AZ_SIZE) */
Flag *pOverflow
);
/*
**************************************************************************
*
* Function : Int_lpc_1and3_2
* Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
* function but we do not recompute Az() for subframe 2 and
* 4 because it is already available.
* Returns : void
*
**************************************************************************
*/
void Int_lpc_1and3_2(
Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
Word16 lsp_mid[], /* i : LSP vector at the 2nd subframe of
present frame (M) */
Word16 lsp_new[], /* i : LSP vector at the 4th subframe of
present frame (M) */
Word16 Az[], /* o :interpolated LP parameters
in subframes 1 and 3 (AZ_SIZE) */
Flag *pOverflow
);
/*
**************************************************************************
*
* Function : Int_lpc_1to3
* Purpose : Interpolates the LSPs and converts to LPC parameters
* to get a different LP filter in each subframe.
* Description : The 20 ms speech frame is divided into 4 subframes.
* The LSPs are quantized and transmitted at the 4th
* subframes (once per frame) and interpolated at the
* 1st, 2nd and 3rd subframe.
*
* |------|------|------|------|
* sf1 sf2 sf3 sf4
* F0 F1
*
* sf1: 3/4 F0 + 1/4 F1 sf3: 1/4 F0 + 3/4 F1
* sf2: 1/2 F0 + 1/2 F1 sf4: F1
* Returns : void
*
**************************************************************************
*/
void Int_lpc_1to3(
Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M) */
Word16 lsp_new[], /* i : LSP vector at the 4th SF of present frame (M) */
Word16 Az[], /* o : interpolated LP parameters in all SFs (AZ_SIZE) */
Flag *pOverflow
);
/*
**************************************************************************
*
* Function : Int_lpc_1to3_2
* Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
* function but we do not recompute Az() for subframe 4
* because it is already available.
* Returns : void
*
**************************************************************************
*/
void Int_lpc_1to3_2(
Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M) */
Word16 lsp_new[], /* i : LSP vector at the 4th SF present frame (M) */
Word16 Az[], /* o :interpolated LP parameters in SFs 1, 2, 3
(AZ_SIZE) */
Flag *pOverflow
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _INT_LPC_H_ */

View File

@@ -0,0 +1,113 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /audio/gsm_amr/c/include/int_lsf.h
------------------------------------------------------------------------------
REVISION HISTORY
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 int_lsf function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef int_lsf_h
#define int_lsf_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void Int_lsf(
Word16 lsf_old[], /* i : LSF vector at the 4th SF of past frame */
Word16 lsf_new[], /* i : LSF vector at the 4th SF of present frame */
Word16 i_subfr, /* i : Current sf (equal to 0,40,80 or 120) */
Word16 lsf_out[], /* o : interpolated LSF parameters for current sf */
Flag *pOverflow /* o : flag set if overflow occurs */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _INT_LSF_H_ */

View File

@@ -0,0 +1,118 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the inv_sqrt() function.
------------------------------------------------------------------------------
*/
#ifndef INV_SQRT_H
#define INV_SQRT_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern Word16 inv_sqrt_tbl[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 Inv_sqrt( /* (o) : output value */
Word32 L_x, /* (i) : input value */
Flag *pOverflow /* (i) : pointer to overflow flag */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _INV_SQRT_H_ */

View File

@@ -0,0 +1,111 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_abs function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_ABS_H
#define L_ABS_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 L_abs(Word32 L_var1);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,171 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_add function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_ADD_H
#define L_ADD_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
__inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
{
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
QADD result, L_var1, L_var2
}
return(result);
}
#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
__inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
{
register Word32 ra = L_var1;
register Word32 rb = L_var2;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("qadd %0, %1, %2"
: "=r"(result)
: "r"(ra), "r"(rb)
);
return (result);
}
#else /* C EQUIVALENT */
static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
{
Word32 L_sum;
L_sum = L_var1 + L_var2;
if ((L_var1 ^ L_var2) >= 0)
{
if ((L_sum ^ L_var1) < 0)
{
L_sum = (L_var1 < 0) ? MIN_32 : MAX_32;
*pOverflow = 1;
}
}
return (L_sum);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_ADD_H_ */

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_add_c function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_ADD_C_H
#define L_ADD_C_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 L_add_c(Word32 L_var1, Word32 L_var2, Flag *pOverflow, Flag *pCarry);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_ADD_C_H_ */

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_comp function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_COMP_H
#define L_COMP_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 L_Comp(Word16 hi, Word16 lo, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_extract function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_EXTRACT_H
#define L_EXTRACT_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void L_Extract(Word32 L_var,
Word16 *pL_var_hi,
Word16 *pL_var_lo,
Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_EXTRACT_H_ */

View File

@@ -0,0 +1,183 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_mac function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_MAC_H
#define L_MAC_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
__inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 result;
Word32 L_sum;
OSCL_UNUSED_ARG(pOverflow);
__asm {SMULBB result, var1, var2}
__asm {QDADD L_sum, L_var3, result}
return (L_sum);
}
#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 ra = L_var3;
register Word32 rb = var1;
register Word32 rc = var2;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(result)
: "r"(rb), "r"(rc)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(rc)
: "r"(ra), "r"(result)
);
return (rc);
}
#else /* C_EQUIVALENT */
__inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 result;
Word32 L_sum;
result = (Word32) var1 * var2;
if (result != (Word32) 0x40000000L)
{
L_sum = (result << 1) + L_var3;
/* Check if L_sum and L_var_3 share the same sign */
if ((L_var3 ^ result) > 0)
{
if ((L_sum ^ L_var3) < 0)
{
L_sum = (L_var3 < 0) ? MIN_32 : MAX_32;
*pOverflow = 1;
}
}
}
else
{
*pOverflow = 1;
L_sum = MAX_32;
}
return (L_sum);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_MAC_H_ */

View File

@@ -0,0 +1,171 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_msu function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_MSU_H
#define L_MSU_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
#include "l_mult.h"
#include "l_sub.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
__inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 product;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
SMULBB product, var1, var2
QDSUB result, L_var3, product
}
return (result);
}
#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
__inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 ra = L_var3;
register Word32 rb = var1;
register Word32 rc = var2;
Word32 product;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(product)
: "r"(rb), "r"(rc)
);
asm volatile("qdsub %0, %1, %2"
: "=r"(result)
: "r"(ra), "r"(product)
);
return (result);
}
#else /* C EQUIVALENT */
static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 result;
result = L_mult(var1, var2, pOverflow);
result = L_sub(L_var3, result, pOverflow);
return (result);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_MSU_H_ */

View File

@@ -0,0 +1,178 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, 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/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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_mult function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_MULT_H
#define L_MULT_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
__inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 result;
Word32 product;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
SMULBB product, var1, var2
QADD result, product, product
}
return (result);
}
#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
__inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 ra = var1;
register Word32 rb = var2;
Word32 result;
Word32 product;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(product)
: "r"(ra), "r"(rb)
);
asm volatile("qadd %0, %1, %2"
: "=r"(result)
: "r"(product), "r"(product)
);
return(result);
}
#else /* C EQUIVALENT */
static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 L_product;
L_product = (Word32) var1 * var2;
if (L_product != (Word32) 0x40000000L)
{
L_product <<= 1; /* Multiply by 2 */
}
else
{
*pOverflow = 1;
L_product = MAX_32;
}
return (L_product);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_MULT_H */

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_negate function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_NEGATE_H
#define L_NEGATE_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 L_negate(Word32 L_var1);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,116 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_shl function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_SHL_H
#define L_SHL_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 L_shl(Word32 L_var1, Word16 var2, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_SHL_H_ */

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_shr function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_SHR_H
#define L_SHR_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 L_shr(Word32 L_var1, Word16 var2, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_SHR_H_ */

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_shr_r function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_SHR_R_H
#define L_SHR_R_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 L_shr_r(Word32 L_var1, Word16 var2, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_SHR_R_H_ */

View File

@@ -0,0 +1,173 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the L_sub function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef L_SUB_H
#define L_SUB_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
__inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
{
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
QSUB result, L_var1, L_var2
}
return(result);
}
#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
__inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
{
register Word32 ra = L_var1;
register Word32 rb = L_var2;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("qsub %0, %1, %2"
: "=r"(result)
: "r"(ra), "r"(rb)
);
return (result);
}
#else /* C EQUIVALENT */
static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2,
register Flag *pOverflow)
{
Word32 L_diff;
L_diff = L_var1 - L_var2;
if ((L_var1 ^ L_var2) < 0)
{
if ((L_diff ^ L_var1) & MIN_32)
{
L_diff = (L_var1 < 0L) ? MIN_32 : MAX_32;
*pOverflow = 1;
}
}
return (L_diff);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _L_SUB_H_ */

View File

@@ -0,0 +1,120 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains the function prototype definition for Log2 function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef LOG2_H
#define LOG2_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "log2_norm.h" /* Used by legacy files */
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void Log2(
Word32 L_x, /* (i) : input value */
Word16 *pExponent, /* (o) : Integer part of Log2. (range: 0<=val<=30)*/
Word16 *pFraction, /* (o) : Fractional part of Log2. (range: 0<=val<1) */
Flag *pOverflow /* (i/o) : overflow flag */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _LOG2_H_ */

View File

@@ -0,0 +1,119 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, 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/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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains the prototype declaration for Log2_norm function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef LOG2_NORM_H
#define LOG2_NORM_H
#define log2_h "$Id $" /* Used by legacy code */
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern Word16 log2_tbl[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void Log2_norm(
Word32 L_x, /* (i) : input value (normalized) */
Word16 exp, /* (i) : norm_l (L_x) */
Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */
Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1) */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _LOG2_NORM_H_ */

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the lsfwt.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef lsfwt_h
#define lsfwt_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "cnst.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void Lsf_wt(
Word16 *lsf, /* input : LSF vector */
Word16 *wf, /* output: square of weighting factors */
Flag * pOverflow); /* o : Flag set when overflow occurs */
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _LSF_WT_H_ */

View File

@@ -0,0 +1,186 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the lsp.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef lsp_h
#define lsp_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "q_plsf.h"
#include "mode.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
typedef struct
{
/* Past LSPs */
Word16 lsp_old[M];
Word16 lsp_old_q[M];
/* Quantization state */
Q_plsfState *qSt;
} lspState;
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*
**************************************************************************
*
* Function : lsp_init
* Purpose : Allocates memory and initializes state variables
* Description : Stores pointer to filter status struct in *st. This
* pointer has to be passed to lsp in each call.
* Returns : 0 on success
*
**************************************************************************
*/
Word16 lsp_init(lspState **st);
/*
**************************************************************************
*
* Function : lsp_reset
* Purpose : Resets state memory
* Returns : 0 on success
*
**************************************************************************
*/
Word16 lsp_reset(lspState *st);
/*
**************************************************************************
*
* Function : lsp_exit
* Purpose : The memory used for state memory is freed
* Description : Stores NULL in *st
*
**************************************************************************
*/
void lsp_exit(lspState **st);
/*
**************************************************************************
*
* Function : lsp
* Purpose : Conversion from LP coefficients to LSPs.
* Quantization of LSPs.
* Description : Generates 2 sets of LSPs from 2 sets of
* LP coefficients for mode 12.2. For the other
* modes 1 set of LSPs is generated from 1 set of
* LP coefficients. These LSPs are quantized with
* Matrix/Vector quantization (depending on the mode)
* and interpolated for the subframes not yet having
* their own LSPs.
*
**************************************************************************
*/
void lsp(lspState *st, /* i/o : State struct */
enum Mode req_mode, /* i : requested coder mode */
enum Mode used_mode,/* i : used coder mode */
Word16 az[], /* i/o : interpolated LP parameters Q12 */
Word16 azQ[], /* o : quantization interpol. LP parameters Q12*/
Word16 lsp_new[], /* o : new lsp vector */
Word16 **anap, /* o : analysis parameters */
Flag *pOverflow /* o : Flag set when overflow occurs */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _LSP_H_ */

View File

@@ -0,0 +1,111 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /audio/gsm_amr/c/include/lsp_az.h
------------------------------------------------------------------------------
REVISION HISTORY
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 lsp_az function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef LSP_AZ_H
#define LSP_AZ_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void Lsp_Az(
Word16 lsp[], /* (i) : line spectral frequencies */
Word16 a[], /* (o) : predictor coefficients (order = 10) */
Flag *pOverflow /* (o) : overflow flag */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _LSP_AZ_H_ */

View File

@@ -0,0 +1,121 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, 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/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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the lsp_lsf.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef lsp_lsf_h
#define lsp_lsf_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void 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(
Word16 lsp[], /* (i) : lsp[m] (range: -1<=val<1) */
Word16 lsf[], /* (o) : lsf[m] normalized (range: 0.0<=val<=0.5) */
Word16 m, /* (i) : LPC order */
Flag *pOverflow /* (o) : Flag set when overflow occurs */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _LSP_LSF_H_ */

View File

@@ -0,0 +1,111 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Pathname: .audio/gsm-amr/c/include/lsp_tab.h
------------------------------------------------------------------------------
REVISION HISTORY
Description: Added #ifdef __cplusplus after Include section.
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file declares a table lsp_init_data.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef LSP_TAB_H
#define LSP_TAB_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "cnst.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern const Word16 lsp_init_data[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,150 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /audio/gsm_amr/c/include/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
needed by the Mac_32 and Mac_32_16 functions
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef MAC_32_H
#define MAC_32_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
static inline Word32 Mac_32(Word32 L_var3,
Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 L_var2_hi,
Word16 L_var2_lo,
Flag *pOverflow)
{
Word16 product;
L_var3 = L_mac(L_var3, L_var1_hi, L_var2_hi, pOverflow);
product = mult(L_var1_hi, L_var2_lo, pOverflow);
L_var3 = L_mac(L_var3, product, 1, pOverflow);
product = mult(L_var1_lo, L_var2_hi, pOverflow);
L_var3 = L_mac(L_var3, product, 1, pOverflow);
return (L_var3);
}
static inline Word32 Mac_32_16(Word32 L_var3,
Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 var2,
Flag *pOverflow)
{
Word16 product;
L_var3 = L_mac(L_var3, L_var1_hi, var2, pOverflow);
product = mult(L_var1_lo, var2, pOverflow);
L_var3 = L_mac(L_var3, product, 1, pOverflow);
return (L_var3);
}
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _MAC_32_H_ */

View File

@@ -0,0 +1,82 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
********************************************************************************
*
* File : mode.h
* Purpose : Declaration of mode type
*
********************************************************************************
*/
#ifndef mode_h
#define mode_h "$Id $"
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#ifdef __cplusplus
extern "C"
{
#endif
/*
********************************************************************************
* DEFINITION OF DATA TYPES
********************************************************************************
*/
enum Mode { MR475 = 0,
MR515,
MR59,
MR67,
MR74,
MR795,
MR102,
MR122,
MRDTX,
N_MODES /* number of (SPC) modes */
};
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,272 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, 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/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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the Mpy_32 function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef MPY_32_H
#define MPY_32_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
__inline Word32 Mpy_32(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 L_var2_hi,
Word16 L_var2_lo,
Flag *pOverflow)
{
/*----------------------------------------------------------------------------
; Define all local variables
----------------------------------------------------------------------------*/
Word32 L_product;
Word32 L_sum;
Word32 product32;
OSCL_UNUSED_ARG(pOverflow);
/*----------------------------------------------------------------------------
; Function body here
----------------------------------------------------------------------------*/
/* L_product = L_mult (L_var1_hi, L_var2_hi, pOverflow);*/
__asm {SMULBB L_product, L_var1_hi, L_var2_hi}
__asm {QDADD L_product, 0, L_product}
__asm {SMULBB product32, L_var1_hi, L_var2_lo}
product32 >>= 15;
__asm {QDADD L_sum, L_product, product32}
L_product = L_sum;
__asm {SMULBB product32, L_var1_lo, L_var2_hi}
product32 >>= 15;
__asm {QDADD L_sum, L_product, product32}
return (L_sum);
}
#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
static inline Word32 Mpy_32(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 L_var2_hi,
Word16 L_var2_lo,
Flag *pOverflow)
{
register Word32 product32;
register Word32 L_sum;
register Word32 L_product, result;
register Word32 ra = L_var1_hi;
register Word32 rb = L_var1_lo;
register Word32 rc = L_var2_hi;
register Word32 rd = L_var2_lo;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(L_product)
: "r"(ra), "r"(rc)
);
asm volatile("mov %0, #0"
: "=r"(result)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(L_sum)
: "r"(result), "r"(L_product)
);
asm volatile("smulbb %0, %1, %2"
: "=r"(product32)
: "r"(ra), "r"(rd)
);
asm volatile("mov %0, %1, ASR #15"
: "=r"(ra)
: "r"(product32)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(L_product)
: "r"(L_sum), "r"(ra)
);
asm volatile("smulbb %0, %1, %2"
: "=r"(product32)
: "r"(rb), "r"(rc)
);
asm volatile("mov %0, %1, ASR #15"
: "=r"(rb)
: "r"(product32)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(L_sum)
: "r"(L_product), "r"(rb)
);
return (L_sum);
}
#else /* C_EQUIVALENT */
__inline Word32 Mpy_32(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 L_var2_hi,
Word16 L_var2_lo,
Flag *pOverflow)
{
Word32 L_product;
Word32 L_sum;
Word32 product32;
OSCL_UNUSED_ARG(pOverflow);
L_product = (Word32) L_var1_hi * L_var2_hi;
if (L_product != (Word32) 0x40000000L)
{
L_product <<= 1;
}
else
{
L_product = MAX_32;
}
/* result = mult (L_var1_hi, L_var2_lo, pOverflow); */
product32 = ((Word32) L_var1_hi * L_var2_lo) >> 15;
/* L_product = L_mac (L_product, result, 1, pOverflow); */
L_sum = L_product + (product32 << 1);
if ((L_product ^ product32) > 0)
{
if ((L_sum ^ L_product) < 0)
{
L_sum = (L_product < 0) ? MIN_32 : MAX_32;
}
}
L_product = L_sum;
/* result = mult (L_var1_lo, L_var2_hi, pOverflow); */
product32 = ((Word32) L_var1_lo * L_var2_hi) >> 15;
/* L_product = L_mac (L_product, result, 1, pOverflow); */
L_sum = L_product + (product32 << 1);
if ((L_product ^ product32) > 0)
{
if ((L_sum ^ L_product) < 0)
{
L_sum = (L_product < 0) ? MIN_32 : MAX_32;
}
}
/*----------------------------------------------------------------------------
; Return nothing or data or data pointer
----------------------------------------------------------------------------*/
return (L_sum);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _MPY_32_H_ */

View File

@@ -0,0 +1,206 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /audio/gsm_amr/c/include/mpy_32_16.h
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the Mpy_32_16 function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef MPY_32_16_H
#define MPY_32_16_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if defined(PV_ARM_V5) /* Instructions for ARM Assembly on ADS*/
__inline Word32 Mpy_32_16(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 var2,
Flag *pOverflow)
{
Word32 L_product;
Word32 L_sum;
Word32 result;
OSCL_UNUSED_ARG(pOverflow);
__asm {SMULBB L_product, L_var1_hi, var2}
__asm {QDADD L_product, 0, L_product}
__asm {SMULBB result, L_var1_lo, var2}
result >>= 15;
__asm {QDADD L_sum, L_product, result}
return (L_sum);
}
#elif defined(PV_ARM_GCC_V5) /* Instructions for ARM-linux cross-compiler*/
static inline Word32 Mpy_32_16(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 var2,
Flag *pOverflow)
{
register Word32 ra = L_var1_hi;
register Word32 rb = L_var1_lo;
register Word32 rc = var2;
Word32 result, L_product;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(L_product)
: "r"(ra), "r"(rc)
);
asm volatile("mov %0, #0"
: "=r"(result)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(L_product)
: "r"(result), "r"(L_product)
);
asm volatile("smulbb %0, %1, %2"
: "=r"(result)
: "r"(rb), "r"(rc)
);
asm volatile("mov %0, %1, ASR #15"
: "=r"(ra)
: "r"(result)
);
asm volatile("qdadd %0, %1, %2"
: "=r"(result)
: "r"(L_product), "r"(ra)
);
return (result);
}
#else /* C_EQUIVALENT */
__inline Word32 Mpy_32_16(Word16 L_var1_hi,
Word16 L_var1_lo,
Word16 var2,
Flag *pOverflow)
{
Word32 L_product;
Word32 L_sum;
Word32 result;
L_product = (Word32) L_var1_hi * var2;
if (L_product != (Word32) 0x40000000L)
{
L_product <<= 1;
}
else
{
*pOverflow = 1;
L_product = MAX_32;
}
result = ((Word32)L_var1_lo * var2) >> 15;
L_sum = L_product + (result << 1);
if ((L_product ^ result) > 0)
{
if ((L_sum ^ L_product) < 0)
{
L_sum = (L_product < 0) ? MIN_32 : MAX_32;
*pOverflow = 1;
}
}
return (L_sum);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _MPY_32_16_H_ */

View File

@@ -0,0 +1,190 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the mult function.
------------------------------------------------------------------------------
*/
#ifndef MULT_H
#define MULT_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if defined(PV_ARM_V5)
__inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
Word32 product;
OSCL_UNUSED_ARG(pOverflow);
__asm
{
SMULBB product, var1, var2
MOV product, product, ASR #15
CMP product, 0x7FFF
MOVGE product, 0x7FFF
}
return ((Word16) product);
}
#elif defined(PV_ARM_GCC_V5)
__inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 ra = var1;
register Word32 rb = var2;
Word32 product;
Word32 temp = 0x7FFF;
OSCL_UNUSED_ARG(pOverflow);
asm volatile("smulbb %0, %1, %2"
: "=r"(product)
: "r"(ra), "r"(rb)
);
asm volatile("mov %0, %1, ASR #15"
: "=r"(product)
: "r"(product)
);
asm volatile("cmp %0, %1"
: "=r"(product)
: "r"(temp)
);
asm volatile("movge %0, %1"
: "=r"(product)
: "r"(temp)
);
return ((Word16) product);
}
#else /* C EQUIVALENT */
static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
{
register Word32 product;
product = ((Word32) var1 * var2) >> 15;
/* Saturate result (if necessary). */
/* var1 * var2 >0x00007fff is the only case */
/* that saturation occurs. */
if (product > 0x00007fffL)
{
*pOverflow = 1;
product = (Word32) MAX_16;
}
/* Return the product as a 16 bit value by type casting Word32 to Word16 */
return ((Word16) product);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _MULT_H_ */

View File

@@ -0,0 +1,121 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, 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/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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the mult_r function.
------------------------------------------------------------------------------
*/
#ifndef MULT_R__H
#define MULT_R__H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _MULT_R_H_ */

View File

@@ -0,0 +1,31 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/* $Id $ */
void proc_head(char *mes);

View File

@@ -0,0 +1,113 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the negate function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef NEGATE_H
#define NEGATE_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 negate(register Word16 var1);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,153 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the norm_l function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef NORM_L_H
#define NORM_L_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) )
/* C EQUIVALENT */
Word16 norm_l(Word32 L_var1);
#elif defined(PV_ARM_V5)
__inline Word16 norm_l(Word32 L_var1)
{
register Word32 var_out = 0;
__asm
{
CMP L_var1, #0
EORNE L_var1, L_var1, L_var1, LSL #1
CLZNE var_out, L_var1
}
return ((Word16)var_out);
}
#elif defined(PV_ARM_GCC_V5)
static inline Word16 norm_l(Word32 L_var1)
{
register Word32 var_out = 0;
register Word32 ra = L_var1;
if (L_var1)
{
ra ^= (ra << 1);
asm volatile(
"clz %0, %1"
: "=r"(var_out)
: "r"(ra)
);
}
return (var_out);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,153 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the norm_s function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef NORM_S_H
#define NORM_S_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
#if !( defined(PV_ARM_V5) || defined(PV_ARM_GCC_V5) )
/* C EQUIVALENT */
Word16 norm_s(Word16 var1);
#elif defined(PV_ARM_V5)
__inline Word16 norm_s(Word16 var)
{
register Word32 var_out = 0;
Word32 var1 = var << 16;
__asm
{
CMP var1, #0
EORNE var1, var1, var1, LSL #1
CLZNE var_out, var1
}
return ((Word16)var_out);
}
#elif defined(PV_ARM_GCC_V5)
static inline Word16 norm_s(Word16 var1)
{
register Word32 var_out = 0;
register Word32 ra = var1 << 16;
if (ra)
{
ra ^= (ra << 1);
asm volatile(
"clz %0, %1"
: "=r"(var_out)
: "r"(ra)
);
}
return (var_out);
}
#endif
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,102 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file includes all the oper_32b.c functions' header files.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef OPER_32B_H
#define OPER_32B_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "div_32.h"
#include "l_comp.h"
#include "l_extract.h"
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#endif

View File

@@ -0,0 +1,144 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
File : p_ol_wgh.h
Purpose : Compute the open loop pitch lag with weighting.
------------------------------------------------------------------------------
*/
#ifndef P_OL_WGH_H
#define P_OL_WGH_H "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "mode.h"
#include "vad.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; [Define module specific macros here]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; [Include all pre-processor statements here.]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; [Declare variables used in this module but defined elsewhere]
----------------------------------------------------------------------------*/
extern const Word16 corrweight[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/* state variable */
typedef struct
{
Word16 old_T0_med;
Word16 ada_w;
Word16 wght_flg;
} pitchOLWghtState;
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; [List function prototypes here]
----------------------------------------------------------------------------*/
Word16 p_ol_wgh_init(pitchOLWghtState **st);
/* initialize one instance of the pre processing state.
Stores pointer to filter status struct in *st. This pointer has to
be passed to p_ol_wgh in each call.
returns 0 on success
*/
Word16 p_ol_wgh_reset(pitchOLWghtState *st);
/* reset of pre processing state (i.e. set state memory to zero)
returns 0 on success
*/
void p_ol_wgh_exit(pitchOLWghtState **st);
/* de-initialize pre processing state (i.e. free status struct)
stores NULL in *st
*/
Word16 Pitch_ol_wgh( /* o : open loop pitch lag */
pitchOLWghtState *st, /* i/o : State struct */
vadState *vadSt, /* i/o : VAD state struct */
Word16 signal[], /* i : signal used to compute the open loop pitch */
/* signal[-pit_max] to signal[-1] should be known */
Word16 pit_min, /* i : minimum pitch lag */
Word16 pit_max, /* i : maximum pitch lag */
Word16 L_frame, /* i : length of frame to compute pitch */
Word16 old_lags[], /* i : history with old stored Cl lags */
Word16 ol_gain_flg[], /* i : OL gain flag */
Word16 idx, /* i : index */
Flag dtx, /* i : dtx flag; use dtx=1, do not use dtx=0 */
Flag *pOverflow /* o : overflow flag */
);
#ifdef __cplusplus
}
#endif
#endif /* _P_OL_WGH_H_ */

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains the prototype declaration for Pow2() function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef POW2_H
#define POW2_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern Word16 pow2_tbl[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 Pow2( /* (o) : result (range: 0<=val<=0x7fffffff) */
Word16 exponent, /* (i) : Integer part. (range: 0<=val<=30) */
Word16 fraction, /* (i) : Fractional part. (range: 0.0<=val<1.0) */
Flag *pOverflow /* (i/o) : overflow flag */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _POW2_H_ */

View File

@@ -0,0 +1,113 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /audio/gsm_amr/c/include/pred_lt.h
------------------------------------------------------------------------------
REVISION HISTORY
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 pred_lt function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef pred_lt_h
#define pred_lt_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void Pred_lt_3or6(
Word16 exc[], /* in/out: excitation buffer */
Word16 T0, /* input : integer pitch lag */
Word16 frac, /* input : fraction of lag */
Word16 L_subfr, /* input : subframe size */
Word16 flag3, /* input : if set, upsampling rate = 3 (6 otherwise) */
Flag *pOverflow /* output: if set, overflow occurred in this function */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* PRED_LT_H */

View File

@@ -0,0 +1,63 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
#ifndef __PVGSMAMR_H
#define __PVGSMAMR_H
// includes
#include <e32std.h>
#include <e32base.h>
#include "sp_dec.h"
#include "pvglobals.h"
// PVGsmDecoder AO
class CPVGsmDecoder : public CBase
{
public:
IMPORT_C static CPVGsmDecoder* NewL(void);
IMPORT_C ~CPVGsmDecoder();
IMPORT_C TInt StartL(void);
// only port the API's used in PVPlayer 2.0
IMPORT_C TInt DecodeFrame(enum Mode mode, unsigned char* compressedBlock, unsigned char* audioBuffer);
IMPORT_C TInt InitDecoder(void);
IMPORT_C void ExitDecoder(void);
private:
CPVGsmDecoder();
void ConstructL(void);
Speech_Decode_FrameState* decState;
enum RXFrameType rx_type;
struct globalDataStruct *gds;
};
#endif

View File

@@ -0,0 +1,169 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, 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/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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the q_plsf_3.c and q_plsf_5.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef q_plsf_h
#define q_plsf_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "cnst.h"
#include "mode.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
#define MR795_1_SIZE 512
#define PAST_RQ_INIT_SIZE 8
#define DICO1_SIZE 256
#define DICO2_SIZE 512
#define DICO3_SIZE 512
#define DICO1_5_SIZE 128
#define DICO2_5_SIZE 256
#define DICO3_5_SIZE 256
#define DICO4_5_SIZE 256
#define DICO5_5_SIZE 64
#define MR515_3_SIZE 128
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
typedef struct
{
Word16 past_rq[M]; /* Past quantized prediction error, Q15 */
} Q_plsfState;
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 Q_plsf_init(Q_plsfState **st);
/* initialize one instance of the state.
Stores pointer to filter status struct in *st. This pointer has to
be passed to Q_plsf_5 / Q_plsf_3 in each call.
returns 0 on success
*/
Word16 Q_plsf_reset(Q_plsfState *st);
/* reset of state (i.e. set state memory to zero)
returns 0 on success
*/
void Q_plsf_exit(Q_plsfState **st);
/* de-initialize state (i.e. free status struct)
stores NULL in *st
*/
void Q_plsf_3(
Q_plsfState *st, /* i/o: state struct */
enum Mode mode, /* i : coder mode */
Word16 *lsp1, /* i : 1st LSP vector Q15 */
Word16 *lsp1_q, /* o : quantized 1st LSP vector Q15 */
Word16 *indice, /* o : quantization indices of 3 vectors Q0 */
Word16 *pred_init_i,/* o : init index for MA prediction in DTX mode */
Flag *pOverflow /* o : Flag set when overflow occurs */
);
void Q_plsf_5(
Q_plsfState *st,
Word16 *lsp1, /* i : 1st LSP vector, Q15 */
Word16 *lsp2, /* i : 2nd LSP vector, Q15 */
Word16 *lsp1_q, /* o : quantized 1st LSP vector, Q15 */
Word16 *lsp2_q, /* o : quantized 2nd LSP vector, Q15 */
Word16 *indice, /* o : quantization indices of 5 matrices, Q0 */
Flag *pOverflow /* o : Flag set when overflow occurs */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _Q_PLSF_H_ */

View File

@@ -0,0 +1,136 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
MODULE DESCRIPTION
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; [Define module specific macros here]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; [Include all pre-processor statements here. Include conditional
; compile variables also.]
----------------------------------------------------------------------------*/
#define MR795_1_SIZE 512
#define PAST_RQ_INIT_SIZE 8
#define DICO1_SIZE 256
#define DICO2_SIZE 512
#define DICO3_SIZE 512
#define MR515_3_SIZE 128
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
; [List function prototypes here]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; LOCAL VARIABLE DEFINITIONS
; [Variable declaration - defined here and used outside this module]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/* Codebooks of LSF prediction residual */
extern const Word16 mean_lsf_3[];
extern const Word16 pred_fac_3[];
extern const Word16 dico1_lsf_3[];
extern const Word16 dico2_lsf_3[];
extern const Word16 dico3_lsf_3[];
extern const Word16 mr515_3_lsf[];
extern const Word16 mr795_1_lsf[];
extern const Word16 past_rq_init[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,110 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Pathname: .audio/gsm-amr/c/include/q_plsf_5_tbl.h
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file declares tables defined in q_plsf_5_tbl.c.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef Q_PLSF_5_TBL_H
#define Q_PLSF_5_TBL_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern const Word16 mean_lsf_5[];
extern const Word16 dico1_lsf_5[];
extern const Word16 dico2_lsf_5[];
extern const Word16 dico3_lsf_5[];
extern const Word16 dico4_lsf_5[];
extern const Word16 dico5_lsf_5[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,107 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Pathname: .audio/gsm-amr/c/include/qgain475_tab.h
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file declares tables defined in qgain475_tab.c.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef QGAIN475_TAB_H
#define QGAIN475_TAB_H
#define MR475_VQ_SIZE 256
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern const Word16 table_gain_MR475[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,135 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the file, qua_gain.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef qua_gain_h
#define qua_gain_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "gc_pred.h"
#include "mode.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
#define VQ_SIZE_HIGHRATES 128
#define VQ_SIZE_LOWRATES 64
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16
Qua_gain( /* o : index of quantization. */
enum Mode mode, /* i : AMR mode */
Word16 exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
Word16 frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
Word16 frac_coeff[], /* i : energy coeff. (5), fraction part, Q15 */
Word16 exp_coeff[], /* i : energy coeff. (5), exponent part, Q0 */
/* (frac_coeff and exp_coeff computed in */
/* calc_filt_energies()) */
Word16 gp_limit, /* i : pitch gain limit */
Word16 *gain_pit, /* o : Pitch gain, Q14 */
Word16 *gain_cod, /* o : Code gain, Q1 */
Word16 *qua_ener_MR122, /* o : quantized energy error, Q10 */
/* (for MR122 MA predictor update) */
Word16 *qua_ener, /* o : quantized energy error, Q10 */
/* (for other MA predictor update) */
Flag *pOverflow /* o : overflow indicator */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* qua_gain_h */

View File

@@ -0,0 +1,108 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Pathname: .audio/gsm-amr/c/include/qua_gain_tbl.h
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file declares tables defined in qua_gain_tbl.c.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef QUA_GAIN_TBL_H
#define QUA_GAIN_TBL_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern const Word16 table_gain_highrates[];
extern const Word16 table_gain_lowrates[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,109 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /audio/gsm_amr/c/include/reorder.h
------------------------------------------------------------------------------
REVISION HISTORY
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 Reorder_lsf() function.
------------------------------------------------------------------------------
*/
#ifndef REORDER_H
#define REORDER_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void Reorder_lsf(
Word16 *lsf, /* (i/o) : vector of LSFs (range: 0<=val<=0.5) */
Word16 min_dist, /* (i) : minimum required distance */
Word16 n, /* (i) : LPC order */
Flag *pOverflow /* (i/o) : overflow Flag */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _REORDER_H_ */

View File

@@ -0,0 +1,83 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
********************************************************************************
*
* File : residu.h
* Purpose : Computes the LP residual.
* Description : The LP residual is computed by filtering the input
* : speech through the LP inverse filter A(z).
*
*
********************************************************************************
*/
#ifndef residu_h
#define residu_h "$Id $"
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "typedef.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*
********************************************************************************
* DEFINITION OF DATA TYPES
********************************************************************************
*/
/*
********************************************************************************
* DECLARATION OF PROTOTYPES
********************************************************************************
*/
void Residu(
Word16 a[], /* (i) : prediction coefficients */
Word16 x[], /* (i) : speech signal */
Word16 y[], /* (o) : residual signal */
Word16 lg /* (i) : size of filtering */
);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,114 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the reverse_bits function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef REVERSE_BITS_H
#define REVERSE_BITS_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "mode.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void reverse_bits(enum Mode mode, unsigned char *pCompressedBlock);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the pv_round function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef ROUND_H
#define ROUND_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 pv_round(Word32 L_var1, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _ROUND_H_ */

View File

@@ -0,0 +1,79 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
********************************************************************************
*
* File : set_zero.h
* Description : Set vector x[] to zero
*
*
********************************************************************************
*/
#ifndef set_zero_h
#define set_zero_h "$Id $"
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "typedef.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*
********************************************************************************
* DEFINITION OF DATA TYPES
********************************************************************************
*/
/*
********************************************************************************
* DECLARATION OF PROTOTYPES
********************************************************************************
*/
void Set_zero(
Word16 x[], /* (o) : vector to clear */
Word16 L /* (i) : length of vector */
);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,118 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the shl function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef SHL_H
#define SHL_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 shl(Word16 var1, Word16 var2, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _SHL_H_ */

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the shr function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef SHR_H
#define SHR_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 shr(Word16 var1, Word16 var2, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _SHR_H_ */

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the shr_r function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef SHR_R_H
#define SHR_R_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 shr_r(Word16 var1, Word16 var2, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,118 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the sqrt_l() function.
------------------------------------------------------------------------------
*/
#ifndef SQRT_L_H
#define SQRT_L_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern Word16 sqrt_l_tbl[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word32 sqrt_l_exp( /* o : output value, Q31 */
Word32 L_x, /* i : input value, Q31 */
Word16 *pExp, /* o : right shift to be applied to result, Q1 */
Flag *pOverflow /* i : pointer to overflow flag */
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _SQRT_L__H_ */

View File

@@ -0,0 +1,115 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the sub function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef SUB_H
#define SUB_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basicop_malloc.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 sub(Word16 var1, Word16 var2, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _SUB_H_ */

View File

@@ -0,0 +1,83 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
********************************************************************************
*
* File : syn_filt.h
* Purpose : Perform synthesis filtering through 1/A(z).
*
*
********************************************************************************
*/
#ifndef syn_filt_h
#define syn_filt_h "$Id $"
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "typedef.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*
********************************************************************************
* DEFINITION OF DATA TYPES
********************************************************************************
*/
/*
********************************************************************************
* DECLARATION OF PROTOTYPES
********************************************************************************
*/
void Syn_filt(
Word16 a[], /* (i) : a[m+1] prediction coefficients (m=10) */
Word16 x[], /* (i) : input signal */
Word16 y[], /* (o) : output signal */
Word16 lg, /* (i) : size of filtering */
Word16 mem[], /* (i/o): memory associated with this filtering. */
Word16 update /* (i) : 0=no update, 1=update of memory. */
);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,73 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
********************************************************************************
*
* File : typedef.c
* Purpose : Basic types.
*
********************************************************************************
*/
#ifndef typedef_h
#define typedef_h "$Id $"
#undef ORIGINAL_TYPEDEF_H /* CHANGE THIS TO #define to get the */
/* "original" ETSI version of typedef.h */
/* CHANGE TO #undef for PV version */
#ifdef ORIGINAL_TYPEDEF_H
/*
* this is the original code from the ETSI file typedef.h
*/
#if defined(__unix__) || defined(__unix)
typedef signed char Word8;
typedef short Word16;
typedef int Word32;
typedef int Flag;
#else
#error No System recognized
#endif
#else /* not original typedef.h */
/*
* use (improved) type definition file typdefs.h
*/
#include "gsm_amr_typedefs.h"
#endif
#endif

View File

@@ -0,0 +1,76 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
**-------------------------------------------------------------------------**
** **
** GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001 **
** R99 Version 3.2.0 **
** REL-4 Version 4.0.0 **
** **
**-------------------------------------------------------------------------**
********************************************************************************
*
* File : vad.h
* Purpose : Voice Activity Detection (VAD) for AMR
*
********************************************************************************
*/
#ifndef vad_h
#define vad_h "$Id $"
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "vad1.h" /* for VAD option 1 */
#include "vad2.h" /* for VAD option 2 */
/*
********************************************************************************
* LOCAL VARIABLES AND TABLES
********************************************************************************
*/
/*
********************************************************************************
* DEFINITION OF DATA TYPES
********************************************************************************
*/
#ifndef VAD2
#define vadState vadState1
#else
#define vadState vadState2
#endif
#endif

View File

@@ -0,0 +1,197 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: /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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions, prototype and structure
definitions needed by vad_1.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef vad_1_h
#define vad_1_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "cnst_vad.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/* state variable */
typedef struct
{
Word16 bckr_est[COMPLEN]; /* background noise estimate */
Word16 ave_level[COMPLEN]; /* averaged input components for stationary */
/* estimation */
Word16 old_level[COMPLEN]; /* input levels of the previous frame */
Word16 sub_level[COMPLEN]; /* input levels calculated at the end of
a frame (lookahead) */
Word16 a_data5[3][2]; /* memory for the filter bank */
Word16 a_data3[5]; /* memory for the filter bank */
Word16 burst_count; /* counts length of a speech burst */
Word16 hang_count; /* hangover counter */
Word16 stat_count; /* stationary counter */
/* Note that each of the following three variables (vadreg, pitch and tone)
holds 15 flags. Each flag reserves 1 bit of the variable. The newest
flag is in the bit 15 (assuming that LSB is bit 1 and MSB is bit 16). */
Word16 vadreg; /* flags for intermediate VAD decisions */
Word16 pitch; /* flags for pitch detection */
Word16 tone; /* flags for tone detection */
Word16 complex_high; /* flags for complex detection */
Word16 complex_low; /* flags for complex detection */
Word16 oldlag_count, oldlag; /* variables for pitch detection */
Word16 complex_hang_count; /* complex hangover counter, used by VAD */
Word16 complex_hang_timer; /* hangover initiator, used by CAD */
Word16 best_corr_hp; /* FIP filtered value Q15 */
Word16 speech_vad_decision; /* final decision */
Word16 complex_warning; /* complex background warning */
Word16 sp_burst_count; /* counts length of a speech burst incl */
Word16 corr_hp_fast; /* filtered value */
} vadState1;
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 vad1_init(vadState1 **st);
/* initialize one instance of the pre processing state.
Stores pointer to filter status struct in *st. This pointer has to
be passed to vad in each call.
returns 0 on success
*/
Word16 vad1_reset(vadState1 *st);
/* reset of pre processing state (i.e. set state memory to zero)
returns 0 on success
*/
void vad1_exit(vadState1 **st);
/* de-initialize pre processing state (i.e. free status struct)
stores NULL in *st
*/
void vad_complex_detection_update(vadState1 *st, /* i/o : State struct */
Word16 best_corr_hp /* i : best Corr Q15 */
);
void vad_tone_detection(vadState1 *st, /* i/o : State struct */
Word32 t0, /* i : autocorrelation maxima */
Word32 t1, /* i : energy */
Flag *pOverflow
);
void vad_tone_detection_update(
vadState1 *st, /* i/o : State struct */
Word16 one_lag_per_frame, /* i : 1 if one open-loop lag is
calculated per each frame,
otherwise 0 */
Flag *pOverflow
);
void vad_pitch_detection(vadState1 *st, /* i/o : State struct */
Word16 lags[], /* i : speech encoder open loop lags */
Flag *pOverflow
);
Word16 vad1(vadState1 *st, /* i/o : State struct */
Word16 in_buf[], /* i : samples of the input frame
inbuf[159] is the very last sample,
incl lookahead */
Flag *pOverflow
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _VAD1_H_ */

View File

@@ -0,0 +1,203 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, 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/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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions, prototype and structure
definitions needed by vad_2.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef vad_2_h
#define vad_2_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
#define YES 1
#define NO 0
#define ON 1
#define OFF 0
#define TRUE 1
#define FALSE 0
#define FRM_LEN 80
#define DELAY 24
#define FFT_LEN 128
#define NUM_CHAN 16
#define LO_CHAN 0
#define HI_CHAN 15
#define UPDATE_THLD 35
#define HYSTER_CNT_THLD 6
#define UPDATE_CNT_THLD 50
#define SHIFT_STATE_0 0 /* channel energy scaled as 22,9 */
#define SHIFT_STATE_1 1 /* channel energy scaled as 27,4 */
#define NOISE_FLOOR_CHAN_0 512 /* 1.0 scaled as 22,9 */
#define MIN_CHAN_ENRG_0 32 /* 0.0625 scaled as 22,9 */
#define MIN_NOISE_ENRG_0 32 /* 0.0625 scaled as 22,9 */
#define INE_NOISE_0 8192 /* 16.0 scaled as 22,9 */
#define FRACTIONAL_BITS_0 9 /* used as input to fn10Log10() */
#define NOISE_FLOOR_CHAN_1 16 /* 1.0 scaled as 27,4 */
#define MIN_CHAN_ENRG_1 1 /* 0.0625 scaled as 27,4 */
#define MIN_NOISE_ENRG_1 1 /* 0.0625 scaled as 27,4 */
#define INE_NOISE_1 256 /* 16.0 scaled as 27,4 */
#define FRACTIONAL_BITS_1 4 /* used as input to fn10Log10() */
#define STATE_1_TO_0_SHIFT_R (FRACTIONAL_BITS_1-FRACTIONAL_BITS_0) /* state correction factor */
#define STATE_0_TO_1_SHIFT_R (FRACTIONAL_BITS_0-FRACTIONAL_BITS_1) /* state correction factor */
#define HIGH_ALPHA 29491 /* 0.9 scaled as 0,15 */
#define LOW_ALPHA 22938 /* 0.7 scaled as 0,15 */
#define ALPHA_RANGE (HIGH_ALPHA - LOW_ALPHA)
#define DEV_THLD 7168 /* 28.0 scaled as 7,8 */
#define PRE_EMP_FAC (-26214) /* -0.8 scaled as 0,15 */
#define CEE_SM_FAC 18022 /* 0.55 scaled as 0,15 */
#define ONE_MINUS_CEE_SM_FAC 14746 /* 0.45 scaled as 0,15 */
#define CNE_SM_FAC 3277 /* 0.1 scaled as 0,15 */
#define ONE_MINUS_CNE_SM_FAC 29491 /* 0.9 scaled as 0,15 */
#define FFT_HEADROOM 2
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
typedef struct
{
Word16 pre_emp_mem;
Word16 update_cnt;
Word16 hyster_cnt;
Word16 last_update_cnt;
Word16 ch_enrg_long_db[NUM_CHAN]; /* scaled as 7,8 */
Word32 Lframe_cnt;
Word32 Lch_enrg[NUM_CHAN]; /* scaled as 22,9 or 27,4 */
Word32 Lch_noise[NUM_CHAN]; /* scaled as 22,9 */
Word16 last_normb_shift; /* last block norm shift count */
Word16 tsnr; /* total signal-to-noise ratio in dB (scaled as 7,8) */
Word16 hangover;
Word16 burstcount;
Word16 fupdate_flag; /* forced update flag from previous frame */
Word16 negSNRvar; /* Negative SNR variance (scaled as 7,8) */
Word16 negSNRbias; /* sensitivity bias from negative SNR variance (scaled as 15,0) */
Word16 shift_state; /* use 22,9 or 27,4 scaling for ch_enrg[] */
Word32 L_R0;
Word32 L_Rmax;
Flag LTP_flag; /* Use to indicate the the LTP gain is > LTP_THRESH */
} vadState2;
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
Word16 vad2(Word16 *farray_ptr, vadState2 *st, Flag *pOverflow);
Word16 vad2_init(vadState2 **st);
Word16 vad2_reset(vadState2 *st);
void vad2_exit(vadState2 **state);
void r_fft(Word16 *farray_ptr, Flag *pOverflow);
void LTP_flag_update(vadState2 *st, Word16 mode, Flag *pOverflow);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _VAD2_H_ */

View File

@@ -0,0 +1,81 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
********************************************************************************
*
* File : weight_a.h
* Purpose : Spectral expansion of LP coefficients. (order==10)
* Description : a_exp[i] = a[i] * fac[i-1] ,i=1,10
*
*
********************************************************************************
*/
#ifndef weight_a_h
#define weight_a_h "$Id $"
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "typedef.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*
********************************************************************************
* DEFINITION OF DATA TYPES
********************************************************************************
*/
/*
********************************************************************************
* DECLARATION OF PROTOTYPES
********************************************************************************
*/
void Weight_Ai(
Word16 a[], /* (i) : a[m+1] LPC coefficients (m=10) */
const Word16 fac[],/* (i) : Spectral expansion factors. */
Word16 a_exp[] /* (o) : Spectral expanded LPC coefficients */
);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,109 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Pathname: .audio/gsm-amr/c/include/window_tab.h
------------------------------------------------------------------------------
REVISION HISTORY
Who: Date:
Description:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file declares a tables in window_tab.c used in lpc.c.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef WINDOW_TAB_H
#define WINDOW_TAB_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
#include "cnst.h"
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
extern const Word16 window_200_40[];
extern const Word16 window_160_80[];
extern const Word16 window_232_8[];
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,119 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, 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: ./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:
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the wmf_to_ets function.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef WMF_TO_ETS_H
#define WMF_TO_ETS_H
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "frame_type_3gpp.h"
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
void wmf_to_ets(enum Frame_Type_3GPP frame_type_3gpp,
UWord8 *wmf_input_ptr,
Word16 *ets_output_ptr);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,183 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
//////////////////////////////////////////////////////////////////////////////////
// //
// File: pvgsmamrdecoderinterface.h //
// //
//////////////////////////////////////////////////////////////////////////////////
#ifndef _PVGSMAMR_DECODER_INTERFACE_H
#define _PVGSMAMR_DECODER_INTERFACE_H
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
typedef enum
{
/*
* One word (2-byte) to indicate type of frame type.
* One word (2-byte) to indicate frame type.
* One word (2-byte) to indicate mode.
* N words (2-byte) containing N bits (bit 0 = 0xff81, bit 1 = 0x007f).
*/
ETS = 0, /* Both AMR-Narrowband and AMR-Wideband */
/*
* One word (2-byte) for sync word (good frames: 0x6b21, bad frames: 0x6b20)
* One word (2-byte) for frame length N.
* N words (2-byte) containing N bits (bit 0 = 0x007f, bit 1 = 0x0081).
*/
ITU, /* AMR-Wideband */
/*
* AMR-WB MIME/storage format, see RFC 3267 (sections 5.1 and 5.3) for details
*/
MIME_IETF,
WMF, /* AMR-Narrowband */
IF2 /* AMR-Narrowband */
} bitstream_format;
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
typedef struct
{
int16_t prev_ft;
int16_t prev_mode;
} RX_State;
typedef struct tPVAmrDecoderExternal
{
/*
* INPUT:
* Pointer to the input buffer that contains the encoded bistream data.
* The data is filled in such that the first bit transmitted is
* the most-significant bit (MSB) of the first array element.
* The buffer is accessed in a linear fashion for speed, and the number of
* bytes consumed varies frame to frame. This is use for mime/ietf data
*/
uint8_t *pInputBuffer;
/*
* INPUT:
* Pointer to the input buffer that contains the encoded stream data.
* The data is filled such that the first bit transmitted is
* in the first int16_t element.
* The buffer is accessed in a linear fashion for speed, and the number of
* bytes consumed varies frame to frame.
*/
int16_t *pInputSampleBuffer;
/*
* INPUT: (but what is pointed to is an output)
* Pointer to the output buffer to hold the 16-bit PCM audio samples.
*/
int16_t *pOutputBuffer;
/*
* INPUT:
* Number of requested output audio channels. This relieves the calling
* environment from having to perform stereo-to-mono or mono-to-stereo
* conversions.
*/
int32_t desiredChannels;
/*
* INPUT:
* Format type of the encoded bitstream.
*/
bitstream_format input_format;
/*
* OUTPUT:
* The sampling rate decoded from the bitstream, in units of
* samples/second. For this release of the library this value does
* not change from frame to frame, but future versions will.
*/
int32_t samplingRate;
/*
* OUTPUT:
* This value is the bitrate in units of bits/second. IT
* is calculated using the number of bits consumed for the current frame,
* and then multiplying by the sampling_rate, divided by points in a frame.
* This value can changes frame to frame.
*/
int32_t bitRate;
/*
* OUTPUT:
* The number of channels decoded from the bitstream. The output data
* will have be the amount specified in the variable desiredChannels,
* this output is informative only, and can be ignored.
*/
int32_t encodedChannels;
/*
* OUTPUT:
* This value is the number of output PCM samples per channel.
* It is 320.
*/
int16_t frameLength;
/*
* OUTPUT:
* This value is the quality indicator. 1 (good) 0 (bad)
*/
uint8_t quality;
/*
* OUTPUT:
* GSM AMR NB and WB mode (i.e. bit-rate )
*/
int16_t mode;
int16_t mode_old;
/*
* OUTPUT:
* GSM AMR NB and WB frame type ( speech_good, speech_bad, sid, etc.)
*/
int16_t frame_type;
int16_t reset_flag;
int16_t reset_flag_old;
/*
* OUTPUT:
* Decoder status
*/
int32_t status;
/*
* OUTPUT:
* Rx status state
*/
RX_State rx_state;
} tPVAmrDecoderExternal;
#endif

View File

@@ -0,0 +1,203 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, 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/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:
------------------------------------------------------------------------------
MODULE DESCRIPTION
Summation function with overflow control
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "basic_op.h"
/*----------------------------------------------------------------------------
; MACROS
; [Define module specific macros here]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; [Include all pre-processor statements here. Include conditional
; compile variables also.]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
; [List function prototypes here]
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; LOCAL VARIABLE DEFINITIONS
; [Variable declaration - defined here and used outside this module]
----------------------------------------------------------------------------*/
/*
------------------------------------------------------------------------------
FUNCTION NAME: add
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
var1 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
var2 = 16 bit short signed integer (Word16) whose value falls in
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the add operation resulted in overflow
Returns:
sum = 16-bit limited sum of var1 and var2 (Word16)
Global Variables Used:
None
Local Variables Needed:
None
------------------------------------------------------------------------------
FUNCTION DESCRIPTION
This function performs the addition (var1+var2) with overflow control and
saturation; the 16 bit result is set at +32767 when overflow occurs or at
-32768 when underflow occurs.
------------------------------------------------------------------------------
REQUIREMENTS
None
------------------------------------------------------------------------------
REFERENCES
[1] add.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
------------------------------------------------------------------------------
PSEUDO-CODE
Word16 add (Word16 var1, Word16 var2)
{
Word16 var_out;
Word32 sum;
sum = (Word32) var1 + var2;
* The reference ETSI code uses a global flag for Overflow inside the function
* saturate(). In the actual implementation a pointer to Overflow flag is passed in
* as a parameter to the function
var_out = saturate (sum);
#if (WMOPS)
multiCounter[currCounter].add++;
#endif
return (var_out);
}
------------------------------------------------------------------------------
RESOURCES USED [optional]
When the code is written for a specific target processor the
the resources used should be documented below.
HEAP MEMORY USED: x bytes
STACK MEMORY USED: x bytes
CLOCK CYCLES: (cycle count equation for this function) + (variable
used to represent cycle count for each subroutine
called)
where: (cycle count variable) = cycle count for [subroutine
name]
------------------------------------------------------------------------------
CAUTION [optional]
[State any special notes, constraints or cautions for users of this function]
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; FUNCTION CODE
----------------------------------------------------------------------------*/
Word16 add(Word16 var1, Word16 var2, Flag *pOverflow)
{
/*----------------------------------------------------------------------------
; Define all local variables
----------------------------------------------------------------------------*/
Word32 sum;
sum = (Word32) var1 + var2;
/* Saturate result (if necessary). */
/* Replaced function call with in-line code */
/* to conserve MIPS, i.e., var_out = saturate (sum) */
if (sum > 0X00007fffL)
{
*pOverflow = 1;
sum = MAX_16;
}
else if (sum < (Word32) 0xffff8000L)
{
*pOverflow = 1;
sum = MIN_16;
}
/* Return the sum as a 16 bit value by type casting Word32 to Word16 */
return ((Word16) sum);
}

View File

@@ -0,0 +1,740 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, 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: ./audio/gsm-amr/c/src/az_lsp.c
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.
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "az_lsp.h"
#include "cnst.h"
#include "basic_op.h"
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here. Include conditional
; compile variables also.
----------------------------------------------------------------------------*/
#define NC M/2 /* M = LPC order, NC = M/2 */
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; LOCAL VARIABLE DEFINITIONS
; Variable declaration - defined here and used outside this module
----------------------------------------------------------------------------*/
/*
------------------------------------------------------------------------------
FUNCTION NAME: Chebps
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
x = input value (Word16)
f = polynomial (Word16)
n = polynomial order (Word16)
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the operations in the function resulted in saturation.
Returns:
cheb = Chebyshev polynomial for the input value x.(Word16)
Global Variables Used:
None.
Local Variables Needed:
None.
------------------------------------------------------------------------------
FUNCTION DESCRIPTION
This module evaluates the Chebyshev polynomial series.
- The polynomial order is n = m/2 = 5
- The polynomial F(z) (F1(z) or F2(z)) is given by
F(w) = 2 exp(-j5w) C(x)
where
C(x) = T_n(x) + f(1)T_n-1(x) + ... +f(n-1)T_1(x) + f(n)/2
and T_m(x) = cos(mw) is the mth order Chebyshev
polynomial ( x=cos(w) )
- C(x) for the input x is returned.
------------------------------------------------------------------------------
REQUIREMENTS
None.
------------------------------------------------------------------------------
REFERENCES
az_lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
------------------------------------------------------------------------------
PSEUDO-CODE
static Word16 Chebps (Word16 x,
Word16 f[], // (n)
Word16 n)
{
Word16 i, cheb;
Word16 b0_h, b0_l, b1_h, b1_l, b2_h, b2_l;
Word32 t0;
// The reference ETSI code uses a global flag for Overflow. However, in the
// actual implementation a pointer to Overflow flag is passed in as a
// parameter to the function. This pointer is passed into all the basic math
// functions invoked
b2_h = 256; // b2 = 1.0
b2_l = 0;
t0 = L_mult (x, 512); // 2*x
t0 = L_mac (t0, f[1], 8192); // + f[1]
L_Extract (t0, &b1_h, &b1_l); // b1 = 2*x + f[1]
for (i = 2; i < n; i++)
{
t0 = Mpy_32_16 (b1_h, b1_l, x); // t0 = 2.0*x*b1
t0 = L_shl (t0, 1);
t0 = L_mac (t0, b2_h, (Word16) 0x8000); // t0 = 2.0*x*b1 - b2
t0 = L_msu (t0, b2_l, 1);
t0 = L_mac (t0, f[i], 8192); // t0 = 2.0*x*b1 - b2 + f[i]
L_Extract (t0, &b0_h, &b0_l); // b0 = 2.0*x*b1 - b2 + f[i]
b2_l = b1_l; // b2 = b1;
b2_h = b1_h;
b1_l = b0_l; // b1 = b0;
b1_h = b0_h;
}
t0 = Mpy_32_16 (b1_h, b1_l, x); // t0 = x*b1;
t0 = L_mac (t0, b2_h, (Word16) 0x8000); // t0 = x*b1 - b2
t0 = L_msu (t0, b2_l, 1);
t0 = L_mac (t0, f[i], 4096); // t0 = x*b1 - b2 + f[i]/2
t0 = L_shl (t0, 6);
cheb = extract_h (t0);
return (cheb);
}
------------------------------------------------------------------------------
RESOURCES USED [optional]
When the code is written for a specific target processor the
the resources used should be documented below.
HEAP MEMORY USED: x bytes
STACK MEMORY USED: x bytes
CLOCK CYCLES: (cycle count equation for this function) + (variable
used to represent cycle count for each subroutine
called)
where: (cycle count variable) = cycle count for [subroutine
name]
------------------------------------------------------------------------------
CAUTION [optional]
[State any special notes, constraints or cautions for users of this function]
------------------------------------------------------------------------------
*/
static Word16 Chebps(Word16 x,
Word16 f[], /* (n) */
Word16 n,
Flag *pOverflow)
{
Word16 i;
Word16 cheb;
Word16 b1_h;
Word16 b1_l;
Word32 t0;
Word32 L_temp;
Word16 *p_f = &f[1];
OSCL_UNUSED_ARG(pOverflow);
/* L_temp = 1.0 */
L_temp = 0x01000000L;
t0 = ((Word32) x << 10) + ((Word32) * (p_f++) << 14);
/* b1 = t0 = 2*x + f[1] */
b1_h = (Word16)(t0 >> 16);
b1_l = (Word16)((t0 >> 1) - (b1_h << 15));
for (i = 2; i < n; i++)
{
/* t0 = 2.0*x*b1 */
t0 = ((Word32) b1_h * x);
t0 += ((Word32) b1_l * x) >> 15;
t0 <<= 2;
/* t0 = 2.0*x*b1 - b2 */
t0 -= L_temp;
/* t0 = 2.0*x*b1 - b2 + f[i] */
t0 += (Word32) * (p_f++) << 14;
L_temp = ((Word32) b1_h << 16) + ((Word32) b1_l << 1);
/* b0 = 2.0*x*b1 - b2 + f[i]*/
b1_h = (Word16)(t0 >> 16);
b1_l = (Word16)((t0 >> 1) - (b1_h << 15));
}
/* t0 = x*b1; */
t0 = ((Word32) b1_h * x);
t0 += ((Word32) b1_l * x) >> 15;
t0 <<= 1;
/* t0 = x*b1 - b2 */
t0 -= L_temp;
/* t0 = x*b1 - b2 + f[i]/2 */
t0 += (Word32) * (p_f) << 13;
if ((UWord32)(t0 - 0xfe000000L) < 0x01ffffffL - 0xfe000000L)
{
cheb = (Word16)(t0 >> 10);
}
else
{
if (t0 > (Word32) 0x01ffffffL)
{
cheb = MAX_16;
}
else
{
cheb = MIN_16;
}
}
return (cheb);
}
/*
------------------------------------------------------------------------------
FUNCTION NAME: Az_lsp
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS FOR Az_lsp
Inputs:
a = predictor coefficients (Word16)
lsp = line spectral pairs (Word16)
old_lsp = old line spectral pairs (Word16)
pOverflow = pointer to overflow (Flag)
Outputs:
pOverflow -> 1 if the operations in the function resulted in saturation.
Returns:
None.
Global Variables Used:
None.
Local Variables Needed:
None.
------------------------------------------------------------------------------
FUNCTION DESCRIPTION
This function computes the LSPs from the LP coefficients.
The sum and difference filters are computed and divided by 1+z^{-1} and
1-z^{-1}, respectively.
f1[i] = a[i] + a[11-i] - f1[i-1] ; i=1,...,5
f2[i] = a[i] - a[11-i] + f2[i-1] ; i=1,...,5
The roots of F1(z) and F2(z) are found using Chebyshev polynomial evaluation.
The polynomials are evaluated at 60 points regularly spaced in the
frequency domain. The sign change interval is subdivided 4 times to better
track the root. The LSPs are found in the cosine domain [1,-1].
If less than 10 roots are found, the LSPs from the past frame are used.
------------------------------------------------------------------------------
REQUIREMENTS
None.
------------------------------------------------------------------------------
REFERENCES
az_lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
------------------------------------------------------------------------------
PSEUDO-CODE
void Az_lsp (
Word16 a[], // (i) : predictor coefficients (MP1)
Word16 lsp[], // (o) : line spectral pairs (M)
Word16 old_lsp[] // (i) : old lsp[] (in case not found 10 roots) (M)
)
{
Word16 i, j, nf, ip;
Word16 xlow, ylow, xhigh, yhigh, xmid, ymid, xint;
Word16 x, y, sign, exp;
Word16 *coef;
Word16 f1[M / 2 + 1], f2[M / 2 + 1];
Word32 t0;
*-------------------------------------------------------------*
* find the sum and diff. pol. F1(z) and F2(z) *
* F1(z) <--- F1(z)/(1+z**-1) & F2(z) <--- F2(z)/(1-z**-1) *
* *
* f1[0] = 1.0; *
* f2[0] = 1.0; *
* *
* for (i = 0; i< NC; i++) *
* { *
* f1[i+1] = a[i+1] + a[M-i] - f1[i] ; *
* f2[i+1] = a[i+1] - a[M-i] + f2[i] ; *
* } *
*-------------------------------------------------------------*
f1[0] = 1024; // f1[0] = 1.0
f2[0] = 1024; // f2[0] = 1.0
// The reference ETSI code uses a global flag for Overflow. However, in the
// actual implementation a pointer to Overflow flag is passed in as a
// parameter to the function. This pointer is passed into all the basic math
// functions invoked
for (i = 0; i < NC; i++)
{
t0 = L_mult (a[i + 1], 8192); // x = (a[i+1] + a[M-i]) >> 2
t0 = L_mac (t0, a[M - i], 8192);
x = extract_h (t0);
// f1[i+1] = a[i+1] + a[M-i] - f1[i]
f1[i + 1] = sub (x, f1[i]);
t0 = L_mult (a[i + 1], 8192); // x = (a[i+1] - a[M-i]) >> 2
t0 = L_msu (t0, a[M - i], 8192);
x = extract_h (t0);
// f2[i+1] = a[i+1] - a[M-i] + f2[i]
f2[i + 1] = add (x, f2[i]);
}
*-------------------------------------------------------------*
* find the LSPs using the Chebychev pol. evaluation *
*-------------------------------------------------------------*
nf = 0; // number of found frequencies
ip = 0; // indicator for f1 or f2
coef = f1;
xlow = grid[0];
ylow = Chebps (xlow, coef, NC);
j = 0;
// while ( (nf < M) && (j < grid_points) )
while ((sub (nf, M) < 0) && (sub (j, grid_points) < 0))
{
j++;
xhigh = xlow;
yhigh = ylow;
xlow = grid[j];
ylow = Chebps (xlow, coef, NC);
if (L_mult (ylow, yhigh) <= (Word32) 0L)
{
// divide 4 times the interval
for (i = 0; i < 4; i++)
{
// xmid = (xlow + xhigh)/2
xmid = add (shr (xlow, 1), shr (xhigh, 1));
ymid = Chebps (xmid, coef, NC);
if (L_mult (ylow, ymid) <= (Word32) 0L)
{
yhigh = ymid;
xhigh = xmid;
}
else
{
ylow = ymid;
xlow = xmid;
}
}
*-------------------------------------------------------------*
* Linear interpolation *
* xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow); *
*-------------------------------------------------------------*
x = sub (xhigh, xlow);
y = sub (yhigh, ylow);
if (y == 0)
{
xint = xlow;
}
else
{
sign = y;
y = abs_s (y);
exp = norm_s (y);
y = shl (y, exp);
y = div_s ((Word16) 16383, y);
t0 = L_mult (x, y);
t0 = L_shr (t0, sub (20, exp));
y = extract_l (t0); // y= (xhigh-xlow)/(yhigh-ylow)
if (sign < 0)
y = negate (y);
t0 = L_mult (ylow, y);
t0 = L_shr (t0, 11);
xint = sub (xlow, extract_l (t0)); // xint = xlow - ylow*y
}
lsp[nf] = xint;
xlow = xint;
nf++;
if (ip == 0)
{
ip = 1;
coef = f2;
}
else
{
ip = 0;
coef = f1;
}
ylow = Chebps (xlow, coef, NC);
}
}
// Check if M roots found
if (sub (nf, M) < 0)
{
for (i = 0; i < M; i++)
{
lsp[i] = old_lsp[i];
}
}
return;
}
------------------------------------------------------------------------------
RESOURCES USED [optional]
When the code is written for a specific target processor the
the resources used should be documented below.
HEAP MEMORY USED: x bytes
STACK MEMORY USED: x bytes
CLOCK CYCLES: (cycle count equation for this function) + (variable
used to represent cycle count for each subroutine
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 Az_lsp(
Word16 a[], /* (i) : predictor coefficients (MP1) */
Word16 lsp[], /* (o) : line spectral pairs (M) */
Word16 old_lsp[], /* (i) : old lsp[] (in case not found 10 roots) (M) */
Flag *pOverflow /* (i/o): overflow flag */
)
{
register Word16 i;
register Word16 j;
register Word16 nf;
register Word16 ip;
Word16 xlow;
Word16 ylow;
Word16 xhigh;
Word16 yhigh;
Word16 xmid;
Word16 ymid;
Word16 xint;
Word16 x;
Word16 y;
Word16 sign;
Word16 exp;
Word16 *coef;
Word16 f1[NC + 1];
Word16 f2[NC + 1];
Word32 L_temp1;
Word32 L_temp2;
Word16 *p_f1 = f1;
Word16 *p_f2 = f2;
/*-------------------------------------------------------------*
* find the sum and diff. pol. F1(z) and F2(z) *
* F1(z) <--- F1(z)/(1+z**-1) & F2(z) <--- F2(z)/(1-z**-1) *
* *
* f1[0] = 1.0; *
* f2[0] = 1.0; *
* *
* for (i = 0; i< NC; i++) *
* { *
* f1[i+1] = a[i+1] + a[M-i] - f1[i] ; *
* f2[i+1] = a[i+1] - a[M-i] + f2[i] ; *
* } *
*-------------------------------------------------------------*/
*p_f1 = 1024; /* f1[0] = 1.0 */
*p_f2 = 1024; /* f2[0] = 1.0 */
for (i = 0; i < NC; i++)
{
L_temp1 = (Word32) * (a + i + 1);
L_temp2 = (Word32) * (a + M - i);
/* x = (a[i+1] + a[M-i]) >> 2 */
x = (Word16)((L_temp1 + L_temp2) >> 2);
/* y = (a[i+1] - a[M-i]) >> 2 */
y = (Word16)((L_temp1 - L_temp2) >> 2);
/* f1[i+1] = a[i+1] + a[M-i] - f1[i] */
x -= *(p_f1++);
*(p_f1) = x;
/* f2[i+1] = a[i+1] - a[M-i] + f2[i] */
y += *(p_f2++);
*(p_f2) = y;
}
/*-------------------------------------------------------------*
* find the LSPs using the Chebychev pol. evaluation *
*-------------------------------------------------------------*/
nf = 0; /* number of found frequencies */
ip = 0; /* indicator for f1 or f2 */
coef = f1;
xlow = *(grid);
ylow = Chebps(xlow, coef, NC, pOverflow);
j = 0;
while ((nf < M) && (j < grid_points))
{
j++;
xhigh = xlow;
yhigh = ylow;
xlow = *(grid + j);
ylow = Chebps(xlow, coef, NC, pOverflow);
if (((Word32)ylow*yhigh) <= 0)
{
/* divide 4 times the interval */
for (i = 4; i != 0; i--)
{
/* xmid = (xlow + xhigh)/2 */
x = xlow >> 1;
y = xhigh >> 1;
xmid = x + y;
ymid = Chebps(xmid, coef, NC, pOverflow);
if (((Word32)ylow*ymid) <= 0)
{
yhigh = ymid;
xhigh = xmid;
}
else
{
ylow = ymid;
xlow = xmid;
}
}
/*-------------------------------------------------------------*
* Linear interpolation *
* xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow); *
*-------------------------------------------------------------*/
x = xhigh - xlow;
y = yhigh - ylow;
if (y == 0)
{
xint = xlow;
}
else
{
sign = y;
y = abs_s(y);
exp = norm_s(y);
y <<= exp;
y = div_s((Word16) 16383, y);
y = ((Word32)x * y) >> (19 - exp);
if (sign < 0)
{
y = -y;
}
/* xint = xlow - ylow*y */
xint = xlow - (((Word32) ylow * y) >> 10);
}
*(lsp + nf) = xint;
xlow = xint;
nf++;
if (ip == 0)
{
ip = 1;
coef = f2;
}
else
{
ip = 0;
coef = f1;
}
ylow = Chebps(xlow, coef, NC, pOverflow);
}
}
/* Check if M roots found */
if (nf < M)
{
for (i = NC; i != 0 ; i--)
{
*lsp++ = *old_lsp++;
*lsp++ = *old_lsp++;
}
}
}
Word16 Chebps_Wrapper(Word16 x,
Word16 f[], /* (n) */
Word16 n,
Flag *pOverflow)
{
return Chebps(x, f, n, pOverflow);
}

View File

@@ -0,0 +1,309 @@
/* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, 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: .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:
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
None
Local Stores/Buffers/Pointers Needed:
None
Global Stores/Buffers/Pointers Needed:
None
Outputs:
None
Pointers and Buffers Modified:
None
Local Stores Modified:
None
Global Stores Modified:
None
------------------------------------------------------------------------------
FUNCTION DESCRIPTION
File : bitno.tab
Purpose : Tables for bit2prm and prm2bit
------------------------------------------------------------------------------
REQUIREMENTS
None
------------------------------------------------------------------------------
REFERENCES
None
------------------------------------------------------------------------------
PSEUDO-CODE
------------------------------------------------------------------------------
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 "typedef.h"
#include "cnst.h" /* parameter sizes: MAX_PRM_SIZE */
#include "mode.h" /* N_MODES */
#include "bitno_tab.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here. Include conditional
; compile variables also.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; LOCAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
; Variable declaration - defined here and used outside this module
----------------------------------------------------------------------------*/
/* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
extern const Word16 prmno[N_MODES] =
{
PRMNO_MR475,
PRMNO_MR515,
PRMNO_MR59,
PRMNO_MR67,
PRMNO_MR74,
PRMNO_MR795,
PRMNO_MR102,
PRMNO_MR122,
PRMNO_MRDTX
};
/* number of parameters to first subframe per modes */
extern const Word16 prmnofsf[N_MODES - 1] =
{
PRMNOFSF_MR475,
PRMNOFSF_MR515,
PRMNOFSF_MR59,
PRMNOFSF_MR67,
PRMNOFSF_MR74,
PRMNOFSF_MR795,
PRMNOFSF_MR102,
PRMNOFSF_MR122
};
/* parameter sizes (# of bits), one table per mode */
extern const Word16 bitno_MR475[PRMNO_MR475] =
{
8, 8, 7, /* LSP VQ */
8, 7, 2, 8, /* first subframe */
4, 7, 2, /* second subframe */
4, 7, 2, 8, /* third subframe */
4, 7, 2, /* fourth subframe */
};
extern const Word16 bitno_MR515[PRMNO_MR515] =
{
8, 8, 7, /* LSP VQ */
8, 7, 2, 6, /* first subframe */
4, 7, 2, 6, /* second subframe */
4, 7, 2, 6, /* third subframe */
4, 7, 2, 6, /* fourth subframe */
};
extern const Word16 bitno_MR59[PRMNO_MR59] =
{
8, 9, 9, /* LSP VQ */
8, 9, 2, 6, /* first subframe */
4, 9, 2, 6, /* second subframe */
8, 9, 2, 6, /* third subframe */
4, 9, 2, 6, /* fourth subframe */
};
extern const Word16 bitno_MR67[PRMNO_MR67] =
{
8, 9, 9, /* LSP VQ */
8, 11, 3, 7, /* first subframe */
4, 11, 3, 7, /* second subframe */
8, 11, 3, 7, /* third subframe */
4, 11, 3, 7, /* fourth subframe */
};
extern const Word16 bitno_MR74[PRMNO_MR74] =
{
8, 9, 9, /* LSP VQ */
8, 13, 4, 7, /* first subframe */
5, 13, 4, 7, /* second subframe */
8, 13, 4, 7, /* third subframe */
5, 13, 4, 7, /* fourth subframe */
};
extern const Word16 bitno_MR795[PRMNO_MR795] =
{
9, 9, 9, /* LSP VQ */
8, 13, 4, 4, 5, /* first subframe */
6, 13, 4, 4, 5, /* second subframe */
8, 13, 4, 4, 5, /* third subframe */
6, 13, 4, 4, 5, /* fourth subframe */
};
extern const Word16 bitno_MR102[PRMNO_MR102] =
{
8, 9, 9, /* LSP VQ */
8, 1, 1, 1, 1, 10, 10, 7, 7, /* first subframe */
5, 1, 1, 1, 1, 10, 10, 7, 7, /* second subframe */
8, 1, 1, 1, 1, 10, 10, 7, 7, /* third subframe */
5, 1, 1, 1, 1, 10, 10, 7, 7, /* fourth subframe */
};
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 */
6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* second subframe */
9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* third subframe */
6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5 /* fourth subframe */
};
extern const Word16 bitno_MRDTX[PRMNO_MRDTX] =
{
3,
8, 9, 9,
6
};
/* overall table with all parameter sizes for all modes */
extern const Word16 * const bitno[N_MODES] =
{
bitno_MR475,
bitno_MR515,
bitno_MR59,
bitno_MR67,
bitno_MR74,
bitno_MR795,
bitno_MR102,
bitno_MR122,
bitno_MRDTX
};
/*----------------------------------------------------------------------------
; EXTERNAL FUNCTION REFERENCES
; Declare functions defined elsewhere and referenced in this module
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
/*----------------------------------------------------------------------------
; FUNCTION CODE
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; Define all local variables
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; Function body here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; Return nothing or data or data pointer
----------------------------------------------------------------------------*/

Some files were not shown because too many files have changed in this diff Show More