⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pvamrwbdecoder_basic_op_cequivalent.h

📁 实现3GPP的GSM中AMR语音的CODECS。
💻 H
📖 第 1 页 / 共 2 页
字号:
/* ------------------------------------------------------------------ * Copyright (C) 2008 PacketVideo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *      http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. * See the License for the specific language governing permissions * and limitations under the License. * ------------------------------------------------------------------- *//****************************************************************************************Portions of this file are derived from the following 3GPP standard:    3GPP TS 26.173    ANSI-C code for the Adaptive Multi-Rate - Wideband (AMR-WB) speech codec    Available from http://www.3gpp.org(C) 2007, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)Permission to distribute, modify and use this file under the standard licenseterms listed above has been obtained from the copyright holder.****************************************************************************************//*------------------------------------------------------------------------------ Pathname: ./src/pvamrwbdecoder_basic_op_cequivalent.h     Date: 05/07/2007------------------------------------------------------------------------------ REVISION HISTORY Description:------------------------------------------------------------------------------ INCLUDE DESCRIPTION------------------------------------------------------------------------------*/#ifndef PVAMRWBDECODER_BASIC_OP_CEQUIVALENT_H#define PVAMRWBDECODER_BASIC_OP_CEQUIVALENT_H#ifdef __cplusplusextern "C"{#endif#include "normalize_amr_wb.h"#if defined(C_EQUIVALENT)    /*----------------------------------------------------------------------------         Function Name : add_int16         Purpose :          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.         Inputs :          var1                   16 bit short signed integer (int16) whose value falls in the                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.          var2                   16 bit short signed integer (int16) whose value falls in the                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.         Outputs :          none         Return Value :                   16 bit short signed integer (int16) whose value falls in the                   range : 0xffff 8000 <= var_out <= 0x0000 7fff.     ----------------------------------------------------------------------------*/    __inline int16 add_int16(int16 var1, int16 var2)    {        int32 L_sum;        L_sum = (int32) var1 + var2;        if ((L_sum >> 15) != (L_sum >> 31))        {            L_sum = (L_sum >> 31) ^ MAX_16;        }        return ((int16)(L_sum));    }    /*----------------------------------------------------------------------------         Function Name : sub_int16          Performs the subtraction (var1+var2) with overflow control and satu-          ration; the 16 bit result is set at +32767 when overflow occurs or at          -32768 when underflow occurs.         Inputs :          var1                   16 bit short signed integer (int16) whose value falls in the                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.          var2                   16 bit short signed integer (int16) whose value falls in the                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.         Outputs :          none         Return Value :                   16 bit short signed integer (int16) whose value falls in the                   range : 0xffff 8000 <= var_out <= 0x0000 7fff.     ----------------------------------------------------------------------------*/    __inline int16 sub_int16(int16 var1, int16 var2)    {        int32 L_diff;        L_diff = (int32) var1 - var2;        if ((L_diff >> 15) != (L_diff >> 31))        {            L_diff = (L_diff >> 31) ^ MAX_16;        }        return ((int16)(L_diff));    }    /*----------------------------------------------------------------------------         Function Name : mult_int16          Performs the multiplication of var1 by var2 and gives a 16 bit result          which is scaled i.e.:                   mult_int16(var1,var2) = extract_l(L_shr((var1 times var2),15)) and                   mult_int16(-32768,-32768) = 32767.         Inputs :          var1                   16 bit short signed integer (int16) whose value falls in the                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.          var2                   16 bit short signed integer (int16) whose value falls in the                   range : 0xffff 8000 <= var1 <= 0x0000 7fff.         Return Value :                   16 bit short signed integer (int16) whose value falls in the                   range : 0xffff 8000 <= var_out <= 0x0000 7fff.     ----------------------------------------------------------------------------*/    __inline int16 mult_int16(int16 var1, int16 var2)    {        int32 L_product;        L_product = ((int32) var1 * (int32) var2) >> 15;        if ((L_product >> 15) != (L_product >> 31))        {            L_product = (L_product >> 31) ^ MAX_16;        }        return ((int16)L_product);    }    /*----------------------------------------------------------------------------         Function Name : add_int32         32 bits addition of the two 32 bits variables (L_var1+L_var2) with         overflow control and saturation; the result is set at +2147483647 when         overflow occurs or at -2147483648 when underflow occurs.         Inputs :          L_var1   32 bit long signed integer (int32) whose value falls in the                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.          L_var2   32 bit long signed integer (int32) whose value falls in the                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.         Return Value :          L_var_out                   32 bit long signed integer (int32) whose value falls in the                   range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.     ----------------------------------------------------------------------------*/    __inline  int32 add_int32(int32 L_var1, int32 L_var2)    {        int32 L_var_out;        L_var_out = L_var1 + L_var2;        if (((L_var1 ^ L_var2) & MIN_32) == 0)  /* same sign ? */        {            if ((L_var_out ^ L_var1) & MIN_32)  /* addition matches sign ? */            {                L_var_out = (L_var1 >> 31) ^ MAX_32;            }        }        return (L_var_out);    }    /*----------------------------------------------------------------------------         Function Name : sub_int32         32 bits subtraction of the two 32 bits variables (L_var1-L_var2) with         overflow control and saturation; the result is set at +2147483647 when         overflow occurs or at -2147483648 when underflow occurs.         Inputs :          L_var1   32 bit long signed integer (int32) whose value falls in the                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.          L_var2   32 bit long signed integer (int32) whose value falls in the                   range : 0x8000 0000 <= L_var3 <= 0x7fff ffff.         Return Value :          L_var_out                   32 bit long signed integer (int32) whose value falls in the                   range : 0x8000 0000 <= L_var_out <= 0x7fff ffff.     ----------------------------------------------------------------------------*/    __inline  int32 sub_int32(int32 L_var1, int32 L_var2)    {        int32 L_var_out;        L_var_out = L_var1 - L_var2;        if (((L_var1 ^ L_var2) & MIN_32) != 0)  /* different sign ? */        {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -