📄 mmidc_review.c
字号:
//middle
st_param.st_disp_rect.w_width = disp_width;
st_param.st_disp_rect.w_height = disp_height;
st_param.st_disp_rect.w_start_x = left_trunk_2((lcd_width - disp_width) / 2);
st_param.st_disp_rect.w_start_y = left_trunk_2((lcd_height - disp_height) / 2);
}
else
{
//st_disp_rect跟原图的x,y方向的scale down系数应该都一样
disp_width = MIN(lcd_width, trim_width - s_photo_review_info.x_start);
disp_width = right_trunk_2(disp_width);
disp_height = MIN(lcd_height, trim_height - s_photo_review_info.y_start);
disp_height = right_trunk_2(disp_height);
//left top
st_param.st_disp_rect.w_width = disp_width;
st_param.st_disp_rect.w_height = disp_height-MMI_FULLSCREEN_SOFTKEY_BAR_HEIGHT;
st_param.st_disp_rect.w_start_x = 0;
st_param.st_disp_rect.w_start_y = 0;
}
}
else
{
DC_ASSERT_LOW(0);
}
//set osd
DrawDCReviewCharacterOSDMenu(s_photo_review_info.e_review_from, &st_param.st_disp_rect);
// Store OSD characters display rectangle
SCI_MEMCPY(&s_osd_char_disp_rect,&st_param.st_disp_rect,sizeof(RECT_T));
// DisplayCaptureWaitingStr(MAIN_LCD_ID);
//set review param
#ifndef _MMI_OCR
if(DC_SetReviewParam(&st_param))
return 1;
#else
SCI_TRACE_LOW("mmidc_review.c:OCR set the review param");
if (MMIOCR_Is_From_OCR())
{
OCR_SetReviewParam(NULL);
}
else
DC_SetReviewParam(&st_param);
#endif
return 0;
}
else
{
return 1;
}
}
/*****************************************************************************/
// Description : display photo,
// Global resource dependence :
// Author:
// Note: standard interface copied form digitalcamera.h
// disp_rect的计算是根据原图的大小,取一个大的缩小scale系数,然后除出来的。
/*****************************************************************************/
LOCAL int DCAdap_ReviewYUVPhotoCallBack(/*when DCAM encount SOF0, it will call this function*/
/* returns: 0 successful, others failed*/
int b_validate, /* indicate if the stream is validate*/
uint16 w_photo_width, /* if stream is validate, it refer to image width*/
uint16 w_photo_height /* if stream is validate, it refer to image height*/
)
{
uint16 width =0;
uint16 height = 0;
MMIDC_PHOTO_SIZE_E photo_size = DCSetting_GetPhotoSize();
if(DCAdap_ReviewPhotoCallBack(b_validate,w_photo_width,w_photo_height))
return 1;
if (MMIDC_PHOTO_SIZE_320X240==photo_size)
{
s_dc_photo_info_after_review.width = 320;
s_dc_photo_info_after_review.height = 240;
}
else if (MMIDC_PHOTO_SIZE_640X480==photo_size)
{
s_dc_photo_info_after_review.width = 640;
s_dc_photo_info_after_review.height = 480;
}
return 0;
}
/*****************************************************************************/
// Description : review photo
// Global resource dependence :
// Author:bruce.chi
// Note: is_from_capture param effact the character OSD
/*****************************************************************************/
PUBLIC BOOLEAN MMIDC_ReviewPhoto(MMIDC_REVIEW_PHOTO_INFO_T *review_info_ptr)
{
BOOLEAN ret=TRUE;
uint32 result =0;
if (DCAdap_GetZoomLevel() == 0)
{
DC_ASSERT_LOW(review_info_ptr->photo_ptr != PNULL);
}
SCI_MEMCPY(&s_photo_review_info, review_info_ptr, sizeof(s_photo_review_info));
#ifndef _MMI_OCR
if (DCAdap_GetZoomLevel()>0)
{
ret = DC_PlaybackYUVFromBuf(
review_info_ptr->photo_ptr,
review_info_ptr->photo_len,
review_info_ptr->width,
review_info_ptr->height,
DCAdap_ReviewYUVPhotoCallBack
);
}
else
{
ret = DC_PlaybackJpegFromBuf(
review_info_ptr->photo_ptr,
review_info_ptr->photo_len,
1,
DCAdap_ReviewPhotoCallBack
);
}
#else
if (MMIOCR_Is_From_OCR())
{
ret=OCR_DoReview(
review_info_ptr->photo_ptr,
review_info_ptr->photo_len,
DCAdap_ReviewPhotoCallBack
);
}
else
{
if (DCAdap_GetZoomLevel()>0)
{
ret = DC_PlaybackYUVFromBuf(
review_info_ptr->photo_ptr,
review_info_ptr->photo_len,
review_info_ptr->width,
review_info_ptr->height,
DCAdap_ReviewYUVPhotoCallBack
);
}
else
{
ret = DC_PlaybackJpegFromBuf(
review_info_ptr->photo_ptr,
review_info_ptr->photo_len,
1,
DCAdap_ReviewPhotoCallBack
);
}
}
#endif
if(0!=ret)
{
return FALSE;
}
else
{
return TRUE;
SCI_TRACE_LOW("mmidc_review.c:review success");
}
}
/*****************************************************************************/
// Description : get photo info after review
// Global resource dependence :
// Author:bruce.chi
// Note:
/*****************************************************************************/
PUBLIC MMIDC_PHOTO_INFO_AFTER_REVIEW_T MMIDC_GetPhotoInfoAfterReview(void)
{
return s_dc_photo_info_after_review;
}
/*****************************************************************************/
// Description : right trunk a number with 16
// Global resource dependence :
// Author:bruce.chi
// Note:
/*****************************************************************************/
__inline LOCAL uint16 right_trunk_16(uint16 in_num)
{
return (in_num + 15) / 16 * 16;
}
/*****************************************************************************/
// Description : right trunk a number with 8
// Global resource dependence :
// Author:bruce.chi
// Note:
/*****************************************************************************/
__inline LOCAL uint16 right_trunk_8(uint16 in_num)
{
return (in_num + 7) / 8 * 8;
}
/*****************************************************************************/
// Description : left trunk a number with 2
// Global resource dependence :
// Author:bruce.chi
// Note:
/*****************************************************************************/
__inline LOCAL uint16 left_trunk_2(uint16 in_num)
{
return in_num / 2 * 2;
}
/*****************************************************************************/
// Description : right trunk a number with 2
// Global resource dependence :
// Author:bruce.chi
// Note:
/*****************************************************************************/
__inline LOCAL uint16 right_trunk_2(uint16 in_num)
{
return (in_num + 1) / 2 * 2;
}
#endif //_MMIDC_REVIEW_C_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -