//////////////////////////////////////////////////////////////////////////////// #include "System/SysCommon.h" #include "WiFiIpc/nvtwifi.h" #include "UIDateImprint.h" #include "UIDateImprintID.h" #include "Mode/UIMode.h" #include "PhotoFastCapDateImprint.h" #include "UIAppPhoto.h" #include "GxVideoFile.h" #include #include "kwrap/type.h" #include "vf_gfx.h" #include "PhotoFastCapDateImprint.h" #include "vendor_isp.h" #define THIS_DBGLVL 2 // 0=FATAL, 1=ERR, 2=WRN, 3=UNIT, 4=FUNC, 5=IND, 6=MSG, 7=VALUE, 8=USER /////////////////////////////////////////////////////////////////////////////// #define __MODULE__ PhotoFastCapDateImprint #define __DBGLVL__ ((THIS_DBGLVL>=PRJ_DBG_LVL)?THIS_DBGLVL:PRJ_DBG_LVL) #define __DBGFLT__ "*" //*=All, [mark]=CustomClass #include #if defined(_UI_STYLE_LVGL_) #include "UIApp/lv_user_font_conv/lv_user_font_conv.h" /* YUV color key */ #define CKEY_Y 0xFF #define CKEY_U 0xFF #define CKEY_V 0xFF #define CKEY ((CKEY_Y & 0xFF) | ((CKEY_U & 0xFF) << 8) | ((CKEY_V & 0xFF) << 16)) #define LV_USER_FONT_CONV_ALIGN_W 8 #define LV_USER_FONT_CONV_ALIGN_H 2 #define IMG_ID LV_PLUGIN_IMG_ID_ICON_ADAS_CAL_M #define STRING "Novatek Hunting Camera Demo" #define FONT LV_USER_CFG_STAMP_FONT_ID_MEDIUM typedef struct { lv_user_font_conv_draw_cfg draw_cfg; lv_user_font_conv_mem_cfg mem_cfg; lv_user_font_conv_calc_buffer_size_result buff_size; } PhotoFastCapDateImprint_Info; char photo_aesteam[64]={0}; extern UINT16 IRSHTTER; extern UINT32 Cap_cnt; extern UINT32 ae_preset_exp; extern UINT32 ae_preset_iso; void PhotoStamp_get_isp_status_jpg(UINT32 id, char* Buf, UINT32 BufLen) { AET_STATUS_INFO ae_status = {0}; AWBT_STATUS awb_status = {0}; IQT_WDR_PARAM wdr = {0}; //IQT_3DNR_PARAM nr_3d = {0}; //IQT_DEFOG_PARAM defog = {0}; id = 0; ae_status.id = id; if(vendor_isp_init()== HD_ERR_NG) DBG_ERR("init error\r\n"); vendor_isp_get_ae(AET_ITEM_STATUS, &ae_status); awb_status.id = id; vendor_isp_get_awb(AWBT_ITEM_STATUS, &awb_status); wdr.id = id; vendor_isp_get_iq(IQT_ITEM_WDR_PARAM, &wdr); //nr_3d.id= id; //vendor_isp_get_iq(IQT_ITEM_3DNR_PARAM, &nr_3d); //defog.id = id; //vendor_isp_get_iq(IQT_ITEM_DEFOG_PARAM, &defog); struct tm Curr_gsDateTime ={0}; Curr_gsDateTime = hwclock_get_time(TIME_ID_CURRENT); //sprintf(strStampDateTime, "%04d/%02d/%02d %02d:%02d:%02d", Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec); #if 1 //snprintf(Buf, BufLen, "%d %d %3d %4d %4d %4d %4d %d %4d %4d %4d %4d %04d/%02d/%02d %02d:%02d:%02d %d%c", //snprintf(Buf, BufLen, "6 %d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c",// %d%c", /*snprintf(Buf, BufLen, "%d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c %04d/%02d/%02d %02d:%02d:%02d", (INT)(ae_status.status_info.iso_gain[0]), (INT)(ae_status.status_info.expotime[0]), (INT)(ae_status.status_info.lv/100000), (INT)(ae_status.status_info.lum), (INT)(ae_status.status_info.expect_lum), (INT)(ae_status.status_info.overexp_adj), (INT)(ae_status.status_info.overexp_cnt), (INT)(wdr.wdr.enable), (INT)(awb_status.status.cur_r_gain), (INT)(awb_status.status.cur_g_gain), (INT)(awb_status.status.cur_b_gain), (INT)(awb_status.status.cur_ct), (INT)(IRSHTTER), Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec, //(INT)(Init_Adc), //(INT)(nr_3d._3dnr.enable), '\0' );*/ //DBG_DUMP("isp Buf=%s\r\n",Buf); snprintf(Buf, BufLen, "%d %d %3d %d %d %3d %3d %3d %4d %d %d %d %d %02d/%02d %02d:%02d:%02d", (INT)(ae_status.status_info.state_adj), (INT)(ae_status.status_info.lum), (INT)(ae_status.status_info.expect_lum), (INT)(ae_status.status_info.iso_gain[0]), (INT)(ae_status.status_info.expotime[0]), (INT)(ae_status.status_info.lv/100000), (INT)(awb_status.status.cur_r_gain), (INT)(awb_status.status.cur_b_gain), (INT)(awb_status.status.cur_ct), IRSHTTER, Cap_cnt, ae_preset_exp, ae_preset_iso, //Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec); printf("%s:%d Buf=%s\r\n",__FUNCTION__,__LINE__,Buf); #endif vendor_isp_uninit(); return; } void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen) { AET_STATUS_INFO ae_status = {0}; AWBT_STATUS awb_status = {0}; IQT_WDR_PARAM wdr = {0}; //IQT_3DNR_PARAM nr_3d = {0}; //IQT_DEFOG_PARAM defog = {0}; id = 0; ae_status.id = id; if(vendor_isp_init()== HD_ERR_NG) DBG_ERR("init error\r\n"); vendor_isp_get_ae(AET_ITEM_STATUS, &ae_status); awb_status.id = id; vendor_isp_get_awb(AWBT_ITEM_STATUS, &awb_status); wdr.id = id; vendor_isp_get_iq(IQT_ITEM_WDR_PARAM, &wdr); //nr_3d.id= id; //vendor_isp_get_iq(IQT_ITEM_3DNR_PARAM, &nr_3d); //defog.id = id; //vendor_isp_get_iq(IQT_ITEM_DEFOG_PARAM, &defog); struct tm Curr_gsDateTime ={0}; Curr_gsDateTime = hwclock_get_time(TIME_ID_CURRENT); //sprintf(strStampDateTime, "%04d/%02d/%02d %02d:%02d:%02d", Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec); #if 1 //snprintf(Buf, BufLen, "%d %d %3d %4d %4d %4d %4d %d %4d %4d %4d %4d %04d/%02d/%02d %02d:%02d:%02d %d%c", //snprintf(Buf, BufLen, "6 %d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c",// %d%c", /*snprintf(Buf, BufLen, "%d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c %04d/%02d/%02d %02d:%02d:%02d", (INT)(ae_status.status_info.iso_gain[0]), (INT)(ae_status.status_info.expotime[0]), (INT)(ae_status.status_info.lv/100000), (INT)(ae_status.status_info.lum), (INT)(ae_status.status_info.expect_lum), (INT)(ae_status.status_info.overexp_adj), (INT)(ae_status.status_info.overexp_cnt), (INT)(wdr.wdr.enable), (INT)(awb_status.status.cur_r_gain), (INT)(awb_status.status.cur_g_gain), (INT)(awb_status.status.cur_b_gain), (INT)(awb_status.status.cur_ct), (INT)(IRSHTTER), Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec, //(INT)(Init_Adc), //(INT)(nr_3d._3dnr.enable), '\0' );*/ //DBG_DUMP("isp Buf=%s\r\n",Buf); snprintf(Buf, BufLen, "ae_adj:%d cur_lum:%d target_lum:%3d iso:%d exp:%d lv:%3d awbrg:%3d awbbg:%3d ct:%4d adc:%d aecnt:%d preae_exp:%d preae_iso:%d %04d/%02d/%02d %02d:%02d:%02d", (INT)(ae_status.status_info.state_adj), (INT)(ae_status.status_info.lum), (INT)(ae_status.status_info.expect_lum), (INT)(ae_status.status_info.iso_gain[0]), (INT)(ae_status.status_info.expotime[0]), (INT)(ae_status.status_info.lv/100000), (INT)(awb_status.status.cur_r_gain), (INT)(awb_status.status.cur_b_gain), (INT)(awb_status.status.cur_ct), IRSHTTER, Cap_cnt, ae_preset_exp, ae_preset_iso, Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec); printf("%s:%d Buf=%s\r\n",__FUNCTION__,__LINE__,Buf); #endif vendor_isp_uninit(); return; } //static PhotoFastCapDateImprint_Info stamp_img = {0}; static PhotoFastCapDateImprint_Info stamp_text = {0}; static void* custom_stamp_va = 0; static UINT32 custom_stamp_pa = 0; void PhotoFastCapDateImprint_InitBuff(void) { HD_RESULT ret; void *va; UINT32 pa; UINT32 size; HD_COMMON_MEM_DDR_ID ddr_id = DDR_ID0; HD_VIDEO_PXLFMT out_fmt = HD_VIDEO_PXLFMT_YUV420; lv_color32_t color32; /****************************************************************************** * Stamp image ******************************************************************************/ // lv_user_font_conv_draw_cfg_init(&stamp_img.draw_cfg); // // stamp_img.draw_cfg.align_w = LV_USER_FONT_CONV_ALIGN_W; // stamp_img.draw_cfg.align_h = LV_USER_FONT_CONV_ALIGN_H; // stamp_img.draw_cfg.fmt = out_fmt; // stamp_img.draw_cfg.mode = LV_USER_FONT_CONV_DRAW_IMG; //#if LV_COLOR_DEPTH == 8 // extern uint32_t palette_define[]; // stamp_img.draw_cfg.img.palette = palette_define; //#else // stamp_img.draw_cfg.img.palette = NULL; //#endif // stamp_img.draw_cfg.img.id = IMG_ID; // // stamp_img.draw_cfg.key_y = CKEY_Y; // stamp_img.draw_cfg.key_u = CKEY_U; // stamp_img.draw_cfg.key_v = CKEY_V; // // lv_user_font_conv_calc_buffer_size(&stamp_img.draw_cfg, &stamp_img.buff_size); /****************************************************************************** * Stamp text ******************************************************************************/ printf("[%s:%d] s\n",__FUNCTION__,__LINE__); #if PHOTO_STAMP_ISP_STATUS == ENABLE memset(photo_aesteam, '\0', sizeof(photo_aesteam)); PhotoStamp_get_isp_status_jpg(0,&photo_aesteam[0],64); #endif lv_user_font_conv_draw_cfg_init(&stamp_text.draw_cfg); stamp_text.draw_cfg.align_w = LV_USER_FONT_CONV_ALIGN_W; stamp_text.draw_cfg.align_h = LV_USER_FONT_CONV_ALIGN_H; stamp_text.draw_cfg.fmt = out_fmt; stamp_text.draw_cfg.mode = LV_USER_FONT_CONV_DRAW_TEXT; stamp_text.draw_cfg.radius = LV_USER_CFG_STAMP_RADIUS; stamp_text.draw_cfg.string.letter_space = LV_USER_CFG_STAMP_LETTER_SPACE; stamp_text.draw_cfg.string.align = LV_USER_CFG_STAMP_TEXT_ALIGN; #if PHOTO_STAMP_ISP_STATUS == ENABLE stamp_text.draw_cfg.string.text = &photo_aesteam[0];// STRING; #else stamp_text.draw_cfg.string.text = STRING; #endif stamp_text.draw_cfg.string.font = (lv_font_t *)lv_plugin_get_font(LV_USER_CFG_STAMP_FONT_ID_MEDIUM)->font; stamp_text.draw_cfg.ext_w = LV_USER_CFG_STAMP_EXT_WIDTH; stamp_text.draw_cfg.ext_h = LV_USER_CFG_STAMP_EXT_HEIGHT; stamp_text.draw_cfg.border.width = LV_USER_CFG_STAMP_BORDER_WIDTH; /* text color */ color32.full = LV_USER_CFG_STAMP_COLOR_TEXT; stamp_text.draw_cfg.string.color = LV_COLOR_MAKE(color32.ch.red, color32.ch.green, color32.ch.blue); stamp_text.draw_cfg.string.opa = LV_COLOR_GET_A32(color32); /* bg color */ color32.full = LV_USER_CFG_STAMP_COLOR_BACKGROUND; stamp_text.draw_cfg.bg.color = LV_COLOR_MAKE(color32.ch.red, color32.ch.green, color32.ch.blue); stamp_text.draw_cfg.bg.opa = LV_COLOR_GET_A32(color32); /* border color */ color32.full = LV_USER_CFG_STAMP_COLOR_FRAME; stamp_text.draw_cfg.border.color = LV_COLOR_MAKE(color32.ch.red, color32.ch.green, color32.ch.blue); stamp_text.draw_cfg.border.opa = LV_COLOR_GET_A32(color32); stamp_text.draw_cfg.border.width = LV_USER_CFG_STAMP_BORDER_WIDTH; stamp_text.draw_cfg.key_y = CKEY_Y; stamp_text.draw_cfg.key_u = CKEY_U; stamp_text.draw_cfg.key_v = CKEY_V; lv_user_font_conv_calc_buffer_size(&stamp_text.draw_cfg, &stamp_text.buff_size); /* allocate size of the larger one */ // if(stamp_text.buff_size.output_buffer_size > stamp_img.buff_size.output_buffer_size){ // size = stamp_text.buff_size.output_buffer_size; // } // else{ // size = stamp_img.buff_size.output_buffer_size; // } size = stamp_text.buff_size.output_buffer_size; ret = hd_common_mem_alloc("custom_stamp_buffer", &pa, (void **)&va, size, ddr_id); if (ret != HD_OK) { DBG_ERR("custom_stamp_buffer allocate failed\n\r"); } else { // stamp_img.mem_cfg.output_buffer = va; // stamp_img.mem_cfg.output_buffer_size = stamp_img.buff_size.output_buffer_size; stamp_text.mem_cfg.output_buffer = va; stamp_text.mem_cfg.output_buffer_size = stamp_text.buff_size.output_buffer_size; } custom_stamp_va = va; custom_stamp_pa = pa; } void PhotoFastCapDateImprint_UninitBuff(void) { HD_RESULT ret; if (custom_stamp_va) { ret = hd_common_mem_free(custom_stamp_pa, custom_stamp_va); if (ret != HD_OK) { DBG_ERR("hd_common_mem_free failed!(%d)\n", ret); } custom_stamp_va = 0; custom_stamp_pa = 0; } } INT32 PhotoFastCapDateImprint_GenYuvData(HD_VIDEO_FRAME *pDstImg) { HD_VIDEO_FRAME src_img; // VF_GFX_COPY param_img = {0}, VF_GFX_COPY param_text = {0}; // lv_user_font_conv(&stamp_img.draw_cfg, &stamp_img.mem_cfg); // // lv_user_font_conv_cfg_to_hd_frame( // &stamp_img.draw_cfg, // &stamp_img.mem_cfg, // stamp_img.buff_size.width, // stamp_img.buff_size.height, // &src_img // ); // // memset(¶m_img, 0, sizeof(param_img)); // param_img.src_img = src_img; // param_img.src_region.x = 0; // param_img.src_region.y = 0; // param_img.src_region.w = src_img.dim.w; // param_img.src_region.h = src_img.dim.h; // param_img.dst_img = *pDstImg; // param_img.dst_pos.x = 0; // param_img.dst_pos.y = 0; // param_img.alpha = 255; // param_img.colorkey = CKEY; // param_img.engine = 0; // vf_gfx_copy(¶m_img); printf("[%s:%d] s\n",__FUNCTION__,__LINE__); lv_user_font_conv(&stamp_text.draw_cfg, &stamp_text.mem_cfg); lv_user_font_conv_cfg_to_hd_frame( &stamp_text.draw_cfg, &stamp_text.mem_cfg, stamp_text.buff_size.width, stamp_text.buff_size.height, &src_img ); memset(¶m_text, 0, sizeof(param_text)); param_text.src_img = src_img; param_text.src_region.x = 0; param_text.src_region.y = 0; param_text.src_region.w = src_img.dim.w; param_text.src_region.h = src_img.dim.h; param_text.dst_img = *pDstImg; // param_text.dst_pos.x = param_img.dst_pos.x + param_img.src_img.dim.w + 10; // // if(param_img.src_img.dim.h > param_text.src_img.dim.h) // param_text.dst_pos.y = param_img.dst_pos.y + ((param_img.src_img.dim.h - param_text.src_img.dim.h) / 2); // else param_text.dst_pos.y = 0; param_text.alpha = 255; param_text.colorkey = CKEY; param_text.engine = 0; vf_gfx_copy(¶m_text); printf("[%s:%d] e\n",__FUNCTION__,__LINE__); return E_OK; } #else #include "FontConv/FontConv.h" #include "gximage/gximage.h" #include "UIApp/MovieStamp/DateStampFontTbl56x96.h" #include "UIApp/MovieStamp/DateStampFontTbl42x72.h" #include "UIApp/MovieStamp/DateStampFontTbl36x60.h" #include "UIApp/MovieStamp/DateStampFontTbl26x44.h" #include "UIApp/MovieStamp/DateStampFontTbl20x44.h" #include "UIApp/MovieStamp/DateStampFontTbl18x30.h" #include "UIApp/MovieStamp/DateStampFontTbl12x20.h" #include "UIApp/MovieStamp/DateStampFontTbl10x16.h" #include "UIApp/MovieStamp/MovieStamp.h" #include "UIWnd/SPORTCAM/Resource/UIResource.h" #include "UIWnd/SPORTCAM/UIInfo/DateTimeInfo.h" #include "UIWnd/SPORTCAM/UIInfo/UIInfo.h" #include "UIWnd/SPORTCAM/UIInfo/UIPhotoInfo.h" #include "UIWnd/SPORTCAM/UIInfo/UIPhotoMapping.h" #define DATE_COLOR_TRANSPARENT 0x008080C0 #define DATE_COLOR_WHITE 0x008080FF #define DATE_COLOR_BLACK 0x00808000 #define DATE_COLOR_ORANGED 0x00CC2D93 #define DATE_COLOR_RED 0x00F05A45 #define DATE_COLOR_YELLOW 0x007F80C0 //Primary Image and Screennail image. Customized string and icon stamped sample. extern const PALETTE_ITEM gDemoKit_Palette_Palette_custom_photo[256]; static UINT32 g_custom_stamp_va_addr = 0; static UINT32 g_custom_stamp_pa_addr = 0; static char g_custtom_stamp_str_buf[64] = {0}; static FONT_CONV_IN g_PhotoFastIndexColorToYuvIn; // use font data structure static FONT_CONV_OUT g_PhotoFastIndexColorToYuvOut; // use font data structure static FONT_CONV_IN g_PhotoFastIndexColorToYuvIn2; // use font data structure static FONT_CONV_OUT g_PhotoFastIndexColorToYuvOut2; // use font data structure void PhotoFastCapDateImprint_InitBuff(void) { UINT32 u32BufSize = 0;; HD_RESULT hd_ret; HD_COMMON_MEM_DDR_ID ddr_id = DDR_ID0; void *va; UINT32 pa; //Custom stamp buffer u32BufSize = HUNTINGCAP_DATESTAMP_BUF_SIZE; hd_ret = hd_common_mem_alloc("custom_stamp_buffer", &pa, (void **)&va, u32BufSize, ddr_id); if (hd_ret != HD_OK) { DBG_ERR("custom_stamp_buffer allocate failed\n\r"); } else { g_custom_stamp_pa_addr = (UINT32)pa; g_custom_stamp_va_addr = (UINT32)va; } } void PhotoFastCapDateImprint_UninitBuff(void) { HD_RESULT hd_ret; if (g_custom_stamp_va_addr) { hd_ret = hd_common_mem_free((UINT32)g_custom_stamp_pa_addr, (void *)g_custom_stamp_va_addr); if (hd_ret != HD_OK) { DBG_ERR("free g_custom_stamp_va_addr failed! (%d)\r\n", hd_ret); } g_custom_stamp_va_addr = 0; g_custom_stamp_pa_addr = 0; } } static void PhotoFastIndexColorToYuv_OnDrawCB(UINT32 param1,UINT32 param2,UINT32 param3,UINT32 param4) { DC* pTempDC = (DC*)param1; ISIZE ImageSize1;//Logo1 ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); GxGfx_Image(pTempDC, 0, pTempDC->winRect.h - ImageSize1.h, GxGfx_GetImageID(ICON_BATTERY_CHARGE)); } static void PhotoFastIndexColorToYuv_OnDrawCB2(UINT32 param1,UINT32 param2,UINT32 param3,UINT32 param4) { DC* pTempDC = (DC*)param1; ISIZE ImageSize1;//Logo1 ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); GxGfx_Image(pTempDC, (pTempDC->winRect.w-ImageSize1.w)/2, pTempDC->winRect.h - ImageSize1.h, GxGfx_GetImageID(ICON_WIFI_CONNECTED)); } INT32 PhotoFastCapDateImprint_GenYuvData(HD_VIDEO_FRAME *pDstImg) { ISIZE ImageSize1, ImageSize2; IPOINT DstLocation; VF_GFX_COPY param = {0}; HD_RESULT hd_ret; printf("[%s:%d] s\n",__FUNCTION__,__LINE__); if ((!g_custom_stamp_va_addr) || (!pDstImg)) { DBG_ERR("No stamped buffer or pDstImg is NULL\r\n"); return E_SYS; } g_PhotoFastIndexColorToYuvIn.MemAddr = g_custom_stamp_va_addr; g_PhotoFastIndexColorToYuvIn.MemSize = HUNTINGCAP_DATESTAMP_BUF_SIZE; g_PhotoFastIndexColorToYuvIn.pStr = g_custtom_stamp_str_buf; g_PhotoFastIndexColorToYuvIn.ciSolid = DATE_COLOR_RED; //DATE_COLOR_WHITE; g_PhotoFastIndexColorToYuvIn.ciFrame = DATE_COLOR_TRANSPARENT; g_PhotoFastIndexColorToYuvIn.ciTransparet = DATE_COLOR_TRANSPARENT; g_PhotoFastIndexColorToYuvIn.Format = HD_VIDEO_PXLFMT_YUV420; g_PhotoFastIndexColorToYuvIn.bEnableSmooth= FALSE; g_PhotoFastIndexColorToYuvIn.pStringCB = PhotoFastIndexColorToYuv_OnDrawCB; g_PhotoFastIndexColorToYuvIn.pPalette = (PALETTE_ITEM*)gDemoKit_Palette_Palette_custom_photo; g_PhotoFastIndexColorToYuvIn.ScaleFactor = 65536; //1.0x g_PhotoFastIndexColorToYuvIn2.MemAddr = g_custom_stamp_va_addr; g_PhotoFastIndexColorToYuvIn2.MemSize = HUNTINGCAP_DATESTAMP_BUF_SIZE; g_PhotoFastIndexColorToYuvIn2.pStr = g_custtom_stamp_str_buf; g_PhotoFastIndexColorToYuvIn2.ciSolid = DATE_COLOR_RED; g_PhotoFastIndexColorToYuvIn2.ciFrame = DATE_COLOR_TRANSPARENT; g_PhotoFastIndexColorToYuvIn2.ciTransparet = DATE_COLOR_TRANSPARENT; g_PhotoFastIndexColorToYuvIn2.Format = HD_VIDEO_PXLFMT_YUV420; g_PhotoFastIndexColorToYuvIn2.bEnableSmooth= FALSE; g_PhotoFastIndexColorToYuvIn2.pStringCB = PhotoFastIndexColorToYuv_OnDrawCB2; g_PhotoFastIndexColorToYuvIn2.pPalette = (PALETTE_ITEM*)gDemoKit_Palette_Palette_custom_photo; g_PhotoFastIndexColorToYuvIn2.ScaleFactor = 65536; //1.0x switch (pDstImg->dim.w) { case 4032: //12M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 3648: //10M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 3264: //8M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 2592: //5M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 2048: //3M ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; case 640: // VGA (screennail) ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; default: ImageSize1 = IMAGE_GetSize(GxGfx_GetImageID(ICON_BATTERY_CHARGE)); g_PhotoFastIndexColorToYuvIn.StampSize.w = pDstImg->dim.w; g_PhotoFastIndexColorToYuvIn.StampSize.h = ImageSize1.h; //Bottom image bar ImageSize2 = IMAGE_GetSize(GxGfx_GetImageID(ICON_WIFI_CONNECTED)); g_PhotoFastIndexColorToYuvIn2.StampSize.w = ImageSize2.w; g_PhotoFastIndexColorToYuvIn2.StampSize.h = ImageSize2.h; //according to max icon height break; } FontConv(&g_PhotoFastIndexColorToYuvIn,&g_PhotoFastIndexColorToYuvOut); DstLocation.x = 0; DstLocation.y = pDstImg->dim.h - g_PhotoFastIndexColorToYuvIn.StampSize.h; param.src_img = g_PhotoFastIndexColorToYuvOut.GenImg; param.src_region.x = 0; param.src_region.y = 0; param.src_region.w = g_PhotoFastIndexColorToYuvOut.GenImg.dim.w; param.src_region.h = g_PhotoFastIndexColorToYuvOut.GenImg.dim.h; param.dst_img = *pDstImg; param.dst_pos.x = DstLocation.x; param.dst_pos.y = DstLocation.y; param.alpha = 255; param.colorkey = 0; param.engine = GXIMG_CP_ENG1; hd_ret = vf_gfx_copy(¶m); memset(¶m, 0, sizeof(VF_GFX_COPY)); FontConv(&g_PhotoFastIndexColorToYuvIn2,&g_PhotoFastIndexColorToYuvOut2); DstLocation.x = 0; DstLocation.y = pDstImg->dim.h - g_PhotoFastIndexColorToYuvIn2.StampSize.h*3; param.src_img = g_PhotoFastIndexColorToYuvOut2.GenImg; param.src_region.x = 0; param.src_region.y = 0; param.src_region.w = g_PhotoFastIndexColorToYuvOut2.GenImg.loff[HD_VIDEO_PINDEX_Y]; param.src_region.h = g_PhotoFastIndexColorToYuvOut2.GenImg.dim.h; param.dst_img = *pDstImg; param.dst_pos.x = DstLocation.x; param.dst_pos.y = DstLocation.y; param.alpha = 255; param.colorkey = 0; param.engine = GXIMG_CP_ENG1; hd_ret = vf_gfx_copy(¶m); printf("[%s:%d] e\n",__FUNCTION__,__LINE__); if (hd_ret != HD_OK) { return E_SYS; } return E_OK; } #endif