/*
2.4 kbps MELP Proposed Federal Standard speech coder
Fixed-point C 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 fixed-point version of the voice codec Mixed Excitation Linear
Prediction (MELP) is based on specifications on the C-language software
simulation contained in GSM 06.06 which is protected by copyright and
is the property of the European Telecommunications Standards Institute
(ETSI). This standard is available from the ETSI publication office
tel. +33 (0)4 92 94 42 58. ETSI has granted a license to United States
Department of Defense to use the C-language software simulation contained
in GSM 06.06 for the purposes of the development of a fixed-point
version of the voice codec Mixed Excitation Linear Prediction (MELP).
Requests for authorization to make other use of the GSM 06.06 or
otherwise distribute or modify them need to be addressed to the ETSI
Secretariat fax: +33 493 65 47 16.
*/
/***************************************************************************
*
* File Name: mathhalf.c
*
* Purpose: Contains functions which implement the primitive
* arithmetic operations.
*
* The functions in this file are listed below. Some of them are
* defined in terms of other basic operations. One of the
* routines, saturate() is static. This is not a basic
* operation, and is not reference outside the scope of this
* file.
*
*
* abs_s()
* add()
* divide_s()
* extract_h()
* extract_l()
* L_abs()
* L_add()
* L_deposit_h()
* L_deposit_l()
* L_mac()
* L_msu()
* L_mult()
* L_negate()
* L_shift_r()
* L_shl()
* L_shr()
* L_sub()
* mac_r()
* msu_r()
* mult()
* mult_r()
* negate()
* norm_l()
* norm_s()
* round()
* saturate()
* shift_r()
* shl()
* shr()
* sub()
*
**************************************************************************/
#include "typedefs.h"
#include "mathhalf.h"
#include "mathdp31.h"
/***************************************************************************
*
* FUNCTION NAME: saturate
*
* PURPOSE:
*
* Limit the 32 bit input to the range of a 16 bit word.
*
*
* INPUTS:
*
* L_var1
* 32 bit long signed integer (Longword) whose value
* falls in the range
* 0x8000 0000 <= L_var1 <= 0x7fff ffff.
*
* OUTPUTS:
*
* none
*
* RETURN VALUE:
*
* swOut
* 16 bit short signed integer (Shortword) whose value
* falls in the range
* 0xffff 8000 <= swOut <= 0x0000 7fff.
*
* KEYWORDS: saturation, limiting, limit, saturate, 16 bits
*
*************************************************************************/
static Shortword saturate(Longword L_var1)
{
Shortword swOut;
if (L_var1 > SW_MAX)
{
swOut = SW_MAX;
}
else if (L_var1 < SW_MIN)
{
swOut = SW_MIN;
}
else
{
swOut = (Shortword) L_var1;
}
return (swOut);
}
/***************************************************************************
*
* FUNCTION NAME: divide_s
*
* PURPOSE:
*
* Divide var1 by var2. Note that both must be positive, and
* var1 >= var2. The output is set to 0 if invalid input is
* provided.
*
* INPUTS:
*
* var1
* 16 bit short signed integer (Shortword) whose value
* falls in the range 0xffff 8000 <= var1 <= 0x0000 7fff.
* var2
* 16 bit short signed integer (Shortword) whose value
* falls in the range 0xffff 8000 <= var2 <= 0x0000 7fff.
*
* OUTPUTS:
*
* none
*
* RETURN VALUE:
*
* swOut
* 16 bit short signed integer (Shortword) whose value
* falls in the range
* 0xffff 8000 <= swOut <= 0x0000 7fff.
*
* IMPLEMENTATION:
*
* In the case where var1==var2 the function returns 0x7fff. The output
* is undefined for invalid inputs. This implementation returns zero
* and issues a warning via stdio if invalid input is presented.
*
* KEYWORDS: divide
*
*************************************************************************/
Shortword divide_s(Shortword var1, Shortword var2)
{
Longword L_div;
Shortword swOut;
if (var1 < 0 || var2 < 0 || var1 > var2) {
/* undefined output for invalid input into divide_s */
return ((Shortword)0);
}
if (var1 == var2)
return ((Shortword)0x7fff);
L_div = ((0x00008000L * (Longword) var1) / (Longword) var2);
swOut = saturate(L_div);
return (swOut);
}
/***************************************************************************
*
* FUNCTION NAME: L_deposit_l
*
* PURPOSE:
*
* Put the 16 bit input into the 16 LSB's of the output Longword with
* sign extension i.e. the top 16 bits are set to either 0 or 0xffff.
*
* INPUTS:
*
* var1
* 16 bit short signed integer (Shortword) whose value
* falls in the range 0xffff 8000 <= var1 <= 0x0000 7fff.
*
* OUTPUTS:
*
* none
*
* RETURN VALUE:
*
* L_Out
* 32 bit long signed integer (Longword) whose value
* falls in the range
* 0xffff 8000 <= L_var1 <= 0x0000 7fff.
*
* KEYWORDS: deposit, assign
*
*************************************************************************/
Longword L_deposit_l(Shortword var1)
{
Longword L_Out;
L_Out = var1;
return (L_Out);
}
/***************************************************************************
*
* FUNCTION NAME: L_deposit_h
*
* PURPOSE:
*
* Put the 16 bit input into the 16 MSB's of the output Longword. The
* LS 16 bits are zeroed.
*
* INPUTS:
*
* var1
* 16 bit short signed integer (Shortword) whose value
* falls in the range 0xffff 8000 <= var1 <= 0x0000 7fff.
*
* OUTPUTS:
*
* none
*
* RETURN VALUE:
*
* L_Out
* 32 bit long signed integer (Longword) whose value
* falls in the range
* 0x8000 0000 <= L_var1 <= 0x7fff 0000.
*
*
* KEYWORDS: deposit, assign, fractional assign
*
*************************************************************************/
Longword L_deposit_h(Shortword var1)
{
Longword L_var2;
L_var2 = (Longword) var1 << 16;
return (L_var2);
}
/***************************************************************************
*
* FUNCTION NAME: extract_l
*
* PURPOSE:
*
* Extract the 16 LS bits of a 32 bit Longword. Return the 16 bit
* number as a Shortword. The upper portion of the input Longword
* has no impact whatsoever on the output.
*
* INPUTS:
*
* L_var1
* 32 bit long signed integer (Longword) whose value
* falls in the range
* 0x8000 0000 <= L_var1 <= 0x7fff ffff.
*
* OUTPUTS:
*
* none
*
* RETURN VALUE:
*
* swOut
* 16 bit short signed integer (Shortword) whose value
* falls in the range
* 0xffff 8000 <= swOut <= 0x0000 7fff.
*
*
* KEYWORDS: extract, as
没有合适的资源?快使用搜索试试~ 我知道了~
msp430.rar_12.21_24 FFT_ads1241电路_dsp无线传输_无线温度传输
共89个文件
c:42个
h:32个
bak:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 32 浏览量
2022-07-15
16:07:56
上传
评论
收藏 242KB RAR 举报
温馨提示
msp430 实验代码 1,MSP430开发基础 2,键盘设计 3,数码管显示电路设计 4,液晶模块接口 5,MSP430 CRC 6,中文输入法 7,数据压缩算法 8,FIR滤波 9,FFT算法 10,波特率自动识别 11,串行存储 12;NAND flash 接口 13;A/ D,TLV2541 14;DA DAC8830 15;ADS1241 16;温度 TMP100 17;定时器 DAC 18;数据采集 19;交流电压测量 20;车速测量 21;DS1820 22;DS1302 23;基于BQ26500温度检测系统 24;红外传输系统 25;pc通信 26;无线MODEM 27;楼宇对讲系统 28;DSP HPI接口 29;无线传输模块 30;步进电机控制 31;can通信系统
资源推荐
资源详情
资源评论
收起资源包目录
msp430.rar (89个子文件)
程序
第28章
Main.c 408B
HPI.h 138B
HPI_DSP.asm 14KB
hpi.c 3KB
第18章
caiji.c 8KB
init.c 4KB
Init.h 191B
第10章
autouart.c 5KB
第17章
DAC.c 2KB
第13章
tlv2541.c 3KB
TLV2541.H 175B
第8章
LowpassFilter.c 1KB
第2章
key01.c 3KB
key02.c 3KB
第15章
ADS1241.H 3KB
ads1241.c 5KB
第7章
huffman.c 3KB
第21章
ds1820.c 2KB
DS1820.h 165B
第9章
dsp_sub.h 3KB
mathdp31.h 2KB
mathhalf.c 52KB
math_lib.c 6KB
mathhalf.h 4KB
fs.h 2KB
math_lib.h 2KB
spbstd.h 4KB
mat_lib.c 2KB
constant.h 4KB
typedefs.h 4KB
mathdp31.c 7KB
fs_lib.c 5KB
mat.h 2KB
第30章
motor.c 11KB
第19章
Jiaoliu.c 3KB
第29章
nRF2401.c 5KB
第4章
mg12232.h 530B
mg12232.c 5KB
第27章
host.c 28KB
I2C.c 5KB
Led.c 2KB
led.h 172B
I2C.h 629B
第16章
I2C.c 7KB
I2C.h 701B
第23章
HDQ.c 4KB
hdq.h 1KB
第3章
Led.c 2KB
led.h 168B
第22章
ds1302.c 4KB
第26章
CMX469A.c 8KB
第11章
I2C.c 6KB
I2C.h 670B
第12章
Nand.h 801B
nand.c 14KB
第6章
main.c 6KB
sm.c 12KB
SM.h 801B
第24章
irda.c 3KB
IrDA.h 71B
第5章
crc.plg 1KB
crc.opt 48KB
table16.H 2KB
crc.c 4KB
crc.h 2KB
table32.h 3KB
crc.ncb 33KB
crc.dsw 514B
Debug
crc.obj 12KB
vc60.idb 33KB
crc.exe 172KB
crc.pdb 329KB
crc.pch 162KB
vc60.pdb 44KB
crc.ilk 167KB
crc.dsp 3KB
第25章
sp3220.c 4KB
sp3220.h 108B
第31章
mcp2510.H 4KB
mcp2510.c 7KB
第14章
dac8830.c 4KB
DAC8830.H.bak 155B
DAC8830.H 162B
第20章
I2C.c 6KB
Led.c 3KB
main.c 4KB
led.h 302B
main.c.bak 5KB
I2C.h 650B
共 89 条
- 1
资源评论
朱moyimi
- 粉丝: 75
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C语言-leetcode题解之83-remove-duplicates-from-sorted-list.c
- C语言-leetcode题解之79-word-search.c
- C语言-leetcode题解之78-subsets.c
- C语言-leetcode题解之75-sort-colors.c
- C语言-leetcode题解之74-search-a-2d-matrix.c
- C语言-leetcode题解之73-set-matrix-zeroes.c
- 树莓派物联网智能家居基础教程
- YOLOv5深度学习目标检测基础教程
- (源码)基于Arduino和Nextion的HMI人机界面系统.zip
- (源码)基于 JavaFX 和 MySQL 的影院管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功