fh = (FrameHeader *) malloc(sizeof(FrameHeader));
si = (SideInfo *) malloc(sizeof(SideInfo));
sfi = (ScaleFactorInfo *) malloc(sizeof(ScaleFactorInfo));
hi = (HuffmanInfo *) malloc(sizeof(HuffmanInfo));
di = (DequantInfo *) malloc(sizeof(DequantInfo));
mi = (IMDCTInfo *) malloc(sizeof(IMDCTInfo));
sbi = (SubbandInfo *) malloc(sizeof(SubbandInfo));
if (!fh || !si || !sfi || !hi || !di || !mi || !sbi) {
FreeBuffers(mp3DecInfo); /* safe to call - only frees memory that was successfully allocated */
return 0;
}
#endif
#if USE_STATIC
/* MP3解码器静态内存 23816 bytes */
/*
* Use static buffers to make the RAM usage
* known at compile time.
*/
static MP3DecInfo s_mp3DecInfo;
ClearBuffer(mp3DecInfo, sizeof(MP3DecInfo));
// important to do this - DSP primitives assume a bunch of state variables are 0 on first use
ClearBuffer(fh, sizeof(FrameHeader));
ClearBuffer(si, sizeof(SideInfo));
ClearBuffer(sfi, sizeof(ScaleFactorInfo));
ClearBuffer(hi, sizeof(HuffmanInfo));
ClearBuffer(di, sizeof(DequantInfo));
ClearBuffer(mi, sizeof(IMDCTInfo));
ClearBuffer(sbi, sizeof(SubbandInfo));
我说的这个全是C语言的。。。
你好,还是会出现上面的 .s 的错误,
现在关键的是 .s 的汇编文件通不过,如果你有修改好的,能否提供一下啊 ??
不是提供给你了么?
删掉你原来的库,.c/.h/.s一个都不要留。
把我上传的库加入你的工程,检查一下buffer.c就行了。
你好,增加工程后,编译时提示 缺少 #include "player.h" 这个头文件 ?
另外错误主要出现在 这个函数里面
#define USE_MALLOC 1
MP3DecInfo *AllocateBuffers(void)
{
MP3DecInfo *mp3DecInfo;
FrameHeader *fh;
SideInfo *si;
ScaleFactorInfo *sfi;
HuffmanInfo *hi;
DequantInfo *di;
IMDCTInfo *mi;
SubbandInfo *sbi;
#if USE_MALLOC
/* 使用动态内存分配 */
mp3DecInfo = (MP3DecInfo *)malloc(sizeof(MP3DecInfo));
if (!mp3DecInfo) {
return 0;
}
ClearBuffer(mp3DecInfo, sizeof(MP3DecInfo));
fh = (FrameHeader *) malloc(sizeof(FrameHeader));
si = (SideInfo *) malloc(sizeof(SideInfo));
sfi = (ScaleFactorInfo *) malloc(sizeof(ScaleFactorInfo));
hi = (HuffmanInfo *) malloc(sizeof(HuffmanInfo));
di = (DequantInfo *) malloc(sizeof(DequantInfo));
mi = (IMDCTInfo *) malloc(sizeof(IMDCTInfo));
sbi = (SubbandInfo *) malloc(sizeof(SubbandInfo));
if (!fh || !si || !sfi || !hi || !di || !mi || !sbi) {
FreeBuffers(mp3DecInfo); /* safe to call - only frees memory that was successfully allocated */
return 0;
}
#endif
#if USE_STATIC
/* MP3解码器静态内存 23816 bytes */
/*
* Use static buffers to make the RAM usage
* known at compile time.
*/
static MP3DecInfo s_mp3DecInfo;
ClearBuffer(mp3DecInfo, sizeof(MP3DecInfo));
static FrameHeader s_fh;
static SideInfo s_si;
static ScaleFactorInfo s_sfi;
static HuffmanInfo s_hi;
static DequantInfo s_di;
static IMDCTInfo s_mi;
static SubbandInfo s_sbi;
mp3DecInfo = &(s_mp3DecInfo); /* player.c mowin add */
fh = &(s_fh);
si = &(s_si);
sfi = &(s_sfi);
hi = &(s_hi);
di = &(s_di);
mi = &(s_mi);
sbi = &(s_sbi);
#endif
#if 1
// 使用全局共享内存
struct player_st *pl = get_player_data(); // 这个函数没有 及类型不对 ???
mp3DecInfo = (void *)pl->uni_24kb_buf;
ClearBuffer(mp3DecInfo, sizeof(MP3DecInfo));
fh = (void *) ((uint8_t *)mp3DecInfo + sizeof(MP3DecInfo));
si = (void *) ((uint8_t *)fh + sizeof(FrameHeader));
sfi = (void *) ((uint8_t *)si + sizeof(SideInfo));
hi = (void *) ((uint8_t *)sfi + sizeof(ScaleFactorInfo));
di = (void *) ((uint8_t *)hi + sizeof(HuffmanInfo));
mi = (void *) ((uint8_t *)di + sizeof(DequantInfo));
sbi = (void *) ((uint8_t *)mi + sizeof(IMDCTInfo));
if ((uint32_t)((uint8_t *)sbi + sizeof(SubbandInfo)) > (uint32_t)((uint8_t *)pl->uni_24kb_buf + 24*1024) - 1)
return 0;
#endif
mp3DecInfo->FrameHeaderPS = (void *)fh;
mp3DecInfo->SideInfoPS = (void *)si;
mp3DecInfo->ScaleFactorInfoPS = (void *)sfi;
mp3DecInfo->HuffmanInfoPS = (void *)hi;
mp3DecInfo->DequantInfoPS = (void *)di;
mp3DecInfo->IMDCTInfoPS = (void *)mi;
mp3DecInfo->SubbandInfoPS = (void *)sbi;
// important to do this - DSP primitives assume a bunch of state variables are 0 on first use
ClearBuffer(fh, sizeof(FrameHeader));
ClearBuffer(si, sizeof(SideInfo));
ClearBuffer(sfi, sizeof(ScaleFactorInfo));
ClearBuffer(hi, sizeof(HuffmanInfo));
ClearBuffer(di, sizeof(DequantInfo));
ClearBuffer(mi, sizeof(IMDCTInfo));
ClearBuffer(sbi, sizeof(SubbandInfo));
return mp3DecInfo;
}
上面的定义 #if USE_MALLOC
#if USE_STATIC 这两个选择其一就可以了把,
另外出现的错误如下:
wwww.png (70.06 KB, 下载次数: 0)
下载附件
2017-5-16 23:03 上传
一周热门 更多>