www.pudn.com > bu1566.rar > BUxx_Sample.c
/* ************************************************************************ */ /* */ /* ROHM BU15xx demo firmware on MD2306 */ /* Client : ROHM Co., Ltd. */ /* End User : */ /* */ /* Processor: ARM-7TDMI(THUMB Mode) */ /* Dev.Env. : ARM-SDTv2.51 */ /* */ /* Sample Routines */ /* */ /* file : BUxx_Sample.c */ /* Auther : J.SATO(NTC) */ /* Date : 2004/Jul./1 */ /* */ /* Copyright (c) 2002-04 Naritagiken Co., Ltd. All rights reserved. */ /* ************************************************************************ */ /* ************************************************** */ /* INCLUDE FILES */ /* ************************************************** */ #include "BUxx_Sample.h" #include#include /* ************************************************** */ /* TYPEDEF */ /* ************************************************** */ /* ************************************************** */ /* LOCAL DEFINES */ /* ************************************************** */ /* ************************************************** */ /* GLOBAL VARIABLE */ /* ************************************************** */ /* ************************************************** */ /* CONST */ /* ************************************************** */ /* ************************************************** */ /* GLOBAL FUNCTIONS */ /* ************************************************** */ /* ************************************************** */ /* LOCAL FUNCTIONS */ /* ************************************************** */ //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void sStartPreview(void) { CAMSET cam; // aDSC_overlayframe_off(); // data_write(OVL_CNT, 0x0000); //william for overlay #if defined SENSOR_ROT90 cam.rot_h_vflip = sROT_ON | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = M_LCD_WSIZE ; cam.srky = M_LCD_WSIZE* 4 / 3; #else cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = M_LCD_HSIZE * 4 / 3; cam.srky = M_LCD_HSIZE; #endif cam.xsize = M_LCD_WSIZE; cam.ysize = M_LCD_HSIZE; 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; aDSC_Start_Preview(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, &cam); } void sExOverlayPreview(void) { CAMSET cam; // aDSC_ExOvlMemory_write_rgb565(OvlFrame_dat,0,0); // aDSC_ExOvlmemory_set(); // data_write(OVL_FRMST1, (86 << 8) | gl_ExOvl_High); //95,60 #if defined SENSOR_ROT90 cam.rot_h_vflip = sROT_ON | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = M_LCD_WSIZE ; cam.srky = M_LCD_WSIZE* 4 / 3; #else cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = M_LCD_HSIZE * 4 / 3; cam.srky = M_LCD_HSIZE; #endif cam.xsize = M_LCD_WSIZE; cam.ysize = M_LCD_HSIZE; 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; aDSC_Start_Preview(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, &cam); } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void sOverlayPreview(void) { CAMSET cam; //aDSC_fmemory_write_rgb565_2(frame_dat, 10, 10, 144, 176); // aDSC_fmemory_write_rgb565(OvlFrame_dat, 10, 60); aDSC_maskmemory_write(0, 0,144, 176, TRAN_KEY_COLOR); aDSC_overlayframe_on(); #if defined SENSOR_ROT90 cam.rot_h_vflip = sROT_ON | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = M_LCD_WSIZE ; cam.srky = M_LCD_WSIZE* 4 / 3; #else cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = M_LCD_HSIZE * 4 / 3; cam.srky = M_LCD_HSIZE; #endif cam.xsize = M_LCD_WSIZE; cam.ysize = M_LCD_HSIZE; 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; aDSC_Start_Preview(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, &cam); } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void sFilterSet(const int sel) { switch (sel) { case sDISABLE: aDSC_filter_set("disable"); break; case sTHD: aDSC_filter_set("thd", 0x0060); break; case sGRAY: aDSC_filter_set("gray"); break; case sSEPIA: aDSC_filter_set("sepia", 0x20, 0xf0, 0x0000); break; case sEMBOSS: aDSC_filter_set("emboss", 0x0d); break; case sEDGE1: aDSC_filter_set("edge1", 0x0001, 0x0d); break; case sEDGE2: aDSC_filter_set("edge2", 0x0b, 0x2f); break; case sNEGA: aDSC_filter_set("nega"); break; default: aDSC_filter_set("disable"); break; } } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void sJPEGFEncode(UINT16 * start_add, UINT32 * const jpeg_size) { aDSC_FrameEncode(start_add, jpeg_size, 0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0); aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE,0x00f8); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- #if 1 void sJPEGCEncode(UINT16 * start_add,const UINT16 je_q) { CAMSET cam; UINT16* p_u16JpgCode=(UINT16 *)(start_add+2); UINT32 u32JpgSize=JPEG_BUFFER; cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = CAM_HSIZE; cam.srky = CAM_VSIZE; cam.xsize = CAM_HSIZE; cam.ysize = CAM_VSIZE; 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; *start_add=0; *(start_add+1)=0; aDSC_CameraEncode(p_u16JpgCode, &u32JpgSize, &cam, je_q, sJE_HFLIP_OFF); *start_add=(UINT16)((u32JpgSize & 0xffff0000)>>16); *(start_add+1)=(UINT16)(u32JpgSize & 0x0000ffff); aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0x0000); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); } #else void sJPEGCEncode(UINT16 * start_add, UINT32 * const jpeg_size) { CAMSET cam; cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = CAM_HSIZE; cam.srky = CAM_VSIZE; cam.xsize = CAM_HSIZE; cam.ysize = CAM_VSIZE; 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; aDSC_CameraEncode(start_add, jpeg_size, &cam, 9, sJE_HFLIP_OFF); aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0x0000); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); // gl_bitstream_size = *jpeg_size; } #endif void sJPEGCEncode2(UINT16 * start_add,const UINT16 je_q) { CAMSET cam; UINT16* p_u16JpgCode=(UINT16 *)(start_add+2); UINT32 u32JpgSize=100*1024; cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = 320; cam.srky = 240; cam.xsize = 320; cam.ysize = 240; 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; *start_add=0; *(start_add+1)=0; aDSC_CameraEncode(p_u16JpgCode, &u32JpgSize, &cam, je_q, sJE_HFLIP_OFF); *start_add=(UINT16)((u32JpgSize & 0xffff0000)>>16); *(start_add+1)=(UINT16)(u32JpgSize & 0x0000ffff); aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0x0000); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void sJPEGDecode(UINT16 * start_add, UINT32 * const jpeg_size) { CAMSET cam; cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = M_LCD_WSIZE; cam.srky = M_LCD_HSIZE; cam.xsize = M_LCD_WSIZE; cam.ysize = M_LCD_HSIZE; cam.cst_x = 0; cam.cst_y = 0; cam.mst_x = 0; cam.mst_y = 0; aDSC_Decode(start_add, jpeg_size, &cam); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void sJPEGCameraDecode(UINT16 * start_add, UINT16 u16CstX, UINT16 u16CstY) { CAMSET cam; UINT16 *p_u16JpgCode=(UINT16 *)(start_add+2); UINT16 u16OvlPos=0; UINT32 u32JpgSize=0; sFilterSet(sDISABLE); u32JpgSize=(*start_add)<<16; u32JpgSize=u32JpgSize|(*(start_add+1)); if(*p_u16JpgCode!=0xd8ff) //if dec before enc, return { data_write(OVL_CNT,0x0000); return; } if((u16CstX/20)%2==0) u16OvlPos=(u16CstX/20)<<8; else u16OvlPos=(u16CstX/20+1)<<8; u16OvlPos = u16OvlPos | (u16CstY/20) ; data_write(OVL_FRMST1, u16OvlPos); //95,60 cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = CAM_HSIZE; cam.srky = CAM_VSIZE; cam.xsize = M_LCD_WSIZE; cam.ysize = M_LCD_HSIZE; cam.cst_x = u16CstX; cam.cst_y = u16CstY; cam.mst_x = 0; cam.mst_y = 0; aDSC_Decode(p_u16JpgCode, &u32JpgSize, &cam); wait(10); cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = CAM_HSIZE/10; cam.srky = CAM_VSIZE/10; cam.xsize = CAM_HSIZE/10; cam.ysize = CAM_VSIZE/10; cam.cst_x = 0; cam.cst_y = 0; cam.mst_x = 0; cam.mst_y = 0; aDSC_Decode(p_u16JpgCode, &u32JpgSize, &cam); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); } void sJPEGCameraDecode2(UINT16 * start_add, UINT16 u16Srkx, UINT16 u16Srky) { CAMSET cam; UINT16 *p_u16JpgCode=(UINT16 *)(start_add+2); UINT32 u32JpgSize=0; sFilterSet(sDISABLE); u32JpgSize=(*start_add)<<16; u32JpgSize=u32JpgSize|(*(start_add+1)); if(*p_u16JpgCode!=0xd8ff) //if dec before enc, return { data_write(OVL_CNT,0x0000); return; } cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = 128; cam.srky = 96; cam.xsize = M_LCD_WSIZE; cam.ysize = M_LCD_HSIZE; cam.cst_x = 0; cam.cst_y = 0; cam.mst_x = 0; cam.mst_y = 0; aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0x000000); aDSC_Decode(p_u16JpgCode, &u32JpgSize, &cam); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); } void sJPEGHostEnc(UINT16 * start_add, const UINT16 je_q) { } void sJPEGHostDec(UINT16 * start_add, UINT16* p_u16Rgb_addr) { CAMSET cam; UINT16 *p_u16JpgCode=(UINT16 *)(start_add+2); UINT32 u32JpgSize=0; sFilterSet(sDISABLE); u32JpgSize=(*start_add)<<16; u32JpgSize=u32JpgSize|(*(start_add+1)); if(*p_u16JpgCode!=0xd8ff) //if dec before enc, return { data_write(OVL_CNT,0x0000); return; } cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = 320; cam.srky = 240; cam.xsize = 320; cam.ysize = 240; cam.cst_x = 0; cam.cst_y = 0; cam.mst_x = 0; cam.mst_y = 0; aDSC_HostJpegDec(p_u16JpgCode, &u32JpgSize, p_u16Rgb_addr, &cam); } void sRgbRot(UINT16 * start_add, UINT32 rgb_size) { } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void sMultiShot(UINT16 * start_add, UINT32 * jpeg_size) { int i; CAMSET cam; CAMSET d_cam; UINT32 framesize[4]; framesize[0] = 0; for (i = 0; i < 3; i++) { framesize[i + 1] = framesize[i] + jpeg_size[i]; } #if defined SENSOR_ROT90 cam.rot_h_vflip = sROT_ON | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = M_LCD_WSIZE ; cam.srky = M_LCD_WSIZE* 4 / 3; #else cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = M_LCD_HSIZE * 4 / 3; cam.srky = M_LCD_HSIZE; #endif cam.xsize = M_LCD_WSIZE; cam.ysize = M_LCD_HSIZE; 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; d_cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; d_cam.srkx = M_LCD_WSIZE / 2; d_cam.srky = M_LCD_HSIZE / 2; if (d_cam.rot_h_vflip & sROT_ON) { d_cam.xsize = M_LCD_WSIZE / 2; d_cam.ysize = M_LCD_HSIZE / 2; d_cam.cst_x = (cam.srkx - cam.xsize) / 2 + 1; d_cam.cst_y = (cam.srky - cam.ysize) / 2; } else { d_cam.xsize = M_LCD_WSIZE / 2; d_cam.ysize = M_LCD_HSIZE / 2; d_cam.cst_x = (cam.srkx - cam.xsize) / 2 + 1; d_cam.cst_y = (cam.srky - cam.ysize) / 2; } d_cam.cst_x = 0; d_cam.cst_y = 0; d_cam.mst_x = 0; d_cam.mst_y = 0; aDSC_overlayframe_off(); for (i = 0; i < 4; i++) { aDSC_Start_Preview(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, &cam); wait(500); aDSC_FrameEncode(start_add + framesize[i] / 2, &jpeg_size[i], 0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0); aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0x0000); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); } for (i = 0; i < 4; i++) { d_cam.mst_x = (M_LCD_WSIZE / 2) * (i % 2); d_cam.mst_y = (M_LCD_HSIZE / 2) * (i / 2); if (aDSC_Decode ((start_add + framesize[i] / 2), &jpeg_size[i], &d_cam) != 0) break; //err wait(10); } aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); } //----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void sMotionJPEG_Preview(void) { CAMSET cam; aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0x0000); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); #if defined SENSOR_ROT90 cam.rot_h_vflip = sROT_ON | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = 80; cam.srky = 80* 4 / 3; #else cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = 80 * 4 / 3; cam.srky = 80; #endif cam.xsize = 80; cam.ysize = 80; 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 = (M_LCD_WSIZE - 80) / 2; cam.mst_y = (M_LCD_HSIZE - 80) / 2; aDSC_Start_Preview((M_LCD_WSIZE - 80) / 2, (M_LCD_HSIZE - 80) / 2, 80, 80, &cam); } //----------------------------------------------------------------------------- // Jpeg Decode dispose //----------------------------------------------------------------------------- void sMjEncode(UINT16 * start_add, UINT32 * jpeg_size) { UINT32 mj_framesize; UINT32 motionjpeg_size = *jpeg_size; CAMSET cam; #if defined SENSOR_ROT90 cam.rot_h_vflip = sROT_ON | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = 80; cam.srky = 80* 4 / 3; #else cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = 80 * 4 / 3; cam.srky = 80; #endif cam.xsize = 80; cam.ysize = 80; 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 = (M_LCD_WSIZE - 80) / 2; cam.mst_y = (M_LCD_HSIZE - 80) / 2; aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0xf800); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); *jpeg_size = 0; do { mj_framesize = 176 * 232; aDSC_Start_Preview((M_LCD_WSIZE - 80) / 2, (M_LCD_HSIZE - 80) / 2, 80, 80, &cam); aDSC_FrameEncode(start_add + *jpeg_size / 2, &mj_framesize, (M_LCD_WSIZE - 80) / 2, (M_LCD_HSIZE - 80) / 2, 80, 80, 0); *jpeg_size += mj_framesize; } while (*jpeg_size < motionjpeg_size - mj_framesize * 2); } //----------------------------------------------------------------------------- // Jpeg Decode dispose //----------------------------------------------------------------------------- int sMjDecode(UINT16 * start_add, UINT32 * jpeg_size) { UINT32 framesize; UINT32 decode_size = 0; int ret_code = 0; CAMSET cam; cam.rot_h_vflip = sROT_OFF | sHFLIP_OFF | sVFLIP_OFF; cam.srkx = 80; cam.srky = 80; cam.xsize = 80; cam.ysize = 80; cam.cst_x = 0; cam.cst_y = 0; cam.mst_x = (M_LCD_WSIZE - 80) / 2; cam.mst_y = (M_LCD_HSIZE - 80) / 2; aDSC_overlayframe_off(); aDSC_fmemory_clear(0, 0, M_LCD_WSIZE, M_LCD_HSIZE, 0x44ff); aDSC_data_trans_st(0, 0, M_LCD_WSIZE, M_LCD_HSIZE); do { framesize = 307200; //640*480 ret_code = aDSC_Decode(start_add + decode_size / 2, &framesize, &cam); if (ret_code != 0) break; //err aDSC_data_trans_st((M_LCD_WSIZE - 80) / 2, (M_LCD_HSIZE - 80) / 2, 80, 80); wait(132); decode_size += framesize; } while (*jpeg_size > (decode_size)); return (ret_code); } void sZoomPreview(INT16 u8Zoom) { CAMSET cam; #if defined SENSOR_ROT90 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_OFF; #else 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_OFF; #endif 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; #if 0 gl_dsc_status=sLEDMODE; wait_int0(bCAMST_MSK); bit_write(HWMODE2, bFRM_PRT, HIGH); // Frame protect ON wait_int0(bLCDED_MSK); cam_capture_set(&cam); bit_write(HWMODE2, bFRM_PRT, LOW); // Frame protect OFF gl_dsc_status=dummy_mode; #endif cam_capture_set(&cam); wait(50); // wait 50ms }