资源简介
IMA ADPCM PCM 编码和解码 C语言程序
代码片段和文件信息
#include “adpcm.h“
/* Intel ADPCM step variation table */
static int indexTable[16]={
-1-1-1-12468
-1-1-1-12468
};
static int stepsizeTable[89]={
78910111213141617
19212325283134374145
5055606673808897107118
130143157173190209230253279307
337371408449494544598658724796
87696310601166128214111552170718782066
2272249927493024332736604026442848715358
58946484713278458630949310442114871263513899
152891681818500203502238524623270862979432767
};
void adpcm_decoder(char*inbuff char*outbuff int len_of_in struct adpcm_state *state )
{
int i=0j=0;
char tmp_data;
struct adpcm_state *tmp_state =state;
long step;/* Quantizer step size */
signed long predsample;/* Output of ADPCM predictor */
signed long diffq;/* Dequantized predicted difference */
int index;/* Index into step size table */
int Samp;
unsigned char SampHSampL;
unsigned char inCode;
/* Restore previous values of predicted sample and quantizer step
size index
*/
predsample =state->valprev;
index =state->index;
for(i=0;i {
tmp_data=inbuff[i/2];
if(i%2)
inCode=(tmp_data&0xf0)>>4;
else
inCode=tmp_data &0x0f;
step =stepsizeTable[index];
/* Inverse quantize the ADPCM code into a predicted difference
using the quantizer step size
*/
diffq =step >>3;
if(inCode &4)
diffq +=step;
if(inCode &2)
diffq +=step >>1;
if(inCode &1)
diffq +=step >>2;
/* Fixed predictor computes new predicted sample by adding the
old predicted sample to predicted difference
*/
if(inCode &8)
predsample -=diffq;
else
predsample +=diffq;
/* Check for overflow of the new predicted sample
*/
if(predsample >32767)
predsample =32767;
else if(predsample <-32768)
predsample =-32768;
/* Find new quantizer stepsize index by adding the old index
to a table lookup using the ADPCM code
*/
index +=indexTable[inCode];
/* Check for overflow of the new quantizer step size index
*/
if(index <0)
index =0;
if(index >88)
index =88;
/* Return the new ADPCM code */
Samp=predsample;
if(Samp>=0)
{
SampH=Samp/256;
SampL=Samp-256*SampH;
}
else
{
Samp=32768+Samp;
SampH=Samp/256;
SampL=Samp-256*SampH;
SampH+=0x80;
}
outbuff[j++]=SampL;
outbuff[j++]=SampH;
}
/* Save the predicted sample and quantizer step size index for
next iteration
*/
state->valprev =(short)predsample;
state->index =(char)index;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-09-04 12:31 test1\
目录 0 2014-09-04 12:24 test1\Debug\
文件 1799 2014-09-04 12:16 test1\Debug\StdAfx.obj
文件 3399 2014-09-04 12:16 test1\Debug\adpcm.obj
文件 163886 2014-09-04 12:24 test1\Debug\test1.exe
文件 182932 2014-09-04 12:24 test1\Debug\test1.ilk
文件 7051 2014-09-04 12:24 test1\Debug\test1.obj
文件 203728 2014-09-04 12:16 test1\Debug\test1.pch
文件 435200 2014-09-04 12:24 test1\Debug\test1.pdb
文件 41984 2014-09-04 12:24 test1\Debug\vc60.idb
文件 53248 2014-09-04 12:24 test1\Debug\vc60.pdb
文件 1202 2014-09-04 12:06 test1\ReadMe.txt
文件 292 2014-09-04 12:06 test1\StdAfx.cpp
文件 769 2014-09-04 12:06 test1\StdAfx.h
文件 2756 2014-09-04 12:16 test1\adpcm.c
文件 366 2014-09-04 12:01 test1\adpcm.h
文件 4175 2014-09-04 12:01 test1\main.c
文件 4019 2014-09-04 12:24 test1\test1.cpp
文件 4658 2014-09-04 12:18 test1\test1.dsp
文件 533 2014-09-04 12:06 test1\test1.dsw
文件 41984 2014-09-04 12:31 test1\test1.ncb
文件 48640 2014-09-04 12:31 test1\test1.opt
文件 1246 2014-09-04 12:24 test1\test1.plg
相关资源
- pcm转换成wav
- pcm语音编码
- C++ 双缓存机制播放音频流(PCM裸流)
- ultimateGrid72
- C++PCM音频格式录音
- vs2013 c++ 条码 条形码 二维码识别 通
- 64位png2jpg
- 动画编程 人体骨骼运动Forward Kinemat
- iqa 源代码 Image Quality Assessment 图像质
- 基于OpenCV的步态能量图源代码GEI Gai
- 音频采集并且adpcm编码再网络发送
- C++实现调用摄像头并实时二值化
- PCM编解码C++
- vc6.0调用vs2008 CImage类
- MFC 常用界面组件集合CGridCtrl
- linux系统C语言AVI格式音视频封装应用
- 计算机考研资料
- SelectiveSearch2
- C++ 解析rtsp流后返回Iplimage,用Opengl显
- ImageEN v8.3.0 fullsource For Xe10.4
- GDAL遥感影像处理
- c++ pcm转mp3编码(编码器为lamp)
- g711播放器和各种格式G711AG711U,PCM的音
- MFC 实现 图片的拖动 放大缩小和区域
- Matlab实现Mnist-image 手写数字图像识别
- Step by Step Skeletal Animation in C++ and Ope
- 语音信号分析与处理及其MATLAB实现L
- 日本葵花卫星himawari8数据投影程序
- MFC显示图片的相关文件
- PCM 8位文件提取PCM采样的C语言代码
评论
共有 条评论