📄 jpgdecfillbuf.c
字号:
//
//
//
#include "JpgDecFillBuf.h"
#include "JpegBitstreamProcess.h"
#include "../../ImageWin/ImageDecodeMain.h"
// 双Buffer , 为DSP 准备码流
__align(32) unsigned char Jpg_gInBuf[2][JPGD_INBUFSIZE];
extern unsigned char *ImageLCDLogicBuf;
extern void DelayMs_nops(unsigned int Counter);
//
// 为DSP 准备码流数据
// 1: 成功;0:出错
long RK27_JPEGDEC_FillBuf(void)
{
unsigned long bytes_read, NumOfMS = 0;
volatile JPGArmZspCom *share = (JPGArmZspCom *)JPG_COM_DRAM_ADR;
long Index;
long c = 0;
long r = 0;
//initialization to share
share->JpgInputBuf = (long) & Jpg_gInBuf[0][0]; // 码流输入Buffer
share->JpgOutputBuf = (long)ImageBufAddr; // RGB 输出Buffer
share->JpgInputBufStatus[1] = share->JpgInputBufStatus[0] = JPG_DATA_EMPTY;
share->JpgDecStatus = JPG_DEC_DECODING;
Index = 0;
JpgDecBitStreamInit();
while (1)
{
if (share->JpgDecStatus != JPG_DEC_DECODING)
break; // 解码结束
//if() // 收到强制退出解码命令时
//{
// DelayMs_nops(200); // 在这段时间内必须保证DSP 结束操作
// break;
//}
while (share->JpgInputBufStatus[Index] != JPG_DATA_EMPTY)
{
if (share->JpgDecStatus != JPG_DEC_DECODING)
break;
}
//bytes_read = FSFileRead((void *)((unsigned long)share->JpgInputBuf+Index*JPGD_INBUFSIZE), JPGD_INBUFSIZE, pImageFile);
bytes_read = JpgDecGetGivenBitStream((unsigned char*)((unsigned long)share->JpgInputBuf + Index * JPGD_INBUFSIZE), JPGD_INBUFSIZE);
share->JpgInputBufStatus[Index] = JPG_DATA_FULL;
if (bytes_read < JPGD_INBUFSIZE)
{
while (share->JpgDecStatus == JPG_DEC_DECODING)//若等待超过1秒,强制退出
{
DelayMs_nops(1);
if (NumOfMS++ >= 1000)
break;
}
break; // 文件读完
}
Index = (Index + 1) % 2;
}
g_bufferwidth = share->JpgDecOutputWidth;
g_bufferheight = share->JpgDecOutputHeight;
if (share->JpgDecStatus != JPG_DEC_SUCCESS)
return 0;
else
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -