資源簡介
基于c的小尺寸JPEG解碼,程序源程序是日本的一個開源網站

代碼片段和文件信息
#include?“stm32f10x.h“
#include?“jpegdecode.h“?
#include?“TFT.h“
#include?“Systic.h“
#include?
#include?“integer.h“
//?以下3句宏定義在tjpgd.h中修改
static?int?MaskL?=?0;?
static?int?MaskR?=?DISP_XS?-?1;?
static?int?MaskT?=?0;?
static?int?MaskB?=?DISP_YS?-?1;?
extern?BYTE?whflag;
/*
u16?Covert_RGB565_to_BGR565(unsigned?short?inRGB)?
{?
????u16????outBGR?=?0;?
?????
????u16?rgb;?
????b?=?(inRGB????)?&?0x1F;?
????g?=?(inRGB>>?5)?&?0x3F;?
????r?=?(inRGB>>11)?&?0x1F;?
????outBGR?=?(b?<11)?|?(g?<5)?|?r;?
????return?outBGR;?
}?
*/
?
//?在屏幕上顯示圖片?
//?屏幕的起始地址在LCD_UPbase中保存?
void?STM32_disp_blt?(?
????????????????????????????int?left????????/*?Left?end?(-32768?to?32767)?*/?
????????????????????????????int?right????????/*?Right?end?(-32768?to?32767?>=left)?*/?
????????????????????????????int?top????????/*?Top?end?(-32768?to?32767)?*/?
????????????????????????????int?bottom????????/*?Bottom?end?(-32768?to?32767?>=right)?*/?
????????????????????????????const?uint16_t?*pat????/*?Pattern?data?*/?
????????????????????????)?
{?
????int?yc?xc;????
????u32?i;
u32?len=0;?
int?left2=0right2=7top2=0bottom2=7;
????if?(left?>?right?||?top?>?bottom)??
????{?
????????return;?????????????//?Check?varidity?
????}?
????if?(left?>?MaskR?||?right??MaskB?||?bottom?????{?
????????return;????????????????//?Check?if?in?active?area??
????}?????
????yc?=?bottom?-?top??+?1;????//?Vertical?size??
????xc?=?right??-?left?+?1;??
????if?(top?????{?
????????pat+=?xc?*?(MaskT?-?top);?
????????yc?-=?MaskT?-?top;?
????????top?=?MaskT;?
????}?
????if?(bottom?>?MaskB)?????//?Clip?bottom?of?source?image?if?it?is?out?of?active?area??
????{?
????????yc?-=?bottom?-?MaskB;?
????????bottom?=?MaskB;?
????}?
????if?(left?????{?
????????pat?+=?MaskL?-?left;?
????????xc?-=?MaskL?-?left;??
????????left?=?MaskL;?
????}?
????if?(right?>?MaskR)?????????//?Clip?right?of?source?image?it?is?out?of?active?area?
????{?
????????xc?-=?right?-?MaskR;?
????????right?=?MaskR;?
????}?
????//?已經計算出了要繪制的x方向pixels和y方向pixels?
????//?上下左右的值已經校正為,為屏幕上的絕對位置,由此可以算出屏幕緩沖區的起始位置?
?????
if(whflag==1)
{
// top2=320-bottom-1;
// bottom2=320-top-1;
// if(left2?!=?left)
// {
// top2+=(left-left2);
// bottom2+=(left-left2);
// left=left2;
// right=right2;
// }
// LCD_Set_Window(lefttop2rightbottom2);
// LCD_Scan_Dir(D2U_L2R);//從下到上從左到右
// LCD_SetCursor(left320-bottom);//設置光標位置
????????//果然解碼的順序是從上到下,從左至右的
//顯示順序用從下到上就不對了!
LCD_Set_Window(lefttoprightbottom);
LCD_Scan_Dir(U2D_L2R);//從上到下從左到右
LCD_SetCursor(lefttop);//設置光標位置
// left2=left;
// right2=right;
}
else
{
LCD_Set_Window(lefttoprightbottom);
LCD_Scan_Dir(L2R_U2D);//從左到右從上到下
LCD_SetCursor(lefttop);//設置光標位置?
}
// LCD_WriteRAM
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????856??2010-04-24?23:45??integer.h
?????文件???????5231??2012-03-21?21:37??jpegdecode.c
?????文件????????241??2012-03-14?16:15??jpegdecode.h
?????文件??????36309??2012-03-21?21:30??tjpgd.c
?????文件???????3546??2012-03-14?11:29??tjpgd.h
-----------?---------??----------?-----??----
????????????????46183????????????????????5
評論
共有 條評論