📄 w_interface.c
字号:
}while (gv_VideoData.u32JpgSize < MJPEG_BUFFER - u32FrameByteSize * 2 - 1000);
}
break;
default:
break;
}
}
void fJpegDec(void)
{
if (gv_VideoData.u32JpgSize == 0)
return;
aDRT_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0x0000ff);
wait(500);
aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0x0000);
bit_write(OVL_CNT, 3, LOW); //switch off OSD
switch (gv_VideoData.u16JpgFunc)
{
case SIGLESHOT:
{
aDSC_Decode(gv_VideoData.p_u16JpgCode, &gv_VideoData.u32JpgSize,
gv_VideoData.p_DecSize);
aDSC_data_trans_st(gv_VideoData.p_DecSize->mst_x,
gv_VideoData.p_DecSize->mst_y,
gv_VideoData.p_DecSize->xsize, gv_VideoData.p_DecSize->ysize);
}
break;
case MULTISHOT:
{
UINT32 u32DecodeByteSize = 0, u32FrameSize = 0;
do
{
u32FrameSize = 0;
u32FrameSize = *(gv_VideoData.p_u16JpgCode + u32DecodeByteSize / 2);
u32FrameSize <<= 16;
u32FrameSize |= *(gv_VideoData.p_u16JpgCode + u32DecodeByteSize / 2 + 1);
aDSC_Decode(gv_VideoData.p_u16JpgCode + u32DecodeByteSize / 2 + 2,
&u32FrameSize, &tCamDec128x96);
u32DecodeByteSize += u32FrameSize + 4;
aDSC_data_trans_st(tCamDec128x96.mst_x,
tCamDec128x96.mst_y,
tCamDec128x96.xsize,
tCamDec128x96.ysize);
wait(500);
}
while (gv_VideoData.u32JpgSize > u32DecodeByteSize);
}
break;
case MOTIONJPEG:
{
UINT32 u32DecodeByteSize = 0, u32FrameSize = 0;
do
{
u32FrameSize = 0;
u32FrameSize = *(gv_VideoData.p_u16JpgCode + u32DecodeByteSize / 2);
u32FrameSize <<= 16;
u32FrameSize |= *(gv_VideoData.p_u16JpgCode + u32DecodeByteSize / 2 + 1);
aDSC_Decode(gv_VideoData.p_u16JpgCode + u32DecodeByteSize / 2 + 2,
&u32FrameSize, &tCamDec80x80);
u32DecodeByteSize += u32FrameSize + 4;
aDSC_data_trans_st(tCamDec80x80.mst_x,
tCamDec80x80.mst_y,
tCamDec80x80.xsize,
tCamDec80x80.ysize);
wait(100);
}
while (gv_VideoData.u32JpgSize > u32DecodeByteSize);
}
break;
default:
break;
}
}
void fZoom(INT16 u8Zoom)
{
CAMSET cam;
/* MT9M111_SENSOR
static UINT16 sHoriZoom=M_LCD_WSIZE;
static UINT16 sVertZoom=M_LCD_WSIZE* 4 / 3;
INT16 u16HoriZoomStep=3*u8Zoom;
INT16 u16VertZoomStep=4*u8Zoom;
UINT16 u16CamWidth=CAM_VSIZE;
UINT16 u16CamHight=CAM_HSIZE;
cam.rot_h_vflip = sROT_ON | sHFLIP_OFF | sVFLIP_ON;
*/
static UINT16 sHoriZoom = M_LCD_HSIZE * 4 / 3;
static UINT16 sVertZoom = M_LCD_HSIZE;
INT16 u16HoriZoomStep = 4 * u8Zoom;
INT16 u16VertZoomStep = 3 * u8Zoom;
UINT16 u16CamWidth = CAM_HSIZE;
UINT16 u16CamHight = CAM_VSIZE;
cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_ON;
aDSC_overlayframe_off();
cam.xsize = M_LCD_WSIZE;
cam.ysize = M_LCD_HSIZE;
if ((((sHoriZoom + u16HoriZoomStep) <= u16CamWidth)
&& ((sHoriZoom + u16HoriZoomStep) >= cam.xsize))
&& (((sVertZoom + u16VertZoomStep) <= u16CamHight)
&& ((sVertZoom + u16VertZoomStep) >= cam.ysize)))
{
sHoriZoom += u16HoriZoomStep;
sVertZoom += u16VertZoomStep;
}
cam.srkx = sHoriZoom;
cam.srky = sVertZoom;
if (cam.rot_h_vflip & sROT_ON)
{
cam.cst_x = (cam.srkx - cam.xsize) / 2;
cam.cst_y = (cam.srky - cam.ysize) / 2 + 1;
if (cam.cst_y % 2)
cam.cst_y--;
}
else
{
cam.cst_x = (cam.srkx - cam.xsize) / 2 + 1;
cam.cst_y = (cam.srky - cam.ysize) / 2;
if (cam.cst_x % 2)
cam.cst_x--;
}
cam.mst_x = 0;
cam.mst_y = 0;
cam_capture_set(&cam);
wait(50); // wait 50ms
}
static void fFillExOvlMirror(c_ItemBase * p_Item)
{
UINT8 font_cnt;
const UINT16 *font_data;
char *string;
*gl_pExOvlMem_Buf = p_Item->p_ExOverlay1->u16FmXsize;
*(gl_pExOvlMem_Buf + 1) = p_Item->p_ExOverlay1->u16FmYsize + p_Item->p_ExOverlay2->u16FmYsize;
memset((UINT8 *) gl_pExOvlMem_Buf + 4, 0x00, EXOVLMEM_BUF_SIZE - 4);
bit_write(OVL_CNT, 3, LOW); //switch off OSD
if (p_Item->p_ExOverlay1->u16OvlOpen) //set ex-overlay1 string
{
bit_write(OVL_CNT, 1 << 1, HIGH);
string = p_Item->szOvl1Str;
for (font_cnt = 0; (font_cnt < 10) || (*string != '\0'); font_cnt++)
{
if (*string != '\0')
{
font_data = fonttable[*string];
fFillStrExOvlMirror(font_data, p_Item->p_ExOverlay1, font_cnt);
string++;
}
}
}
if (p_Item->p_ExOverlay2->u16OvlOpen) //set ex-overlay2 string
{
bit_write(OVL_CNT, 1 << 0, HIGH);
string = p_Item->szOvl2Str;
for (font_cnt = 0; (font_cnt < 10) || (*string != '\0'); font_cnt++)
{
if (*string != '\0')
{
font_data = fonttable[*string];
fFillStrExOvlMirror(font_data, p_Item->p_ExOverlay2, font_cnt);
string++;
}
}
}
fExOvlParamSet(p_Item->p_ExOverlay1, p_Item->p_ExOverlay2);
aDSC_ExOvlMemory_write_rgb565(gl_pExOvlMem_Buf);
}
static void fFillStrExOvlMirror(const UINT16 * rgb_data, EXOVLSET * p_ExOverlay,
const UINT8 font_cnt)
{
UINT16 xsize, ysize;
int width, height;
UINT32 u32HeightOffset = 0;
UINT32 u32WidthOffset = 0;
UINT16 st_x, st_y;
UINT8 space = 2;
st_x = p_ExOverlay->u16ExmSt_x + (space + 4) * font_cnt;
st_y = p_ExOverlay->u16ExmSt_y;
xsize = *rgb_data;
rgb_data++;
ysize = *rgb_data;
rgb_data++;
for (height = 0; height < ysize; height++)
{
u32HeightOffset = p_ExOverlay->u16OvlIndex * p_ExOverlay->u16FmYsize + st_y + height;
u32HeightOffset *= p_ExOverlay->u16FmXsize;
for (width = 0; width < xsize; width++)
{
u32WidthOffset = st_x + width;
u32WidthOffset += u32HeightOffset;
if (*rgb_data != p_ExOverlay->u16TransColor)
{
*(gl_pExOvlMem_Buf + 2 + u32WidthOffset) = *rgb_data;
}
else
{
*(gl_pExOvlMem_Buf + 2 + u32WidthOffset) = *rgb_data+1;
}
rgb_data++;
}
}
}
static void fExOvlParamSet(EXOVLSET * p_ExOverlay1, EXOVLSET * p_ExOverlay2)
{
UINT16 u16Ovl_H, u16Ovl_V;
u16Ovl_H = p_ExOverlay1->u16FmXsize;
u16Ovl_V = p_ExOverlay1->u16FmYsize + p_ExOverlay2->u16FmYsize;
if (p_ExOverlay1->u16TransEnable)
bit_write(OVL_CNT, 1 << 4, HIGH); //transparent color enable
else
bit_write(OVL_CNT, 1 << 4, LOW);
data_write(OVL_TRANS, p_ExOverlay1->u16TransColor);
data_write(OVL_TRMSK, p_ExOverlay1->u16MaskColor);
data_write(OVLSIZE, (u16Ovl_H << 8) | u16Ovl_V);
data_write(OVL_ST1, 0x0000);
data_write(OVL_ED1, ((u16Ovl_H - 1) << 8) | (u16Ovl_V / 2 - 1));
data_write(OVL_FRMST1, (p_ExOverlay1->u16FmSt_x << 8) | p_ExOverlay1->u16FmSt_y);
data_write(OVL_ST2, u16Ovl_V / 2);
data_write(OVL_ED2, ((u16Ovl_H - 1) << 8) | (u16Ovl_V - 1));
data_write(OVL_FRMST2, (p_ExOverlay2->u16FmSt_x << 8) | p_ExOverlay2->u16FmSt_y);
}
#endif //_BU1563API_INTERFACE_
#undef _W_INTERFACE_C_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -