资源简介
在CCS上测试通过的MP3解码代码,可结合5509和AIC23来实现音频解码和编码,适合初学者。

代码片段和文件信息
#include
#include
#include
#include “common.h“
char *layer_names[3] = { “I“ “II“ “III“ };
int bitrate[3][15] = {
{0326496128160192224256288320352384416448}
{0324856648096112128160192224256320384}
{032404856648096112128160192224256320}
};
double s_freq[4] = {44.1 48 32 0};
char *mode_names[4] = { “stereo“ “j-stereo“ “dual-ch“ “single-ch“ };
FILE *OpenTableFile(char *name)
{
char fulname[80];
FILE *f;
fulname[0] = ‘\0‘;
strcat(fulname name);
if( (f=fopen(fulname“r“))==NULL ) {
fprintf(stderr“\nOpenTable: could not find %s\n“ fulname);
}
return f;
}
void WriteHdr(frame_params *fr_ps)
{
layer *info = fr_ps->header;
printf(“HDR: sync=FFF id=%X layer=%X ep=%X br=%X sf=%X pd=%X “
info->version info->lay !info->error_protection
info->bitrate_index info->sampling_frequency info->padding);
printf(“pr=%X m=%X js=%X c=%X o=%X e=%X\n“
info->extension info->mode info->mode_ext
info->copyright info->original info->emphasis);
printf(“layer=%s tot bitrate=%d sfrq=%.1f mode=%s “
layer_names[info->lay-1] bitrate[info->lay-1][info->bitrate_index]
s_freq[info->sampling_frequency] mode_names[info->mode]);
printf(“sblim=%d jsbd=%d ch=%d\n“
fr_ps->sblimit fr_ps->jsbound fr_ps->stereo);
}
void *mem_alloc(unsigned long block char *item)
{
void *ptr;
ptr = (void *)malloc((unsigned long)block);
if (ptr != NULL)
memset(ptr 0 block);
else{
printf(“Unable to allocate %s\n“ item);
exit(0);
}
return ptr;
}
/*open and initialize the buffer; */
void alloc_buffer(Bit_stream_struc *bs int size)
{
bs->buf = (unsigned char *) mem_alloc(size*sizeof(unsigned char) “buffer“);
bs->buf_size = size;
}
void desalloc_buffer(Bit_stream_struc *bs)
{
free(bs->buf);
}
/* open the device to read the bit stream from it */
void open_bit_stream_r(Bit_stream_struc *bs char *bs_filenam int size)
{
register unsigned char flag = 1;
if ((bs->pt = fopen(bs_filenam “rb“)) == NULL) {
printf(“Could not find \“%s\“.\n“ bs_filenam);
exit(1);
}
bs->format = BINARY;
alloc_buffer(bs size);
bs->buf_byte_idx=0;
bs->buf_bit_idx=0;
bs->totbit=0;
bs->mode = READ_MODE;
bs->eob = FALSE;
bs->eobs = FALSE;
}
void close_bit_stream_r(Bit_stream_struc *bs)
{
fclose(bs->pt);
desalloc_buffer(bs);
}
/*return the status of the bit stream*/
/* returns 1 if end of bit stream was reached */
/* returns 0 if end of bit stream was not reached */
int end_bs(Bit_stream_struc *bs)
{
return(bs->eobs);
}
/*return the current bit stream length (in bits)*/
unsigned long sstell(Bit_stream_struc *bs)
{
return(bs->totbit);
}
void refill_buffer(Bit_stream_struc *bs)
{
register int i=bs->buf_size-2-bs->buf_byte_idx;
register unsigned long n=1;
while ((i>=0) && (!bs->eob)) {
n=fread(&bs->buf[
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-11-03 20:30 MP3\
目录 0 2011-11-24 21:08 MP3\mp3code\
目录 0 2011-11-24 20:08 MP3\mp3code\Debug\
文件 29381 2011-11-24 20:07 MP3\mp3code\Debug\common.obj
文件 114039 2011-11-24 20:08 MP3\mp3code\Debug\decode.obj
文件 23221 2011-11-24 20:08 MP3\mp3code\Debug\huffman.obj
文件 23574 2011-11-24 20:25 MP3\mp3code\Debug\la
文件 32277 2011-11-24 20:08 MP3\mp3code\Debug\mp3code.map
文件 292886 2011-11-24 20:08 MP3\mp3code\Debug\mp3code.out
文件 248 2011-11-24 20:25 MP3\mp3code\Debug.lkf
文件 1810 2011-11-24 20:08 MP3\mp3code\cc_build_Debug.log
文件 7463 1999-01-28 13:27 MP3\mp3code\common.c
文件 4036 1999-01-28 13:59 MP3\mp3code\common.h
文件 29640 2011-11-24 20:09 MP3\mp3code\decode.c
文件 1673 2011-11-24 20:25 MP3\mp3code\decode.h
文件 6006 1999-01-28 09:20 MP3\mp3code\huffman.c
文件 2089 1999-01-28 09:19 MP3\mp3code\huffman.h
文件 5394 2011-11-24 21:08 MP3\mp3code\la
目录 0 2011-11-24 20:07 MP3\mp3code\mp3code.CS_\
文件 3072 2011-11-24 20:07 MP3\mp3code\mp3code.CS_\FILE.CDX
文件 2556 2011-11-24 21:08 MP3\mp3code\mp3code.CS_\FILE.DBF
文件 4378 2011-11-24 20:07 MP3\mp3code\mp3code.CS_\FILE.FPT
文件 346624 2011-11-24 21:08 MP3\mp3code\mp3code.CS_\SYMBOL.CDX
文件 275289 2011-11-24 21:08 MP3\mp3code\mp3code.CS_\SYMBOL.DBF
文件 571346 2011-11-24 21:08 MP3\mp3code\mp3code.CS_\SYMBOL.FPT
文件 759 2011-11-24 19:00 MP3\mp3code\mp3code.cmd
文件 3536 2011-11-24 21:26 MP3\mp3code\mp3code.paf2
文件 1177 2011-11-24 16:15 MP3\mp3code\mp3code.pjt
文件 12620 2011-11-24 21:26 MP3\mp3code\mp3code.sbl
相关资源
- CCS5.05.1可使用的license
- 2017款解码软件v1.0.0.6
- 一种红外遥控编解码仿真
- mp3解析文档及其分析工具
- dsp2812上128点FFTc程序以及其CMD文件
- DSP28335程序片内FLASH搬运至RAM运行的
- MP3文件ID3v2ID3v2APEv2标签读取
- 曼彻斯特编解码_同步QuartusII工程
- L-Z编码L-Z解码
- QT,JPEG解码源代码(已完成)
- vc URL编解码类
- 基于DSP2812的以太网调试程序
- DSP与PC通讯的几种方法
- DSP 语音识别程序 DTW MFCC
- 创龙C66x平台GigE工业相机图像采集案例
- VC工程转Qt工程文件的工具
- VS1053B编解码器的VDR分布式声音采集卡
- 易语言搜搜mp3源码
- ETC中FM0解码器的设计
- 基于DSP的大功率开关电源的设计方案
- 基于DSP 56F801的正弦波输出DC/AC电源
- 基于DSP的大功率开关电源设计
- 基于ARM7和DSP的逆变电源设计电路
- H.264视频编码基本知识
- 基于运动控制器MCK2407的无刷直流电机
-
MP3Pla
yer播放器 - es(elasticsearch)整合SpringCloudSpringBo
- 音频测试文件pcmmp3aacamrg711ag711u等多种
- tms320c6748 DSP原理图 SCH PCB
- TMS320F280049最小系统原理图
评论
共有 条评论