📄 math_lib.c
字号:
/*
*2.4 kbps MELP Proposed Federal Standard speech coder
*
*TMS320C5x assembly code
*
*version 1.0
*
*Copyright (c) 1998, Texas Instruments, Inc.
*
*Texas Instruments has intellectual property rights on the MELP
*algorithm. The Texas Instruments contact for licensing issues for
*commercial and non-government use is William Gordon, Director,
*Government Contracts, Texas Instruments Incorporated, Semiconductor
*Group (phone 972 480 7442).
*/
/*************************************************************************
*
* The following code was hand optimized for the Texas Instuments
* TMS320C5x DSP by DSPCon, Inc. For information, please contact DSPCon
* at:
*
* DSPCon, Inc.
* 380 Foothill Road
* Bridgewater, New Jersey 08807
* (908) 722-5656
* info@dspcon.com
* www.dspcon.com
*
*************************************************************************/
#include <math.h>
#include "spbstd.h"
#include "mathhalf.h"
#include "mathdp31.h"
#include "math_lib.h"
extern int saturation;
Shortword DEBUG;
#define X05_Q15 (Shortword)(0.5*((Longword)1<<15))
#define ONE_Q15 (Shortword)(((Longword)1<<15)-1)
#define PI_Q13 M_PI*(1<<13)
/***************************************************************************
*
* FUNCTION NAME: L_pow_fxp
*
* PURPOSE:
*
* Compute the value of x raised to the power 'power'.
*
*
* INPUTS:
*
* x
* 32 bit long signed integer (Longword).
* power
* 16 bit short signed integer (Shortword) in Q15.
* Q_in
* 16 bit short signed integer (Shortword) represents
* Q value of x.
* Q_out
* 16 bit short signed integer (Shortword) represents
* required Q value of returned result.
*
* OUTPUTS:
*
* none
*
* RETURN VALUE:
*
* temp
* 16 bit short signed integer (Shortword).
*
*************************************************************************/
Shortword L_pow_fxp(Longword x,Shortword power,Shortword Q_in,Shortword Q_out)
{
Shortword temp;
/* increment complexity for if statement */
if (!x)
return((Shortword)0);
temp = L_log10_fxp(x,Q_in); /* temp in Q11 */
temp = mult(power,shl(temp,1)); /* temp in Q12 */
temp = pow10_fxp(temp,Q_out);
return (temp);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -