mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-21 02:15:55 +08:00
更新硬件SDK
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// File: pvgsmamrdecoderinterface.h //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _PVGSMAMR_DECODER_INTERFACE_H
|
||||
#define _PVGSMAMR_DECODER_INTERFACE_H
|
||||
|
||||
#include "oscl_base.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/*
|
||||
* One word (2-byte) to indicate type of frame type.
|
||||
* One word (2-byte) to indicate frame type.
|
||||
* One word (2-byte) to indicate mode.
|
||||
* N words (2-byte) containing N bits (bit 0 = 0xff81, bit 1 = 0x007f).
|
||||
*/
|
||||
ETS = 0, /* Both AMR-Narrowband and AMR-Wideband */
|
||||
|
||||
/*
|
||||
* One word (2-byte) for sync word (good frames: 0x6b21, bad frames: 0x6b20)
|
||||
* One word (2-byte) for frame length N.
|
||||
* N words (2-byte) containing N bits (bit 0 = 0x007f, bit 1 = 0x0081).
|
||||
*/
|
||||
ITU, /* AMR-Wideband */
|
||||
|
||||
/*
|
||||
* AMR-WB MIME/storage format, see RFC 3267 (sections 5.1 and 5.3) for details
|
||||
*/
|
||||
MIME_IETF,
|
||||
|
||||
WMF, /* AMR-Narrowband */
|
||||
|
||||
IF2 /* AMR-Narrowband */
|
||||
|
||||
} bitstream_format;
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
int16 prev_ft;
|
||||
int16 prev_mode;
|
||||
} RX_State;
|
||||
|
||||
|
||||
typedef struct tPVAmrDecoderExternal
|
||||
{
|
||||
/*
|
||||
* INPUT:
|
||||
* Pointer to the input buffer that contains the encoded bistream data.
|
||||
* The data is filled in such that the first bit transmitted is
|
||||
* the most-significant bit (MSB) of the first array element.
|
||||
* The buffer is accessed in a linear fashion for speed, and the number of
|
||||
* bytes consumed varies frame to frame. This is use for mime/ietf data
|
||||
*/
|
||||
uint8 *pInputBuffer;
|
||||
|
||||
/*
|
||||
* INPUT:
|
||||
* Pointer to the input buffer that contains the encoded stream data.
|
||||
* The data is filled such that the first bit transmitted is
|
||||
* in the first int16 element.
|
||||
* The buffer is accessed in a linear fashion for speed, and the number of
|
||||
* bytes consumed varies frame to frame.
|
||||
*/
|
||||
int16 *pInputSampleBuffer;
|
||||
|
||||
/*
|
||||
* INPUT: (but what is pointed to is an output)
|
||||
* Pointer to the output buffer to hold the 16-bit PCM audio samples.
|
||||
*/
|
||||
int16 *pOutputBuffer;
|
||||
|
||||
/*
|
||||
* INPUT:
|
||||
* Number of requested output audio channels. This relieves the calling
|
||||
* environment from having to perform stereo-to-mono or mono-to-stereo
|
||||
* conversions.
|
||||
*/
|
||||
int32 desiredChannels;
|
||||
|
||||
/*
|
||||
* INPUT:
|
||||
* Format type of the encoded bitstream.
|
||||
*/
|
||||
bitstream_format input_format;
|
||||
|
||||
/*
|
||||
* OUTPUT:
|
||||
* The sampling rate decoded from the bitstream, in units of
|
||||
* samples/second. For this release of the library this value does
|
||||
* not change from frame to frame, but future versions will.
|
||||
*/
|
||||
int32 samplingRate;
|
||||
|
||||
/*
|
||||
* OUTPUT:
|
||||
* This value is the bitrate in units of bits/second. IT
|
||||
* is calculated using the number of bits consumed for the current frame,
|
||||
* and then multiplying by the sampling_rate, divided by points in a frame.
|
||||
* This value can changes frame to frame.
|
||||
*/
|
||||
int32 bitRate;
|
||||
|
||||
/*
|
||||
* OUTPUT:
|
||||
* The number of channels decoded from the bitstream. The output data
|
||||
* will have be the amount specified in the variable desiredChannels,
|
||||
* this output is informative only, and can be ignored.
|
||||
*/
|
||||
int32 encodedChannels;
|
||||
|
||||
/*
|
||||
* OUTPUT:
|
||||
* This value is the number of output PCM samples per channel.
|
||||
* It is 320.
|
||||
*/
|
||||
int16 frameLength;
|
||||
|
||||
/*
|
||||
* OUTPUT:
|
||||
* This value is the quality indicator. 1 (good) 0 (bad)
|
||||
*/
|
||||
uint8 quality;
|
||||
|
||||
|
||||
/*
|
||||
* OUTPUT:
|
||||
* GSM AMR NB and WB mode (i.e. bit-rate )
|
||||
*/
|
||||
int16 mode;
|
||||
int16 mode_old;
|
||||
|
||||
/*
|
||||
* OUTPUT:
|
||||
* GSM AMR NB and WB frame type ( speech_good, speech_bad, sid, etc.)
|
||||
*/
|
||||
int16 frame_type;
|
||||
|
||||
int16 reset_flag;
|
||||
int16 reset_flag_old;
|
||||
|
||||
/*
|
||||
* OUTPUT:
|
||||
* Decoder status
|
||||
*/
|
||||
int32 status;
|
||||
|
||||
/*
|
||||
* OUTPUT:
|
||||
* Rx status state
|
||||
*/
|
||||
RX_State rx_state;
|
||||
|
||||
} tPVAmrDecoderExternal;
|
||||
|
||||
// CDecoder_AMRInterface
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
class CDecoder_AMRInterface
|
||||
{
|
||||
public:
|
||||
virtual ~CDecoder_AMRInterface() {};
|
||||
OSCL_IMPORT_REF virtual int32 StartL(tPVAmrDecoderExternal * pExt,
|
||||
bool aAllocateInputBuffer = false,
|
||||
bool aAllocateOutputBuffer = false) = 0;
|
||||
|
||||
OSCL_IMPORT_REF virtual int32 ExecuteL(tPVAmrDecoderExternal * pExt) = 0;
|
||||
|
||||
OSCL_IMPORT_REF virtual int32 ResetDecoderL() = 0;
|
||||
OSCL_IMPORT_REF virtual void StopL() = 0;
|
||||
OSCL_IMPORT_REF virtual void TerminateDecoderL() = 0;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/abs_s.h
vendored
Normal file
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/abs_s.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: abs_s.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the abs_s function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef ABS_S_H
|
||||
#define ABS_S_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
Word16 abs_s(Word16 var1);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ABS_S_H */
|
||||
|
||||
|
||||
97
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/add.h
vendored
Normal file
97
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/add.h
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: add.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the add function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef ADD_H
|
||||
#define ADD_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF Word16 add_16(Word16 var1, Word16 var2, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ADD_H_ */
|
||||
|
||||
105
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/az_lsp.h
vendored
Normal file
105
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/az_lsp.h
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: az_lsp.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the function Az_lsp()
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef AZ_LSP_H
|
||||
#define AZ_LSP_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define grid_points 60
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 grid[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
void Az_lsp(
|
||||
Word16 a[], /* (i) : predictor coefficients (MP1) */
|
||||
Word16 lsp[], /* (o) : line spectral pairs (M) */
|
||||
Word16 old_lsp[], /* (i) : old lsp[] (in case not found 10 roots) (M) */
|
||||
Flag *pOverflow /* (i/o): overflow flag */
|
||||
);
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _AZ_LSP_H */
|
||||
|
||||
422
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/basic_op.h
vendored
Normal file
422
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/basic_op.h
vendored
Normal file
@@ -0,0 +1,422 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: basic_op.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file includes all the basicop2.c functions' header files.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef BASIC_OP_H
|
||||
#define BASIC_OP_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
|
||||
#include "basic_op_arm_gcc_v5.h"
|
||||
|
||||
#else
|
||||
#include "basic_op_c_equivalent.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include "add.h"
|
||||
#include "div_s.h"
|
||||
#include "l_shr_r.h"
|
||||
#include "mult_r.h"
|
||||
#include "norm_l.h"
|
||||
#include "norm_s.h"
|
||||
#include "round.h"
|
||||
#include "shr_r.h"
|
||||
#include "sub.h"
|
||||
#include "shr.h"
|
||||
#include "l_negate.h"
|
||||
#include "l_extract.h"
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: mac_32
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var3 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
|
||||
L_var1_hi = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
L_var1_lo = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
L_var2_hi = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
L_var2_lo = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit mac operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_var3 = 32-bit result of L_var3 + (L_var1 * L_var2)(Word32)
|
||||
|
||||
*/
|
||||
static inline Word32 Mac_32(Word32 L_var3,
|
||||
Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 L_var2_hi,
|
||||
Word16 L_var2_lo,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
Word16 product;
|
||||
|
||||
L_var3 = L_mac(L_var3, L_var1_hi, L_var2_hi, pOverflow);
|
||||
|
||||
product = mult(L_var1_hi, L_var2_lo, pOverflow);
|
||||
L_var3 = L_mac(L_var3, product, 1, pOverflow);
|
||||
|
||||
product = mult(L_var1_lo, L_var2_hi, pOverflow);
|
||||
L_var3 = L_mac(L_var3, product, 1, pOverflow);
|
||||
|
||||
return (L_var3);
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: mac_32_16
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var3 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
|
||||
L_var1_hi = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
L_var1_lo = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
var2= 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit mac operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_var3 = 32-bit result of L_var3 + (L_var1 * var2)(Word32)
|
||||
*/
|
||||
|
||||
static inline Word32 Mac_32_16(Word32 L_var3,
|
||||
Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 var2,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
Word16 product;
|
||||
|
||||
L_var3 = L_mac(L_var3, L_var1_hi, var2, pOverflow);
|
||||
|
||||
product = mult(L_var1_lo, var2, pOverflow);
|
||||
L_var3 = L_mac(L_var3, product, 1, pOverflow);
|
||||
|
||||
return (L_var3);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Function Name : negate
|
||||
|
||||
Negate var1 with saturation, saturate in the case where input is -32768:
|
||||
negate(var1) = sub(0,var1).
|
||||
|
||||
Inputs :
|
||||
var1
|
||||
16 bit short signed integer (Word16) whose value falls in the
|
||||
range : 0x8000 <= var1 <= 0x7fff.
|
||||
|
||||
Outputs :
|
||||
none
|
||||
|
||||
Return Value :
|
||||
16 bit short signed integer (Word16) whose value falls in the
|
||||
range : 0x8000 <= var_out <= 0x7fff.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
static inline Word16 negate(Word16 var1)
|
||||
{
|
||||
return (((var1 == MIN_16) ? MAX_16 : -var1));
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
||||
Function Name : shl
|
||||
|
||||
Arithmetically shift the 16 bit input var1 left var2 positions.Zero fill
|
||||
the var2 LSB of the result. If var2 is negative, arithmetically shift
|
||||
var1 right by -var2 with sign extension. Saturate the result in case of
|
||||
underflows or overflows.
|
||||
|
||||
Inputs :
|
||||
var1
|
||||
16 bit short signed integer (Word16) whose value falls in the
|
||||
range : 0x8000 <= var1 <= 0x7fff.
|
||||
|
||||
var2
|
||||
16 bit short signed integer (Word16) whose value falls in the
|
||||
range : 0x8000 <= var1 <= 0x7fff.
|
||||
|
||||
pOverflow : pointer to overflow (Flag)
|
||||
|
||||
Return Value :
|
||||
var_out
|
||||
16 bit short signed integer (Word16) whose value falls in the
|
||||
range : 0x8000 <= var_out <= 0x7fff.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
static inline Word16 shl(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
Word16 var_out = 0;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
if (var2 < 0)
|
||||
{
|
||||
var2 = -var2;
|
||||
if (var2 < 15)
|
||||
{
|
||||
var_out = var1 >> var2;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var_out = var1 << var2;
|
||||
if (var_out >> var2 != var1)
|
||||
{
|
||||
var_out = (var1 >> 15) ^ MAX_16;
|
||||
}
|
||||
}
|
||||
return (var_out);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
||||
Function Name : L_shl
|
||||
|
||||
Arithmetically shift the 32 bit input L_var1 left var2 positions. Zero
|
||||
fill the var2 LSB of the result. If var2 is negative, arithmetically
|
||||
shift L_var1 right by -var2 with sign extension. Saturate the result in
|
||||
case of underflows or overflows.
|
||||
|
||||
Inputs :
|
||||
L_var1 32 bit long signed integer (Word32) whose value falls in the
|
||||
range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
var2
|
||||
16 bit short signed integer (Word16) whose value falls in the
|
||||
range : 8000 <= var2 <= 7fff.
|
||||
|
||||
pOverflow : pointer to overflow (Flag)
|
||||
|
||||
Return Value :
|
||||
32 bit long signed integer (Word32) whose value falls in the
|
||||
range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
|
||||
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
static inline Word32 L_shl(Word32 L_var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
Word32 L_var_out = 0;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
if (var2 > 0)
|
||||
{
|
||||
L_var_out = L_var1 << var2;
|
||||
if (L_var_out >> var2 != L_var1)
|
||||
{
|
||||
L_var_out = (L_var1 >> 31) ^ MAX_32;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var2 = -var2;
|
||||
if (var2 < 31)
|
||||
{
|
||||
L_var_out = L_var1 >> var2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return (L_var_out);
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
||||
Function Name : L_shr
|
||||
|
||||
Arithmetically shift the 32 bit input L_var1 right var2 positions with
|
||||
sign extension. If var2 is negative, arithmetically shift L_var1 left
|
||||
by -var2 and zero fill the -var2 LSB of the result. Saturate the result
|
||||
in case of underflows or overflows.
|
||||
|
||||
Inputs :
|
||||
L_var1 32 bit long signed integer (Word32) whose value falls in the
|
||||
range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
var2
|
||||
16 bit short signed integer (Word16) whose value falls in the
|
||||
range : 8000 <= var2 <= 7fff.
|
||||
|
||||
pOverflow : pointer to overflow (Flag)
|
||||
|
||||
Return Value :
|
||||
32 bit long signed integer (Word32) whose value falls in the
|
||||
range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.
|
||||
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
static inline Word32 L_shr(Word32 L_var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
Word32 L_var_out = 0;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
if (var2 > 0)
|
||||
{
|
||||
if (var2 < 31)
|
||||
{
|
||||
L_var_out = L_var1 >> var2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var2 = -var2;
|
||||
|
||||
L_var_out = L_var1 << (var2) ;
|
||||
if ((L_var_out >> (var2)) != L_var1)
|
||||
{
|
||||
L_var_out = (L_var1 >> 31) ^ MAX_32;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return (L_var_out);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
||||
Function Name : abs_s
|
||||
|
||||
Absolute value of var1; abs_s(-32768) = 32767.
|
||||
|
||||
Inputs :
|
||||
var1
|
||||
16 bit short signed integer (Word16) whose value falls in the
|
||||
range : 0x8000 <= var1 <= 0x7fff.
|
||||
|
||||
pOverflow : pointer to overflow (Flag)
|
||||
|
||||
Outputs :
|
||||
none
|
||||
|
||||
Return Value :
|
||||
16 bit short signed integer (Word16) whose value falls in the
|
||||
range : 0x0000 <= var_out <= 0x7fff.
|
||||
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
static inline Word16 abs_s(Word16 var1)
|
||||
{
|
||||
|
||||
Word16 y = var1 - (var1 < 0);
|
||||
y = y ^(y >> 15);
|
||||
return (y);
|
||||
|
||||
}
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* BASIC_OP_H */
|
||||
|
||||
|
||||
@@ -0,0 +1,537 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: basic_op_arm_gcc_v5.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file includes all the GCC-ARM V5 basicop.c functions.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef BASIC_OP_ARM_GCC_V5_H
|
||||
#define BASIC_OP_ARM_GCC_V5_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_add
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
L_var2 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
|
||||
*/
|
||||
|
||||
static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = L_var1;
|
||||
register Word32 rb = L_var2;
|
||||
Word32 result;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
__asm__ volatile("qadd %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(ra), "r"(rb)
|
||||
);
|
||||
return (result);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_sub
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
L_var2 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
|
||||
*/
|
||||
static inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = L_var1;
|
||||
register Word32 rb = L_var2;
|
||||
Word32 result;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
__asm__ volatile("qsub %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(ra), "r"(rb)
|
||||
);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_mac
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var3 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
|
||||
var1 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
var2 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
result = 32-bit result of L_var3 + (var1 * var2)(Word32)
|
||||
*/
|
||||
static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = L_var3;
|
||||
register Word32 rb = var1;
|
||||
register Word32 rc = var2;
|
||||
Word32 result;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(rb), "r"(rc)
|
||||
);
|
||||
|
||||
__asm__ volatile("qdadd %0, %1, %2"
|
||||
: "=r"(rc)
|
||||
: "r"(ra), "r"(result)
|
||||
);
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_mult
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
|
||||
L_var2 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_product = 32-bit product of L_var1 and L_var2 (Word32)
|
||||
*/
|
||||
|
||||
static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = var1;
|
||||
register Word32 rb = var2;
|
||||
Word32 result;
|
||||
Word32 product;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(product)
|
||||
: "r"(ra), "r"(rb)
|
||||
);
|
||||
|
||||
__asm__ volatile("qadd %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(product), "r"(product)
|
||||
);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_msu
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var3 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
|
||||
|
||||
var1 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
var2 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
result = 32-bit result of L_var3 - (var1 * var2)
|
||||
*/
|
||||
static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = L_var3;
|
||||
register Word32 rb = var1;
|
||||
register Word32 rc = var2;
|
||||
Word32 product;
|
||||
Word32 result;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(product)
|
||||
: "r"(rb), "r"(rc)
|
||||
);
|
||||
|
||||
__asm__ volatile("qdsub %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(ra), "r"(product)
|
||||
);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: Mpy_32
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1_hi = most significant word of first input (Word16).
|
||||
L_var1_lo = least significant word of first input (Word16).
|
||||
L_var2_hi = most significant word of second input (Word16).
|
||||
L_var2_lo = least significant word of second input (Word16).
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit multiply operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_product = 32-bit product of L_var1 and L_var2 (Word32)
|
||||
*/
|
||||
static inline Word32 Mpy_32(Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 L_var2_hi,
|
||||
Word16 L_var2_lo,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
register Word32 product32;
|
||||
register Word32 L_sum;
|
||||
register Word32 L_product, result;
|
||||
register Word32 ra = L_var1_hi;
|
||||
register Word32 rb = L_var1_lo;
|
||||
register Word32 rc = L_var2_hi;
|
||||
register Word32 rd = L_var2_lo;
|
||||
|
||||
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(L_product)
|
||||
: "r"(ra), "r"(rc)
|
||||
);
|
||||
__asm__ volatile("mov %0, #0"
|
||||
: "=r"(result)
|
||||
);
|
||||
|
||||
__asm__ volatile("qdadd %0, %1, %2"
|
||||
: "=r"(L_sum)
|
||||
: "r"(result), "r"(L_product)
|
||||
);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(product32)
|
||||
: "r"(ra), "r"(rd)
|
||||
);
|
||||
|
||||
__asm__ volatile("mov %0, %1, ASR #15"
|
||||
: "=r"(ra)
|
||||
: "r"(product32)
|
||||
);
|
||||
__asm__ volatile("qdadd %0, %1, %2"
|
||||
: "=r"(L_product)
|
||||
: "r"(L_sum), "r"(ra)
|
||||
);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(product32)
|
||||
: "r"(rb), "r"(rc)
|
||||
);
|
||||
|
||||
__asm__ volatile("mov %0, %1, ASR #15"
|
||||
: "=r"(rb)
|
||||
: "r"(product32)
|
||||
);
|
||||
|
||||
__asm__ volatile("qdadd %0, %1, %2"
|
||||
: "=r"(L_sum)
|
||||
: "r"(L_product), "r"(rb)
|
||||
);
|
||||
|
||||
return (L_sum);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: Mpy_32_16
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1_hi = most significant 16 bits of 32-bit input (Word16).
|
||||
L_var1_lo = least significant 16 bits of 32-bit input (Word16).
|
||||
var2 = 16-bit signed integer (Word16).
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit product operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
product = 32-bit product of the 32-bit L_var1 and 16-bit var1 (Word32)
|
||||
*/
|
||||
static inline Word32 Mpy_32_16(Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 var2,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
|
||||
register Word32 ra = L_var1_hi;
|
||||
register Word32 rb = L_var1_lo;
|
||||
register Word32 rc = var2;
|
||||
Word32 result, L_product;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(L_product)
|
||||
: "r"(ra), "r"(rc)
|
||||
);
|
||||
__asm__ volatile("mov %0, #0"
|
||||
: "=r"(result)
|
||||
);
|
||||
|
||||
__asm__ volatile("qdadd %0, %1, %2"
|
||||
: "=r"(L_product)
|
||||
: "r"(result), "r"(L_product)
|
||||
);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(rb), "r"(rc)
|
||||
);
|
||||
|
||||
__asm__ volatile("mov %0, %1, ASR #15"
|
||||
: "=r"(ra)
|
||||
: "r"(result)
|
||||
);
|
||||
__asm__ volatile("qdadd %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(L_product), "r"(ra)
|
||||
);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: mult
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
var1 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
|
||||
var2 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
product = 16-bit limited product of var1 and var2 (Word16)
|
||||
*/
|
||||
static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = var1;
|
||||
register Word32 rb = var2;
|
||||
Word32 product;
|
||||
Word32 temp;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
__asm__ volatile(
|
||||
"smulbb %0, %1, %2"
|
||||
: "=r"(temp)
|
||||
: "r"(ra), "r"(rb)
|
||||
);
|
||||
__asm__ volatile(
|
||||
"qadd %0, %1, %2\n\t"
|
||||
"mov %0, %0, asr #16"
|
||||
: "=&r*i"(product)
|
||||
: "r"(temp), "r"(temp)
|
||||
);
|
||||
|
||||
return ((Word16) product);
|
||||
}
|
||||
|
||||
static inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
|
||||
{
|
||||
register Word32 ra = L_var1;
|
||||
register Word32 rb = L_var2;
|
||||
register Word32 rc = L_var3;
|
||||
Word32 result;
|
||||
|
||||
__asm__ volatile("smlabb %0, %1, %2, %3"
|
||||
: "=r"(result)
|
||||
: "r"(ra), "r"(rb), "r"(rc)
|
||||
);
|
||||
return (result);
|
||||
}
|
||||
|
||||
static inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
|
||||
{
|
||||
register Word32 ra = L_var1;
|
||||
register Word32 rb = L_var2;
|
||||
register Word32 rc = L_var3;
|
||||
Word32 result;
|
||||
|
||||
__asm__ volatile("rsb %0, %1, #0"
|
||||
: "=r"(ra)
|
||||
: "r"(ra)
|
||||
);
|
||||
|
||||
__asm__ volatile("smlabb %0, %1, %2, %3"
|
||||
: "=r"(result)
|
||||
: "r"(ra), "r"(rb), "r"(rc)
|
||||
);
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BASIC_OP_ARM_GCC_V5_H */
|
||||
|
||||
|
||||
@@ -0,0 +1,499 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: basic_op_c_equivalent.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file includes all the C-Equivalent basicop.c functions.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef BASIC_OP_C_EQUIVALENT_H
|
||||
#define BASIC_OP_C_EQUIVALENT_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_add
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
L_var2 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_sum = 32-bit sum of L_var1 and L_var2 (Word32)
|
||||
*/
|
||||
static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
|
||||
{
|
||||
Word32 L_sum;
|
||||
|
||||
L_sum = L_var1 + L_var2;
|
||||
|
||||
if ((L_var1 ^ L_var2) >= 0)
|
||||
{
|
||||
if ((L_sum ^ L_var1) >> 31)
|
||||
{
|
||||
L_sum = (L_var1 >> 31) ? MIN_32 : MAX_32;
|
||||
*pOverflow = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return (L_sum);
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_sub
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
L_var2 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_diff = 32-bit difference of L_var1 and L_var2 (Word32)
|
||||
*/
|
||||
static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2,
|
||||
register Flag *pOverflow)
|
||||
{
|
||||
Word32 L_diff;
|
||||
|
||||
L_diff = L_var1 - L_var2;
|
||||
|
||||
if ((L_var1 ^ L_var2) >> 31)
|
||||
{
|
||||
if ((L_diff ^ L_var1) & MIN_32)
|
||||
{
|
||||
L_diff = (L_var1 >> 31) ? MIN_32 : MAX_32;
|
||||
*pOverflow = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return (L_diff);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_mac
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var3 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
|
||||
var1 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
var2 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
result = 32-bit result of L_var3 + (var1 * var2)(Word32)
|
||||
*/
|
||||
static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
Word32 result;
|
||||
Word32 L_sum;
|
||||
result = (Word32) var1 * var2;
|
||||
if (result != (Word32) 0x40000000L)
|
||||
{
|
||||
L_sum = (result << 1) + L_var3;
|
||||
|
||||
/* Check if L_sum and L_var_3 share the same sign */
|
||||
if ((L_var3 ^ result) > 0)
|
||||
{
|
||||
if ((L_sum ^ L_var3) >> 31)
|
||||
{
|
||||
L_sum = (L_var3 >> 31) ? MIN_32 : MAX_32;
|
||||
*pOverflow = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*pOverflow = 1;
|
||||
L_sum = MAX_32;
|
||||
}
|
||||
return (L_sum);
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_mult
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
|
||||
L_var2 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_product = 32-bit product of L_var1 and L_var2 (Word32)
|
||||
*/
|
||||
static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 L_product;
|
||||
|
||||
L_product = (Word32) var1 * var2;
|
||||
|
||||
if (L_product != (Word32) 0x40000000L)
|
||||
{
|
||||
L_product <<= 1; /* Multiply by 2 */
|
||||
}
|
||||
else
|
||||
{
|
||||
*pOverflow = 1;
|
||||
L_product = MAX_32;
|
||||
}
|
||||
|
||||
return (L_product);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: L_msu
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var3 = 32 bit long signed integer (Word32) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.
|
||||
|
||||
var1 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
var2 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
result = 32-bit result of L_var3 - (var1 * var2)
|
||||
*/
|
||||
|
||||
static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
Word32 result;
|
||||
|
||||
result = L_mult(var1, var2, pOverflow);
|
||||
result = L_sub(L_var3, result, pOverflow);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: Mpy_32
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1_hi = most significant word of first input (Word16).
|
||||
L_var1_lo = least significant word of first input (Word16).
|
||||
L_var2_hi = most significant word of second input (Word16).
|
||||
L_var2_lo = least significant word of second input (Word16).
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit multiply operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
L_product = 32-bit product of L_var1 and L_var2 (Word32)
|
||||
*/
|
||||
static inline Word32 Mpy_32(Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 L_var2_hi,
|
||||
Word16 L_var2_lo,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
Word32 L_product;
|
||||
Word32 L_sum;
|
||||
Word32 product32;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
L_product = (Word32) L_var1_hi * L_var2_hi;
|
||||
|
||||
if (L_product != (Word32) 0x40000000L)
|
||||
{
|
||||
L_product <<= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
L_product = MAX_32;
|
||||
}
|
||||
|
||||
/* result = mult (L_var1_hi, L_var2_lo, pOverflow); */
|
||||
product32 = ((Word32) L_var1_hi * L_var2_lo) >> 15;
|
||||
|
||||
/* L_product = L_mac (L_product, result, 1, pOverflow); */
|
||||
L_sum = L_product + (product32 << 1);
|
||||
|
||||
if ((L_product ^ product32) > 0)
|
||||
{
|
||||
if ((L_sum ^ L_product) >> 31)
|
||||
{
|
||||
L_sum = (L_product >> 31) ? MIN_32 : MAX_32;
|
||||
}
|
||||
}
|
||||
|
||||
L_product = L_sum;
|
||||
|
||||
/* result = mult (L_var1_lo, L_var2_hi, pOverflow); */
|
||||
product32 = ((Word32) L_var1_lo * L_var2_hi) >> 15;
|
||||
|
||||
/* L_product = L_mac (L_product, result, 1, pOverflow); */
|
||||
L_sum = L_product + (product32 << 1);
|
||||
|
||||
if ((L_product ^ product32) > 0)
|
||||
{
|
||||
if ((L_sum ^ L_product) >> 31)
|
||||
{
|
||||
L_sum = (L_product >> 31) ? MIN_32 : MAX_32;
|
||||
}
|
||||
}
|
||||
return (L_sum);
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: Mpy_32_16
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1_hi = most significant 16 bits of 32-bit input (Word16).
|
||||
L_var1_lo = least significant 16 bits of 32-bit input (Word16).
|
||||
var2 = 16-bit signed integer (Word16).
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit product operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
product = 32-bit product of the 32-bit L_var1 and 16-bit var1 (Word32)
|
||||
*/
|
||||
|
||||
static inline Word32 Mpy_32_16(Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 var2,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
|
||||
Word32 L_product;
|
||||
Word32 L_sum;
|
||||
Word32 result;
|
||||
L_product = (Word32) L_var1_hi * var2;
|
||||
|
||||
if (L_product != (Word32) 0x40000000L)
|
||||
{
|
||||
L_product <<= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pOverflow = 1;
|
||||
L_product = MAX_32;
|
||||
}
|
||||
|
||||
result = ((Word32)L_var1_lo * var2) >> 15;
|
||||
|
||||
L_sum = L_product + (result << 1);
|
||||
|
||||
if ((L_product ^ result) > 0)
|
||||
{
|
||||
if ((L_sum ^ L_product) >> 31)
|
||||
{
|
||||
L_sum = (L_product >> 31) ? MIN_32 : MAX_32;
|
||||
*pOverflow = 1;
|
||||
}
|
||||
}
|
||||
return (L_sum);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: mult
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
var1 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
|
||||
var2 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
product = 16-bit limited product of var1 and var2 (Word16)
|
||||
*/
|
||||
static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 product;
|
||||
|
||||
product = ((Word32) var1 * var2) >> 15;
|
||||
|
||||
/* Saturate result (if necessary). */
|
||||
/* var1 * var2 >0x00007fff is the only case */
|
||||
/* that saturation occurs. */
|
||||
|
||||
if (product > 0x00007fffL)
|
||||
{
|
||||
*pOverflow = 1;
|
||||
product = (Word32) MAX_16;
|
||||
}
|
||||
|
||||
|
||||
/* Return the product as a 16 bit value by type casting Word32 to Word16 */
|
||||
|
||||
return ((Word16) product);
|
||||
}
|
||||
|
||||
|
||||
static inline Word32 amrnb_fxp_mac_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
|
||||
{
|
||||
Word32 result;
|
||||
|
||||
result = L_var3 + L_var1 * L_var2;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline Word32 amrnb_fxp_msu_16_by_16bb(Word32 L_var1, Word32 L_var2, Word32 L_var3)
|
||||
{
|
||||
Word32 result;
|
||||
|
||||
result = L_var3 - L_var1 * L_var2;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BASIC_OP_C_EQUIVALENT_H */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: basicop_malloc.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains constant definitions and external references to the stores
|
||||
used by any arithmetic function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef BASICOP_MALLOC_H
|
||||
#define BASICOP_MALLOC_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define MAX_32 (Word32)0x7fffffffL
|
||||
#define MIN_32 (Word32)0x80000000L
|
||||
|
||||
#define MAX_16 (Word16)0x7fff
|
||||
#define MIN_16 (Word16)0x8000
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern Flag Overflow;
|
||||
extern Flag Carry;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
134
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/bitno_tab.h
vendored
Normal file
134
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/bitno_tab.h
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: bitno_tab.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file declares a tables in bitno_tab.c.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef BITNO_TAB_H
|
||||
#define BITNO_TAB_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define BIT_0 0
|
||||
#define BIT_1 1
|
||||
|
||||
#define PRMNO_MR475 17
|
||||
#define PRMNO_MR515 19
|
||||
#define PRMNO_MR59 19
|
||||
#define PRMNO_MR67 19
|
||||
#define PRMNO_MR74 19
|
||||
#define PRMNO_MR795 23
|
||||
#define PRMNO_MR102 39
|
||||
#define PRMNO_MR122 57
|
||||
#define PRMNO_MRDTX 5
|
||||
|
||||
/* number of parameters to first subframe */
|
||||
#define PRMNOFSF_MR475 7
|
||||
#define PRMNOFSF_MR515 7
|
||||
#define PRMNOFSF_MR59 7
|
||||
#define PRMNOFSF_MR67 7
|
||||
#define PRMNOFSF_MR74 7
|
||||
#define PRMNOFSF_MR795 8
|
||||
#define PRMNOFSF_MR102 12
|
||||
#define PRMNOFSF_MR122 18
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 prmno[];
|
||||
extern const Word16 prmnofsf[];
|
||||
extern const Word16 bitno_MR475[];
|
||||
extern const Word16 bitno_MR515[];
|
||||
extern const Word16 bitno_MR59[];
|
||||
extern const Word16 bitno_MR67[];
|
||||
extern const Word16 bitno_MR74[];
|
||||
extern const Word16 bitno_MR95[];
|
||||
extern const Word16 bitno_MR102[];
|
||||
extern const Word16 bitno_MR122[];
|
||||
extern const Word16 bitno_MRDTX[];
|
||||
extern const Word16 *const bitno[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: bitreorder_tab.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file declares a tables in bitreorder.c.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef BITREORDER_H
|
||||
#define BITREORDER_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 numOfBits[];
|
||||
extern const Word16 reorderBits_MR475[];
|
||||
extern const Word16 reorderBits_MR515[];
|
||||
extern const Word16 reorderBits_MR59[];
|
||||
extern const Word16 reorderBits_MR67[];
|
||||
extern const Word16 reorderBits_MR74[];
|
||||
extern const Word16 reorderBits_MR795[];
|
||||
extern const Word16 reorderBits_MR102[];
|
||||
extern const Word16 reorderBits_MR122[];
|
||||
|
||||
extern const Word16 *const reorderBits[];
|
||||
extern const Word16 numCompressedBytes[];
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/bytesused.h
vendored
Normal file
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/bytesused.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: bytesused.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file declares a table BytesUsed.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef BYTESUSED_H
|
||||
#define BYTESUSED_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const short BytesUsed[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
129
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/cnst.h
vendored
Normal file
129
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/cnst.h
vendored
Normal 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_ */
|
||||
133
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/cnst_vad.h
vendored
Normal file
133
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/cnst_vad.h
vendored
Normal 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
|
||||
118
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/d_gain_c.h
vendored
Normal file
118
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/d_gain_c.h
vendored
Normal 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: d_gain_c.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
File : d_gain_c.h
|
||||
Purpose : Decode the fixed codebook gain using the received index.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _D_GAIN_C_H_
|
||||
#define _D_GAIN_C_H_
|
||||
#define d_gain_c_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "mode.h"
|
||||
#include "gc_pred.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here.]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; [Declare variables used in this module but defined elsewhere]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Function : d_gain_code
|
||||
* Purpose : Decode the fixed codebook gain using the received index.
|
||||
* Description : The received index gives the gain correction factor
|
||||
* gamma. The quantized gain is given by g_q = g0 * gamma
|
||||
* where g0 is the predicted gain. To find g0, 4th order
|
||||
* MA prediction is applied to the mean-removed innovation
|
||||
* energy in dB.
|
||||
* Returns : void
|
||||
*/
|
||||
void d_gain_code(
|
||||
gc_predState *pred_state, /* i/o : MA predictor state */
|
||||
enum Mode mode, /* i : AMR mode */
|
||||
Word16 index, /* i : received quantization index */
|
||||
Word16 code[], /* i : innovation codevector */
|
||||
const Word16* qua_gain_code_ptr, /* i : Pointer to read-only table */
|
||||
Word16 *gain_code, /* o : decoded innovation gain */
|
||||
Flag *pOverflow
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _D_GAIN_C_H_ */
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
********************************************************************************
|
||||
*
|
||||
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
|
||||
* R99 Version 3.2.0
|
||||
* REL-4 Version 4.0.0
|
||||
*
|
||||
********************************************************************************
|
||||
*
|
||||
* File : d_gain_p.h
|
||||
* Purpose : Decodes the pitch gain using the received index.
|
||||
*
|
||||
********************************************************************************
|
||||
*/
|
||||
#ifndef d_gain_p_h
|
||||
#define d_gain_p_h "$Id $"
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* INCLUDE FILES
|
||||
********************************************************************************
|
||||
*/
|
||||
#include "typedef.h"
|
||||
#include "mode.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : d_gain_pitch
|
||||
* Purpose : Decodes the pitch gain using the received index.
|
||||
* Description : In case of no frame erasure, the gain is obtained
|
||||
* from the quantization table at the given index;
|
||||
* otherwise, a downscaled past gain is used.
|
||||
* Returns : Quantized pitch gain
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
Word16 d_gain_pitch( /* return value: gain (Q14) */
|
||||
enum Mode mode, /* i : AMR mode */
|
||||
Word16 index, /* i : index of quantization */
|
||||
const Word16* qua_gain_pitch_ptr /* i : pointer to read-only tables */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
190
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/d_plsf.h
vendored
Normal file
190
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/d_plsf.h
vendored
Normal 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: d_plsf.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the d_plsf_3.c and d_plsf_5.c
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef d_plsf_h
|
||||
#define d_plsf_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "cnst.h"
|
||||
#include "mode.h"
|
||||
#include "get_const_tbls.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
Word16 past_r_q[M]; /* Past quantized prediction error, Q15 */
|
||||
Word16 past_lsf_q[M]; /* Past dequantized lsfs, Q15 */
|
||||
} D_plsfState;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : D_plsf_reset
|
||||
* Purpose : Resets state memory
|
||||
* Returns : 0 on success
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
Word16 D_plsf_reset(D_plsfState *st, const Word16* mean_lsf_5_ptr);
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : D_plsf_exit
|
||||
* Purpose : The memory used for state memory is freed
|
||||
* Description : Stores NULL in *st
|
||||
* Returns : void
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
void D_plsf_exit(D_plsfState **st);
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : D_plsf_5
|
||||
* Purpose : Decodes the 2 sets of LSP parameters in a frame
|
||||
* using the received quantization indices.
|
||||
* Description : The two sets of LSFs are quantized using split by
|
||||
* 5 matrix quantization (split-MQ) with 1st order MA
|
||||
* prediction.
|
||||
* See "q_plsf_5.c" for more details about the
|
||||
* quantization procedure
|
||||
* Returns : 0
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
void D_plsf_5(
|
||||
D_plsfState *st, /* i/o: State variables */
|
||||
Word16 bfi, /* i : bad frame indicator (set to 1 if a bad
|
||||
frame is received) */
|
||||
Word16 *indice, /* i : quantization indices of 5 submatrices, Q0 */
|
||||
CommonAmrTbls* common_amr_tbls, /* i : structure containing ptrs to read-only tables */
|
||||
Word16 *lsp1_q, /* o : quantized 1st LSP vector (M) Q15 */
|
||||
Word16 *lsp2_q, /* o : quantized 2nd LSP vector (M) Q15 */
|
||||
Flag *pOverflow /* o : Flag set when overflow occurs */
|
||||
);
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* FUNCTION: D_plsf_3()
|
||||
*
|
||||
* PURPOSE: Decodes the LSP parameters using the received quantization
|
||||
* indices.1st order MA prediction and split by 3 matrix
|
||||
* quantization (split-MQ)
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
void D_plsf_3(
|
||||
D_plsfState *st, /* i/o: State struct */
|
||||
enum Mode mode, /* i : coder mode */
|
||||
Word16 bfi, /* i : bad frame indicator (set to 1 if a */
|
||||
/* bad frame is received) */
|
||||
Word16 * indice, /* i : quantization indices of 3 submatrices, Q0 */
|
||||
CommonAmrTbls* common_amr_tbls, /* i : structure containing ptrs to read-only tables */
|
||||
Word16 * lsp1_q, /* o : quantized 1st LSP vector, Q15 */
|
||||
Flag *pOverflow /* o : Flag set when overflow occurs */
|
||||
);
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* FUNCTION: Init_D_plsf_3()
|
||||
*
|
||||
* PURPOSE: Set the past_r_q[M] vector to one of the eight
|
||||
* past_rq_init vectors.
|
||||
*
|
||||
*************************************************************************/
|
||||
void Init_D_plsf_3(D_plsfState *st, /* i/o: State struct */
|
||||
Word16 index, /* i : past_rq_init[] index [0, 7] */
|
||||
const Word16* past_rq_init_ptr /* ptr to read-only table */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _Q_PLSF_H_ */
|
||||
|
||||
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/div_s.h
vendored
Normal file
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/div_s.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: div_s.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the div_s function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef DIV_S_H
|
||||
#define DIV_S_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF Word16 div_s(Word16 var1, Word16 var2);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: dtx_common_def.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
File : dtx_common_def.h
|
||||
Purpose : DTX definitions common to encoder and decoder
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef DTX_COMMON_DEF_H
|
||||
#define DTX_COMMON_DEF_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define DTX_MAX_EMPTY_THRESH 50
|
||||
#define DTX_HIST_SIZE 8
|
||||
#define DTX_ELAPSED_FRAMES_THRESH (24 + 7 -1)
|
||||
#define DTX_HANG_CONST 7 /* yields eight frames of SP HANGOVER */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DTX_COMMON_DEF_H */
|
||||
|
||||
114
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/frame.h
vendored
Normal file
114
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/frame.h
vendored
Normal 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
|
||||
@@ -0,0 +1,113 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: frame_type_3gpp.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains the definition of the 3GPP frame types.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef FRAME_TYPE_3GPP_H
|
||||
#define FRAME_TYPE_3GPP_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
enum Frame_Type_3GPP
|
||||
{
|
||||
AMR_475 = 0,
|
||||
AMR_515,
|
||||
AMR_59,
|
||||
AMR_67,
|
||||
AMR_74,
|
||||
AMR_795,
|
||||
AMR_102,
|
||||
AMR_122,
|
||||
AMR_SID,
|
||||
GSM_EFR_SID,
|
||||
TDMA_EFR_SID,
|
||||
PDC_EFR_SID,
|
||||
FOR_FUTURE_USE1,
|
||||
FOR_FUTURE_USE2,
|
||||
FOR_FUTURE_USE3,
|
||||
AMR_NO_DATA
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _FRAME_TYPE_3GPP_H_ */
|
||||
|
||||
|
||||
166
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/gc_pred.h
vendored
Normal file
166
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/gc_pred.h
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: gc_pred.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
File : gc_pred.h
|
||||
Purpose : codebook gain MA prediction
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef _GC_PRED_H_
|
||||
#define _GC_PRED_H_
|
||||
#define gc_pred_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "mode.h"
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here.]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; [Declare variables used in this module but defined elsewhere]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
Word16 past_qua_en[4]; /* normal MA predictor memory, Q10 */
|
||||
/* (contains 20*log10(qua_err)) */
|
||||
Word16 past_qua_en_MR122[4]; /* MA predictor memory for MR122 mode, Q10 */
|
||||
/* (contains log2(qua_err)) */
|
||||
} gc_predState;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
OSCL_IMPORT_REF Word16 gc_pred_reset(gc_predState *st);
|
||||
/* reset of codebook gain MA predictor state (i.e. set state memory to zero)
|
||||
returns 0 on success
|
||||
*/
|
||||
void gc_pred_exit(gc_predState **st);
|
||||
/* de-initialize codebook gain MA predictor state (i.e. free state struct)
|
||||
stores NULL in *st
|
||||
*/
|
||||
|
||||
void
|
||||
gc_pred_copy(
|
||||
gc_predState *st_src, /* i : State struct */
|
||||
gc_predState *st_dest /* o : State struct */
|
||||
);
|
||||
|
||||
/*
|
||||
* FUNCTION: gc_pred()
|
||||
* PURPOSE: MA prediction of the innovation energy
|
||||
* (in dB/(20*log10(2))) with mean removed).
|
||||
*/
|
||||
OSCL_IMPORT_REF void gc_pred(
|
||||
gc_predState *st, /* i/o: State struct */
|
||||
enum Mode mode, /* i : AMR mode */
|
||||
Word16 *code, /* i : innovative codebook vector (L_SUBFR) */
|
||||
/* MR122: Q12, other modes: Q13 */
|
||||
Word16 *exp_gcode0, /* o : exponent of predicted gain factor, Q0 */
|
||||
Word16 *frac_gcode0,/* o : fraction of predicted gain factor Q15 */
|
||||
Word16 *exp_en, /* o : exponent of innovation energy, Q0 */
|
||||
/* (only calculated for MR795) */
|
||||
Word16 *frac_en, /* o : fraction of innovation energy, Q15 */
|
||||
/* (only calculated for MR795) */
|
||||
Flag *pOverflow
|
||||
);
|
||||
|
||||
/*
|
||||
* FUNCTION: gc_pred_update()
|
||||
* PURPOSE: update MA predictor with last quantized energy
|
||||
*/
|
||||
OSCL_IMPORT_REF void gc_pred_update(
|
||||
gc_predState *st, /* i/o: State struct */
|
||||
Word16 qua_ener_MR122, /* i : quantized energy for update, Q10 */
|
||||
/* (log2(qua_err)) */
|
||||
Word16 qua_ener /* i : quantized energy for update, Q10 */
|
||||
/* (20*log10(qua_err)) */
|
||||
);
|
||||
|
||||
/*
|
||||
* FUNCTION: gc_pred_average_limited()
|
||||
* PURPOSE: get average of MA predictor state values (with a lower limit)
|
||||
* [used in error concealment]
|
||||
*/
|
||||
OSCL_IMPORT_REF void gc_pred_average_limited(
|
||||
gc_predState *st, /* i: State struct */
|
||||
Word16 *ener_avg_MR122, /* o: averaged quantized energy, Q10 */
|
||||
/* (log2(qua_err)) */
|
||||
Word16 *ener_avg, /* o: averaged quantized energy, Q10 */
|
||||
/* (20*log10(qua_err)) */
|
||||
Flag *pOverflow
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GC_PRED_H_ */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef GET_CONST_TBLS_H
|
||||
#define GET_CONST_TBLS_H
|
||||
|
||||
#include "typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
const Word16* dgray_ptr;
|
||||
const Word16* dico1_lsf_3_ptr;
|
||||
const Word16* dico1_lsf_5_ptr;
|
||||
const Word16* dico2_lsf_3_ptr;
|
||||
const Word16* dico2_lsf_5_ptr;
|
||||
const Word16* dico3_lsf_3_ptr;
|
||||
const Word16* dico3_lsf_5_ptr;
|
||||
const Word16* dico4_lsf_5_ptr;
|
||||
const Word16* dico5_lsf_5_ptr;
|
||||
const Word16* gray_ptr;
|
||||
const Word16* lsp_init_data_ptr;
|
||||
const Word16* mean_lsf_3_ptr;
|
||||
const Word16* mean_lsf_5_ptr;
|
||||
const Word16* mr515_3_lsf_ptr;
|
||||
const Word16* mr795_1_lsf_ptr;
|
||||
const Word16* past_rq_init_ptr;
|
||||
const Word16* pred_fac_3_ptr;
|
||||
const Word16* qua_gain_code_ptr;
|
||||
const Word16* qua_gain_pitch_ptr;
|
||||
const Word16* startPos_ptr;
|
||||
const Word16* table_gain_lowrates_ptr;
|
||||
const Word16* table_gain_highrates_ptr;
|
||||
const Word16* prmno_ptr;
|
||||
const Word16* const* bitno_ptr;
|
||||
const Word16* numOfBits_ptr;
|
||||
const Word16* const* reorderBits_ptr;
|
||||
const Word16* numCompressedBytes_ptr;
|
||||
const Word16* window_200_40_ptr;
|
||||
const Word16* window_160_80_ptr;
|
||||
const Word16* window_232_8_ptr;
|
||||
const Word16* ph_imp_low_MR795_ptr;
|
||||
const Word16* ph_imp_mid_MR795_ptr;
|
||||
const Word16* ph_imp_low_ptr;
|
||||
const Word16* ph_imp_mid_ptr;
|
||||
} CommonAmrTbls;
|
||||
|
||||
OSCL_IMPORT_REF void get_const_tbls(CommonAmrTbls* tbl_struct_ptr);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
80
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/gmed_n.h
vendored
Normal file
80
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/gmed_n.h
vendored
Normal 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
|
||||
********************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF Word16 gmed_n( /* o : index of the median value (0...N-1) */
|
||||
Word16 ind[], /* i : Past gain values */
|
||||
Word16 n /* i : The number of gains; this routine */
|
||||
/* is only valid for a odd number of gains */
|
||||
);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,147 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: gsm_amr_typedefs.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains the definition of the amr codec types.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef GSM_AMR_TYPEDEFS_H
|
||||
#define GSM_AMR_TYPEDEFS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "oscl_base.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Word8
|
||||
typedef int8 Word8;
|
||||
#endif
|
||||
|
||||
#ifndef UWord8
|
||||
typedef uint8 UWord8;
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define 16 bit signed and unsigned words
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Word16
|
||||
typedef int16 Word16;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef UWord16
|
||||
typedef uint16 UWord16;
|
||||
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define 32 bit signed and unsigned words
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Word32
|
||||
typedef int32 Word32;
|
||||
#endif
|
||||
|
||||
#ifndef UWord32
|
||||
typedef uint32 UWord32;
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define boolean type
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef Bool
|
||||
typedef int Bool;
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef OFF
|
||||
#define OFF 0
|
||||
#endif
|
||||
|
||||
#ifndef ON
|
||||
#define ON 1
|
||||
#endif
|
||||
|
||||
#ifndef NO
|
||||
#define NO 0
|
||||
#endif
|
||||
|
||||
#ifndef YES
|
||||
#define YES 1
|
||||
#endif
|
||||
|
||||
#ifndef SUCCESS
|
||||
#define SUCCESS 0
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef Flag
|
||||
typedef int32 Flag;
|
||||
#endif
|
||||
|
||||
#endif /* GSM_AMR_TYPEDEFS_H */
|
||||
201
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/int_lpc.h
vendored
Normal file
201
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/int_lpc.h
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: int_lpc.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the lsp_avg.c
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef int_lpc_h
|
||||
#define int_lpc_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : Int_lpc_1and3
|
||||
* Purpose : Interpolates the LSPs and converts to LPC parameters
|
||||
* to get a different LP filter in each subframe.
|
||||
* Description : The 20 ms speech frame is divided into 4 subframes.
|
||||
* The LSPs are quantized and transmitted at the 2nd and
|
||||
* 4th subframes (twice per frame) and interpolated at the
|
||||
* 1st and 3rd subframe.
|
||||
*
|
||||
* |------|------|------|------|
|
||||
* sf1 sf2 sf3 sf4
|
||||
* F0 Fm F1
|
||||
*
|
||||
* sf1: 1/2 Fm + 1/2 F0 sf3: 1/2 F1 + 1/2 Fm
|
||||
* sf2: Fm sf4: F1
|
||||
* Returns : void
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF void Int_lpc_1and3(
|
||||
Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
|
||||
Word16 lsp_mid[], /* i : LSP vector at the 2nd subfr. of
|
||||
present frame (M) */
|
||||
Word16 lsp_new[], /* i : LSP vector at the 4th subfr. of
|
||||
present frame (M) */
|
||||
Word16 Az[], /* o : interpolated LP parameters in all subfr.
|
||||
(AZ_SIZE) */
|
||||
Flag *pOverflow
|
||||
);
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : Int_lpc_1and3_2
|
||||
* Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
|
||||
* function but we do not recompute Az() for subframe 2 and
|
||||
* 4 because it is already available.
|
||||
* Returns : void
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
void Int_lpc_1and3_2(
|
||||
Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
|
||||
Word16 lsp_mid[], /* i : LSP vector at the 2nd subframe of
|
||||
present frame (M) */
|
||||
Word16 lsp_new[], /* i : LSP vector at the 4th subframe of
|
||||
present frame (M) */
|
||||
Word16 Az[], /* o :interpolated LP parameters
|
||||
in subframes 1 and 3 (AZ_SIZE) */
|
||||
Flag *pOverflow
|
||||
);
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : Int_lpc_1to3
|
||||
* Purpose : Interpolates the LSPs and converts to LPC parameters
|
||||
* to get a different LP filter in each subframe.
|
||||
* Description : The 20 ms speech frame is divided into 4 subframes.
|
||||
* The LSPs are quantized and transmitted at the 4th
|
||||
* subframes (once per frame) and interpolated at the
|
||||
* 1st, 2nd and 3rd subframe.
|
||||
*
|
||||
* |------|------|------|------|
|
||||
* sf1 sf2 sf3 sf4
|
||||
* F0 F1
|
||||
*
|
||||
* sf1: 3/4 F0 + 1/4 F1 sf3: 1/4 F0 + 3/4 F1
|
||||
* sf2: 1/2 F0 + 1/2 F1 sf4: F1
|
||||
* Returns : void
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF void Int_lpc_1to3(
|
||||
Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M) */
|
||||
Word16 lsp_new[], /* i : LSP vector at the 4th SF of present frame (M) */
|
||||
Word16 Az[], /* o : interpolated LP parameters in all SFs (AZ_SIZE) */
|
||||
Flag *pOverflow
|
||||
);
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : Int_lpc_1to3_2
|
||||
* Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
|
||||
* function but we do not recompute Az() for subframe 4
|
||||
* because it is already available.
|
||||
* Returns : void
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
void Int_lpc_1to3_2(
|
||||
Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M) */
|
||||
Word16 lsp_new[], /* i : LSP vector at the 4th SF present frame (M) */
|
||||
Word16 Az[], /* o :interpolated LP parameters in SFs 1, 2, 3
|
||||
(AZ_SIZE) */
|
||||
Flag *pOverflow
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INT_LPC_H_ */
|
||||
|
||||
|
||||
105
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/int_lsf.h
vendored
Normal file
105
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/int_lsf.h
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: int_lsf.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the int_lsf function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef int_lsf_h
|
||||
#define int_lsf_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
void Int_lsf(
|
||||
Word16 lsf_old[], /* i : LSF vector at the 4th SF of past frame */
|
||||
Word16 lsf_new[], /* i : LSF vector at the 4th SF of present frame */
|
||||
Word16 i_subfr, /* i : Current sf (equal to 0,40,80 or 120) */
|
||||
Word16 lsf_out[], /* o : interpolated LSF parameters for current sf */
|
||||
Flag *pOverflow /* o : flag set if overflow occurs */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INT_LSF_H_ */
|
||||
100
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/inv_sqrt.h
vendored
Normal file
100
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/inv_sqrt.h
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: inv_sqrt.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the inv_sqrt() function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef INV_SQRT_H
|
||||
#define INV_SQRT_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 inv_sqrt_tbl[];
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF Word32 Inv_sqrt( /* (o) : output value */
|
||||
Word32 L_x, /* (i) : input value */
|
||||
Flag *pOverflow /* (i) : pointer to overflow flag */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INV_SQRT_H_ */
|
||||
|
||||
137
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_add.h
vendored
Normal file
137
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_add.h
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: l_add.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_add function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_ADD_H
|
||||
#define L_ADD_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
|
||||
__inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = L_var1;
|
||||
register Word32 rb = L_var2;
|
||||
Word32 result;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
asm volatile("qadd %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(ra), "r"(rb)
|
||||
);
|
||||
return (result);
|
||||
|
||||
}
|
||||
|
||||
#else /* C EQUIVALENT */
|
||||
|
||||
|
||||
static inline Word32 L_add(register Word32 L_var1, register Word32 L_var2, Flag *pOverflow)
|
||||
{
|
||||
Word32 L_sum;
|
||||
|
||||
L_sum = L_var1 + L_var2;
|
||||
|
||||
if ((L_var1 ^ L_var2) >= 0)
|
||||
{
|
||||
if ((L_sum ^ L_var1) < 0)
|
||||
{
|
||||
L_sum = (L_var1 < 0) ? MIN_32 : MAX_32;
|
||||
*pOverflow = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return (L_sum);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_ADD_H_ */
|
||||
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_add_c.h
vendored
Normal file
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_add_c.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: l_add_c.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_add_c function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_ADD_C_H
|
||||
#define L_ADD_C_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
Word32 L_add_c(Word32 L_var1, Word32 L_var2, Flag *pOverflow, Flag *pCarry);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_ADD_C_H_ */
|
||||
|
||||
|
||||
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_comp.h
vendored
Normal file
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_comp.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: l_comp.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_comp function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_COMP_H
|
||||
#define L_COMP_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
Word32 L_Comp(Word16 hi, Word16 lo, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_extract.h
vendored
Normal file
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_extract.h
vendored
Normal 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: l_extract.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_extract function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_EXTRACT_H
|
||||
#define L_EXTRACT_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
void L_Extract(Word32 L_var,
|
||||
Word16 *pL_var_hi,
|
||||
Word16 *pL_var_lo,
|
||||
Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_EXTRACT_H_ */
|
||||
152
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_mac.h
vendored
Normal file
152
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_mac.h
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: l_mac.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_mac function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_MAC_H
|
||||
#define L_MAC_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
|
||||
|
||||
static inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = L_var3;
|
||||
register Word32 rb = var1;
|
||||
register Word32 rc = var2;
|
||||
Word32 result;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
asm volatile("smulbb %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(rb), "r"(rc)
|
||||
);
|
||||
|
||||
asm volatile("qdadd %0, %1, %2"
|
||||
: "=r"(rc)
|
||||
: "r"(ra), "r"(result)
|
||||
);
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
#else /* C_EQUIVALENT */
|
||||
|
||||
__inline Word32 L_mac(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
Word32 result;
|
||||
Word32 L_sum;
|
||||
result = (Word32) var1 * var2;
|
||||
if (result != (Word32) 0x40000000L)
|
||||
{
|
||||
L_sum = (result << 1) + L_var3;
|
||||
|
||||
/* Check if L_sum and L_var_3 share the same sign */
|
||||
if ((L_var3 ^ result) > 0)
|
||||
{
|
||||
if ((L_sum ^ L_var3) < 0)
|
||||
{
|
||||
L_sum = (L_var3 < 0) ? MIN_32 : MAX_32;
|
||||
*pOverflow = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*pOverflow = 1;
|
||||
L_sum = MAX_32;
|
||||
}
|
||||
return (L_sum);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_MAC_H_ */
|
||||
|
||||
|
||||
137
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_msu.h
vendored
Normal file
137
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_msu.h
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: l_msu.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_msu function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_MSU_H
|
||||
#define L_MSU_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
#include "l_mult.h"
|
||||
#include "l_sub.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
|
||||
|
||||
__inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = L_var3;
|
||||
register Word32 rb = var1;
|
||||
register Word32 rc = var2;
|
||||
Word32 product;
|
||||
Word32 result;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
asm volatile("smulbb %0, %1, %2"
|
||||
: "=r"(product)
|
||||
: "r"(rb), "r"(rc)
|
||||
);
|
||||
|
||||
asm volatile("qdsub %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(ra), "r"(product)
|
||||
);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
#else /* C EQUIVALENT */
|
||||
|
||||
static inline Word32 L_msu(Word32 L_var3, Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
Word32 result;
|
||||
|
||||
result = L_mult(var1, var2, pOverflow);
|
||||
result = L_sub(L_var3, result, pOverflow);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_MSU_H_ */
|
||||
143
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_mult.h
vendored
Normal file
143
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_mult.h
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: l_mult.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_mult function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_MULT_H
|
||||
#define L_MULT_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
|
||||
|
||||
__inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = var1;
|
||||
register Word32 rb = var2;
|
||||
Word32 result;
|
||||
Word32 product;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
asm volatile("smulbb %0, %1, %2"
|
||||
: "=r"(product)
|
||||
: "r"(ra), "r"(rb)
|
||||
);
|
||||
|
||||
asm volatile("qadd %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(product), "r"(product)
|
||||
);
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
#else /* C EQUIVALENT */
|
||||
|
||||
static inline Word32 L_mult(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 L_product;
|
||||
|
||||
L_product = (Word32) var1 * var2;
|
||||
|
||||
if (L_product != (Word32) 0x40000000L)
|
||||
{
|
||||
L_product <<= 1; /* Multiply by 2 */
|
||||
}
|
||||
else
|
||||
{
|
||||
*pOverflow = 1;
|
||||
L_product = MAX_32;
|
||||
}
|
||||
|
||||
return (L_product);
|
||||
}
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_MULT_H */
|
||||
|
||||
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_negate.h
vendored
Normal file
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_negate.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: l_negate.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_negate function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_NEGATE_H
|
||||
#define L_NEGATE_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
Word32 L_negate(Word32 L_var1);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
102
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_shl.h
vendored
Normal file
102
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_shl.h
vendored
Normal 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.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: l_shl.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_shl function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_SHL_H
|
||||
#define L_SHL_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
Word32 L_shl(Word32 L_var1, Word16 var2, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_SHL_H_ */
|
||||
|
||||
|
||||
|
||||
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_shr.h
vendored
Normal file
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_shr.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: l_shr.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_shr function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_SHR_H
|
||||
#define L_SHR_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
Word32 L_shr(Word32 L_var1, Word16 var2, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_SHR_H_ */
|
||||
|
||||
|
||||
|
||||
100
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_shr_r.h
vendored
Normal file
100
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_shr_r.h
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: l_shr_r.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_shr_r function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_SHR_R_H
|
||||
#define L_SHR_R_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF Word32 L_shr_r(Word32 L_var1, Word16 var2, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_SHR_R_H_ */
|
||||
|
||||
141
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_sub.h
vendored
Normal file
141
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/l_sub.h
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: l_sub.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the L_sub function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef L_SUB_H
|
||||
#define L_SUB_H
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC)) /* Instructions for ARM-linux cross-compiler*/
|
||||
|
||||
__inline Word32 L_sub(Word32 L_var1, Word32 L_var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = L_var1;
|
||||
register Word32 rb = L_var2;
|
||||
Word32 result;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
asm volatile("qsub %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(ra), "r"(rb)
|
||||
);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
#else /* C EQUIVALENT */
|
||||
|
||||
static inline Word32 L_sub(register Word32 L_var1, register Word32 L_var2,
|
||||
register Flag *pOverflow)
|
||||
{
|
||||
Word32 L_diff;
|
||||
|
||||
L_diff = L_var1 - L_var2;
|
||||
|
||||
if ((L_var1 ^ L_var2) < 0)
|
||||
{
|
||||
if ((L_diff ^ L_var1) & MIN_32)
|
||||
{
|
||||
L_diff = (L_var1 < 0L) ? MIN_32 : MAX_32;
|
||||
*pOverflow = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return (L_diff);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _L_SUB_H_ */
|
||||
|
||||
|
||||
104
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/log2.h
vendored
Normal file
104
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/log2.h
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: log2.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains the function prototype definition for Log2 function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef LOG2_H
|
||||
#define LOG2_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
#include "log2_norm.h" /* Used by legacy files */
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF void Log2(
|
||||
Word32 L_x, /* (i) : input value */
|
||||
Word16 *pExponent, /* (o) : Integer part of Log2. (range: 0<=val<=30)*/
|
||||
Word16 *pFraction, /* (o) : Fractional part of Log2. (range: 0<=val<1) */
|
||||
Flag *pOverflow /* (i/o) : overflow flag */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LOG2_H_ */
|
||||
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/log2_norm.h
vendored
Normal file
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/log2_norm.h
vendored
Normal 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: log2_norm.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains the prototype declaration for Log2_norm function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef LOG2_NORM_H
|
||||
#define LOG2_NORM_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 log2_tbl[];
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
void Log2_norm(
|
||||
Word32 L_x, /* (i) : input value (normalized) */
|
||||
Word16 exp, /* (i) : norm_l (L_x) */
|
||||
Word16 *exponent, /* (o) : Integer part of Log2. (range: 0<=val<=30) */
|
||||
Word16 *fraction /* (o) : Fractional part of Log2. (range: 0<=val<1) */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LOG2_NORM_H_ */
|
||||
104
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsfwt.h
vendored
Normal file
104
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsfwt.h
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: lsfwt.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the lsfwt.c
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef lsfwt_h
|
||||
#define lsfwt_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "cnst.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
void Lsf_wt(
|
||||
Word16 *lsf, /* input : LSF vector */
|
||||
Word16 *wf, /* output: square of weighting factors */
|
||||
Flag * pOverflow); /* o : Flag set when overflow occurs */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LSF_WT_H_ */
|
||||
|
||||
173
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsp.h
vendored
Normal file
173
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsp.h
vendored
Normal 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: lsp.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the lsp.c
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef lsp_h
|
||||
#define lsp_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "q_plsf.h"
|
||||
#include "mode.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
|
||||
/* Past LSPs */
|
||||
Word16 lsp_old[M];
|
||||
Word16 lsp_old_q[M];
|
||||
|
||||
/* Quantization state */
|
||||
Q_plsfState *qSt;
|
||||
|
||||
} lspState;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : lsp_init
|
||||
* Purpose : Allocates memory and initializes state variables
|
||||
* Description : Stores pointer to filter status struct in *st. This
|
||||
* pointer has to be passed to lsp in each call.
|
||||
* Returns : 0 on success
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF Word16 lsp_init(lspState **st);
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : lsp_reset
|
||||
* Purpose : Resets state memory
|
||||
* Returns : 0 on success
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF Word16 lsp_reset(lspState *st);
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : lsp_exit
|
||||
* Purpose : The memory used for state memory is freed
|
||||
* Description : Stores NULL in *st
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF void lsp_exit(lspState **st);
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : lsp
|
||||
* Purpose : Conversion from LP coefficients to LSPs.
|
||||
* Quantization of LSPs.
|
||||
* Description : Generates 2 sets of LSPs from 2 sets of
|
||||
* LP coefficients for mode 12.2. For the other
|
||||
* modes 1 set of LSPs is generated from 1 set of
|
||||
* LP coefficients. These LSPs are quantized with
|
||||
* Matrix/Vector quantization (depending on the mode)
|
||||
* and interpolated for the subframes not yet having
|
||||
* their own LSPs.
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF void lsp(lspState *st, /* i/o : State struct */
|
||||
enum Mode req_mode, /* i : requested coder mode */
|
||||
enum Mode used_mode,/* i : used coder mode */
|
||||
Word16 az[], /* i/o : interpolated LP parameters Q12 */
|
||||
Word16 azQ[], /* o : quantization interpol. LP parameters Q12*/
|
||||
Word16 lsp_new[], /* o : new lsp vector */
|
||||
Word16 **anap, /* o : analysis parameters */
|
||||
Flag *pOverflow /* o : Flag set when overflow occurs */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LSP_H_ */
|
||||
|
||||
|
||||
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsp_az.h
vendored
Normal file
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsp_az.h
vendored
Normal 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: lsp_az.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the lsp_az function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef LSP_AZ_H
|
||||
#define LSP_AZ_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF void Lsp_Az(
|
||||
Word16 lsp[], /* (i) : line spectral frequencies */
|
||||
Word16 a[], /* (o) : predictor coefficients (order = 10) */
|
||||
Flag *pOverflow /* (o) : overflow flag */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LSP_AZ_H_ */
|
||||
111
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsp_lsf.h
vendored
Normal file
111
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsp_lsf.h
vendored
Normal 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: lsp_lsf.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the lsp_lsf.c
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef lsp_lsf_h
|
||||
#define lsp_lsf_h
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
OSCL_IMPORT_REF void Lsf_lsp(
|
||||
Word16 lsf[], /* (i) : lsf[m] normalized (range: 0.0<=val<=0.5) */
|
||||
Word16 lsp[], /* (o) : lsp[m] (range: -1<=val<1) */
|
||||
Word16 m, /* (i) : LPC order */
|
||||
Flag *pOverflow /* (o) : Flag set when overflow occurs */
|
||||
);
|
||||
OSCL_IMPORT_REF void Lsp_lsf(
|
||||
Word16 lsp[], /* (i) : lsp[m] (range: -1<=val<1) */
|
||||
Word16 lsf[], /* (o) : lsf[m] normalized (range: 0.0<=val<=0.5) */
|
||||
Word16 m, /* (i) : LPC order */
|
||||
Flag *pOverflow /* (o) : Flag set when overflow occurs */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LSP_LSF_H_ */
|
||||
|
||||
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsp_tab.h
vendored
Normal file
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/lsp_tab.h
vendored
Normal 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: lsp_tab.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file declares a table lsp_init_data.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef LSP_TAB_H
|
||||
#define LSP_TAB_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "cnst.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 lsp_init_data[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
136
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mac_32.h
vendored
Normal file
136
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mac_32.h
vendored
Normal 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: mac_32.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the Mac_32 and Mac_32_16 functions
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef MAC_32_H
|
||||
#define MAC_32_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
static inline Word32 Mac_32(Word32 L_var3,
|
||||
Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 L_var2_hi,
|
||||
Word16 L_var2_lo,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
Word16 product;
|
||||
|
||||
L_var3 = L_mac(L_var3, L_var1_hi, L_var2_hi, pOverflow);
|
||||
|
||||
product = mult(L_var1_hi, L_var2_lo, pOverflow);
|
||||
L_var3 = L_mac(L_var3, product, 1, pOverflow);
|
||||
|
||||
product = mult(L_var1_lo, L_var2_hi, pOverflow);
|
||||
L_var3 = L_mac(L_var3, product, 1, pOverflow);
|
||||
|
||||
return (L_var3);
|
||||
}
|
||||
|
||||
static inline Word32 Mac_32_16(Word32 L_var3,
|
||||
Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 var2,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
Word16 product;
|
||||
|
||||
L_var3 = L_mac(L_var3, L_var1_hi, var2, pOverflow);
|
||||
|
||||
product = mult(L_var1_lo, var2, pOverflow);
|
||||
L_var3 = L_mac(L_var3, product, 1, pOverflow);
|
||||
|
||||
return (L_var3);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MAC_32_H_ */
|
||||
|
||||
|
||||
82
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mode.h
vendored
Normal file
82
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mode.h
vendored
Normal 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
|
||||
224
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mpy_32.h
vendored
Normal file
224
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mpy_32.h
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: mpy_32.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the Mpy_32 function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef MPY_32_H
|
||||
#define MPY_32_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
|
||||
|
||||
static inline Word32 Mpy_32(Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 L_var2_hi,
|
||||
Word16 L_var2_lo,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
register Word32 product32;
|
||||
register Word32 L_sum;
|
||||
register Word32 L_product, result;
|
||||
register Word32 ra = L_var1_hi;
|
||||
register Word32 rb = L_var1_lo;
|
||||
register Word32 rc = L_var2_hi;
|
||||
register Word32 rd = L_var2_lo;
|
||||
|
||||
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
asm volatile("smulbb %0, %1, %2"
|
||||
: "=r"(L_product)
|
||||
: "r"(ra), "r"(rc)
|
||||
);
|
||||
asm volatile("mov %0, #0"
|
||||
: "=r"(result)
|
||||
);
|
||||
|
||||
asm volatile("qdadd %0, %1, %2"
|
||||
: "=r"(L_sum)
|
||||
: "r"(result), "r"(L_product)
|
||||
);
|
||||
|
||||
asm volatile("smulbb %0, %1, %2"
|
||||
: "=r"(product32)
|
||||
: "r"(ra), "r"(rd)
|
||||
);
|
||||
|
||||
asm volatile("mov %0, %1, ASR #15"
|
||||
: "=r"(ra)
|
||||
: "r"(product32)
|
||||
);
|
||||
asm volatile("qdadd %0, %1, %2"
|
||||
: "=r"(L_product)
|
||||
: "r"(L_sum), "r"(ra)
|
||||
);
|
||||
|
||||
asm volatile("smulbb %0, %1, %2"
|
||||
: "=r"(product32)
|
||||
: "r"(rb), "r"(rc)
|
||||
);
|
||||
|
||||
asm volatile("mov %0, %1, ASR #15"
|
||||
: "=r"(rb)
|
||||
: "r"(product32)
|
||||
);
|
||||
|
||||
asm volatile("qdadd %0, %1, %2"
|
||||
: "=r"(L_sum)
|
||||
: "r"(L_product), "r"(rb)
|
||||
);
|
||||
|
||||
return (L_sum);
|
||||
}
|
||||
|
||||
#else /* C_EQUIVALENT */
|
||||
|
||||
__inline Word32 Mpy_32(Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 L_var2_hi,
|
||||
Word16 L_var2_lo,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
Word32 L_product;
|
||||
Word32 L_sum;
|
||||
Word32 product32;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
L_product = (Word32) L_var1_hi * L_var2_hi;
|
||||
|
||||
if (L_product != (Word32) 0x40000000L)
|
||||
{
|
||||
L_product <<= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
L_product = MAX_32;
|
||||
}
|
||||
|
||||
/* result = mult (L_var1_hi, L_var2_lo, pOverflow); */
|
||||
product32 = ((Word32) L_var1_hi * L_var2_lo) >> 15;
|
||||
|
||||
/* L_product = L_mac (L_product, result, 1, pOverflow); */
|
||||
L_sum = L_product + (product32 << 1);
|
||||
|
||||
if ((L_product ^ product32) > 0)
|
||||
{
|
||||
if ((L_sum ^ L_product) < 0)
|
||||
{
|
||||
L_sum = (L_product < 0) ? MIN_32 : MAX_32;
|
||||
}
|
||||
}
|
||||
|
||||
L_product = L_sum;
|
||||
|
||||
/* result = mult (L_var1_lo, L_var2_hi, pOverflow); */
|
||||
product32 = ((Word32) L_var1_lo * L_var2_hi) >> 15;
|
||||
|
||||
/* L_product = L_mac (L_product, result, 1, pOverflow); */
|
||||
L_sum = L_product + (product32 << 1);
|
||||
|
||||
if ((L_product ^ product32) > 0)
|
||||
{
|
||||
if ((L_sum ^ L_product) < 0)
|
||||
{
|
||||
L_sum = (L_product < 0) ? MIN_32 : MAX_32;
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Return nothing or data or data pointer
|
||||
----------------------------------------------------------------------------*/
|
||||
return (L_sum);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MPY_32_H_ */
|
||||
184
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mpy_32_16.h
vendored
Normal file
184
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mpy_32_16.h
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: mpy_32_16.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the Mpy_32_16 function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef MPY_32_16_H
|
||||
#define MPY_32_16_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))/* Instructions for ARM-linux cross-compiler*/
|
||||
|
||||
static inline Word32 Mpy_32_16(Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 var2,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
|
||||
register Word32 ra = L_var1_hi;
|
||||
register Word32 rb = L_var1_lo;
|
||||
register Word32 rc = var2;
|
||||
Word32 result, L_product;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(L_product)
|
||||
: "r"(ra), "r"(rc)
|
||||
);
|
||||
__asm__ volatile("mov %0, #0"
|
||||
: "=r"(result)
|
||||
);
|
||||
|
||||
__asm__ volatile("qdadd %0, %1, %2"
|
||||
: "=r"(L_product)
|
||||
: "r"(result), "r"(L_product)
|
||||
);
|
||||
|
||||
__asm__ volatile("smulbb %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(rb), "r"(rc)
|
||||
);
|
||||
|
||||
__asm__ volatile("mov %0, %1, ASR #15"
|
||||
: "=r"(ra)
|
||||
: "r"(result)
|
||||
);
|
||||
__asm__ volatile("qdadd %0, %1, %2"
|
||||
: "=r"(result)
|
||||
: "r"(L_product), "r"(ra)
|
||||
);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
#else /* C_EQUIVALENT */
|
||||
static inline Word32 Mpy_32_16(Word16 L_var1_hi,
|
||||
Word16 L_var1_lo,
|
||||
Word16 var2,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
|
||||
Word32 L_product;
|
||||
Word32 L_sum;
|
||||
Word32 result;
|
||||
L_product = (Word32) L_var1_hi * var2;
|
||||
|
||||
if (L_product != (Word32) 0x40000000L)
|
||||
{
|
||||
L_product <<= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pOverflow = 1;
|
||||
L_product = MAX_32;
|
||||
}
|
||||
|
||||
result = ((Word32)L_var1_lo * var2) >> 15;
|
||||
|
||||
L_sum = L_product + (result << 1);
|
||||
|
||||
if ((L_product ^ result) > 0)
|
||||
{
|
||||
if ((L_sum ^ L_product) < 0)
|
||||
{
|
||||
L_sum = (L_product < 0) ? MIN_32 : MAX_32;
|
||||
*pOverflow = 1;
|
||||
}
|
||||
}
|
||||
return (L_sum);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MPY_32_16_H_ */
|
||||
|
||||
|
||||
152
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mult.h
vendored
Normal file
152
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mult.h
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: mult.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the mult function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef MULT_H
|
||||
#define MULT_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
|
||||
|
||||
__inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 ra = var1;
|
||||
register Word32 rb = var2;
|
||||
Word32 product;
|
||||
Word32 temp = 0x7FFF;
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
asm volatile("smulbb %0, %1, %2"
|
||||
: "=r"(product)
|
||||
: "r"(ra), "r"(rb)
|
||||
);
|
||||
asm volatile("mov %0, %1, ASR #15"
|
||||
: "=r"(product)
|
||||
: "r"(product)
|
||||
);
|
||||
asm volatile("cmp %0, %1"
|
||||
: "=r"(product)
|
||||
: "r"(temp)
|
||||
);
|
||||
asm volatile("movge %0, %1"
|
||||
: "=r"(product)
|
||||
: "r"(temp)
|
||||
);
|
||||
|
||||
return ((Word16) product);
|
||||
}
|
||||
|
||||
#else /* C EQUIVALENT */
|
||||
|
||||
static inline Word16 mult(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
register Word32 product;
|
||||
|
||||
product = ((Word32) var1 * var2) >> 15;
|
||||
|
||||
/* Saturate result (if necessary). */
|
||||
/* var1 * var2 >0x00007fff is the only case */
|
||||
/* that saturation occurs. */
|
||||
|
||||
if (product > 0x00007fffL)
|
||||
{
|
||||
*pOverflow = 1;
|
||||
product = (Word32) MAX_16;
|
||||
}
|
||||
|
||||
|
||||
/* Return the product as a 16 bit value by type casting Word32 to Word16 */
|
||||
|
||||
return ((Word16) product);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MULT_H_ */
|
||||
|
||||
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mult_r.h
vendored
Normal file
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/mult_r.h
vendored
Normal 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: mult_r.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the mult_r function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef MULT_R__H
|
||||
#define MULT_R__H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF Word16 mult_r(Word16 var1, Word16 var2, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _MULT_R_H_ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
31
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/n_proc.h
vendored
Normal file
31
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/n_proc.h
vendored
Normal 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);
|
||||
100
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/negate.h
vendored
Normal file
100
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/negate.h
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*****************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
**************************************************************************/
|
||||
/*
|
||||
Filename: negate.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the negate function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef NEGATE_H
|
||||
#define NEGATE_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
Word16 negate(register Word16 var1);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
119
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/norm_l.h
vendored
Normal file
119
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/norm_l.h
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: norm_l.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the norm_l function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef NORM_L_H
|
||||
#define NORM_L_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
|
||||
static inline Word16 norm_l(Word32 L_var1)
|
||||
{
|
||||
register Word32 var_out = 0;
|
||||
register Word32 ra = L_var1;
|
||||
if (L_var1)
|
||||
{
|
||||
ra ^= (ra << 1);
|
||||
__asm__ volatile(
|
||||
"clz %0, %1"
|
||||
: "=r"(var_out)
|
||||
: "r"(ra)
|
||||
);
|
||||
}
|
||||
return (var_out);
|
||||
}
|
||||
#else
|
||||
/* C EQUIVALENT */
|
||||
OSCL_IMPORT_REF Word16 norm_l(Word32 L_var1);
|
||||
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
118
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/norm_s.h
vendored
Normal file
118
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/norm_s.h
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: norm_s.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the norm_s function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef NORM_S_H
|
||||
#define NORM_S_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#if ((PV_CPU_ARCH_VERSION >=5) && (PV_COMPILER == EPV_ARM_GNUC))
|
||||
static inline Word16 norm_s(Word16 var1)
|
||||
{
|
||||
register Word32 var_out = 0;
|
||||
register Word32 ra = var1 << 16;
|
||||
if (ra)
|
||||
{
|
||||
ra ^= (ra << 1);
|
||||
__asm__ volatile(
|
||||
"clz %0, %1"
|
||||
: "=r"(var_out)
|
||||
: "r"(ra)
|
||||
);
|
||||
}
|
||||
return (var_out);
|
||||
}
|
||||
#else
|
||||
/*C EQUIVALENT */
|
||||
OSCL_IMPORT_REF Word16 norm_s(Word16 var1);
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,92 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: oper_32b.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file includes all the oper_32b.c functions' header files.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef OPER_32B_H
|
||||
#define OPER_32B_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
#include "l_comp.h"
|
||||
#include "l_extract.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#endif
|
||||
|
||||
|
||||
134
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/p_ol_wgh.h
vendored
Normal file
134
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/p_ol_wgh.h
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: p_ol_wgh.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
File : p_ol_wgh.h
|
||||
Purpose : Compute the open loop pitch lag with weighting.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef P_OL_WGH_H
|
||||
#define P_OL_WGH_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "mode.h"
|
||||
#include "vad.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here.]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; [Declare variables used in this module but defined elsewhere]
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 corrweight[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
/* state variable */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Word16 old_T0_med;
|
||||
Word16 ada_w;
|
||||
Word16 wght_flg;
|
||||
} pitchOLWghtState;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
Word16 p_ol_wgh_init(pitchOLWghtState **st);
|
||||
/* initialize one instance of the pre processing state.
|
||||
Stores pointer to filter status struct in *st. This pointer has to
|
||||
be passed to p_ol_wgh in each call.
|
||||
returns 0 on success
|
||||
*/
|
||||
|
||||
Word16 p_ol_wgh_reset(pitchOLWghtState *st);
|
||||
/* reset of pre processing state (i.e. set state memory to zero)
|
||||
returns 0 on success
|
||||
*/
|
||||
|
||||
void p_ol_wgh_exit(pitchOLWghtState **st);
|
||||
/* de-initialize pre processing state (i.e. free status struct)
|
||||
stores NULL in *st
|
||||
*/
|
||||
|
||||
Word16 Pitch_ol_wgh( /* o : open loop pitch lag */
|
||||
pitchOLWghtState *st, /* i/o : State struct */
|
||||
vadState *vadSt, /* i/o : VAD state struct */
|
||||
Word16 signal[], /* i : signal used to compute the open loop pitch */
|
||||
/* signal[-pit_max] to signal[-1] should be known */
|
||||
Word16 pit_min, /* i : minimum pitch lag */
|
||||
Word16 pit_max, /* i : maximum pitch lag */
|
||||
Word16 L_frame, /* i : length of frame to compute pitch */
|
||||
Word16 old_lags[], /* i : history with old stored Cl lags */
|
||||
Word16 ol_gain_flg[], /* i : OL gain flag */
|
||||
Word16 idx, /* i : index */
|
||||
Flag dtx, /* i : dtx flag; use dtx=1, do not use dtx=0 */
|
||||
Flag *pOverflow /* o : overflow flag */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _P_OL_WGH_H_ */
|
||||
104
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/pow2.h
vendored
Normal file
104
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/pow2.h
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: pow2.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains the prototype declaration for Pow2() function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef POW2_H
|
||||
#define POW2_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 pow2_tbl[];
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
OSCL_IMPORT_REF Word32 Pow2(
|
||||
/* (o) : result (range: 0<=val<=0x7fffffff) */
|
||||
Word16 exponent, /* (i) : Integer part. (range: 0<=val<=30) */
|
||||
Word16 fraction, /* (i) : Fractional part. (range: 0.0<=val<1.0) */
|
||||
Flag *pOverflow /* (i/o) : overflow flag */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _POW2_H_ */
|
||||
105
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/pred_lt.h
vendored
Normal file
105
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/pred_lt.h
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: pred_lt.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the pred_lt function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef pred_lt_h
|
||||
#define pred_lt_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF void Pred_lt_3or6(
|
||||
Word16 exc[], /* in/out: excitation buffer */
|
||||
Word16 T0, /* input : integer pitch lag */
|
||||
Word16 frac, /* input : fraction of lag */
|
||||
Word16 L_subfr, /* input : subframe size */
|
||||
Word16 flag3, /* input : if set, upsampling rate = 3 (6 otherwise) */
|
||||
Flag *pOverflow /* output: if set, overflow occurred in this function */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PRED_LT_H */
|
||||
@@ -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
|
||||
156
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/q_plsf.h
vendored
Normal file
156
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/q_plsf.h
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: q_plsf.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the q_plsf_3.c and q_plsf_5.c
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef q_plsf_h
|
||||
#define q_plsf_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "cnst.h"
|
||||
#include "mode.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define MR795_1_SIZE 512
|
||||
#define PAST_RQ_INIT_SIZE 8
|
||||
|
||||
#define DICO1_SIZE 256
|
||||
#define DICO2_SIZE 512
|
||||
#define DICO3_SIZE 512
|
||||
|
||||
#define DICO1_5_SIZE 128
|
||||
#define DICO2_5_SIZE 256
|
||||
#define DICO3_5_SIZE 256
|
||||
#define DICO4_5_SIZE 256
|
||||
#define DICO5_5_SIZE 64
|
||||
|
||||
#define MR515_3_SIZE 128
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
Word16 past_rq[M]; /* Past quantized prediction error, Q15 */
|
||||
|
||||
} Q_plsfState;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
Word16 Q_plsf_init(Q_plsfState **st);
|
||||
/* initialize one instance of the state.
|
||||
Stores pointer to filter status struct in *st. This pointer has to
|
||||
be passed to Q_plsf_5 / Q_plsf_3 in each call.
|
||||
returns 0 on success
|
||||
*/
|
||||
|
||||
Word16 Q_plsf_reset(Q_plsfState *st);
|
||||
/* reset of state (i.e. set state memory to zero)
|
||||
returns 0 on success
|
||||
*/
|
||||
|
||||
void Q_plsf_exit(Q_plsfState **st);
|
||||
/* de-initialize state (i.e. free status struct)
|
||||
stores NULL in *st
|
||||
*/
|
||||
|
||||
OSCL_IMPORT_REF void Q_plsf_3(
|
||||
Q_plsfState *st, /* i/o: state struct */
|
||||
enum Mode mode, /* i : coder mode */
|
||||
Word16 *lsp1, /* i : 1st LSP vector Q15 */
|
||||
Word16 *lsp1_q, /* o : quantized 1st LSP vector Q15 */
|
||||
Word16 *indice, /* o : quantization indices of 3 vectors Q0 */
|
||||
Word16 *pred_init_i,/* o : init index for MA prediction in DTX mode */
|
||||
Flag *pOverflow /* o : Flag set when overflow occurs */
|
||||
);
|
||||
|
||||
OSCL_IMPORT_REF void Q_plsf_5(
|
||||
Q_plsfState *st,
|
||||
Word16 *lsp1, /* i : 1st LSP vector, Q15 */
|
||||
Word16 *lsp2, /* i : 2nd LSP vector, Q15 */
|
||||
Word16 *lsp1_q, /* o : quantized 1st LSP vector, Q15 */
|
||||
Word16 *lsp2_q, /* o : quantized 2nd LSP vector, Q15 */
|
||||
Word16 *indice, /* o : quantization indices of 5 matrices, Q0 */
|
||||
Flag *pOverflow /* o : Flag set when overflow occurs */
|
||||
);
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _Q_PLSF_H_ */
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: q_plsf_3_tbl.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
MODULE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.]
|
||||
----------------------------------------------------------------------------*/
|
||||
#define MR795_1_SIZE 512
|
||||
#define PAST_RQ_INIT_SIZE 8
|
||||
|
||||
#define DICO1_SIZE 256
|
||||
#define DICO2_SIZE 512
|
||||
#define DICO3_SIZE 512
|
||||
|
||||
#define MR515_3_SIZE 128
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; [Variable declaration - defined here and used outside this module]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* Codebooks of LSF prediction residual */
|
||||
extern const Word16 mean_lsf_3[];
|
||||
|
||||
extern const Word16 pred_fac_3[];
|
||||
|
||||
extern const Word16 dico1_lsf_3[];
|
||||
extern const Word16 dico2_lsf_3[];
|
||||
extern const Word16 dico3_lsf_3[];
|
||||
|
||||
extern const Word16 mr515_3_lsf[];
|
||||
extern const Word16 mr795_1_lsf[];
|
||||
|
||||
extern const Word16 past_rq_init[];
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: q_plsf_5_tbl.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file declares tables defined in q_plsf_5_tbl.c.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef Q_PLSF_5_TBL_H
|
||||
#define Q_PLSF_5_TBL_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 mean_lsf_5[];
|
||||
extern const Word16 dico1_lsf_5[];
|
||||
extern const Word16 dico2_lsf_5[];
|
||||
extern const Word16 dico3_lsf_5[];
|
||||
extern const Word16 dico4_lsf_5[];
|
||||
extern const Word16 dico5_lsf_5[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: qgain475_tab.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file declares tables defined in qgain475_tab.c.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef QGAIN475_TAB_H
|
||||
#define QGAIN475_TAB_H
|
||||
|
||||
#define MR475_VQ_SIZE 256
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 table_gain_MR475[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
126
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/qua_gain.h
vendored
Normal file
126
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/qua_gain.h
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: qua_gain.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the file, qua_gain.c
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef qua_gain_h
|
||||
#define qua_gain_h "$Id $"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "gc_pred.h"
|
||||
#include "mode.h"
|
||||
#include "get_const_tbls.h"
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define VQ_SIZE_HIGHRATES 128
|
||||
#define VQ_SIZE_LOWRATES 64
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
Word16
|
||||
Qua_gain( /* o : index of quantization. */
|
||||
enum Mode mode, /* i : AMR mode */
|
||||
Word16 exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
|
||||
Word16 frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
|
||||
Word16 frac_coeff[], /* i : energy coeff. (5), fraction part, Q15 */
|
||||
Word16 exp_coeff[], /* i : energy coeff. (5), exponent part, Q0 */
|
||||
/* (frac_coeff and exp_coeff computed in */
|
||||
/* calc_filt_energies()) */
|
||||
Word16 gp_limit, /* i : pitch gain limit */
|
||||
Word16 *gain_pit, /* o : Pitch gain, Q14 */
|
||||
Word16 *gain_cod, /* o : Code gain, Q1 */
|
||||
Word16 *qua_ener_MR122, /* o : quantized energy error, Q10 */
|
||||
/* (for MR122 MA predictor update) */
|
||||
Word16 *qua_ener, /* o : quantized energy error, Q10 */
|
||||
/* (for other MA predictor update) */
|
||||
CommonAmrTbls* common_amr_tbls, /* i : ptr to struct of table ptrs */
|
||||
Flag *pOverflow /* o : overflow indicator */
|
||||
);
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* qua_gain_h */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: qua_gain_tbl.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file declares tables defined in qua_gain_tbl.c.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef QUA_GAIN_TBL_H
|
||||
#define QUA_GAIN_TBL_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 table_gain_highrates[];
|
||||
extern const Word16 table_gain_lowrates[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/reorder.h
vendored
Normal file
101
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/reorder.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: reorder.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the Reorder_lsf() function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef REORDER_H
|
||||
#define REORDER_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF void Reorder_lsf(
|
||||
Word16 *lsf, /* (i/o) : vector of LSFs (range: 0<=val<=0.5) */
|
||||
Word16 min_dist, /* (i) : minimum required distance */
|
||||
Word16 n, /* (i) : LPC order */
|
||||
Flag *pOverflow /* (i/o) : overflow Flag */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _REORDER_H_ */
|
||||
|
||||
83
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/residu.h
vendored
Normal file
83
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/residu.h
vendored
Normal 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
|
||||
********************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF void Residu(
|
||||
Word16 a[], /* (i) : prediction coefficients */
|
||||
Word16 x[], /* (i) : speech signal */
|
||||
Word16 y[], /* (o) : residual signal */
|
||||
Word16 lg /* (i) : size of filtering */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,100 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: reverse_bits.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the reverse_bits function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef REVERSE_BITS_H
|
||||
#define REVERSE_BITS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "mode.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
void reverse_bits(enum Mode mode, unsigned char *pCompressedBlock);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
98
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/round.h
vendored
Normal file
98
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/round.h
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: round.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the pv_round function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef ROUND_H
|
||||
#define ROUND_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF Word16 pv_round(Word32 L_var1, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ROUND_H_ */
|
||||
@@ -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
|
||||
102
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/shl.h
vendored
Normal file
102
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/shl.h
vendored
Normal 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.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: shl.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the shl function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef SHL_H
|
||||
#define SHL_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
Word16 shl(Word16 var1, Word16 var2, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SHL_H_ */
|
||||
|
||||
|
||||
|
||||
99
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/shr.h
vendored
Normal file
99
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/shr.h
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: shr.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the shr function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef SHR_H
|
||||
#define SHR_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF Word16 shr(Word16 var1, Word16 var2, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SHR_H_ */
|
||||
100
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/shr_r.h
vendored
Normal file
100
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/shr_r.h
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: shr_r.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the shr_r function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef SHR_R_H
|
||||
#define SHR_R_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF Word16 shr_r(Word16 var1, Word16 var2, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
102
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/sqrt_l.h
vendored
Normal file
102
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/sqrt_l.h
vendored
Normal 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.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: sqrt_l.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the sqrt_l() function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef SQRT_L_H
|
||||
#define SQRT_L_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 sqrt_l_tbl[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
OSCL_IMPORT_REF Word32 sqrt_l_exp( /* o : output value, Q31 */
|
||||
Word32 L_x, /* i : input value, Q31 */
|
||||
Word16 *pExp, /* o : right shift to be applied to result, Q1 */
|
||||
Flag *pOverflow /* i : pointer to overflow flag */
|
||||
);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SQRT_L__H_ */
|
||||
|
||||
99
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/sub.h
vendored
Normal file
99
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/sub.h
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: sub.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the sub function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef SUB_H
|
||||
#define SUB_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basicop_malloc.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_IMPORT_REF Word16 sub(Word16 var1, Word16 var2, Flag *pOverflow);
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SUB_H_ */
|
||||
@@ -0,0 +1,83 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
********************************************************************************
|
||||
*
|
||||
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
|
||||
* R99 Version 3.2.0
|
||||
* REL-4 Version 4.0.0
|
||||
*
|
||||
********************************************************************************
|
||||
*
|
||||
* File : syn_filt.h
|
||||
* Purpose : Perform synthesis filtering through 1/A(z).
|
||||
*
|
||||
*
|
||||
********************************************************************************
|
||||
*/
|
||||
#ifndef syn_filt_h
|
||||
#define syn_filt_h "$Id $"
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* INCLUDE FILES
|
||||
********************************************************************************
|
||||
*/
|
||||
#include "typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* DEFINITION OF DATA TYPES
|
||||
********************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* DECLARATION OF PROTOTYPES
|
||||
********************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF void Syn_filt(
|
||||
Word16 a[], /* (i) : a[m+1] prediction coefficients (m=10) */
|
||||
Word16 x[], /* (i) : input signal */
|
||||
Word16 y[], /* (o) : output signal */
|
||||
Word16 lg, /* (i) : size of filtering */
|
||||
Word16 mem[], /* (i/o): memory associated with this filtering. */
|
||||
Word16 update /* (i) : 0=no update, 1=update of memory. */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
74
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/typedef.h
vendored
Normal file
74
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/typedef.h
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2010 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
********************************************************************************
|
||||
*
|
||||
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
|
||||
* R99 Version 3.2.0
|
||||
* REL-4 Version 4.0.0
|
||||
*
|
||||
********************************************************************************
|
||||
*
|
||||
* File : typedef.c
|
||||
* Purpose : Basic types.
|
||||
*
|
||||
********************************************************************************
|
||||
*/
|
||||
#include "oscl_base_macros.h"// has integer values of PV_COMPILER
|
||||
#ifndef typedef_h
|
||||
#define typedef_h "$Id $"
|
||||
|
||||
#undef ORIGINAL_TYPEDEF_H /* CHANGE THIS TO #define to get the */
|
||||
/* "original" ETSI version of typedef.h */
|
||||
/* CHANGE TO #undef for PV version */
|
||||
|
||||
#ifdef ORIGINAL_TYPEDEF_H
|
||||
/*
|
||||
* this is the original code from the ETSI file typedef.h
|
||||
*/
|
||||
|
||||
#if defined(__unix__) || defined(__unix)
|
||||
typedef signed char Word8;
|
||||
typedef short Word16;
|
||||
typedef int Word32;
|
||||
typedef int Flag;
|
||||
|
||||
#else
|
||||
#error No System recognized
|
||||
#endif
|
||||
#else /* not original typedef.h */
|
||||
|
||||
/*
|
||||
* use (improved) type definition file typdefs.h
|
||||
*/
|
||||
#include "gsm_amr_typedefs.h"
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
76
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/vad.h
vendored
Normal file
76
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/vad.h
vendored
Normal 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
|
||||
@@ -0,0 +1,81 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
********************************************************************************
|
||||
*
|
||||
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
|
||||
* R99 Version 3.2.0
|
||||
* REL-4 Version 4.0.0
|
||||
*
|
||||
********************************************************************************
|
||||
*
|
||||
* File : weight_a.h
|
||||
* Purpose : Spectral expansion of LP coefficients. (order==10)
|
||||
* Description : a_exp[i] = a[i] * fac[i-1] ,i=1,10
|
||||
*
|
||||
*
|
||||
********************************************************************************
|
||||
*/
|
||||
#ifndef weight_a_h
|
||||
#define weight_a_h "$Id $"
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* INCLUDE FILES
|
||||
********************************************************************************
|
||||
*/
|
||||
#include "typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* DEFINITION OF DATA TYPES
|
||||
********************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* DECLARATION OF PROTOTYPES
|
||||
********************************************************************************
|
||||
*/
|
||||
OSCL_IMPORT_REF void Weight_Ai(
|
||||
Word16 a[], /* (i) : a[m+1] LPC coefficients (m=10) */
|
||||
const Word16 fac[],/* (i) : Spectral expansion factors. */
|
||||
Word16 a_exp[] /* (o) : Spectral expanded LPC coefficients */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/window_tab.h
vendored
Normal file
103
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/window_tab.h
vendored
Normal 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: window_tab.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file declares a tables in window_tab.c used in lpc.c.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef WINDOW_TAB_H
|
||||
#define WINDOW_TAB_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "cnst.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
extern const Word16 window_200_40[];
|
||||
extern const Word16 window_160_80[];
|
||||
extern const Word16 window_232_8[];
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
108
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/wmf_to_ets.h
vendored
Normal file
108
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/include/wmf_to_ets.h
vendored
Normal 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.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: wmf_to_ets.h
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INCLUDE DESCRIPTION
|
||||
|
||||
This file contains all the constant definitions and prototype definitions
|
||||
needed by the wmf_to_ets function.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; CONTINUE ONLY IF NOT ALREADY DEFINED
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifndef WMF_TO_ETS_H
|
||||
#define WMF_TO_ETS_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "frame_type_3gpp.h"
|
||||
#include "typedef.h"
|
||||
#include "get_const_tbls.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL VARIABLES REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; SIMPLE TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; ENUMERATED TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; STRUCTURES TYPEDEF'S
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; GLOBAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
void wmf_to_ets(enum Frame_Type_3GPP frame_type_3gpp,
|
||||
UWord8 *wmf_input_ptr,
|
||||
Word16 *ets_output_ptr,
|
||||
CommonAmrTbls* common_amr_tbls);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; END
|
||||
----------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
171
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/add.c
vendored
Normal file
171
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/add.c
vendored
Normal 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: add.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
MODULE DESCRIPTION
|
||||
|
||||
Summation function with overflow control
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basic_op.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; [Variable declaration - defined here and used outside this module]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: add
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
var1 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var1 <= 0x0000 7fff.
|
||||
|
||||
var2 = 16 bit short signed integer (Word16) whose value falls in
|
||||
the range : 0xffff 8000 <= var2 <= 0x0000 7fff.
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the add operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
sum = 16-bit limited sum of var1 and var2 (Word16)
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function performs the addition (var1+var2) with overflow control and
|
||||
saturation; the 16 bit result is set at +32767 when overflow occurs or at
|
||||
-32768 when underflow occurs.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] add.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
Word16 add (Word16 var1, Word16 var2)
|
||||
{
|
||||
Word16 var_out;
|
||||
Word32 sum;
|
||||
|
||||
sum = (Word32) var1 + var2;
|
||||
|
||||
* The reference ETSI code uses a global flag for Overflow inside the function
|
||||
* saturate(). In the actual implementation a pointer to Overflow flag is passed in
|
||||
* as a parameter to the function
|
||||
|
||||
var_out = saturate (sum);
|
||||
#if (WMOPS)
|
||||
multiCounter[currCounter].add++;
|
||||
#endif
|
||||
return (var_out);
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_EXPORT_REF Word16 add_16(Word16 var1, Word16 var2, Flag *pOverflow)
|
||||
{
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define all local variables
|
||||
----------------------------------------------------------------------------*/
|
||||
Word32 sum;
|
||||
sum = (Word32) var1 + var2;
|
||||
|
||||
/* Saturate result (if necessary). */
|
||||
/* Replaced function call with in-line code */
|
||||
/* to conserve MIPS, i.e., var_out = saturate (sum) */
|
||||
|
||||
if (sum > 0X00007fffL)
|
||||
{
|
||||
*pOverflow = 1;
|
||||
sum = MAX_16;
|
||||
}
|
||||
else if (sum < (Word32) - 32768)
|
||||
{
|
||||
*pOverflow = 1;
|
||||
sum = MIN_16;
|
||||
}
|
||||
|
||||
/* Return the sum as a 16 bit value by type casting Word32 to Word16 */
|
||||
|
||||
return ((Word16) sum);
|
||||
}
|
||||
|
||||
665
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/az_lsp.c
vendored
Normal file
665
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/az_lsp.c
vendored
Normal file
@@ -0,0 +1,665 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: az_lsp.cpp
|
||||
Funtions: Chebps
|
||||
Chebps_Wrapper
|
||||
Az_lsp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
MODULE DESCRIPTION
|
||||
|
||||
These modules compute the LSPs from the LP coefficients.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "az_lsp.h"
|
||||
#include "cnst.h"
|
||||
#include "basic_op.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define NC M/2 /* M = LPC order, NC = M/2 */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: Chebps
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
x = input value (Word16)
|
||||
f = polynomial (Word16)
|
||||
n = polynomial order (Word16)
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the operations in the function resulted in saturation.
|
||||
|
||||
Returns:
|
||||
cheb = Chebyshev polynomial for the input value x.(Word16)
|
||||
|
||||
Global Variables Used:
|
||||
None.
|
||||
|
||||
Local Variables Needed:
|
||||
None.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This module evaluates the Chebyshev polynomial series.
|
||||
- The polynomial order is n = m/2 = 5
|
||||
- The polynomial F(z) (F1(z) or F2(z)) is given by
|
||||
F(w) = 2 exp(-j5w) C(x)
|
||||
where
|
||||
C(x) = T_n(x) + f(1)T_n-1(x) + ... +f(n-1)T_1(x) + f(n)/2
|
||||
and T_m(x) = cos(mw) is the mth order Chebyshev
|
||||
polynomial ( x=cos(w) )
|
||||
- C(x) for the input x is returned.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
az_lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
static Word16 Chebps (Word16 x,
|
||||
Word16 f[], // (n)
|
||||
Word16 n)
|
||||
{
|
||||
Word16 i, cheb;
|
||||
Word16 b0_h, b0_l, b1_h, b1_l, b2_h, b2_l;
|
||||
Word32 t0;
|
||||
|
||||
// The reference ETSI code uses a global flag for Overflow. However, in the
|
||||
// actual implementation a pointer to Overflow flag is passed in as a
|
||||
// parameter to the function. This pointer is passed into all the basic math
|
||||
// functions invoked
|
||||
|
||||
b2_h = 256; // b2 = 1.0
|
||||
b2_l = 0;
|
||||
|
||||
t0 = L_mult (x, 512); // 2*x
|
||||
t0 = L_mac (t0, f[1], 8192); // + f[1]
|
||||
L_Extract (t0, &b1_h, &b1_l); // b1 = 2*x + f[1]
|
||||
|
||||
for (i = 2; i < n; i++)
|
||||
{
|
||||
t0 = Mpy_32_16 (b1_h, b1_l, x); // t0 = 2.0*x*b1
|
||||
t0 = L_shl (t0, 1);
|
||||
t0 = L_mac (t0, b2_h, (Word16) 0x8000); // t0 = 2.0*x*b1 - b2
|
||||
t0 = L_msu (t0, b2_l, 1);
|
||||
t0 = L_mac (t0, f[i], 8192); // t0 = 2.0*x*b1 - b2 + f[i]
|
||||
|
||||
L_Extract (t0, &b0_h, &b0_l); // b0 = 2.0*x*b1 - b2 + f[i]
|
||||
|
||||
b2_l = b1_l; // b2 = b1;
|
||||
b2_h = b1_h;
|
||||
b1_l = b0_l; // b1 = b0;
|
||||
b1_h = b0_h;
|
||||
}
|
||||
|
||||
t0 = Mpy_32_16 (b1_h, b1_l, x); // t0 = x*b1;
|
||||
t0 = L_mac (t0, b2_h, (Word16) 0x8000); // t0 = x*b1 - b2
|
||||
t0 = L_msu (t0, b2_l, 1);
|
||||
t0 = L_mac (t0, f[i], 4096); // t0 = x*b1 - b2 + f[i]/2
|
||||
|
||||
t0 = L_shl (t0, 6);
|
||||
|
||||
cheb = extract_h (t0);
|
||||
|
||||
return (cheb);
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static Word16 Chebps(Word16 x,
|
||||
Word16 f[], /* (n) */
|
||||
Word16 n,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
Word16 i;
|
||||
Word16 cheb;
|
||||
Word16 b1_h;
|
||||
Word16 b1_l;
|
||||
Word32 t0;
|
||||
Word32 L_temp;
|
||||
Word16 *p_f = &f[1];
|
||||
|
||||
OSCL_UNUSED_ARG(pOverflow);
|
||||
|
||||
/* L_temp = 1.0 */
|
||||
|
||||
L_temp = 0x01000000L;
|
||||
|
||||
t0 = ((Word32) x << 10) + ((Word32) * (p_f++) << 14);
|
||||
|
||||
/* b1 = t0 = 2*x + f[1] */
|
||||
|
||||
b1_h = (Word16)(t0 >> 16);
|
||||
b1_l = (Word16)((t0 >> 1) - (b1_h << 15));
|
||||
|
||||
|
||||
for (i = 2; i < n; i++)
|
||||
{
|
||||
/* t0 = 2.0*x*b1 */
|
||||
t0 = ((Word32) b1_h * x);
|
||||
t0 += ((Word32) b1_l * x) >> 15;
|
||||
t0 <<= 2;
|
||||
|
||||
/* t0 = 2.0*x*b1 - b2 */
|
||||
t0 -= L_temp;
|
||||
|
||||
/* t0 = 2.0*x*b1 - b2 + f[i] */
|
||||
t0 += (Word32) * (p_f++) << 14;
|
||||
|
||||
L_temp = ((Word32) b1_h << 16) + ((Word32) b1_l << 1);
|
||||
|
||||
/* b0 = 2.0*x*b1 - b2 + f[i]*/
|
||||
b1_h = (Word16)(t0 >> 16);
|
||||
b1_l = (Word16)((t0 >> 1) - (b1_h << 15));
|
||||
|
||||
}
|
||||
|
||||
/* t0 = x*b1; */
|
||||
t0 = ((Word32) b1_h * x);
|
||||
t0 += ((Word32) b1_l * x) >> 15;
|
||||
t0 <<= 1;
|
||||
|
||||
|
||||
/* t0 = x*b1 - b2 */
|
||||
t0 -= L_temp;
|
||||
|
||||
/* t0 = x*b1 - b2 + f[i]/2 */
|
||||
t0 += (Word32) * (p_f) << 13;
|
||||
|
||||
|
||||
if ((UWord32)(t0 + 33554432) < 67108863)
|
||||
{
|
||||
cheb = (Word16)(t0 >> 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (t0 > (Word32) 0x01ffffffL)
|
||||
{
|
||||
cheb = MAX_16;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cheb = MIN_16;
|
||||
}
|
||||
}
|
||||
|
||||
return (cheb);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: Az_lsp
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS FOR Az_lsp
|
||||
|
||||
Inputs:
|
||||
a = predictor coefficients (Word16)
|
||||
lsp = line spectral pairs (Word16)
|
||||
old_lsp = old line spectral pairs (Word16)
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the operations in the function resulted in saturation.
|
||||
|
||||
Returns:
|
||||
None.
|
||||
|
||||
Global Variables Used:
|
||||
None.
|
||||
|
||||
Local Variables Needed:
|
||||
None.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function computes the LSPs from the LP coefficients.
|
||||
|
||||
The sum and difference filters are computed and divided by 1+z^{-1} and
|
||||
1-z^{-1}, respectively.
|
||||
|
||||
f1[i] = a[i] + a[11-i] - f1[i-1] ; i=1,...,5
|
||||
f2[i] = a[i] - a[11-i] + f2[i-1] ; i=1,...,5
|
||||
|
||||
The roots of F1(z) and F2(z) are found using Chebyshev polynomial evaluation.
|
||||
The polynomials are evaluated at 60 points regularly spaced in the
|
||||
frequency domain. The sign change interval is subdivided 4 times to better
|
||||
track the root. The LSPs are found in the cosine domain [1,-1].
|
||||
|
||||
If less than 10 roots are found, the LSPs from the past frame are used.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
az_lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
void Az_lsp (
|
||||
Word16 a[], // (i) : predictor coefficients (MP1)
|
||||
Word16 lsp[], // (o) : line spectral pairs (M)
|
||||
Word16 old_lsp[] // (i) : old lsp[] (in case not found 10 roots) (M)
|
||||
)
|
||||
{
|
||||
Word16 i, j, nf, ip;
|
||||
Word16 xlow, ylow, xhigh, yhigh, xmid, ymid, xint;
|
||||
Word16 x, y, sign, exp;
|
||||
Word16 *coef;
|
||||
Word16 f1[M / 2 + 1], f2[M / 2 + 1];
|
||||
Word32 t0;
|
||||
|
||||
*-------------------------------------------------------------*
|
||||
* find the sum and diff. pol. F1(z) and F2(z) *
|
||||
* F1(z) <--- F1(z)/(1+z**-1) & F2(z) <--- F2(z)/(1-z**-1) *
|
||||
* *
|
||||
* f1[0] = 1.0; *
|
||||
* f2[0] = 1.0; *
|
||||
* *
|
||||
* for (i = 0; i< NC; i++) *
|
||||
* { *
|
||||
* f1[i+1] = a[i+1] + a[M-i] - f1[i] ; *
|
||||
* f2[i+1] = a[i+1] - a[M-i] + f2[i] ; *
|
||||
* } *
|
||||
*-------------------------------------------------------------*
|
||||
|
||||
f1[0] = 1024; // f1[0] = 1.0
|
||||
f2[0] = 1024; // f2[0] = 1.0
|
||||
|
||||
// The reference ETSI code uses a global flag for Overflow. However, in the
|
||||
// actual implementation a pointer to Overflow flag is passed in as a
|
||||
// parameter to the function. This pointer is passed into all the basic math
|
||||
// functions invoked
|
||||
|
||||
for (i = 0; i < NC; i++)
|
||||
{
|
||||
t0 = L_mult (a[i + 1], 8192); // x = (a[i+1] + a[M-i]) >> 2
|
||||
t0 = L_mac (t0, a[M - i], 8192);
|
||||
x = extract_h (t0);
|
||||
// f1[i+1] = a[i+1] + a[M-i] - f1[i]
|
||||
f1[i + 1] = sub (x, f1[i]);
|
||||
|
||||
t0 = L_mult (a[i + 1], 8192); // x = (a[i+1] - a[M-i]) >> 2
|
||||
t0 = L_msu (t0, a[M - i], 8192);
|
||||
x = extract_h (t0);
|
||||
// f2[i+1] = a[i+1] - a[M-i] + f2[i]
|
||||
f2[i + 1] = add (x, f2[i]);
|
||||
}
|
||||
|
||||
*-------------------------------------------------------------*
|
||||
* find the LSPs using the Chebychev pol. evaluation *
|
||||
*-------------------------------------------------------------*
|
||||
|
||||
nf = 0; // number of found frequencies
|
||||
ip = 0; // indicator for f1 or f2
|
||||
|
||||
coef = f1;
|
||||
|
||||
xlow = grid[0];
|
||||
ylow = Chebps (xlow, coef, NC);
|
||||
|
||||
j = 0;
|
||||
// while ( (nf < M) && (j < grid_points) )
|
||||
while ((sub (nf, M) < 0) && (sub (j, grid_points) < 0))
|
||||
{
|
||||
j++;
|
||||
xhigh = xlow;
|
||||
yhigh = ylow;
|
||||
xlow = grid[j];
|
||||
ylow = Chebps (xlow, coef, NC);
|
||||
|
||||
if (L_mult (ylow, yhigh) <= (Word32) 0L)
|
||||
{
|
||||
|
||||
// divide 4 times the interval
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
// xmid = (xlow + xhigh)/2
|
||||
xmid = add (shr (xlow, 1), shr (xhigh, 1));
|
||||
ymid = Chebps (xmid, coef, NC);
|
||||
|
||||
if (L_mult (ylow, ymid) <= (Word32) 0L)
|
||||
{
|
||||
yhigh = ymid;
|
||||
xhigh = xmid;
|
||||
}
|
||||
else
|
||||
{
|
||||
ylow = ymid;
|
||||
xlow = xmid;
|
||||
}
|
||||
}
|
||||
|
||||
*-------------------------------------------------------------*
|
||||
* Linear interpolation *
|
||||
* xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow); *
|
||||
*-------------------------------------------------------------*
|
||||
|
||||
x = sub (xhigh, xlow);
|
||||
y = sub (yhigh, ylow);
|
||||
|
||||
if (y == 0)
|
||||
{
|
||||
xint = xlow;
|
||||
}
|
||||
else
|
||||
{
|
||||
sign = y;
|
||||
y = abs_s (y);
|
||||
exp = norm_s (y);
|
||||
y = shl (y, exp);
|
||||
y = div_s ((Word16) 16383, y);
|
||||
t0 = L_mult (x, y);
|
||||
t0 = L_shr (t0, sub (20, exp));
|
||||
y = extract_l (t0); // y= (xhigh-xlow)/(yhigh-ylow)
|
||||
|
||||
if (sign < 0)
|
||||
y = negate (y);
|
||||
|
||||
t0 = L_mult (ylow, y);
|
||||
t0 = L_shr (t0, 11);
|
||||
xint = sub (xlow, extract_l (t0)); // xint = xlow - ylow*y
|
||||
}
|
||||
|
||||
lsp[nf] = xint;
|
||||
xlow = xint;
|
||||
nf++;
|
||||
|
||||
if (ip == 0)
|
||||
{
|
||||
ip = 1;
|
||||
coef = f2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ip = 0;
|
||||
coef = f1;
|
||||
}
|
||||
ylow = Chebps (xlow, coef, NC);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Check if M roots found
|
||||
|
||||
if (sub (nf, M) < 0)
|
||||
{
|
||||
for (i = 0; i < M; i++)
|
||||
{
|
||||
lsp[i] = old_lsp[i];
|
||||
}
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void Az_lsp(
|
||||
Word16 a[], /* (i) : predictor coefficients (MP1) */
|
||||
Word16 lsp[], /* (o) : line spectral pairs (M) */
|
||||
Word16 old_lsp[], /* (i) : old lsp[] (in case not found 10 roots) (M) */
|
||||
Flag *pOverflow /* (i/o): overflow flag */
|
||||
)
|
||||
{
|
||||
register Word16 i;
|
||||
register Word16 j;
|
||||
register Word16 nf;
|
||||
register Word16 ip;
|
||||
Word16 xlow;
|
||||
Word16 ylow;
|
||||
Word16 xhigh;
|
||||
Word16 yhigh;
|
||||
Word16 xmid;
|
||||
Word16 ymid;
|
||||
Word16 xint;
|
||||
Word16 x;
|
||||
Word16 y;
|
||||
Word16 sign;
|
||||
Word16 exp;
|
||||
Word16 *coef;
|
||||
Word16 f1[NC + 1];
|
||||
Word16 f2[NC + 1];
|
||||
Word32 L_temp1;
|
||||
Word32 L_temp2;
|
||||
Word16 *p_f1 = f1;
|
||||
Word16 *p_f2 = f2;
|
||||
|
||||
/*-------------------------------------------------------------*
|
||||
* find the sum and diff. pol. F1(z) and F2(z) *
|
||||
* F1(z) <--- F1(z)/(1+z**-1) & F2(z) <--- F2(z)/(1-z**-1) *
|
||||
* *
|
||||
* f1[0] = 1.0; *
|
||||
* f2[0] = 1.0; *
|
||||
* *
|
||||
* for (i = 0; i< NC; i++) *
|
||||
* { *
|
||||
* f1[i+1] = a[i+1] + a[M-i] - f1[i] ; *
|
||||
* f2[i+1] = a[i+1] - a[M-i] + f2[i] ; *
|
||||
* } *
|
||||
*-------------------------------------------------------------*/
|
||||
|
||||
*p_f1 = 1024; /* f1[0] = 1.0 */
|
||||
*p_f2 = 1024; /* f2[0] = 1.0 */
|
||||
|
||||
for (i = 0; i < NC; i++)
|
||||
{
|
||||
L_temp1 = (Word32) * (a + i + 1);
|
||||
L_temp2 = (Word32) * (a + M - i);
|
||||
/* x = (a[i+1] + a[M-i]) >> 2 */
|
||||
x = (Word16)((L_temp1 + L_temp2) >> 2);
|
||||
/* y = (a[i+1] - a[M-i]) >> 2 */
|
||||
y = (Word16)((L_temp1 - L_temp2) >> 2);
|
||||
/* f1[i+1] = a[i+1] + a[M-i] - f1[i] */
|
||||
x -= *(p_f1++);
|
||||
*(p_f1) = x;
|
||||
/* f2[i+1] = a[i+1] - a[M-i] + f2[i] */
|
||||
y += *(p_f2++);
|
||||
*(p_f2) = y;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------*
|
||||
* find the LSPs using the Chebychev pol. evaluation *
|
||||
*-------------------------------------------------------------*/
|
||||
|
||||
nf = 0; /* number of found frequencies */
|
||||
ip = 0; /* indicator for f1 or f2 */
|
||||
|
||||
coef = f1;
|
||||
|
||||
xlow = *(grid);
|
||||
ylow = Chebps(xlow, coef, NC, pOverflow);
|
||||
|
||||
j = 0;
|
||||
|
||||
while ((nf < M) && (j < grid_points))
|
||||
{
|
||||
j++;
|
||||
xhigh = xlow;
|
||||
yhigh = ylow;
|
||||
xlow = *(grid + j);
|
||||
ylow = Chebps(xlow, coef, NC, pOverflow);
|
||||
|
||||
if (((Word32)ylow*yhigh) <= 0)
|
||||
{
|
||||
/* divide 4 times the interval */
|
||||
for (i = 4; i != 0; i--)
|
||||
{
|
||||
/* xmid = (xlow + xhigh)/2 */
|
||||
x = xlow >> 1;
|
||||
y = xhigh >> 1;
|
||||
xmid = x + y;
|
||||
|
||||
ymid = Chebps(xmid, coef, NC, pOverflow);
|
||||
|
||||
if (((Word32)ylow*ymid) <= 0)
|
||||
{
|
||||
yhigh = ymid;
|
||||
xhigh = xmid;
|
||||
}
|
||||
else
|
||||
{
|
||||
ylow = ymid;
|
||||
xlow = xmid;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------*
|
||||
* Linear interpolation *
|
||||
* xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow); *
|
||||
*-------------------------------------------------------------*/
|
||||
|
||||
x = xhigh - xlow;
|
||||
y = yhigh - ylow;
|
||||
|
||||
if (y == 0)
|
||||
{
|
||||
xint = xlow;
|
||||
}
|
||||
else
|
||||
{
|
||||
sign = y;
|
||||
y = abs_s(y);
|
||||
exp = norm_s(y);
|
||||
y <<= exp;
|
||||
y = div_s((Word16) 16383, y);
|
||||
|
||||
y = ((Word32)x * y) >> (19 - exp);
|
||||
|
||||
if (sign < 0)
|
||||
{
|
||||
y = -y;
|
||||
}
|
||||
|
||||
/* xint = xlow - ylow*y */
|
||||
xint = xlow - (((Word32) ylow * y) >> 10);
|
||||
}
|
||||
|
||||
*(lsp + nf) = xint;
|
||||
xlow = xint;
|
||||
nf++;
|
||||
|
||||
if (ip == 0)
|
||||
{
|
||||
ip = 1;
|
||||
coef = f2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ip = 0;
|
||||
coef = f1;
|
||||
}
|
||||
|
||||
ylow = Chebps(xlow, coef, NC, pOverflow);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if M roots found */
|
||||
|
||||
if (nf < M)
|
||||
{
|
||||
for (i = NC; i != 0 ; i--)
|
||||
{
|
||||
*lsp++ = *old_lsp++;
|
||||
*lsp++ = *old_lsp++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Word16 Chebps_Wrapper(Word16 x,
|
||||
Word16 f[], /* (n) */
|
||||
Word16 n,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
return Chebps(x, f, n, pOverflow);
|
||||
}
|
||||
|
||||
273
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/bitno_tab.c
vendored
Normal file
273
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/bitno_tab.c
vendored
Normal file
@@ -0,0 +1,273 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: bitno_tab.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
None
|
||||
|
||||
Local Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Global Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Outputs:
|
||||
None
|
||||
|
||||
Pointers and Buffers Modified:
|
||||
None
|
||||
|
||||
Local Stores Modified:
|
||||
None
|
||||
|
||||
Global Stores Modified:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
File : bitno.tab
|
||||
Purpose : Tables for bit2prm and prm2bit
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
#include "cnst.h" /* parameter sizes: MAX_PRM_SIZE */
|
||||
#include "mode.h" /* N_MODES */
|
||||
#include "bitno_tab.h"
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
/* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
|
||||
const Word16 prmno[N_MODES] =
|
||||
{
|
||||
PRMNO_MR475,
|
||||
PRMNO_MR515,
|
||||
PRMNO_MR59,
|
||||
PRMNO_MR67,
|
||||
PRMNO_MR74,
|
||||
PRMNO_MR795,
|
||||
PRMNO_MR102,
|
||||
PRMNO_MR122,
|
||||
PRMNO_MRDTX
|
||||
};
|
||||
|
||||
/* number of parameters to first subframe per modes */
|
||||
const Word16 prmnofsf[N_MODES - 1] =
|
||||
{
|
||||
PRMNOFSF_MR475,
|
||||
PRMNOFSF_MR515,
|
||||
PRMNOFSF_MR59,
|
||||
PRMNOFSF_MR67,
|
||||
PRMNOFSF_MR74,
|
||||
PRMNOFSF_MR795,
|
||||
PRMNOFSF_MR102,
|
||||
PRMNOFSF_MR122
|
||||
};
|
||||
|
||||
/* parameter sizes (# of bits), one table per mode */
|
||||
const Word16 bitno_MR475[PRMNO_MR475] =
|
||||
{
|
||||
8, 8, 7, /* LSP VQ */
|
||||
8, 7, 2, 8, /* first subframe */
|
||||
4, 7, 2, /* second subframe */
|
||||
4, 7, 2, 8, /* third subframe */
|
||||
4, 7, 2, /* fourth subframe */
|
||||
};
|
||||
|
||||
const Word16 bitno_MR515[PRMNO_MR515] =
|
||||
{
|
||||
8, 8, 7, /* LSP VQ */
|
||||
8, 7, 2, 6, /* first subframe */
|
||||
4, 7, 2, 6, /* second subframe */
|
||||
4, 7, 2, 6, /* third subframe */
|
||||
4, 7, 2, 6, /* fourth subframe */
|
||||
};
|
||||
|
||||
const Word16 bitno_MR59[PRMNO_MR59] =
|
||||
{
|
||||
8, 9, 9, /* LSP VQ */
|
||||
8, 9, 2, 6, /* first subframe */
|
||||
4, 9, 2, 6, /* second subframe */
|
||||
8, 9, 2, 6, /* third subframe */
|
||||
4, 9, 2, 6, /* fourth subframe */
|
||||
};
|
||||
|
||||
const Word16 bitno_MR67[PRMNO_MR67] =
|
||||
{
|
||||
8, 9, 9, /* LSP VQ */
|
||||
8, 11, 3, 7, /* first subframe */
|
||||
4, 11, 3, 7, /* second subframe */
|
||||
8, 11, 3, 7, /* third subframe */
|
||||
4, 11, 3, 7, /* fourth subframe */
|
||||
};
|
||||
|
||||
const Word16 bitno_MR74[PRMNO_MR74] =
|
||||
{
|
||||
8, 9, 9, /* LSP VQ */
|
||||
8, 13, 4, 7, /* first subframe */
|
||||
5, 13, 4, 7, /* second subframe */
|
||||
8, 13, 4, 7, /* third subframe */
|
||||
5, 13, 4, 7, /* fourth subframe */
|
||||
};
|
||||
|
||||
const Word16 bitno_MR795[PRMNO_MR795] =
|
||||
{
|
||||
9, 9, 9, /* LSP VQ */
|
||||
8, 13, 4, 4, 5, /* first subframe */
|
||||
6, 13, 4, 4, 5, /* second subframe */
|
||||
8, 13, 4, 4, 5, /* third subframe */
|
||||
6, 13, 4, 4, 5, /* fourth subframe */
|
||||
};
|
||||
|
||||
const Word16 bitno_MR102[PRMNO_MR102] =
|
||||
{
|
||||
8, 9, 9, /* LSP VQ */
|
||||
8, 1, 1, 1, 1, 10, 10, 7, 7, /* first subframe */
|
||||
5, 1, 1, 1, 1, 10, 10, 7, 7, /* second subframe */
|
||||
8, 1, 1, 1, 1, 10, 10, 7, 7, /* third subframe */
|
||||
5, 1, 1, 1, 1, 10, 10, 7, 7, /* fourth subframe */
|
||||
};
|
||||
|
||||
const Word16 bitno_MR122[PRMNO_MR122] =
|
||||
{
|
||||
7, 8, 9, 8, 6, /* LSP VQ */
|
||||
9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* first subframe */
|
||||
6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* second subframe */
|
||||
9, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5, /* third subframe */
|
||||
6, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 5 /* fourth subframe */
|
||||
};
|
||||
|
||||
const Word16 bitno_MRDTX[PRMNO_MRDTX] =
|
||||
{
|
||||
3,
|
||||
8, 9, 9,
|
||||
6
|
||||
};
|
||||
|
||||
/* overall table with all parameter sizes for all modes */
|
||||
const Word16 * const bitno[N_MODES] =
|
||||
{
|
||||
bitno_MR475,
|
||||
bitno_MR515,
|
||||
bitno_MR59,
|
||||
bitno_MR67,
|
||||
bitno_MR74,
|
||||
bitno_MR795,
|
||||
bitno_MR102,
|
||||
bitno_MR122,
|
||||
bitno_MRDTX
|
||||
};
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define all local variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Function body here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Return nothing or data or data pointer
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
381
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/bitreorder_tab.c
vendored
Normal file
381
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/bitreorder_tab.c
vendored
Normal file
@@ -0,0 +1,381 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: bitreorder_tab.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
None
|
||||
|
||||
Local Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Global Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Outputs:
|
||||
None
|
||||
|
||||
Pointers and Buffers Modified:
|
||||
None
|
||||
|
||||
Local Stores Modified:
|
||||
None
|
||||
|
||||
Global Stores Modified:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function contains tables needed to reformat the encoded speech bits
|
||||
into IF2, WMF, and ETS.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
AMR Speech Codec Frame Structure,
|
||||
3GPP TS 26.101 version 4.1.0 Release 4, June 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "bitreorder_tab.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define NUM_MODES 16
|
||||
#define NUMBIT_MR475 95
|
||||
#define NUMBIT_MR515 103
|
||||
#define NUMBIT_MR59 118
|
||||
#define NUMBIT_MR67 134
|
||||
#define NUMBIT_MR74 148
|
||||
#define NUMBIT_MR795 159
|
||||
#define NUMBIT_MR102 204
|
||||
#define NUMBIT_MR122 244
|
||||
#define NUMBIT_AMR_SID 39
|
||||
#define NUMBIT_GSMEFR_SID 43
|
||||
#define NUMBIT_TDMAEFR_SID 38
|
||||
#define NUMBIT_PDCEFR_SID 37
|
||||
#define NUMBIT_UNUSED1 0
|
||||
#define NUMBIT_UNUSED2 0
|
||||
#define NUMBIT_UNUSED3 0
|
||||
#define NUMBIT_NO_DATA 0
|
||||
|
||||
#define MAX_NUM_BITS 244
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
/* number of parameters per modes (values must be <= MAX_PRM_SIZE!) */
|
||||
const Word16 numOfBits[NUM_MODES] =
|
||||
{
|
||||
NUMBIT_MR475,
|
||||
NUMBIT_MR515,
|
||||
NUMBIT_MR59,
|
||||
NUMBIT_MR67,
|
||||
NUMBIT_MR74,
|
||||
NUMBIT_MR795,
|
||||
NUMBIT_MR102,
|
||||
NUMBIT_MR122,
|
||||
NUMBIT_AMR_SID,
|
||||
NUMBIT_GSMEFR_SID,
|
||||
NUMBIT_TDMAEFR_SID,
|
||||
NUMBIT_PDCEFR_SID,
|
||||
NUMBIT_UNUSED1,
|
||||
NUMBIT_UNUSED2,
|
||||
NUMBIT_UNUSED3,
|
||||
NUMBIT_NO_DATA
|
||||
};
|
||||
|
||||
const Word16 reorderBits_MR475[NUMBIT_MR475] =
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 23, 24, 25, 26,
|
||||
27, 28, 48, 49, 61, 62, 82, 83, 47, 46,
|
||||
45, 44, 81, 80, 79, 78, 17, 18, 20, 22,
|
||||
77, 76, 75, 74, 29, 30, 43, 42, 41, 40,
|
||||
38, 39, 16, 19, 21, 50, 51, 59, 60, 63,
|
||||
64, 72, 73, 84, 85, 93, 94, 32, 33, 35,
|
||||
36, 53, 54, 56, 57, 66, 67, 69, 70, 87,
|
||||
88, 90, 91, 34, 55, 68, 89, 37, 58, 71,
|
||||
92, 31, 52, 65, 86
|
||||
};
|
||||
|
||||
const Word16 reorderBits_MR515[NUMBIT_MR515] =
|
||||
{
|
||||
7, 6, 5, 4, 3, 2, 1, 0, 15, 14,
|
||||
13, 12, 11, 10, 9, 8, 23, 24, 25, 26,
|
||||
27, 46, 65, 84, 45, 44, 43, 64, 63, 62,
|
||||
83, 82, 81, 102, 101, 100, 42, 61, 80, 99,
|
||||
28, 47, 66, 85, 18, 41, 60, 79, 98, 29,
|
||||
48, 67, 17, 20, 22, 40, 59, 78, 97, 21,
|
||||
30, 49, 68, 86, 19, 16, 87, 39, 38, 58,
|
||||
57, 77, 35, 54, 73, 92, 76, 96, 95, 36,
|
||||
55, 74, 93, 32, 51, 33, 52, 70, 71, 89,
|
||||
90, 31, 50, 69, 88, 37, 56, 75, 94, 34,
|
||||
53, 72, 91
|
||||
};
|
||||
|
||||
const Word16 reorderBits_MR59[NUMBIT_MR59] =
|
||||
{
|
||||
0, 1, 4, 5, 3, 6, 7, 2, 13, 15,
|
||||
8, 9, 11, 12, 14, 10, 16, 28, 74, 29,
|
||||
75, 27, 73, 26, 72, 30, 76, 51, 97, 50,
|
||||
71, 96, 117, 31, 77, 52, 98, 49, 70, 95,
|
||||
116, 53, 99, 32, 78, 33, 79, 48, 69, 94,
|
||||
115, 47, 68, 93, 114, 46, 67, 92, 113, 19,
|
||||
21, 23, 22, 18, 17, 20, 24, 111, 43, 89,
|
||||
110, 64, 65, 44, 90, 25, 45, 66, 91, 112,
|
||||
54, 100, 40, 61, 86, 107, 39, 60, 85, 106,
|
||||
36, 57, 82, 103, 35, 56, 81, 102, 34, 55,
|
||||
80, 101, 42, 63, 88, 109, 41, 62, 87, 108,
|
||||
38, 59, 84, 105, 37, 58, 83, 104
|
||||
};
|
||||
|
||||
const Word16 reorderBits_MR67[NUMBIT_MR67] =
|
||||
{
|
||||
0, 1, 4, 3, 5, 6, 13, 7, 2, 8,
|
||||
9, 11, 15, 12, 14, 10, 28, 82, 29, 83,
|
||||
27, 81, 26, 80, 30, 84, 16, 55, 109, 56,
|
||||
110, 31, 85, 57, 111, 48, 73, 102, 127, 32,
|
||||
86, 51, 76, 105, 130, 52, 77, 106, 131, 58,
|
||||
112, 33, 87, 19, 23, 53, 78, 107, 132, 21,
|
||||
22, 18, 17, 20, 24, 25, 50, 75, 104, 129,
|
||||
47, 72, 101, 126, 54, 79, 108, 133, 46, 71,
|
||||
100, 125, 128, 103, 74, 49, 45, 70, 99, 124,
|
||||
42, 67, 96, 121, 39, 64, 93, 118, 38, 63,
|
||||
92, 117, 35, 60, 89, 114, 34, 59, 88, 113,
|
||||
44, 69, 98, 123, 43, 68, 97, 122, 41, 66,
|
||||
95, 120, 40, 65, 94, 119, 37, 62, 91, 116,
|
||||
36, 61, 90, 115
|
||||
};
|
||||
|
||||
const Word16 reorderBits_MR74[NUMBIT_MR74] =
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15, 16, 26, 87, 27,
|
||||
88, 28, 89, 29, 90, 30, 91, 51, 80, 112,
|
||||
141, 52, 81, 113, 142, 54, 83, 115, 144, 55,
|
||||
84, 116, 145, 58, 119, 59, 120, 21, 22, 23,
|
||||
17, 18, 19, 31, 60, 92, 121, 56, 85, 117,
|
||||
146, 20, 24, 25, 50, 79, 111, 140, 57, 86,
|
||||
118, 147, 49, 78, 110, 139, 48, 77, 53, 82,
|
||||
114, 143, 109, 138, 47, 76, 108, 137, 32, 33,
|
||||
61, 62, 93, 94, 122, 123, 41, 42, 43, 44,
|
||||
45, 46, 70, 71, 72, 73, 74, 75, 102, 103,
|
||||
104, 105, 106, 107, 131, 132, 133, 134, 135, 136,
|
||||
34, 63, 95, 124, 35, 64, 96, 125, 36, 65,
|
||||
97, 126, 37, 66, 98, 127, 38, 67, 99, 128,
|
||||
39, 68, 100, 129, 40, 69, 101, 130
|
||||
};
|
||||
|
||||
const Word16 reorderBits_MR795[NUMBIT_MR795] =
|
||||
{
|
||||
8, 7, 6, 5, 4, 3, 2, 14, 16, 9,
|
||||
10, 12, 13, 15, 11, 17, 20, 22, 24, 23,
|
||||
19, 18, 21, 56, 88, 122, 154, 57, 89, 123,
|
||||
155, 58, 90, 124, 156, 52, 84, 118, 150, 53,
|
||||
85, 119, 151, 27, 93, 28, 94, 29, 95, 30,
|
||||
96, 31, 97, 61, 127, 62, 128, 63, 129, 59,
|
||||
91, 125, 157, 32, 98, 64, 130, 1, 0, 25,
|
||||
26, 33, 99, 34, 100, 65, 131, 66, 132, 54,
|
||||
86, 120, 152, 60, 92, 126, 158, 55, 87, 121,
|
||||
153, 117, 116, 115, 46, 78, 112, 144, 43, 75,
|
||||
109, 141, 40, 72, 106, 138, 36, 68, 102, 134,
|
||||
114, 149, 148, 147, 146, 83, 82, 81, 80, 51,
|
||||
50, 49, 48, 47, 45, 44, 42, 39, 35, 79,
|
||||
77, 76, 74, 71, 67, 113, 111, 110, 108, 105,
|
||||
101, 145, 143, 142, 140, 137, 133, 41, 73, 107,
|
||||
139, 37, 69, 103, 135, 38, 70, 104, 136
|
||||
};
|
||||
|
||||
const Word16 reorderBits_MR102[NUMBIT_MR102] =
|
||||
{
|
||||
7, 6, 5, 4, 3, 2, 1, 0, 16, 15,
|
||||
14, 13, 12, 11, 10, 9, 8, 26, 27, 28,
|
||||
29, 30, 31, 115, 116, 117, 118, 119, 120, 72,
|
||||
73, 161, 162, 65, 68, 69, 108, 111, 112, 154,
|
||||
157, 158, 197, 200, 201, 32, 33, 121, 122, 74,
|
||||
75, 163, 164, 66, 109, 155, 198, 19, 23, 21,
|
||||
22, 18, 17, 20, 24, 25, 37, 36, 35, 34,
|
||||
80, 79, 78, 77, 126, 125, 124, 123, 169, 168,
|
||||
167, 166, 70, 67, 71, 113, 110, 114, 159, 156,
|
||||
160, 202, 199, 203, 76, 165, 81, 82, 92, 91,
|
||||
93, 83, 95, 85, 84, 94, 101, 102, 96, 104,
|
||||
86, 103, 87, 97, 127, 128, 138, 137, 139, 129,
|
||||
141, 131, 130, 140, 147, 148, 142, 150, 132, 149,
|
||||
133, 143, 170, 171, 181, 180, 182, 172, 184, 174,
|
||||
173, 183, 190, 191, 185, 193, 175, 192, 176, 186,
|
||||
38, 39, 49, 48, 50, 40, 52, 42, 41, 51,
|
||||
58, 59, 53, 61, 43, 60, 44, 54, 194, 179,
|
||||
189, 196, 177, 195, 178, 187, 188, 151, 136, 146,
|
||||
153, 134, 152, 135, 144, 145, 105, 90, 100, 107,
|
||||
88, 106, 89, 98, 99, 62, 47, 57, 64, 45,
|
||||
63, 46, 55, 56
|
||||
};
|
||||
|
||||
const Word16 reorderBits_MR122[NUMBIT_MR122] =
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 23, 15, 16, 17, 18,
|
||||
19, 20, 21, 22, 24, 25, 26, 27, 28, 38,
|
||||
141, 39, 142, 40, 143, 41, 144, 42, 145, 43,
|
||||
146, 44, 147, 45, 148, 46, 149, 47, 97, 150,
|
||||
200, 48, 98, 151, 201, 49, 99, 152, 202, 86,
|
||||
136, 189, 239, 87, 137, 190, 240, 88, 138, 191,
|
||||
241, 91, 194, 92, 195, 93, 196, 94, 197, 95,
|
||||
198, 29, 30, 31, 32, 33, 34, 35, 50, 100,
|
||||
153, 203, 89, 139, 192, 242, 51, 101, 154, 204,
|
||||
55, 105, 158, 208, 90, 140, 193, 243, 59, 109,
|
||||
162, 212, 63, 113, 166, 216, 67, 117, 170, 220,
|
||||
36, 37, 54, 53, 52, 58, 57, 56, 62, 61,
|
||||
60, 66, 65, 64, 70, 69, 68, 104, 103, 102,
|
||||
108, 107, 106, 112, 111, 110, 116, 115, 114, 120,
|
||||
119, 118, 157, 156, 155, 161, 160, 159, 165, 164,
|
||||
163, 169, 168, 167, 173, 172, 171, 207, 206, 205,
|
||||
211, 210, 209, 215, 214, 213, 219, 218, 217, 223,
|
||||
222, 221, 73, 72, 71, 76, 75, 74, 79, 78,
|
||||
77, 82, 81, 80, 85, 84, 83, 123, 122, 121,
|
||||
126, 125, 124, 129, 128, 127, 132, 131, 130, 135,
|
||||
134, 133, 176, 175, 174, 179, 178, 177, 182, 181,
|
||||
180, 185, 184, 183, 188, 187, 186, 226, 225, 224,
|
||||
229, 228, 227, 232, 231, 230, 235, 234, 233, 238,
|
||||
237, 236, 96, 199
|
||||
};
|
||||
|
||||
/* overall table with all parameter sizes for all modes */
|
||||
const Word16 * const reorderBits[NUM_MODES-1] =
|
||||
{
|
||||
reorderBits_MR475,
|
||||
reorderBits_MR515,
|
||||
reorderBits_MR59,
|
||||
reorderBits_MR67,
|
||||
reorderBits_MR74,
|
||||
reorderBits_MR795,
|
||||
reorderBits_MR102,
|
||||
reorderBits_MR122
|
||||
};
|
||||
|
||||
/* Number of Frames (16-bit segments sent for each mode */
|
||||
const Word16 numCompressedBytes[16] =
|
||||
{
|
||||
13, /*4.75*/
|
||||
14, /*5.15*/
|
||||
16, /*5.90*/
|
||||
18, /*6.70*/
|
||||
19, /*7.40*/
|
||||
21, /*7.95*/
|
||||
26, /*10.2*/
|
||||
31, /*12.2*/
|
||||
6, /*GsmAmr comfort noise*/
|
||||
6, /*Gsm-Efr comfort noise*/
|
||||
6, /*IS-641 comfort noise*/
|
||||
6, /*Pdc-Efr comfort noise*/
|
||||
0, /*future use*/
|
||||
0, /*future use*/
|
||||
0, /*future use*/
|
||||
1 /*No transmission*/
|
||||
};
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define all local variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Function body here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Return nothing or data or data pointer
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
137
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/c2_9pf_tab.c
vendored
Normal file
137
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/c2_9pf_tab.c
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: c2_9pf_tab.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
MODULE DESCRIPTION
|
||||
|
||||
This file contains the declaration for startPos[] used by the functions
|
||||
c2_9pf.c and d2_9pf.c
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "get_const_tbls.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; [Variable declaration - defined here and used outside this module]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
extern const Word16 startPos[];
|
||||
const Word16 startPos[2*4*2] =
|
||||
{
|
||||
0, 2, 0, 3,
|
||||
0, 2, 0, 3,
|
||||
1, 3, 2, 4,
|
||||
1, 4, 1, 4
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME:
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
None
|
||||
|
||||
Outputs:
|
||||
None
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] c2_9pf.c UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
86
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/copy.c
vendored
Normal file
86
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/copy.c
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
********************************************************************************
|
||||
*
|
||||
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
|
||||
* R99 Version 3.2.0
|
||||
* REL-4 Version 4.0.0
|
||||
*
|
||||
********************************************************************************
|
||||
* File : copy.h
|
||||
*
|
||||
********************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* MODULE INCLUDE FILE AND VERSION ID
|
||||
********************************************************************************
|
||||
*/
|
||||
//#include "copy.h"
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* INCLUDE FILES
|
||||
********************************************************************************
|
||||
*/
|
||||
#include "typedef.h"
|
||||
#include "basic_op.h"
|
||||
#include "oscl_mem.h"
|
||||
|
||||
/*
|
||||
********************************************************************************
|
||||
* PUBLIC PROGRAM CODE
|
||||
********************************************************************************
|
||||
*/
|
||||
/*************************************************************************
|
||||
*
|
||||
* FUNCTION: Copy
|
||||
*
|
||||
* PURPOSE: Copy vector x[] to y[]
|
||||
*
|
||||
*
|
||||
*************************************************************************/
|
||||
/*
|
||||
**************************************************************************
|
||||
*
|
||||
* Function : Copy
|
||||
* Purpose : Copy vector x[] to y[]
|
||||
*
|
||||
**************************************************************************
|
||||
*/
|
||||
void Copy(
|
||||
const Word16 x[], /* i : input vector (L) */
|
||||
Word16 y[], /* o : output vector (L) */
|
||||
Word16 L /* i : vector length */
|
||||
)
|
||||
{
|
||||
oscl_memmove(y, x, L*sizeof(*x));
|
||||
}
|
||||
172
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/div_32.c
vendored
Normal file
172
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/div_32.c
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: div_32.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basic_op.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; [Variable declaration - defined here and used outside this module]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: div_32
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_num = 32 bit signed integer (Word32) whose value falls in the
|
||||
range : 0x0000 0000 < L_num < L_denom
|
||||
L_denom_hi = 16 bit positive normalized integer whose value falls in
|
||||
the range : 0x4000 < hi < 0x7fff
|
||||
L_denom_lo = 16 bit positive integer whose value falls in the range :
|
||||
0 < lo < 0x7fff
|
||||
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
pOverflow -> 1 if the 32 bit divide operation resulted in overflow
|
||||
|
||||
Returns:
|
||||
result = 32-bit quotient of of the division of two 32 bit integers
|
||||
L_num / L_denom (Word32)
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function is a fractional integer division of two 32 bit numbers, the
|
||||
numerator L_num and the denominator L_denom. The denominator is formed by
|
||||
combining denom_hi and denom_lo. Note that denom_hi is a normalized numbers.
|
||||
The numerator and denominator must be positive and the numerator must be
|
||||
less than the denominator.
|
||||
|
||||
The division is done as follows:
|
||||
1. Find 1/L_denom by first approximating: approx = 1 / denom_hi.
|
||||
2. 1/L_denom = approx * (2.0 - L_denom * approx ).
|
||||
3. result = L_num * (1/L_denom).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] div_32() function in oper_32b.c, UMTS GSM AMR speech codec, R99 -
|
||||
Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
Word32 Div_32(Word32 L_num,
|
||||
Word16 L_denom_hi,
|
||||
Word16 L_denom_lo,
|
||||
Flag *pOverflow)
|
||||
{
|
||||
|
||||
Word16 approx;
|
||||
Word16 hi;
|
||||
Word16 lo;
|
||||
Word16 n_hi;
|
||||
Word16 n_lo;
|
||||
Word32 result;
|
||||
|
||||
/* First approximation: 1 / L_denom = 1/L_denom_hi */
|
||||
|
||||
approx = div_s((Word16) 0x3fff, L_denom_hi);
|
||||
|
||||
/* 1/L_denom = approx * (2.0 - L_denom * approx) */
|
||||
|
||||
result = Mpy_32_16(L_denom_hi, L_denom_lo, approx, pOverflow);
|
||||
/* result is > 0 , and less than 1.0 */
|
||||
result = 0x7fffffffL - result;
|
||||
|
||||
hi = (Word16)(result >> 16);
|
||||
lo = (result >> 1) - (hi << 15);
|
||||
|
||||
result = Mpy_32_16(hi, lo, approx, pOverflow);
|
||||
|
||||
/* L_num * (1/L_denom) */
|
||||
|
||||
hi = (Word16)(result >> 16);
|
||||
lo = (result >> 1) - (hi << 15);
|
||||
|
||||
n_hi = (Word16)(L_num >> 16);
|
||||
n_lo = (L_num >> 1) - (n_hi << 15);
|
||||
|
||||
result = Mpy_32(n_hi, n_lo, hi, lo, pOverflow);
|
||||
result = L_shl(result, 2, pOverflow);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
235
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/div_s.c
vendored
Normal file
235
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/div_s.c
vendored
Normal file
@@ -0,0 +1,235 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: div_s.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
var1 = 16 bit signed integer (Word16) whose value falls in
|
||||
the range : 0x0000 <= var1 <= 0x7fff.
|
||||
var2 = 16 bit signed integer (Word16) whose value falls in
|
||||
the range : 0x0000 <= var1 <= 0x7fff.
|
||||
|
||||
Local Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Global Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Outputs:
|
||||
var_out = quotient of var1 divided by var2 (Word16)
|
||||
|
||||
Pointers and Buffers Modified:
|
||||
None
|
||||
|
||||
Local Stores Modified:
|
||||
None
|
||||
|
||||
Global Stores Modified:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function produces a result which is the fractional integer division of
|
||||
var1 by var2; var1 and var2 must be positive and var2 must be greater or equal
|
||||
to var1; the result is positive (leading bit equal to 0) and truncated to 16
|
||||
bits. If var1 = var2 then div(var1,var2) = 32767.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] basicop2.c, ETS Version 2.0.0, February 8, 1999
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
Word16 div_s (Word16 var1, Word16 var2)
|
||||
{
|
||||
Word16 var_out = 0;
|
||||
Word16 iteration;
|
||||
Word32 L_num;
|
||||
Word32 L_denom;
|
||||
Word16 abort_flag = 0;
|
||||
|
||||
if ((var1 > var2) || (var1 < 0))
|
||||
{
|
||||
printf ("Division Error var1=%d var2=%d\n", var1, var2);
|
||||
abort_flag = 1;
|
||||
exit(0);
|
||||
}
|
||||
if ((var1 != 0) && (abort_flag == 0))
|
||||
{
|
||||
if (var1 == var2)
|
||||
{
|
||||
var_out = MAX_16;
|
||||
}
|
||||
else
|
||||
{
|
||||
L_num = (Word32) var1;
|
||||
L_denom = (Word32) var2;
|
||||
|
||||
for (iteration = 15; iteration > 0; iteration--)
|
||||
{
|
||||
var_out <<= 1;
|
||||
L_num <<= 1;
|
||||
|
||||
if (L_num >= L_denom)
|
||||
{
|
||||
L_num -= L_denom;
|
||||
var_out += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if (WMOPS)
|
||||
multiCounter[currCounter].div_s++;
|
||||
#endif
|
||||
return (var_out);
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basic_op.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
OSCL_EXPORT_REF Word16 div_s(register Word16 var1, register Word16 var2)
|
||||
{
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define all local variables
|
||||
----------------------------------------------------------------------------*/
|
||||
Word16 var_out = 0;
|
||||
register Word16 iteration;
|
||||
Word32 L_num;
|
||||
Word32 L_denom;
|
||||
Word32 L_denom_by_2;
|
||||
Word32 L_denom_by_4;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Function body here
|
||||
----------------------------------------------------------------------------*/
|
||||
if ((var1 > var2) || (var1 < 0))
|
||||
{
|
||||
return 0; // used to exit(0);
|
||||
}
|
||||
if (var1)
|
||||
{
|
||||
if (var1 != var2)
|
||||
{
|
||||
|
||||
L_num = (Word32) var1;
|
||||
L_denom = (Word32) var2;
|
||||
L_denom_by_2 = (L_denom << 1);
|
||||
L_denom_by_4 = (L_denom << 2);
|
||||
for (iteration = 5; iteration > 0; iteration--)
|
||||
{
|
||||
var_out <<= 3;
|
||||
L_num <<= 3;
|
||||
|
||||
if (L_num >= L_denom_by_4)
|
||||
{
|
||||
L_num -= L_denom_by_4;
|
||||
var_out |= 4;
|
||||
}
|
||||
|
||||
if (L_num >= L_denom_by_2)
|
||||
{
|
||||
L_num -= L_denom_by_2;
|
||||
var_out |= 2;
|
||||
}
|
||||
|
||||
if (L_num >= (L_denom))
|
||||
{
|
||||
L_num -= (L_denom);
|
||||
var_out |= 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var_out = MAX_16;
|
||||
}
|
||||
}
|
||||
|
||||
#if (WMOPS)
|
||||
multiCounter[currCounter].div_s++;
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Return nothing or data or data pointer
|
||||
----------------------------------------------------------------------------*/
|
||||
return (var_out);
|
||||
}
|
||||
144
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/extract_h.c
vendored
Normal file
144
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/extract_h.c
vendored
Normal 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: extract_h.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1 = 32 bit long signed integer (Word32 ) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
Local Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Global Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Outputs:
|
||||
L_var1 = Most significant word of input (Word16)
|
||||
|
||||
Pointers and Buffers Modified:
|
||||
None
|
||||
|
||||
Local Stores Modified:
|
||||
None
|
||||
|
||||
Global Stores Modified:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function returns the 16 MSB of the input, L_var1.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] basicop2.c, ETS Version 2.0.0, February 8, 1999
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
Word16 extract_h (Word32 L_var1)
|
||||
{
|
||||
Word16 var_out;
|
||||
|
||||
var_out = (Word16) (L_var1 >> 16);
|
||||
#if (WMOPS)
|
||||
multiCounter[currCounter].extract_h++;
|
||||
#endif
|
||||
return (var_out);
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basic_op.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
Word16 extract_h(Word32 L_var1)
|
||||
{
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define all local variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Function body here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Return nothing or data or data pointer
|
||||
----------------------------------------------------------------------------*/
|
||||
return ((Word16)(L_var1 >> 16));
|
||||
}
|
||||
143
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/extract_l.c
vendored
Normal file
143
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/extract_l.c
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: extract_l.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
L_var1 = 32 bit long signed integer (Word32 ) whose value falls
|
||||
in the range : 0x8000 0000 <= L_var1 <= 0x7fff ffff.
|
||||
|
||||
Local Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Global Stores/Buffers/Pointers Needed:
|
||||
None
|
||||
|
||||
Outputs:
|
||||
L_var1 = Most significant word of input (Word16)
|
||||
|
||||
Pointers and Buffers Modified:
|
||||
None
|
||||
|
||||
Local Stores Modified:
|
||||
None
|
||||
|
||||
Global Stores Modified:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function returns the 16 LSB of the input, L_var1.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] basicop2.c, ETS Version 2.0.0, February 8, 1999
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
Word16 extract_l (Word32 L_var1)
|
||||
{
|
||||
Word16 var_out;
|
||||
|
||||
var_out = (Word16) L_var1;
|
||||
#if (WMOPS)
|
||||
multiCounter[currCounter].extract_l++;
|
||||
#endif
|
||||
return (var_out);
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "basic_op.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL FUNCTION REFERENCES
|
||||
; Declare functions defined elsewhere and referenced in this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; EXTERNAL GLOBAL STORE/BUFFER/POINTER REFERENCES
|
||||
; Declare variables used in this module but defined elsewhere
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
Word16 extract_l(Word32 L_var1)
|
||||
{
|
||||
/*----------------------------------------------------------------------------
|
||||
; Define all local variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Function body here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; Return nothing or data or data pointer
|
||||
----------------------------------------------------------------------------*/
|
||||
return ((Word16) L_var1);
|
||||
}
|
||||
188
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/gains_tbl.c
vendored
Normal file
188
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/gains_tbl.c
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: gains_tbl.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
MODULE DESCRIPTION
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.]
|
||||
----------------------------------------------------------------------------*/
|
||||
#define NB_QUA_PITCH 16
|
||||
#define NB_QUA_CODE 32
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; [Variable declaration - defined here and used outside this module]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
extern const Word16 qua_gain_pitch[];
|
||||
const Word16 qua_gain_pitch[NB_QUA_PITCH] =
|
||||
{
|
||||
0, 3277, 6556, 8192, 9830, 11469, 12288, 13107,
|
||||
13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661
|
||||
};
|
||||
|
||||
|
||||
extern const Word16 qua_gain_code[];
|
||||
const Word16 qua_gain_code[(NB_QUA_CODE+1)*3] =
|
||||
{
|
||||
/* gain factor (g_fac) and quantized energy error (qua_ener_MR122, qua_ener)
|
||||
* are stored:
|
||||
*
|
||||
* qua_ener_MR122 = log2(g_fac) (not the rounded floating point value, but
|
||||
* the value the original EFR algorithm
|
||||
* calculates from g_fac [using Log2])
|
||||
* qua_ener = 20*log10(g_fac); (rounded floating point value)
|
||||
*
|
||||
*
|
||||
* g_fac (Q11), qua_ener_MR122 (Q10), qua_ener (Q10)
|
||||
*/
|
||||
159, -3776, -22731,
|
||||
206, -3394, -20428,
|
||||
268, -3005, -18088,
|
||||
349, -2615, -15739,
|
||||
419, -2345, -14113,
|
||||
482, -2138, -12867,
|
||||
554, -1932, -11629,
|
||||
637, -1726, -10387,
|
||||
733, -1518, -9139,
|
||||
842, -1314, -7906,
|
||||
969, -1106, -6656,
|
||||
1114, -900, -5416,
|
||||
1281, -694, -4173,
|
||||
1473, -487, -2931,
|
||||
1694, -281, -1688,
|
||||
1948, -75, -445,
|
||||
2241, 133, 801,
|
||||
2577, 339, 2044,
|
||||
2963, 545, 3285,
|
||||
3408, 752, 4530,
|
||||
3919, 958, 5772,
|
||||
4507, 1165, 7016,
|
||||
5183, 1371, 8259,
|
||||
5960, 1577, 9501,
|
||||
6855, 1784, 10745,
|
||||
7883, 1991, 11988,
|
||||
9065, 2197, 13231,
|
||||
10425, 2404, 14474,
|
||||
12510, 2673, 16096,
|
||||
16263, 3060, 18429,
|
||||
21142, 3448, 20763,
|
||||
27485, 3836, 23097,
|
||||
27485, 3836, 23097
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME:
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
None
|
||||
|
||||
Outputs:
|
||||
None
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] gains.tab, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
982
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/gc_pred.c
vendored
Normal file
982
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/gc_pred.c
vendored
Normal file
@@ -0,0 +1,982 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: gc_pred.cpp
|
||||
Functions:
|
||||
gc_pred_reset
|
||||
gc_pred
|
||||
gc_pred_update
|
||||
gc_pred_average_limited
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
MODULE DESCRIPTION
|
||||
|
||||
This file contains the functions that perform codebook gain MA prediction.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "gc_pred.h"
|
||||
#include "basicop_malloc.h"
|
||||
#include "basic_op.h"
|
||||
#include "cnst.h"
|
||||
#include "log2.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define NPRED 4 /* number of prediction taps */
|
||||
|
||||
/* average innovation energy. */
|
||||
/* MEAN_ENER = 36.0/constant, constant = 20*Log10(2) */
|
||||
#define MEAN_ENER_MR122 783741L /* 36/(20*log10(2)) (Q17) */
|
||||
|
||||
/* minimum quantized energy: -14 dB */
|
||||
#define MIN_ENERGY -14336 /* 14 Q10 */
|
||||
#define MIN_ENERGY_MR122 -2381 /* 14 / (20*log10(2)) Q10 */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* MA prediction coefficients (Q13) */
|
||||
static const Word16 pred[NPRED] = {5571, 4751, 2785, 1556};
|
||||
|
||||
/* MA prediction coefficients (Q6) */
|
||||
static const Word16 pred_MR122[NPRED] = {44, 37, 22, 12};
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: gc_pred_reset
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
state = pointer to a structure of type gc_predState
|
||||
|
||||
Outputs:
|
||||
past_qua_en field in the structure pointed to by state is initialized
|
||||
to MIN_ENERGY
|
||||
past_qua_en_MR122 field in the structure pointed to by state is
|
||||
initialized to MIN_ENERGY_MR122
|
||||
|
||||
Returns:
|
||||
return_value = 0, if reset was successful; -1, otherwise (int)
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function initializes the state memory used by gc_pred to zero.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
gc_pred.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
int gc_pred_reset (gc_predState *state)
|
||||
{
|
||||
Word16 i;
|
||||
|
||||
if (state == (gc_predState *) NULL){
|
||||
fprintf(stderr, "gc_pred_reset: invalid parameter\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(i = 0; i < NPRED; i++)
|
||||
{
|
||||
state->past_qua_en[i] = MIN_ENERGY;
|
||||
state->past_qua_en_MR122[i] = MIN_ENERGY_MR122;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
OSCL_EXPORT_REF Word16 gc_pred_reset(gc_predState *state)
|
||||
{
|
||||
Word16 i;
|
||||
|
||||
if (state == (gc_predState *) NULL)
|
||||
{
|
||||
/* fprintf(stderr, "gc_pred_reset: invalid parameter\n"); */
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < NPRED; i++)
|
||||
{
|
||||
state->past_qua_en[i] = MIN_ENERGY;
|
||||
state->past_qua_en_MR122[i] = MIN_ENERGY_MR122;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: gc_pred
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
st = pointer to a structure of type gc_predState
|
||||
mode = AMR mode (enum Mode)
|
||||
code = pointer to the innovative codebook vector; Q12 in MR122 mode,
|
||||
otherwise, Q13 (Word16)
|
||||
exp_gcode0 = pointer to the exponent part of predicted gain factor
|
||||
(Q0) (Word16)
|
||||
frac_gcode0 = pointer to the fractional part of predicted gain factor
|
||||
(Q15) (Word16)
|
||||
exp_en = pointer to the exponent part of the innovation energy; this
|
||||
is calculated for MR795 mode, Q0 (Word16)
|
||||
frac_en = pointer to the fractional part of the innovation energy;
|
||||
this is calculated for MR795 mode, Q15 (Word16)
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
store pointed to by exp_gcode0 contains the exponent part of the
|
||||
recently calculated predicted gain factor
|
||||
store pointed to by frac_gcode0 contains the fractional part of the
|
||||
recently calculated predicted gain factor
|
||||
store pointed to by exp_en contains the exponent part of the
|
||||
recently calculated innovation energy
|
||||
store pointed to by frac_en contains the fractional part of the
|
||||
recently calculated innovation energy
|
||||
pOverflow = 1 if the math functions called by gc_pred
|
||||
results in overflow else zero.
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
pred = table of MA prediction coefficients (Q13) (Word16)
|
||||
pred_MR122 = table of MA prediction coefficients (Q6) (Word16)
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function performs the MA prediction of the innovation energy (in
|
||||
dB/(20*log10(2))), with the mean removed.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
gc_pred.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
The original etsi reference code uses a global flag Overflow. However, in the
|
||||
actual implementation a pointer to a the overflow flag is passed in.
|
||||
|
||||
void
|
||||
gc_pred(
|
||||
gc_predState *st, // i/o: State struct
|
||||
enum Mode mode, // i : AMR mode
|
||||
Word16 *code, // i : innovative codebook vector (L_SUBFR)
|
||||
// MR122: Q12, other modes: Q13
|
||||
Word16 *exp_gcode0, // o : exponent of predicted gain factor, Q0
|
||||
Word16 *frac_gcode0,// o : fraction of predicted gain factor Q15
|
||||
Word16 *exp_en, // o : exponent of innovation energy, Q0
|
||||
// (only calculated for MR795)
|
||||
Word16 *frac_en // o : fraction of innovation energy, Q15
|
||||
// (only calculated for MR795)
|
||||
)
|
||||
{
|
||||
Word16 i;
|
||||
Word32 ener_code;
|
||||
Word16 exp, frac;
|
||||
|
||||
*-------------------------------------------------------------------*
|
||||
* energy of code: *
|
||||
* ~~~~~~~~~~~~~~~ *
|
||||
* ener_code = sum(code[i]^2) *
|
||||
*-------------------------------------------------------------------*
|
||||
ener_code = L_mac((Word32) 0, code[0], code[0]);
|
||||
// MR122: Q12*Q12 -> Q25
|
||||
// others: Q13*Q13 -> Q27
|
||||
for (i = 1; i < L_SUBFR; i++)
|
||||
ener_code = L_mac(ener_code, code[i], code[i]);
|
||||
|
||||
if (sub (mode, MR122) == 0)
|
||||
{
|
||||
Word32 ener;
|
||||
|
||||
// ener_code = ener_code / lcode; lcode = 40; 1/40 = 26214 Q20
|
||||
ener_code = L_mult (pv_round (ener_code), 26214); // Q9 * Q20 -> Q30
|
||||
|
||||
*-------------------------------------------------------------------*
|
||||
* energy of code: *
|
||||
* ~~~~~~~~~~~~~~~ *
|
||||
* ener_code(Q17) = 10 * Log10(energy) / constant *
|
||||
* = 1/2 * Log2(energy) *
|
||||
* constant = 20*Log10(2) *
|
||||
*-------------------------------------------------------------------*
|
||||
// ener_code = 1/2 * Log2(ener_code); Note: Log2=log2+30
|
||||
Log2(ener_code, &exp, &frac);
|
||||
ener_code = L_Comp (sub (exp, 30), frac); // Q16 for log()
|
||||
// ->Q17 for 1/2 log()
|
||||
|
||||
*-------------------------------------------------------------------*
|
||||
* predicted energy: *
|
||||
* ~~~~~~~~~~~~~~~~~ *
|
||||
* ener(Q24) = (Emean + sum{pred[i]*past_en[i]})/constant *
|
||||
* = MEAN_ENER + sum(pred[i]*past_qua_en[i]) *
|
||||
* constant = 20*Log10(2) *
|
||||
*-------------------------------------------------------------------*
|
||||
|
||||
ener = MEAN_ENER_MR122; // Q24 (Q17)
|
||||
for (i = 0; i < NPRED; i++)
|
||||
{
|
||||
ener = L_mac (ener, st->past_qua_en_MR122[i], pred_MR122[i]);
|
||||
// Q10 * Q13 -> Q24
|
||||
// Q10 * Q6 -> Q17
|
||||
}
|
||||
|
||||
*-------------------------------------------------------------------*
|
||||
* predicted codebook gain *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
* gc0 = Pow10( (ener*constant - ener_code*constant) / 20 ) *
|
||||
* = Pow2(ener-ener_code) *
|
||||
* = Pow2(int(d)+frac(d)) *
|
||||
* *
|
||||
* (store exp and frac for pow2()) *
|
||||
*-------------------------------------------------------------------*
|
||||
|
||||
ener = L_shr (L_sub (ener, ener_code), 1); // Q16
|
||||
L_Extract(ener, exp_gcode0, frac_gcode0);
|
||||
}
|
||||
else // all modes except 12.2
|
||||
{
|
||||
Word32 L_tmp;
|
||||
Word16 exp_code, gcode0;
|
||||
|
||||
*-----------------------------------------------------------------*
|
||||
* Compute: means_ener - 10log10(ener_code/ L_sufr) *
|
||||
*-----------------------------------------------------------------*
|
||||
|
||||
exp_code = norm_l (ener_code);
|
||||
ener_code = L_shl (ener_code, exp_code);
|
||||
|
||||
// Log2 = log2 + 27
|
||||
Log2_norm (ener_code, exp_code, &exp, &frac);
|
||||
|
||||
// fact = 10/log2(10) = 3.01 = 24660 Q13
|
||||
L_tmp = Mpy_32_16(exp, frac, -24660); // Q0.Q15 * Q13 -> Q14
|
||||
|
||||
* L_tmp = means_ener - 10log10(ener_code/L_SUBFR)
|
||||
* = means_ener - 10log10(ener_code) + 10log10(L_SUBFR)
|
||||
* = K - fact * Log2(ener_code)
|
||||
* = K - fact * log2(ener_code) - fact*27
|
||||
*
|
||||
* ==> K = means_ener + fact*27 + 10log10(L_SUBFR)
|
||||
*
|
||||
* means_ener = 33 = 540672 Q14 (MR475, MR515, MR59)
|
||||
* means_ener = 28.75 = 471040 Q14 (MR67)
|
||||
* means_ener = 30 = 491520 Q14 (MR74)
|
||||
* means_ener = 36 = 589824 Q14 (MR795)
|
||||
* means_ener = 33 = 540672 Q14 (MR102)
|
||||
* 10log10(L_SUBFR) = 16.02 = 262481.51 Q14
|
||||
* fact * 27 = 1331640 Q14
|
||||
* -----------------------------------------
|
||||
* (MR475, MR515, MR59) K = 2134793.51 Q14 ~= 16678 * 64 * 2
|
||||
* (MR67) K = 2065161.51 Q14 ~= 32268 * 32 * 2
|
||||
* (MR74) K = 2085641.51 Q14 ~= 32588 * 32 * 2
|
||||
* (MR795) K = 2183945.51 Q14 ~= 17062 * 64 * 2
|
||||
* (MR102) K = 2134793.51 Q14 ~= 16678 * 64 * 2
|
||||
|
||||
|
||||
if (sub (mode, MR102) == 0)
|
||||
{
|
||||
// mean = 33 dB
|
||||
L_tmp = L_mac(L_tmp, 16678, 64); // Q14
|
||||
}
|
||||
else if (sub (mode, MR795) == 0)
|
||||
{
|
||||
// ener_code = <xn xn> * 2^27*2^exp_code
|
||||
// frac_en = ener_code / 2^16
|
||||
// = <xn xn> * 2^11*2^exp_code
|
||||
// <xn xn> = <xn xn>*2^11*2^exp * 2^exp_en
|
||||
// := frac_en * 2^exp_en
|
||||
|
||||
// ==> exp_en = -11-exp_code;
|
||||
|
||||
*frac_en = extract_h (ener_code);
|
||||
*exp_en = sub (-11, exp_code);
|
||||
|
||||
// mean = 36 dB
|
||||
L_tmp = L_mac(L_tmp, 17062, 64); // Q14
|
||||
}
|
||||
else if (sub (mode, MR74) == 0)
|
||||
{
|
||||
// mean = 30 dB
|
||||
L_tmp = L_mac(L_tmp, 32588, 32); // Q14
|
||||
}
|
||||
else if (sub (mode, MR67) == 0)
|
||||
{
|
||||
// mean = 28.75 dB
|
||||
L_tmp = L_mac(L_tmp, 32268, 32); // Q14
|
||||
}
|
||||
else // MR59, MR515, MR475
|
||||
{
|
||||
// mean = 33 dB
|
||||
L_tmp = L_mac(L_tmp, 16678, 64); // Q14
|
||||
}
|
||||
|
||||
*-----------------------------------------------------------------*
|
||||
* Compute gcode0. *
|
||||
* = Sum(i=0,3) pred[i]*past_qua_en[i] - ener_code + mean_ener *
|
||||
*-----------------------------------------------------------------*
|
||||
|
||||
L_tmp = L_shl(L_tmp, 10); // Q24
|
||||
for (i = 0; i < 4; i++)
|
||||
L_tmp = L_mac(L_tmp, pred[i], st->past_qua_en[i]);
|
||||
// Q13 * Q10 -> Q24
|
||||
|
||||
gcode0 = extract_h(L_tmp); // Q8
|
||||
|
||||
*-----------------------------------------------------------------*
|
||||
* gcode0 = pow(10.0, gcode0/20) *
|
||||
* = pow(2, 3.3219*gcode0/20) *
|
||||
* = pow(2, 0.166*gcode0) *
|
||||
*-----------------------------------------------------------------*
|
||||
|
||||
// 5439 Q15 = 0.165985
|
||||
// (correct: 1/(20*log10(2)) 0.166096 = 5443 Q15)
|
||||
if (sub (mode, MR74) == 0) // For IS641 bitexactness
|
||||
L_tmp = L_mult(gcode0, 5439); // Q8 * Q15 -> Q24
|
||||
else
|
||||
L_tmp = L_mult(gcode0, 5443); // Q8 * Q15 -> Q24
|
||||
|
||||
L_tmp = L_shr(L_tmp, 8); // -> Q16
|
||||
L_Extract(L_tmp, exp_gcode0, frac_gcode0); // -> Q0.Q15
|
||||
}
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
OSCL_EXPORT_REF void gc_pred(
|
||||
gc_predState *st, /* i/o: State struct */
|
||||
enum Mode mode, /* i : AMR mode */
|
||||
Word16 *code, /* i : innovative codebook vector (L_SUBFR) */
|
||||
/* MR122: Q12, other modes: Q13 */
|
||||
Word16 *exp_gcode0, /* o : exponent of predicted gain factor, Q0 */
|
||||
Word16 *frac_gcode0,/* o : fraction of predicted gain factor Q15 */
|
||||
Word16 *exp_en, /* o : exponent of innovation energy, Q0 */
|
||||
/* (only calculated for MR795) */
|
||||
Word16 *frac_en, /* o : fraction of innovation energy, Q15 */
|
||||
/* (only calculated for MR795) */
|
||||
Flag *pOverflow
|
||||
)
|
||||
{
|
||||
register Word16 i;
|
||||
register Word32 L_temp1, L_temp2;
|
||||
register Word32 L_tmp;
|
||||
Word32 ener_code;
|
||||
Word32 ener;
|
||||
Word16 exp, frac;
|
||||
Word16 exp_code, gcode0;
|
||||
Word16 tmp;
|
||||
Word16 *p_code = &code[0];
|
||||
|
||||
/*-------------------------------------------------------------------*
|
||||
* energy of code: *
|
||||
* ~~~~~~~~~~~~~~~ *
|
||||
* ener_code = sum(code[i]^2) *
|
||||
*-------------------------------------------------------------------*/
|
||||
ener_code = 0;
|
||||
|
||||
/* MR122: Q12*Q12 -> Q25 */
|
||||
/* others: Q13*Q13 -> Q27 */
|
||||
|
||||
for (i = L_SUBFR >> 2; i != 0; i--)
|
||||
{
|
||||
tmp = *(p_code++);
|
||||
ener_code += ((Word32) tmp * tmp) >> 3;
|
||||
tmp = *(p_code++);
|
||||
ener_code += ((Word32) tmp * tmp) >> 3;
|
||||
tmp = *(p_code++);
|
||||
ener_code += ((Word32) tmp * tmp) >> 3;
|
||||
tmp = *(p_code++);
|
||||
ener_code += ((Word32) tmp * tmp) >> 3;
|
||||
}
|
||||
|
||||
ener_code <<= 4;
|
||||
|
||||
if ((ener_code >> 31)) /* Check for saturation */
|
||||
{
|
||||
ener_code = MAX_32;
|
||||
}
|
||||
|
||||
if (mode == MR122)
|
||||
{
|
||||
/* ener_code = ener_code / lcode; lcode = 40; 1/40 = 26214 Q20 */
|
||||
/* Q9 * Q20 -> Q30 */
|
||||
|
||||
ener_code = ((Word32)(pv_round(ener_code, pOverflow) * 26214)) << 1;
|
||||
|
||||
/*-------------------------------------------------------------*
|
||||
* energy of code: *
|
||||
* ~~~~~~~~~~~~~~~ *
|
||||
* ener_code(Q17) = 10 * Log10(energy) / constant *
|
||||
* = 1/2 * Log2(energy) *
|
||||
* constant = 20*Log10(2) *
|
||||
*-------------------------------------------------------------*/
|
||||
/* ener_code = 1/2 * Log2(ener_code); Note: Log2=log2+30 */
|
||||
Log2(ener_code, &exp, &frac, pOverflow);
|
||||
|
||||
/* Q16 for log() */
|
||||
/* ->Q17 for 1/2 log()*/
|
||||
|
||||
L_temp1 = (Word32)(exp - 30) << 16;
|
||||
ener_code = L_temp1 + ((Word32)frac << 1);
|
||||
|
||||
/*-------------------------------------------------------------*
|
||||
* predicted energy: *
|
||||
* ~~~~~~~~~~~~~~~~~ *
|
||||
* ener(Q24) = (Emean + sum{pred[i]*past_en[i]})/constant *
|
||||
* = MEAN_ENER + sum(pred[i]*past_qua_en[i]) *
|
||||
* constant = 20*Log10(2) *
|
||||
*-------------------------------------------------------------*/
|
||||
|
||||
ener = MEAN_ENER_MR122; /* Q24 (Q17) */
|
||||
for (i = 0; i < NPRED; i++)
|
||||
{
|
||||
L_temp1 = (((Word32) st->past_qua_en_MR122[i]) *
|
||||
pred_MR122[i]) << 1;
|
||||
ener = L_add(ener, L_temp1, pOverflow);
|
||||
|
||||
/* Q10 * Q13 -> Q24 */
|
||||
/* Q10 * Q6 -> Q17 */
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------*
|
||||
* predicted codebook gain *
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~ *
|
||||
* gc0 = Pow10( (ener*constant - ener_code*constant) / 20 ) *
|
||||
* = Pow2(ener-ener_code) *
|
||||
* = Pow2(int(d)+frac(d)) *
|
||||
* *
|
||||
* (store exp and frac for pow2()) *
|
||||
*---------------------------------------------------------------*/
|
||||
/* Q16 */
|
||||
|
||||
L_temp1 = L_sub(ener, ener_code, pOverflow);
|
||||
|
||||
|
||||
*exp_gcode0 = (Word16)(L_temp1 >> 17);
|
||||
|
||||
L_temp2 = (Word32) * exp_gcode0 << 15;
|
||||
L_temp1 >>= 2;
|
||||
|
||||
*frac_gcode0 = (Word16)(L_temp1 - L_temp2);
|
||||
|
||||
}
|
||||
else /* all modes except 12.2 */
|
||||
{
|
||||
/*-----------------------------------------------------------------*
|
||||
* Compute: means_ener - 10log10(ener_code/ L_sufr) *
|
||||
*-----------------------------------------------------------------*/
|
||||
|
||||
exp_code = norm_l(ener_code);
|
||||
ener_code = L_shl(ener_code, exp_code, pOverflow);
|
||||
|
||||
/* Log2 = log2 + 27 */
|
||||
Log2_norm(ener_code, exp_code, &exp, &frac);
|
||||
|
||||
/* fact = 10/log2(10) = 3.01 = 24660 Q13 */
|
||||
/* Q0.Q15 * Q13 -> Q14 */
|
||||
|
||||
L_temp2 = (((Word32) exp) * -24660) << 1;
|
||||
L_tmp = (((Word32) frac) * -24660) >> 15;
|
||||
|
||||
/* Sign-extend resulting product */
|
||||
if (L_tmp & (Word32) 0x00010000L)
|
||||
{
|
||||
L_tmp = L_tmp | (Word32) 0xffff0000L;
|
||||
}
|
||||
|
||||
L_tmp = L_tmp << 1;
|
||||
L_tmp = L_add(L_tmp, L_temp2, pOverflow);
|
||||
|
||||
|
||||
/* L_tmp = means_ener - 10log10(ener_code/L_SUBFR)
|
||||
* = means_ener - 10log10(ener_code) + 10log10(L_SUBFR)
|
||||
* = K - fact * Log2(ener_code)
|
||||
* = K - fact * log2(ener_code) - fact*27
|
||||
*
|
||||
* ==> K = means_ener + fact*27 + 10log10(L_SUBFR)
|
||||
*
|
||||
* means_ener = 33 = 540672 Q14 (MR475, MR515, MR59)
|
||||
* means_ener = 28.75 = 471040 Q14 (MR67)
|
||||
* means_ener = 30 = 491520 Q14 (MR74)
|
||||
* means_ener = 36 = 589824 Q14 (MR795)
|
||||
* means_ener = 33 = 540672 Q14 (MR102)
|
||||
* 10log10(L_SUBFR) = 16.02 = 262481.51 Q14
|
||||
* fact * 27 = 1331640 Q14
|
||||
* -----------------------------------------
|
||||
* (MR475, MR515, MR59) K = 2134793.51 Q14 ~= 16678 * 64 * 2
|
||||
* (MR67) K = 2065161.51 Q14 ~= 32268 * 32 * 2
|
||||
* (MR74) K = 2085641.51 Q14 ~= 32588 * 32 * 2
|
||||
* (MR795) K = 2183945.51 Q14 ~= 17062 * 64 * 2
|
||||
* (MR102) K = 2134793.51 Q14 ~= 16678 * 64 * 2
|
||||
*/
|
||||
|
||||
if (mode == MR102)
|
||||
{
|
||||
/* mean = 33 dB */
|
||||
L_temp2 = (Word32) 16678 << 7;
|
||||
L_tmp = L_add(L_tmp, L_temp2, pOverflow); /* Q14 */
|
||||
}
|
||||
else if (mode == MR795)
|
||||
{
|
||||
/* ener_code = <xn xn> * 2^27*2^exp_code
|
||||
frac_en = ener_code / 2^16
|
||||
= <xn xn> * 2^11*2^exp_code
|
||||
<xn xn> = <xn xn>*2^11*2^exp * 2^exp_en
|
||||
: = frac_en * 2^exp_en
|
||||
==> exp_en = -11-exp_code; */
|
||||
*frac_en = (Word16)(ener_code >> 16);
|
||||
*exp_en = -11 - exp_code;
|
||||
|
||||
/* mean = 36 dB */
|
||||
L_temp2 = (Word32) 17062 << 7;
|
||||
L_tmp = L_add(L_tmp, L_temp2, pOverflow); /* Q14 */
|
||||
}
|
||||
else if (mode == MR74)
|
||||
{
|
||||
/* mean = 30 dB */
|
||||
L_temp2 = (Word32) 32588 << 6;
|
||||
L_tmp = L_add(L_tmp, L_temp2, pOverflow); /* Q14 */
|
||||
}
|
||||
else if (mode == MR67)
|
||||
{
|
||||
/* mean = 28.75 dB */
|
||||
L_temp2 = (Word32) 32268 << 6;
|
||||
L_tmp = L_add(L_tmp, L_temp2, pOverflow); /* Q14 */
|
||||
}
|
||||
else /* MR59, MR515, MR475 */
|
||||
{
|
||||
/* mean = 33 dB */
|
||||
L_temp2 = (Word32) 16678 << 7;
|
||||
L_tmp = L_add(L_tmp, L_temp2, pOverflow); /* Q14 */
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------*
|
||||
* Compute gcode0. *
|
||||
* = Sum(i=0,3) pred[i]*past_qua_en[i] - ener_code + mean_ener *
|
||||
*--------------------------------------------------------------*/
|
||||
/* Q24 */
|
||||
if (L_tmp > (Word32) 0X001fffffL)
|
||||
{
|
||||
*pOverflow = 1;
|
||||
L_tmp = MAX_32;
|
||||
}
|
||||
else if (L_tmp < -2097152)
|
||||
{
|
||||
*pOverflow = 1;
|
||||
L_tmp = MIN_32;
|
||||
}
|
||||
else
|
||||
{
|
||||
L_tmp = L_tmp << 10;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
L_temp2 = ((((Word32) pred[i]) * st->past_qua_en[i]) << 1);
|
||||
L_tmp = L_add(L_tmp, L_temp2, pOverflow); /* Q13 * Q10 -> Q24 */
|
||||
}
|
||||
|
||||
gcode0 = (Word16)(L_tmp >> 16); /* Q8 */
|
||||
|
||||
/*-----------------------------------------------------------*
|
||||
* gcode0 = pow(10.0, gcode0/20) *
|
||||
* = pow(2, 3.3219*gcode0/20) *
|
||||
* = pow(2, 0.166*gcode0) *
|
||||
*-----------------------------------------------------------*/
|
||||
|
||||
/* 5439 Q15 = 0.165985 */
|
||||
/* (correct: 1/(20*log10(2)) 0.166096 = 5443 Q15) */
|
||||
|
||||
if (mode == MR74) /* For IS641 bitexactness */
|
||||
{
|
||||
L_tmp = (((Word32) gcode0) * 5439) << 1; /* Q8 * Q15 -> Q24 */
|
||||
}
|
||||
else
|
||||
{
|
||||
L_tmp = (((Word32) gcode0) * 5443) << 1; /* Q8 * Q15 -> Q24 */
|
||||
}
|
||||
|
||||
if (L_tmp < 0)
|
||||
{
|
||||
L_tmp = ~((~L_tmp) >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
L_tmp = L_tmp >> 8; /* -> Q16 */
|
||||
}
|
||||
|
||||
*exp_gcode0 = (Word16)(L_tmp >> 16);
|
||||
if (L_tmp < 0)
|
||||
{
|
||||
L_temp1 = ~((~L_tmp) >> 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
L_temp1 = L_tmp >> 1;
|
||||
}
|
||||
L_temp2 = (Word32) * exp_gcode0 << 15;
|
||||
*frac_gcode0 = (Word16)(L_sub(L_temp1, L_temp2, pOverflow));
|
||||
/* -> Q0.Q15 */
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: gc_pred_update
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
st = pointer to a structure of type gc_predState
|
||||
qua_ener_MR122 = quantized energy for update (Q10); calculated as
|
||||
(log2(qua_err)) (Word16)
|
||||
qua_ener = quantized energy for update (Q10); calculated as
|
||||
(20*log10(qua_err)) (Word16)
|
||||
|
||||
Outputs:
|
||||
structure pointed to by st contains the calculated quantized energy
|
||||
for update
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function updates the MA predictor with the last quantized energy.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
gc_pred.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
void gc_pred_update(
|
||||
gc_predState *st, // i/o: State struct
|
||||
Word16 qua_ener_MR122, // i : quantized energy for update, Q10
|
||||
// (log2(qua_err))
|
||||
Word16 qua_ener // i : quantized energy for update, Q10
|
||||
// (20*log10(qua_err))
|
||||
)
|
||||
{
|
||||
Word16 i;
|
||||
|
||||
for (i = 3; i > 0; i--)
|
||||
{
|
||||
st->past_qua_en[i] = st->past_qua_en[i - 1];
|
||||
st->past_qua_en_MR122[i] = st->past_qua_en_MR122[i - 1];
|
||||
}
|
||||
|
||||
st->past_qua_en_MR122[0] = qua_ener_MR122; // log2 (qua_err), Q10
|
||||
|
||||
st->past_qua_en[0] = qua_ener; // 20*log10(qua_err), Q10
|
||||
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
OSCL_EXPORT_REF void gc_pred_update(
|
||||
gc_predState *st, /* i/o: State struct */
|
||||
Word16 qua_ener_MR122, /* i : quantized energy for update, Q10 */
|
||||
/* (log2(qua_err)) */
|
||||
Word16 qua_ener /* i : quantized energy for update, Q10 */
|
||||
/* (20*log10(qua_err)) */
|
||||
)
|
||||
{
|
||||
st->past_qua_en[3] = st->past_qua_en[2];
|
||||
st->past_qua_en_MR122[3] = st->past_qua_en_MR122[2];
|
||||
|
||||
st->past_qua_en[2] = st->past_qua_en[1];
|
||||
st->past_qua_en_MR122[2] = st->past_qua_en_MR122[1];
|
||||
|
||||
st->past_qua_en[1] = st->past_qua_en[0];
|
||||
st->past_qua_en_MR122[1] = st->past_qua_en_MR122[0];
|
||||
|
||||
st->past_qua_en_MR122[0] = qua_ener_MR122; /* log2 (qua_err), Q10 */
|
||||
|
||||
st->past_qua_en[0] = qua_ener; /* 20*log10(qua_err), Q10 */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: gc_pred_average_limited
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
st = pointer to a structure of type gc_predState
|
||||
ener_avg_MR122 = pointer to the averaged quantized energy (Q10);
|
||||
calculated as (log2(qua_err)) (Word16)
|
||||
ener_avg = pointer to the averaged quantized energy (Q10); calculated
|
||||
as (20*log10(qua_err)) (Word16)
|
||||
pOverflow = pointer to overflow (Flag)
|
||||
|
||||
Outputs:
|
||||
store pointed to by ener_avg_MR122 contains the new averaged quantized
|
||||
energy
|
||||
store pointed to by ener_avg contains the new averaged quantized
|
||||
energy
|
||||
pOverflow = 1 if the math functions called by gc_pred_average_limited
|
||||
results in overflow else zero.
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function calculates the average of MA predictor state values (with a
|
||||
lower limit) used in error concealment.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
gc_pred.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
The original etsi reference code uses a global flag Overflow. However, in the
|
||||
actual implementation a pointer to a the overflow flag is passed in.
|
||||
|
||||
void gc_pred_average_limited(
|
||||
gc_predState *st, // i: State struct
|
||||
Word16 *ener_avg_MR122, // o: everaged quantized energy, Q10
|
||||
// (log2(qua_err))
|
||||
Word16 *ener_avg // o: averaged quantized energy, Q10
|
||||
// (20*log10(qua_err))
|
||||
)
|
||||
{
|
||||
Word16 av_pred_en;
|
||||
Word16 i;
|
||||
|
||||
// do average in MR122 mode (log2() domain)
|
||||
av_pred_en = 0;
|
||||
for (i = 0; i < NPRED; i++)
|
||||
{
|
||||
av_pred_en = add (av_pred_en, st->past_qua_en_MR122[i]);
|
||||
}
|
||||
|
||||
// av_pred_en = 0.25*av_pred_en
|
||||
av_pred_en = mult (av_pred_en, 8192);
|
||||
|
||||
// if (av_pred_en < -14/(20Log10(2))) av_pred_en = ..
|
||||
|
||||
if (sub (av_pred_en, MIN_ENERGY_MR122) < 0)
|
||||
{
|
||||
av_pred_en = MIN_ENERGY_MR122;
|
||||
}
|
||||
*ener_avg_MR122 = av_pred_en;
|
||||
|
||||
// do average for other modes (20*log10() domain)
|
||||
av_pred_en = 0;
|
||||
for (i = 0; i < NPRED; i++)
|
||||
{
|
||||
av_pred_en = add (av_pred_en, st->past_qua_en[i]);
|
||||
}
|
||||
|
||||
// av_pred_en = 0.25*av_pred_en
|
||||
av_pred_en = mult (av_pred_en, 8192);
|
||||
|
||||
// if (av_pred_en < -14) av_pred_en = ..
|
||||
|
||||
if (sub (av_pred_en, MIN_ENERGY) < 0)
|
||||
{
|
||||
av_pred_en = MIN_ENERGY;
|
||||
}
|
||||
*ener_avg = av_pred_en;
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
OSCL_EXPORT_REF void gc_pred_average_limited(
|
||||
gc_predState *st, /* i: State struct */
|
||||
Word16 *ener_avg_MR122, /* o: everaged quantized energy, Q10 */
|
||||
/* (log2(qua_err)) */
|
||||
Word16 *ener_avg, /* o: averaged quantized energy, Q10 */
|
||||
/* (20*log10(qua_err)) */
|
||||
Flag *pOverflow
|
||||
)
|
||||
{
|
||||
Word16 av_pred_en;
|
||||
register Word16 i;
|
||||
|
||||
/* do average in MR122 mode (log2() domain) */
|
||||
av_pred_en = 0;
|
||||
for (i = 0; i < NPRED; i++)
|
||||
{
|
||||
av_pred_en =
|
||||
add_16(av_pred_en, st->past_qua_en_MR122[i], pOverflow);
|
||||
}
|
||||
|
||||
/* av_pred_en = 0.25*av_pred_en (with sign-extension)*/
|
||||
if (av_pred_en < 0)
|
||||
{
|
||||
av_pred_en = (av_pred_en >> 2) | 0xc000;
|
||||
}
|
||||
else
|
||||
{
|
||||
av_pred_en >>= 2;
|
||||
}
|
||||
|
||||
/* if (av_pred_en < -14/(20Log10(2))) av_pred_en = .. */
|
||||
if (av_pred_en < MIN_ENERGY_MR122)
|
||||
{
|
||||
av_pred_en = MIN_ENERGY_MR122;
|
||||
}
|
||||
*ener_avg_MR122 = av_pred_en;
|
||||
|
||||
/* do average for other modes (20*log10() domain) */
|
||||
av_pred_en = 0;
|
||||
for (i = 0; i < NPRED; i++)
|
||||
{
|
||||
av_pred_en = add_16(av_pred_en, st->past_qua_en[i], pOverflow);
|
||||
}
|
||||
|
||||
/* av_pred_en = 0.25*av_pred_en (with sign-extension)*/
|
||||
if (av_pred_en < 0)
|
||||
{
|
||||
av_pred_en = (av_pred_en >> 2) | 0xc000;
|
||||
}
|
||||
else
|
||||
{
|
||||
av_pred_en >>= 2;
|
||||
}
|
||||
|
||||
/* if (av_pred_en < -14) av_pred_en = .. */
|
||||
if (av_pred_en < MIN_ENERGY)
|
||||
{
|
||||
av_pred_en = MIN_ENERGY;
|
||||
}
|
||||
*ener_avg = av_pred_en;
|
||||
}
|
||||
102
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/get_const_tbls.c
vendored
Normal file
102
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/get_const_tbls.c
vendored
Normal 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.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef GET_CONST_TBLS_H
|
||||
#include "get_const_tbls.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern const Word16 dgray[];
|
||||
extern const Word16 dico1_lsf_3[];
|
||||
extern const Word16 dico1_lsf_5[];
|
||||
extern const Word16 dico2_lsf_3[];
|
||||
extern const Word16 dico2_lsf_5[];
|
||||
extern const Word16 dico3_lsf_3[];
|
||||
extern const Word16 dico3_lsf_5[];
|
||||
extern const Word16 dico4_lsf_5[];
|
||||
extern const Word16 dico5_lsf_5[];
|
||||
extern const Word16 gray[];
|
||||
extern const Word16 lsp_init_data[];
|
||||
extern const Word16 mean_lsf_3[];
|
||||
extern const Word16 mean_lsf_5[];
|
||||
extern const Word16 mr515_3_lsf[];
|
||||
extern const Word16 mr795_1_lsf[];
|
||||
extern const Word16 past_rq_init[];
|
||||
extern const Word16 pred_fac_3[];
|
||||
extern const Word16 qua_gain_code[];
|
||||
extern const Word16 qua_gain_pitch[];
|
||||
extern const Word16 startPos[];
|
||||
extern const Word16 table_gain_lowrates[];
|
||||
extern const Word16 table_gain_highrates[];
|
||||
extern const Word16 prmno[];
|
||||
extern const Word16* const bitno[];
|
||||
extern const Word16 numOfBits[];
|
||||
extern const Word16* const reorderBits[];
|
||||
extern const Word16 numCompressedBytes[];
|
||||
extern const Word16 window_200_40[];
|
||||
extern const Word16 window_160_80[];
|
||||
extern const Word16 window_232_8[];
|
||||
extern const Word16 ph_imp_low_MR795[];
|
||||
extern const Word16 ph_imp_mid_MR795[];
|
||||
extern const Word16 ph_imp_low[];
|
||||
extern const Word16 ph_imp_mid[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
OSCL_EXPORT_REF void get_const_tbls(CommonAmrTbls* tbl_struct_ptr)
|
||||
{
|
||||
tbl_struct_ptr->dgray_ptr = dgray;
|
||||
tbl_struct_ptr->dico1_lsf_3_ptr = dico1_lsf_3;
|
||||
tbl_struct_ptr->dico1_lsf_5_ptr = dico1_lsf_5;
|
||||
tbl_struct_ptr->dico2_lsf_3_ptr = dico2_lsf_3;
|
||||
tbl_struct_ptr->dico2_lsf_5_ptr = dico2_lsf_5;
|
||||
tbl_struct_ptr->dico3_lsf_3_ptr = dico3_lsf_3;
|
||||
tbl_struct_ptr->dico3_lsf_5_ptr = dico3_lsf_5;
|
||||
tbl_struct_ptr->dico4_lsf_5_ptr = dico4_lsf_5;
|
||||
tbl_struct_ptr->dico5_lsf_5_ptr = dico5_lsf_5;
|
||||
tbl_struct_ptr->gray_ptr = gray;
|
||||
tbl_struct_ptr->lsp_init_data_ptr = lsp_init_data;
|
||||
tbl_struct_ptr->mean_lsf_3_ptr = mean_lsf_3;
|
||||
tbl_struct_ptr->mean_lsf_5_ptr = mean_lsf_5;
|
||||
tbl_struct_ptr->mr515_3_lsf_ptr = mr515_3_lsf;
|
||||
tbl_struct_ptr->mr795_1_lsf_ptr = mr795_1_lsf;
|
||||
tbl_struct_ptr->past_rq_init_ptr = past_rq_init;
|
||||
tbl_struct_ptr->pred_fac_3_ptr = pred_fac_3;
|
||||
tbl_struct_ptr->qua_gain_code_ptr = qua_gain_code;
|
||||
tbl_struct_ptr->qua_gain_pitch_ptr = qua_gain_pitch;
|
||||
tbl_struct_ptr->startPos_ptr = startPos;
|
||||
tbl_struct_ptr->table_gain_lowrates_ptr = table_gain_lowrates;
|
||||
tbl_struct_ptr->table_gain_highrates_ptr = table_gain_highrates;
|
||||
tbl_struct_ptr->prmno_ptr = prmno;
|
||||
tbl_struct_ptr->bitno_ptr = bitno;
|
||||
tbl_struct_ptr->numOfBits_ptr = numOfBits;
|
||||
tbl_struct_ptr->reorderBits_ptr = reorderBits;
|
||||
tbl_struct_ptr->numCompressedBytes_ptr = numCompressedBytes;
|
||||
tbl_struct_ptr->window_200_40_ptr = window_200_40;
|
||||
tbl_struct_ptr->window_160_80_ptr = window_160_80;
|
||||
tbl_struct_ptr->window_232_8_ptr = window_232_8;
|
||||
tbl_struct_ptr->ph_imp_low_MR795_ptr = ph_imp_low_MR795;
|
||||
tbl_struct_ptr->ph_imp_mid_MR795_ptr = ph_imp_mid_MR795;
|
||||
tbl_struct_ptr->ph_imp_low_ptr = ph_imp_low;
|
||||
tbl_struct_ptr->ph_imp_mid_ptr = ph_imp_mid;
|
||||
}
|
||||
184
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/gmed_n.c
vendored
Normal file
184
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/gmed_n.c
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: gmed_n.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "gmed_n.h"
|
||||
#include "typedef.h"
|
||||
#include "oscl_mem.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
#define NMAX 9 /* largest N used in median calculation */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL STORE/BUFFER/POINTER DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: gmed_n
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
ind = input values (Word16)
|
||||
n = number of inputs to find the median (Word16)
|
||||
|
||||
Returns:
|
||||
median value.
|
||||
|
||||
Outputs:
|
||||
None.
|
||||
|
||||
Global Variables Used:
|
||||
None.
|
||||
|
||||
Local Variables Needed:
|
||||
None.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
This function calculates N-point median of a data set. This routine is only
|
||||
valid for a odd number of gains (n <= NMAX).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
gmed_n.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
Word16 gmed_n ( // o : The median value (0...N-1)
|
||||
Word16 ind[], // i : Past gain values
|
||||
Word16 n // i : The number of gains; this routine
|
||||
// is only valid for a odd number of gains
|
||||
// (n <= NMAX)
|
||||
)
|
||||
{
|
||||
Word16 i, j, ix = 0;
|
||||
Word16 max;
|
||||
Word16 medianIndex;
|
||||
Word16 tmp[NMAX];
|
||||
Word16 tmp2[NMAX];
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
tmp2[i] = ind[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
max = -32767;
|
||||
for (j = 0; j < n; j++)
|
||||
{
|
||||
if (sub (tmp2[j], max) >= 0)
|
||||
{
|
||||
max = tmp2[j];
|
||||
ix = j;
|
||||
}
|
||||
}
|
||||
tmp2[ix] = -32768;
|
||||
tmp[i] = ix;
|
||||
}
|
||||
|
||||
medianIndex=tmp[ shr(n,1) ]; // account for complex addressing
|
||||
return (ind[medianIndex]);
|
||||
}
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
OSCL_EXPORT_REF Word16 gmed_n( /* o : the median value */
|
||||
Word16 ind[], /* i : input values */
|
||||
Word16 n /* i : number of inputs */
|
||||
)
|
||||
{
|
||||
register Word16 i, j, ix = 0;
|
||||
register Word16 max;
|
||||
register Word16 medianIndex;
|
||||
Word16 tmp[NMAX];
|
||||
Word16 tmp2[NMAX];
|
||||
|
||||
oscl_memmove(tmp2, ind, n*sizeof(*ind));
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
max = -32767;
|
||||
for (j = 0; j < n; j++)
|
||||
{
|
||||
if (*(tmp2 + j) >= max)
|
||||
{
|
||||
max = *(tmp2 + j);
|
||||
ix = j;
|
||||
}
|
||||
}
|
||||
*(tmp2 + ix) = -32768;
|
||||
*(tmp + i) = ix;
|
||||
}
|
||||
|
||||
medianIndex = *(tmp + (n >> 1)); /* account for complex addressing */
|
||||
|
||||
return (*(ind + medianIndex));
|
||||
}
|
||||
|
||||
135
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/gray_tbl.c
vendored
Normal file
135
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/gray_tbl.c
vendored
Normal 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: gray_tbl.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
MODULE DESCRIPTION
|
||||
|
||||
This file contains the declaration for the gray encoding and decoding tables,
|
||||
gray_tbl[] and dgray_tbl[] used by the c1035pf and d1035pf module
|
||||
respectively.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "typedef.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; [Variable declaration - defined here and used outside this module]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
extern const Word16 gray[];
|
||||
extern const Word16 dgray[];
|
||||
const Word16 gray[8] = {0, 1, 3, 2, 6, 4, 5, 7};
|
||||
const Word16 dgray[8] = {0, 1, 3, 2, 5, 6, 4, 7};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME:
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
None
|
||||
|
||||
Outputs:
|
||||
None
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] gray.tab, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
153
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/grid_tbl.c
vendored
Normal file
153
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/grid_tbl.c
vendored
Normal 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.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
Filename: grid_tbl.cpp
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
MODULE DESCRIPTION
|
||||
|
||||
This file contains the declaration for grid_tbl[] used by the az_lsp()
|
||||
function.
|
||||
|
||||
// Table for az_lsp()
|
||||
//
|
||||
// grid[0] = 1.0;
|
||||
// grid[grid_points+1] = -1.0;
|
||||
// for (i = 1; i < grid_points; i++)
|
||||
// grid[i] = cos((6.283185307*i)/(2.0*grid_points));
|
||||
//
|
||||
//
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "az_lsp.h"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; [Define module specific macros here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; [Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.]
|
||||
----------------------------------------------------------------------------*/
|
||||
#define grid_points 60
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; [List function prototypes here]
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; [Variable declaration - defined here and used outside this module]
|
||||
----------------------------------------------------------------------------*/
|
||||
const Word16 grid[grid_points + 1] =
|
||||
{
|
||||
32760, 32723, 32588, 32364, 32051, 31651,
|
||||
31164, 30591, 29935, 29196, 28377, 27481,
|
||||
26509, 25465, 24351, 23170, 21926, 20621,
|
||||
19260, 17846, 16384, 14876, 13327, 11743,
|
||||
10125, 8480, 6812, 5126, 3425, 1714,
|
||||
0, -1714, -3425, -5126, -6812, -8480,
|
||||
-10125, -11743, -13327, -14876, -16384, -17846,
|
||||
-19260, -20621, -21926, -23170, -24351, -25465,
|
||||
-26509, -27481, -28377, -29196, -29935, -30591,
|
||||
-31164, -31651, -32051, -32364, -32588, -32723,
|
||||
-32760
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME:
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
None
|
||||
|
||||
Outputs:
|
||||
None
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
[1] grid.tab, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; FUNCTION CODE
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
515
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/int_lpc.c
vendored
Normal file
515
sdk/合宙/air780e/csdk/luatos-soc-2022/thirdparty/audio_decoder/amr/amr_nb/common/src/int_lpc.c
vendored
Normal file
@@ -0,0 +1,515 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/****************************************************************************************
|
||||
Portions of this file are derived from the following 3GPP standard:
|
||||
|
||||
3GPP TS 26.073
|
||||
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
|
||||
Available from http://www.3gpp.org
|
||||
|
||||
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
|
||||
Permission to distribute, modify and use this file under the standard license
|
||||
terms listed above has been obtained from the copyright holder.
|
||||
****************************************************************************************/
|
||||
/*
|
||||
Filename: int_lpc.cpp
|
||||
Functions:
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
MODULE DESCRIPTION
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; INCLUDES
|
||||
----------------------------------------------------------------------------*/
|
||||
#include "int_lpc.h"
|
||||
#include "typedef.h"
|
||||
#include "cnst.h"
|
||||
#include "lsp_az.h"
|
||||
#include "basic_op.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; MACROS
|
||||
; Define module specific macros here
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; DEFINES
|
||||
; Include all pre-processor statements here. Include conditional
|
||||
; compile variables also.
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL FUNCTION DEFINITIONS
|
||||
; Function Prototype declaration
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
; LOCAL VARIABLE DEFINITIONS
|
||||
; Variable declaration - defined here and used outside this module
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: Int_lpc_1and3
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
lsp_old -- array of type Word16 -- LSP vector at the
|
||||
4th subfr. of past frame (M)
|
||||
lsp_mid -- array of type Word16 -- LSP vector at the 2nd subfr. of
|
||||
present frame (M)
|
||||
lsp_new -- array of type Word16 -- LSP vector at the 4th subfr. of
|
||||
present frame (M)
|
||||
|
||||
Outputs:
|
||||
Az -- array of type Word16 -- interpolated LP parameters in all subfr.
|
||||
(AZ_SIZE)
|
||||
pOverflow -- pointer to type Flag -- Overflow indicator
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Purpose : Interpolates the LSPs and converts to LPC parameters
|
||||
to get a different LP filter in each subframe.
|
||||
Description : The 20 ms speech frame is divided into 4 subframes.
|
||||
The LSPs are quantized and transmitted at the 2nd and
|
||||
4th subframes (twice per frame) and interpolated at the
|
||||
1st and 3rd subframe.
|
||||
|
||||
|------|------|------|------|
|
||||
sf1 sf2 sf3 sf4
|
||||
F0 Fm F1
|
||||
|
||||
sf1: 1/2 Fm + 1/2 F0 sf3: 1/2 F1 + 1/2 Fm
|
||||
sf2: Fm sf4: F1
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
int_lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
OSCL_EXPORT_REF void Int_lpc_1and3(
|
||||
Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
|
||||
Word16 lsp_mid[], /* i : LSP vector at the 2nd subfr. of
|
||||
present frame (M) */
|
||||
Word16 lsp_new[], /* i : LSP vector at the 4th subfr. of
|
||||
present frame (M) */
|
||||
Word16 Az[], /* o : interpolated LP parameters in all subfr.
|
||||
(AZ_SIZE) */
|
||||
Flag *pOverflow
|
||||
)
|
||||
{
|
||||
Word16 i;
|
||||
Word16 lsp[M];
|
||||
Word16 *p_lsp_old = &lsp_old[0];
|
||||
Word16 *p_lsp_mid = &lsp_mid[0];
|
||||
Word16 *p_lsp_new = &lsp_new[0];
|
||||
Word16 *p_lsp = &lsp[0];
|
||||
|
||||
/* lsp[i] = lsp_mid[i] * 0.5 + lsp_old[i] * 0.5 */
|
||||
|
||||
for (i = M >> 1; i != 0; i--)
|
||||
{
|
||||
*(p_lsp++) = (*(p_lsp_old++) >> 1) + (*(p_lsp_mid++) >> 1);
|
||||
*(p_lsp++) = (*(p_lsp_old++) >> 1) + (*(p_lsp_mid++) >> 1);
|
||||
}
|
||||
|
||||
Lsp_Az(
|
||||
lsp,
|
||||
Az,
|
||||
pOverflow); /* Subframe 1 */
|
||||
|
||||
Az += MP1;
|
||||
|
||||
Lsp_Az(
|
||||
lsp_mid,
|
||||
Az,
|
||||
pOverflow); /* Subframe 2 */
|
||||
|
||||
Az += MP1;
|
||||
|
||||
p_lsp_mid = &lsp_mid[0];
|
||||
p_lsp = &lsp[0];
|
||||
|
||||
for (i = M >> 1; i != 0; i--)
|
||||
{
|
||||
*(p_lsp++) = (*(p_lsp_mid++) >> 1) + (*(p_lsp_new++) >> 1);
|
||||
*(p_lsp++) = (*(p_lsp_mid++) >> 1) + (*(p_lsp_new++) >> 1);
|
||||
}
|
||||
|
||||
Lsp_Az(
|
||||
lsp,
|
||||
Az,
|
||||
pOverflow); /* Subframe 3 */
|
||||
|
||||
Az += MP1;
|
||||
|
||||
Lsp_Az(
|
||||
lsp_new,
|
||||
Az,
|
||||
pOverflow); /* Subframe 4 */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: Int_lpc_1and3_2
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
lsp_old -- array of type Word16 -- LSP vector at the
|
||||
4th subfr. of past frame (M)
|
||||
lsp_mid -- array of type Word16 -- LSP vector at the 2nd subfr. of
|
||||
present frame (M)
|
||||
lsp_new -- array of type Word16 -- LSP vector at the 4th subfr. of
|
||||
present frame (M)
|
||||
|
||||
Outputs:
|
||||
Az -- array of type Word16 -- interpolated LP parameters in.
|
||||
subfr 1 and 2.
|
||||
pOverflow -- pointer to type Flag -- Overflow indicator
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
|
||||
function but we do not recompute Az() for subframe 2 and
|
||||
4 because it is already available.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
int_lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void Int_lpc_1and3_2(
|
||||
Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
|
||||
Word16 lsp_mid[], /* i : LSP vector at the 2nd subframe of
|
||||
present frame (M) */
|
||||
Word16 lsp_new[], /* i : LSP vector at the 4th subframe of
|
||||
present frame (M) */
|
||||
Word16 Az[], /* o :interpolated LP parameters
|
||||
in subframes 1 and 3 (AZ_SIZE) */
|
||||
Flag *pOverflow
|
||||
)
|
||||
{
|
||||
Word16 i;
|
||||
Word16 lsp[M];
|
||||
Word16 *p_lsp_old = &lsp_old[0];
|
||||
Word16 *p_lsp_mid = &lsp_mid[0];
|
||||
Word16 *p_lsp_new = &lsp_new[0];
|
||||
Word16 *p_lsp = &lsp[0];
|
||||
|
||||
/* lsp[i] = lsp_mid[i] * 0.5 + lsp_old[i] * 0.5 */
|
||||
|
||||
for (i = M >> 1; i != 0; i--)
|
||||
{
|
||||
*(p_lsp++) = (*(p_lsp_old++) >> 1) + (*(p_lsp_mid++) >> 1);
|
||||
*(p_lsp++) = (*(p_lsp_old++) >> 1) + (*(p_lsp_mid++) >> 1);
|
||||
}
|
||||
Lsp_Az(lsp, Az, pOverflow); /* Subframe 1 */
|
||||
Az += MP1 * 2;
|
||||
|
||||
p_lsp_mid = &lsp_mid[0];
|
||||
p_lsp = &lsp[0];
|
||||
|
||||
for (i = M >> 1; i != 0; i--)
|
||||
{
|
||||
*(p_lsp++) = (*(p_lsp_mid++) >> 1) + (*(p_lsp_new++) >> 1);
|
||||
*(p_lsp++) = (*(p_lsp_mid++) >> 1) + (*(p_lsp_new++) >> 1);
|
||||
}
|
||||
|
||||
Lsp_Az(lsp, Az, pOverflow); /* Subframe 3 */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: lsp
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
lsp_old -- array of type Word16 -- LSP vector at the
|
||||
4th subfr. of past frame (M)
|
||||
lsp_new -- array of type Word16 -- LSP vector at the 4th subfr. of
|
||||
present frame (M)
|
||||
|
||||
Outputs:
|
||||
Az -- array of type Word16 -- interpolated LP parameters in.
|
||||
all subframes.
|
||||
pOverflow -- pointer to type Flag -- Overflow indicator
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
PURPOSE: Interpolates the LSPs and convert to LP parameters to get
|
||||
a different LP filter in each subframe.
|
||||
|
||||
DESCRIPTION:
|
||||
The 20 ms speech frame is divided into 4 subframes.
|
||||
The LSPs are quantized and transmitted at the 4th subframe
|
||||
(once per frame) and interpolated at the 1st, 2nd and 3rd subframe.
|
||||
|
||||
|------|------|------|------|
|
||||
sf1 sf2 sf3 sf4
|
||||
F0 F1
|
||||
|
||||
sf1: 3/4 F0 + 1/4 F1 sf3: 1/4 F0 + 3/4 F1
|
||||
sf2: 1/2 F0 + 1/2 F1 sf4: F1
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
int_lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
OSCL_EXPORT_REF void Int_lpc_1to3(
|
||||
Word16 lsp_old[], /* input : LSP vector at the 4th SF of past frame */
|
||||
Word16 lsp_new[], /* input : LSP vector at the 4th SF of present frame */
|
||||
Word16 Az[], /* output: interpolated LP parameters in all SFs */
|
||||
Flag *pOverflow
|
||||
)
|
||||
{
|
||||
Word16 i;
|
||||
Word16 temp;
|
||||
|
||||
Word16 lsp[M];
|
||||
|
||||
for (i = 0; i < M; i++)
|
||||
{
|
||||
temp = lsp_old[i] - (lsp_old[i] >> 2);
|
||||
lsp[i] = temp + (lsp_new[i] >> 2);
|
||||
}
|
||||
|
||||
Lsp_Az(
|
||||
lsp,
|
||||
Az,
|
||||
pOverflow); /* Subframe 1 */
|
||||
|
||||
Az += MP1;
|
||||
|
||||
|
||||
for (i = 0; i < M; i++)
|
||||
{
|
||||
lsp[i] = (lsp_new[i] >> 1) + (lsp_old[i] >> 1);
|
||||
|
||||
}
|
||||
|
||||
Lsp_Az(lsp, Az, pOverflow); /* Subframe 2 */
|
||||
|
||||
Az += MP1;
|
||||
|
||||
for (i = 0; i < M; i++)
|
||||
{
|
||||
|
||||
temp = lsp_new[i] - (lsp_new[i] >> 2);
|
||||
lsp[i] = temp + (lsp_old[i] >> 2);
|
||||
|
||||
}
|
||||
|
||||
Lsp_Az(lsp, Az, pOverflow); /* Subframe 3 */
|
||||
|
||||
Az += MP1;
|
||||
|
||||
Lsp_Az(lsp_new, Az, pOverflow); /* Subframe 4 */
|
||||
|
||||
return;
|
||||
}
|
||||
/*
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION NAME: Int_lpc_1to3_2
|
||||
------------------------------------------------------------------------------
|
||||
INPUT AND OUTPUT DEFINITIONS
|
||||
|
||||
Inputs:
|
||||
lsp_old -- array of type Word16 -- LSP vector at the
|
||||
4th subfr. of past frame (M)
|
||||
lsp_new -- array of type Word16 -- LSP vector at the 4th subfr. of
|
||||
present frame (M)
|
||||
|
||||
Outputs:
|
||||
Az -- array of type Word16 -- interpolated LP parameters in.
|
||||
subfr 1, 2, and 3.
|
||||
pOverflow -- pointer to type Flag -- Overflow indicator
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
Global Variables Used:
|
||||
None
|
||||
|
||||
Local Variables Needed:
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
FUNCTION DESCRIPTION
|
||||
|
||||
Interpolation of the LPC parameters.
|
||||
Same as the previous function but we do not recompute Az() for
|
||||
subframe 4 because it is already available.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
|
||||
None
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
REFERENCES
|
||||
|
||||
int_lpc.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PSEUDO-CODE
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
CAUTION [optional]
|
||||
[State any special notes, constraints or cautions for users of this function]
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void Int_lpc_1to3_2(
|
||||
Word16 lsp_old[], /* input : LSP vector at the 4th SF of past frame */
|
||||
Word16 lsp_new[], /* input : LSP vector at the 4th SF of present frame */
|
||||
Word16 Az[], /* output: interpolated LP parameters in SFs 1,2,3 */
|
||||
Flag *pOverflow
|
||||
)
|
||||
{
|
||||
Word16 i;
|
||||
Word16 temp;
|
||||
Word16 lsp[M];
|
||||
|
||||
for (i = 0; i < M; i++)
|
||||
{
|
||||
temp = lsp_old[i] - (lsp_old[i] >> 2);
|
||||
lsp[i] = temp + (lsp_new[i] >> 2);
|
||||
|
||||
}
|
||||
|
||||
Lsp_Az(lsp, Az, pOverflow); /* Subframe 1 */
|
||||
|
||||
Az += MP1;
|
||||
|
||||
for (i = 0; i < M; i++)
|
||||
{
|
||||
lsp[i] = (lsp_new[i] >> 1) + (lsp_old[i] >> 1);
|
||||
|
||||
}
|
||||
|
||||
Lsp_Az(lsp, Az, pOverflow); /* Subframe 2 */
|
||||
|
||||
Az += MP1;
|
||||
|
||||
for (i = 0; i < M; i++)
|
||||
{
|
||||
temp = lsp_new[i] - (lsp_new[i] >> 2);
|
||||
lsp[i] = temp + (lsp_old[i] >> 2);
|
||||
|
||||
}
|
||||
|
||||
Lsp_Az(lsp, Az, pOverflow); /* Subframe 3 */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user