Merge remote-tracking branch 'origin/Branch_S530' into branch_s530

This commit is contained in:
alisa 2023-09-13 10:43:54 +08:00
commit 03e75f19db
14 changed files with 364 additions and 151 deletions

@ -1 +1 @@
Subproject commit 16e808c3a97ba4c47dd683f1daa79b4459b20202 Subproject commit 670d2f3fc39f4803f5a72bf125c0aea7a146a100

View File

@ -501,6 +501,16 @@ void Load_MenuInfo(void)
if(Check_OTA() == TRUE){ if(Check_OTA() == TRUE){
DBG_DUMP("OTA success, reset system param\n"); DBG_DUMP("OTA success, reset system param\n");
#if HUNTING_CAMERA_MCU == ENABLE
if(sf_get_ui_para_flag())
{
memcpy(&origInfo, &currentInfo, sizeof(currentInfo));
memcpy(&origInfo_check, &currentInfo, sizeof(currentInfo));
return;
}
#endif
SysResetFlag(); SysResetFlag();
#if HUNTING_CAMERA_MCU == ENABLE #if HUNTING_CAMERA_MCU == ENABLE
@ -515,7 +525,7 @@ void Load_MenuInfo(void)
//origInfo_check = currentInfo; //origInfo_check = currentInfo;
memcpy(&origInfo, &currentInfo, sizeof(currentInfo)); memcpy(&origInfo, &currentInfo, sizeof(currentInfo));
memcpy(&origInfo_check, &currentInfo, sizeof(currentInfo)); memcpy(&origInfo_check, &currentInfo, sizeof(currentInfo));
sf_share_mem_customer_down(0); //sf_share_mem_customer_down(0);
#endif #endif
return; return;
} }
@ -698,14 +708,19 @@ EXIT:
} }
if(((UIMenuStoreInfo*)tmpInfo)->uhInfoSize == sizeof(currentInfo)){ if(((UIMenuStoreInfo*)tmpInfo)->uhInfoSize == sizeof(currentInfo)){
memcpy(&currentInfo, tmpInfo, sizeof(currentInfo));
#if HUNTING_CAMERA_MCU == ENABLE #if HUNTING_CAMERA_MCU == ENABLE
if(!sf_get_ui_para_flag())
{
memcpy(&currentInfo, tmpInfo, sizeof(currentInfo));
}
if(currentInfo.OtaFlag) if(currentInfo.OtaFlag)
{ {
SysResetFlag(); SysResetFlag();
currentInfo.uhInfoSize = sizeof(currentInfo); currentInfo.uhInfoSize = sizeof(currentInfo);
} }
#endif #endif
} }
else{ else{
DBG_WRN("menu info size loaded from flash seems incorrect(old:%lu new:%lu), reset menu info\n", DBG_WRN("menu info size loaded from flash seems incorrect(old:%lu new:%lu), reset menu info\n",

View File

@ -62,7 +62,6 @@ SINT32 eg91_gps_search(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime,UINT8 au
SINT32 eg91_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day); SINT32 eg91_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day);
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

View File

@ -66,7 +66,7 @@ UINT32 sf_auto_operation_adjust(void)
} }
else if((SF_STRNCMP(puiPara->OperatorCode, "46003", 5) == 0) || (SF_STRNCMP(puiPara->OperatorCode, "46005", 5) == 0) || (SF_STRNCMP(puiPara->OperatorCode, "46011", 5) == 0))//china Telecom else if((SF_STRNCMP(puiPara->OperatorCode, "46003", 5) == 0) || (SF_STRNCMP(puiPara->OperatorCode, "46005", 5) == 0) || (SF_STRNCMP(puiPara->OperatorCode, "46011", 5) == 0))//china Telecom
{ {
SF_STRCPY(puiPara->Sim4gApn, "CTNET"); SF_STRCPY(puiPara->Sim4gApn, "vzwinternet");
SF_STRCPY(puiPara->Sim4gUsr, "\0"); SF_STRCPY(puiPara->Sim4gUsr, "\0");
SF_STRCPY(puiPara->Sim4gPwd, "\0"); SF_STRCPY(puiPara->Sim4gPwd, "\0");

View File

@ -14,6 +14,7 @@
#include "sf_hal_ttyusb.h" #include "sf_hal_ttyusb.h"
#include "sf_eg91_server.h" #include "sf_eg91_server.h"
#include "sf_eg91_gps.h" #include "sf_eg91_gps.h"
#include "sf_eg91_sim.h"
#include "sf_param_common.h" #include "sf_param_common.h"
#include "sf_module.h" #include "sf_module.h"
@ -63,6 +64,7 @@ static void gps_infor_convert(SF_CHAR *str)
memcpy(str, strTemp, 4); memcpy(str, strTemp, 4);
} }
SINT32 eg91_gps_greendate_Get(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime) SINT32 eg91_gps_greendate_Get(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime)
{ {
SINT32 ttyRet = SF_SUCCESS; SINT32 ttyRet = SF_SUCCESS;
@ -311,7 +313,6 @@ SINT32 eg91_gps_greendate_Get(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime)
} }
return ret; return ret;
} }
SINT32 eg91_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day) SINT32 eg91_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day)
{ {

View File

@ -3417,7 +3417,13 @@ SINT32 sf_net_regist_manual(void)
} }
else else
{ {
sprintf((char *)gsmPara, "AT+RSTSET\r"); //sprintf((char *)gsmPara, "AT+RSTSET\r");
//sprintf((char *)gsmPara, "AT+CGREG?\r");
//eNetRegLocation = QUECTEL_NETREG_CGREG;
//callTime = SF_QUECTEL_NET_REG_CALLTIME_MAX; /*4 min*/
sprintf((char *)gsmPara, "%s", "AT+CGDCONT=1,\"IPV4V6\",\"\"\r");
eNetRegLocation = QUECTEL_NETREG_CGDCONT;
} }
} }
else else
@ -3477,6 +3483,9 @@ SINT32 sf_net_regist_manual(void)
if(ret == SF_SUCCESS) if(ret == SF_SUCCESS)
{ {
eNetRegLocation = QUECTEL_NETREG_FRIST; eNetRegLocation = QUECTEL_NETREG_FRIST;
//sprintf((char *)gsmPara, "AT+CGREG?\r");
//eNetRegLocation = QUECTEL_NETREG_CGREG;
//callTime = SF_QUECTEL_NET_REG_CALLTIME_MAX;
} }
else else
{ {
@ -3513,7 +3522,7 @@ SINT32 sf_net_regist_manual(void)
#if SF_TEST_ERROR_CODE #if SF_TEST_ERROR_CODE
sf_test_code_err(eNetRegLocation, "+CGREG: 0,2"); sf_test_code_err(eNetRegLocation, "+CGREG: 0,2");
#endif #endif
SF_DEBUG("Sim4gApn=%s", puiPara->Sim4gApn);
if((strstr((const char *)gsmPara, "+CGREG: 2,1") != NULL) || (strstr((const char *)gsmPara, "+CGREG: 0,1") != NULL) || (strstr((const char *)gsmPara, "+CGREG: 0,5") != NULL)) if((strstr((const char *)gsmPara, "+CGREG: 2,1") != NULL) || (strstr((const char *)gsmPara, "+CGREG: 0,1") != NULL) || (strstr((const char *)gsmPara, "+CGREG: 0,5") != NULL))
{ {
if(PWR_ON_TIME_SYNC == sf_poweron_type_get()) if(PWR_ON_TIME_SYNC == sf_poweron_type_get())
@ -4789,6 +4798,7 @@ SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time)
UIMenuStoreInfo *pPara = sf_app_ui_para_get(); UIMenuStoreInfo *pPara = sf_app_ui_para_get();
SF_TTY_DATA_TYPE_S ttyData = { .waitMs = 2000, .len = 3, .lenMax = (GPRS_INFO_LINE_MAX-1), .cmp = "OK", .cmperr = "ERROR", .data = gsmPara}; SF_TTY_DATA_TYPE_S ttyData = { .waitMs = 2000, .len = 3, .lenMax = (GPRS_INFO_LINE_MAX-1), .cmp = "OK", .cmperr = "ERROR", .data = gsmPara};
SF_DEBUG("Sim4gApn=%s", pPara->Sim4gApn);
sf_gsm_para_buff_clear(); sf_gsm_para_buff_clear();
pdpIndex = sf_get_pdp_index(); pdpIndex = sf_get_pdp_index();
@ -4996,7 +5006,8 @@ UINT8 sf_get_pdp_index(void)
UINT8 pdpIndex = 0; UINT8 pdpIndex = 0;
UIMenuStoreInfo *pPara = sf_app_ui_para_get(); UIMenuStoreInfo *pPara = sf_app_ui_para_get();
SF_DEBUG("Sim4gApn=%s", pPara->Sim4gApn);
if(strstr((const char *)pPara->Sim4gApn, APN_4G_VERIZON)) if(strstr((const char *)pPara->Sim4gApn, APN_4G_VERIZON))
{ {
pdpIndex = V_PDP_INDEX; pdpIndex = V_PDP_INDEX;

View File

@ -75,7 +75,7 @@ SINT32 sf_auto_operation_adaptation(SF_CHAR *operatorName, UIMenuStoreInfo *sim_
} }
else if((strncmp(operatorName, "46003", 5) == 0) || (strncmp(operatorName, "46005", 5) == 0) || (strncmp(operatorName, "46011", 5) == 0))//china telcom else if((strncmp(operatorName, "46003", 5) == 0) || (strncmp(operatorName, "46005", 5) == 0) || (strncmp(operatorName, "46011", 5) == 0))//china telcom
{ {
strcpy(sim_info_t->Sim4gApn, "CTNET"); strcpy(sim_info_t->Sim4gApn, "vzwinternet");
strcpy(sim_info_t->Sim4gUsr, "\0"); strcpy(sim_info_t->Sim4gUsr, "\0");
strcpy(sim_info_t->Sim4gPwd, "\0"); strcpy(sim_info_t->Sim4gPwd, "\0");

View File

@ -103,7 +103,7 @@ int main(int argc, char *argv[])
{ {
printf("*********************************************\n"); printf("*********************************************\n");
printf("* *\n"); printf("* *\n");
printf("* sf_app-v3 *\n"); printf("* sf_app-v5-0912 *\n");
printf("* *\n"); printf("* *\n");
printf("*********************************************\n"); printf("*********************************************\n");
//gpio_direction_input(C_GPIO(10)); //gpio_direction_input(C_GPIO(10));

View File

@ -122,6 +122,9 @@ UINT32 sf_cardv_cap_start(void);
UINT32 sf_cardv_hd_cap_start(void); UINT32 sf_cardv_hd_cap_start(void);
void sf_cardv_set_wait_shared_condition(int in); void sf_cardv_set_wait_shared_condition(int in);
int sf_cardv_para_signaling_start(void); int sf_cardv_para_signaling_start(void);
void sf_cardv_wifi_send(void);
void sf_set_ui_para_flag(UINT8 flag);
UINT8 sf_get_ui_para_flag(void);
BOOL sf_cmd_ftp_ota(unsigned char argc, char **argv); BOOL sf_cmd_ftp_ota(unsigned char argc, char **argv);
BOOL sf_cmd_switch_esim(unsigned char argc, char **argv); BOOL sf_cmd_switch_esim(unsigned char argc, char **argv);

View File

@ -89,6 +89,7 @@ static pthread_cond_t condition;
static pthread_mutex_t Param_mutexLock; static pthread_mutex_t Param_mutexLock;
static int shared_condition = 1; static int shared_condition = 1;
static SINT32 WifiSocket = 0; static SINT32 WifiSocket = 0;
static UINT8 UiparaFlag = 0;
static SF_THREAD_S UpgradeTskParam = static SF_THREAD_S UpgradeTskParam =
{ {
.IsRun = 0, .IsRun = 0,
@ -1656,6 +1657,7 @@ static SINT32 sf_cardv_proccess_cmd_para_update(SF_MESSAGE_BUF_S *pMessageBuf)
{ {
case SF_PARA_CMD_UPDATE: case SF_PARA_CMD_UPDATE:
//MLOGI("NeedTimeSyncStartUp = %d\n",puiPara->NeedTimeSyncStartUp); //MLOGI("NeedTimeSyncStartUp = %d\n",puiPara->NeedTimeSyncStartUp);
sf_set_ui_para_flag(1);
sf_share_mem_customer_update(); sf_share_mem_customer_update();
//MLOGI("NeedTimeSyncStartUp = %d\n",puiPara->NeedTimeSyncStartUp); //MLOGI("NeedTimeSyncStartUp = %d\n",puiPara->NeedTimeSyncStartUp);
break; break;
@ -1709,7 +1711,7 @@ void sf_cardv_wifi_send()
if(SF_SUCCESS == sf_share_mem_hd_update()) if(SF_SUCCESS == sf_share_mem_hd_update())
{ {
SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); //SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get();
fd = sf_get_wifi_socket(); fd = sf_get_wifi_socket();
SF_CHAR filePath[64] = { 0 }; SF_CHAR filePath[64] = { 0 };
@ -2681,3 +2683,13 @@ UINT32 sf_cardv_hd_cap_start(void)
HdCapTskCfg.IsRun = 1; HdCapTskCfg.IsRun = 1;
return SF_SUCCESS; return SF_SUCCESS;
} }
UINT8 sf_get_ui_para_flag(void)
{
return UiparaFlag;
}
void sf_set_ui_para_flag(UINT8 flag)
{
UiparaFlag = flag;
}

View File

@ -39,7 +39,7 @@
hdal-memory { hdal-memory {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
media { reg = <0x03600000 0x04A00000>; }; media { reg = <0x03700000 0x04900000>; };
}; };
hdal-maxpath-cfg { hdal-maxpath-cfg {

View File

@ -882,6 +882,12 @@ static int load_linux_from_flash(LINUXTMP_PARTITION *p_linuxtmp, FDT_INFO *p_fdt
LINUX_BOOT_MSG("*linuxtmp used size = %lx , linux compressed / uncompressed size = %lx / %lx ******\n", p_linuxtmp->tmp_curr - p_linuxtmp->tmp_begin, fastload.MemComp.size, fastload.MemUnComp.size); LINUX_BOOT_MSG("*linuxtmp used size = %lx , linux compressed / uncompressed size = %lx / %lx ******\n", p_linuxtmp->tmp_curr - p_linuxtmp->tmp_begin, fastload.MemComp.size, fastload.MemUnComp.size);
if(p_linuxtmp->tmp_curr > p_fdt_info->hdal_addr){
DBG_ERR("linux tmp buffer overflow(curr:%lx), hdal media buffer(%lx) may be corrupted!!\n", p_linuxtmp->tmp_curr, p_fdt_info->hdal_addr);
vos_util_delay_ms(100); // add delay to show dbg_fatal message in linux
vos_debug_halt();
}
cmd.Idx = FWSRV_CMD_IDX_FASTLOAD; cmd.Idx = FWSRV_CMD_IDX_FASTLOAD;
cmd.In.pData = &fastload; cmd.In.pData = &fastload;
cmd.In.uiNumByte = sizeof(fastload); cmd.In.uiNumByte = sizeof(fastload);

View File

@ -16,7 +16,8 @@
#include "PhotoFast.h" #include "PhotoFast.h"
#include <kwrap/cmdsys.h> #include <kwrap/cmdsys.h>
#include "DxHunting.h" #include "DxHunting.h"
#include "UIAppPhoto_Param.h"
#include "DCF.h"
#if HUNTING_CAMERA_MCU == ENABLE #if HUNTING_CAMERA_MCU == ENABLE
#include <sf_mcu.h> #include <sf_mcu.h>
#endif #endif
@ -104,28 +105,36 @@ static void PhotoFast_SliceEncode_Get_Src_Slice_Info(
PhotoFast_SliceSize_Info *src_info, PhotoFast_SliceSize_Info *src_info,
const HD_VIDEO_FRAME video_frame) const HD_VIDEO_FRAME video_frame)
{ {
src_info->slice_num = dst_info->slice_num; src_info->slice_num = dst_info->slice_num;
src_info->width = video_frame.dim.w; src_info->width = video_frame.dim.w;
src_info->height = video_frame.dim.h; src_info->height = video_frame.dim.h;
if(src_info->slice_num > 1){ if(src_info->slice_num > 1){
src_info->slice_height = ALIGN_CEIL((src_info->width * dst_info->slice_height) / dst_info->width, 2); src_info->slice_height = ALIGN_CEIL((src_info->height) / src_info->slice_num, 2);
src_info->last_slice_height = ALIGN_CEIL(src_info->height - src_info->slice_height * (src_info->slice_num - 1), 2); src_info->last_slice_height = ALIGN_CEIL(src_info->height - src_info->slice_height * (src_info->slice_num - 1), 2);
} }
else{ else{
src_info->slice_height = video_frame.dim.h; src_info->slice_height = video_frame.dim.h;
src_info->last_slice_height = src_info->slice_height; src_info->last_slice_height = src_info->slice_height;
} }
PHOTOFAST_SLICE_ENC_DUMP("Src Slice Info: size = {%lu,%lu} slice num = {%lu} slice height = {%lu} last slice height = {%lu}\r\n", if(src_info->slice_height * (src_info->slice_num - 1) >= src_info->height){
src_info->width, src_info->height, src_info->slice_num, src_info->slice_height, src_info->last_slice_height); DBG_ERR("aligned total slice height(%lu * %lu + %lu = %lu) exceed photo height(%lu)!\n",
src_info->slice_height,
src_info->slice_num - 1,
src_info->last_slice_height,
src_info->height);
}
PHOTOFAST_SLICE_ENC_DUMP("Src Slice Info: size = {%lu,%lu} slice num = {%lu} slice height = {%lu} last slice height = {%lu}\r\n",
src_info->width, src_info->height, src_info->slice_num, src_info->slice_height, src_info->last_slice_height);
} }
INT32 PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(HD_VIDEO_PXLFMT pxl_fmt) INT32 PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(HD_VIDEO_PXLFMT pxl_fmt)
{ {
HD_DIM dim = PhotoFast_SliceEncode_Get_Encode_Max_Size(); HD_DIM dim = PhotoFast_SliceEncode_Get_Encode_Max_Size();
UINT32 reserved_buffer = 0; UINT32 reserved_buffer = 0;
UINT32 max_buffer_size = VDO_YUV_BUFSIZE(dim.w, dim.h, pxl_fmt) + reserved_buffer; UINT32 max_buffer_size = VDO_YUV_BUFSIZE(ALIGN_CEIL(dim.w, 16), ALIGN_CEIL(dim.h, 16), pxl_fmt) + reserved_buffer;
return max_buffer_size; return max_buffer_size;
} }
@ -135,11 +144,17 @@ static INT32 PhotoFast_SliceEncode_Get_Dst_Slice_Info(PhotoFast_SliceSize_Info *
info->width = cap_size_w; info->width = cap_size_w;
info->height = cap_size_h; info->height = cap_size_h;
info->slice_num = slice_num; info->slice_num = slice_num;
info->slice_height = ALIGN_CEIL_16(info->height / info->slice_num);
if(info->height == 1080 && slice_num == 1){
info->slice_height = info->height;
}
else{
info->slice_height = ALIGN_CEIL_16(info->height / info->slice_num);
}
if(info->slice_height * (info->slice_num - 1) > info->height){ if(info->slice_height * (info->slice_num - 1) > info->height){
DBG_ERR("calculate last slice height error!\n"); DBG_ERR("calculate last slice height error!(slice_height = %lu, slice_num = %lu, photo height = %lu)\n", info->slice_height, info->slice_num, info->height);
return E_SYS; return E_SYS;
} }
@ -151,33 +166,136 @@ static INT32 PhotoFast_SliceEncode_Get_Dst_Slice_Info(PhotoFast_SliceSize_Info *
return E_OK; return E_OK;
} }
INT32 PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(PhotoFast_SliceSize_Info *info) INT32 PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(PhotoFast_SliceSize_Info *info, const HD_VIDEO_FRAME src_frame)
{ {
UINT32 cap_size_w = GetPhotoSizeWidth(SysGetFlag(FL_PHOTO_SIZE)); UINT32 cap_size_w = GetPhotoSizeWidth(SysGetFlag(FL_PHOTO_SIZE));
UINT32 cap_size_h = GetPhotoSizeHeight(SysGetFlag(FL_PHOTO_SIZE)); UINT32 cap_size_h = GetPhotoSizeHeight(SysGetFlag(FL_PHOTO_SIZE));
UINT32 max_slice_num;
UINT32 slice_num; UINT32 slice_num;
unsigned int cap_size = cap_size_w * cap_size_h; unsigned int cap_size = cap_size_w * cap_size_h;
unsigned int buf_size = CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_WIDTH * CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_HEIGHT; unsigned int buf_size = CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_WIDTH * CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_HEIGHT;
if(buf_size > cap_size){ if(buf_size > cap_size){
max_slice_num = 1;
slice_num = 1; slice_num = 1;
} }
else{ else{
PHOTOFAST_SLICE_ENC_DUMP("cap_size = %lu buf_size = %lu\n", cap_size, buf_size); PHOTOFAST_SLICE_ENC_DUMP("cap_size = %lu buf_size = %lu\n", cap_size, buf_size);
UINT32 lines = (buf_size / cap_size_w); UINT32 lines = (buf_size / cap_size_w);
slice_num = cap_size_h / lines + (cap_size_h % lines ? 1 : 0); max_slice_num = cap_size_h / lines + (cap_size_h % lines ? 1 : 0);
UINT32 tmp_src_h = src_frame.dim.h / 2;
UINT32 tmp_dst_h = cap_size_h / 16;
UINT32 found_common_factor = 0;
UINT32 i;
for (i = 1; i <= (tmp_src_h > tmp_dst_h ? tmp_dst_h : tmp_src_h) ; ++i)
{
if (tmp_src_h % i == 0 && tmp_dst_h % i == 0)
{
PHOTOFAST_SLICE_ENC_DUMP("common factor = %d\n", i);
if(max_slice_num < i){
found_common_factor = i;
break;
}
}
}
if(found_common_factor){
slice_num = found_common_factor;
PHOTOFAST_SLICE_ENC_DUMP("use common factor %d\n ", slice_num);
}
else{
slice_num = max_slice_num;
PHOTOFAST_SLICE_ENC_DUMP("use max slice num %d\n ", slice_num);
}
} }
return PhotoFast_SliceEncode_Get_Dst_Slice_Info(info, cap_size_w, cap_size_h, slice_num); return PhotoFast_SliceEncode_Get_Dst_Slice_Info(info, cap_size_w, cap_size_h, slice_num);
} }
static HD_DIM PhotoFast_SliceEncode_Get_Encode_Max_Size() static UINT32 PhotoFast_SliceEncode_Get_Max_Dst_Slice_Info(PhotoFast_SliceSize_Info *info)
{
static PhotoFast_SliceSize_Info max_slice_info = {0};
UINT32 max_slice_num;
UINT32 slice_num;
INT32 ret = E_OK;
UIAPP_PHOTO_SENSOR_INFO *sensor_info = UIAppPhoto_get_SensorInfo(0);
unsigned int buf_size = CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_WIDTH * CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_HEIGHT;
/* search max slice (slice height * slice width) */
if(!max_slice_info.slice_height || !max_slice_info.width){
UINT8 cap_idx = 0;
for(cap_idx = PHOTO_MAX_CAP_SIZE ; cap_idx <= PHOTO_SLICE_ENC_MIN_CAP_SIZE ; cap_idx++)
{
HD_DIM tmp_cap_size = {0};
PhotoFast_SliceSize_Info tmp_slice_info = {0};
tmp_cap_size = (HD_DIM){GetPhotoSizeWidth(cap_idx), GetPhotoSizeHeight(cap_idx)};
if(buf_size > (tmp_cap_size.w * tmp_cap_size.h)){
max_slice_num = 1;
slice_num = 1;
}
else{
PHOTOFAST_SLICE_ENC_DUMP("cap_size = %lu buf_size = %lu\n", tmp_cap_size.w * tmp_cap_size.h, buf_size);
UINT32 lines = (buf_size / tmp_cap_size.w);
max_slice_num = tmp_cap_size.h / lines + (tmp_cap_size.h % lines ? 1 : 0);
UINT32 tmp_src_h = sensor_info->sSize.h / 2;
UINT32 tmp_dst_h = tmp_cap_size.h / 16;
UINT32 found_common_factor = 0;
UINT32 i;
for (i = 1; i <= (tmp_src_h > tmp_dst_h ? tmp_dst_h : tmp_src_h) ; ++i)
{
if (tmp_src_h % i == 0 && tmp_dst_h % i == 0)
{
PHOTOFAST_SLICE_ENC_DUMP("common factor = %d\n", i);
if(max_slice_num < i){
found_common_factor = i;
break;
}
}
}
if(found_common_factor){
slice_num = found_common_factor;
PHOTOFAST_SLICE_ENC_DUMP("use common factor %d\n ", slice_num);
}
else{
slice_num = max_slice_num;
PHOTOFAST_SLICE_ENC_DUMP("use max slice num %d\n ", slice_num);
}
}
ret = PhotoFast_SliceEncode_Get_Dst_Slice_Info(&tmp_slice_info, tmp_cap_size.w, tmp_cap_size.h, slice_num);
if((tmp_slice_info.slice_height * tmp_slice_info.width) > (max_slice_info.slice_height * max_slice_info.width)){
max_slice_info = tmp_slice_info;
}
}
PHOTOFAST_SLICE_ENC_DUMP("max dst slice = {%lu, %lu}, cap idx = %lu\n", max_slice_info.width, max_slice_info.slice_height, cap_idx);
}
*info = max_slice_info;
return ret;
}
static HD_DIM PhotoFast_SliceEncode_Get_Encode_Max_Size(void)
{ {
PhotoFast_SliceSize_Info info; PhotoFast_SliceSize_Info info;
if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&info) != E_OK) if(PhotoFast_SliceEncode_Get_Max_Dst_Slice_Info(&info) != E_OK)
return (HD_DIM){0, 0}; return (HD_DIM){0, 0};
HD_DIM dim_max_slice = {info.width, info.slice_height}; HD_DIM dim_max_slice = {info.width, info.slice_height};
@ -187,7 +305,7 @@ static HD_DIM PhotoFast_SliceEncode_Get_Encode_Max_Size()
static UINT32 PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(HD_VIDEO_PXLFMT vproc_out_pxlfmt) static UINT32 PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(HD_VIDEO_PXLFMT vproc_out_pxlfmt)
{ {
const UINT32 ratio = 4; const UINT32 ratio = CFG_PHOTOFAST_SLICE_ENC_BS_BUF_RATIO;
UINT32 bitrate; UINT32 bitrate;
HD_DIM dim = PhotoFast_SliceEncode_Get_Encode_Max_Size(); HD_DIM dim = PhotoFast_SliceEncode_Get_Encode_Max_Size();
@ -307,7 +425,7 @@ INT32 PhotoFast_SliceEncode_Open(const HD_PATH_ID vproc_path_id)
HD_OUT_ID out = HD_VIDEOENC_OUT(0, first_out_port); HD_OUT_ID out = HD_VIDEOENC_OUT(0, first_out_port);
/* calculate dst slice info */ /* calculate dst slice info */
if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info) != E_OK){ if(PhotoFast_SliceEncode_Get_Max_Dst_Slice_Info(&dst_slice_info) != E_OK){
goto EXIT; goto EXIT;
} }
@ -317,13 +435,15 @@ INT32 PhotoFast_SliceEncode_Open(const HD_PATH_ID vproc_path_id)
ret = hd_videoproc_get(vproc_path_id, HD_VIDEOPROC_PARAM_OUT, (VOID*)&vproc_out); ret = hd_videoproc_get(vproc_path_id, HD_VIDEOPROC_PARAM_OUT, (VOID*)&vproc_out);
if(ret != HD_OK){ if(ret != HD_OK){
DBG_ERR("hd_videoproc_get HD_VIDEOPROC_PARAM_OUT failed(path_id=%lx, ret=%d)!", vproc_path_id, ret); DBG_ERR("hd_videoproc_get HD_VIDEOPROC_PARAM_OUT failed(path_id=%lx, ret=%d)!", vproc_path_id, ret);
goto EXIT; vproc_out_pxlfmt = HD_VIDEO_PXLFMT_YUV420;
} }
else{
vproc_out_pxlfmt = vproc_out.pxlfmt; vproc_out_pxlfmt = vproc_out.pxlfmt;
}
} }
if ((ret = hd_videoenc_init()) != HD_OK){ ret = hd_videoenc_init();
if (ret != HD_OK && ret != HD_ERR_UNINIT){
DBG_ERR("hd_videoenc_init failed (%d)\r\n", ret); DBG_ERR("hd_videoenc_init failed (%d)\r\n", ret);
goto EXIT; goto EXIT;
} }
@ -350,7 +470,7 @@ INT32 PhotoFast_SliceEncode_Open(const HD_PATH_ID vproc_path_id)
/* calculate max buffer for slice */ /* calculate max buffer for slice */
info->yuv_buf_mem_info.blk_size = PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(vproc_out_pxlfmt); info->yuv_buf_mem_info.blk_size = PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(vproc_out_pxlfmt);
if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&max_info) != E_OK) if(PhotoFast_SliceEncode_Get_Max_Dst_Slice_Info(&max_info) != E_OK)
goto EXIT; goto EXIT;
bitrate = PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(vproc_out_pxlfmt); bitrate = PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(vproc_out_pxlfmt);
@ -570,99 +690,101 @@ static INT32 PhotoFast_SliceEncode_Get_Enc_Buffer_Info(const HD_PATH_ID enc_path
} }
static INT32 PhotoFast_SliceEncode_Init_VF_GFX_Slice( static INT32 PhotoFast_SliceEncode_Init_VF_GFX_Slice(
VF_GFX_SCALE* vf_gfx_scale_param, VF_GFX_SCALE* vf_gfx_scale_param,
const HD_VIDEO_FRAME* video_frame, const HD_VIDEO_FRAME* video_frame,
const PhotoFast_MEM_Info dst_buffer_info, const PhotoFast_MEM_Info dst_buffer_info,
const PhotoFast_SliceSize_Info src_slice_info, const PhotoFast_SliceSize_Info src_slice_info,
const PhotoFast_SliceSize_Info dst_slice_info, const PhotoFast_SliceSize_Info dst_slice_info,
const UINT8 slice_idx) const UINT8 slice_idx)
{ {
HD_RESULT ret; HD_RESULT ret;
UINT32 addr_src[HD_VIDEO_MAX_PLANE] = {0}; UINT32 addr_src[HD_VIDEO_MAX_PLANE] = {0};
UINT32 addr_dst[HD_VIDEO_MAX_PLANE] = {0}; UINT32 addr_dst[HD_VIDEO_MAX_PLANE] = {0};
UINT32 loff_src[HD_VIDEO_MAX_PLANE] = {0}; UINT32 loff_src[HD_VIDEO_MAX_PLANE] = {0};
UINT32 loff_dst[HD_VIDEO_MAX_PLANE] = {0}; UINT32 loff_dst[HD_VIDEO_MAX_PLANE] = {0};
UINT32 offset; UINT32 offset;
UINT32 scr_slice_height = (slice_idx == (src_slice_info.slice_num - 1)) ? src_slice_info.last_slice_height : src_slice_info.slice_height; UINT32 scr_slice_height = (slice_idx == (src_slice_info.slice_num - 1)) ? src_slice_info.last_slice_height : src_slice_info.slice_height;
UINT32 dst_slice_height = (slice_idx == (dst_slice_info.slice_num - 1)) ? dst_slice_info.last_slice_height : dst_slice_info.slice_height; UINT32 dst_slice_height = (slice_idx == (dst_slice_info.slice_num - 1)) ? dst_slice_info.last_slice_height : dst_slice_info.slice_height;
UINT32 dst_scale_slice_height = (slice_idx == (dst_slice_info.slice_num - 1)) ? (src_slice_info.last_slice_height * dst_slice_info.slice_height / src_slice_info.slice_height) : dst_slice_info.slice_height; UINT32 dst_scale_slice_height = (slice_idx == (dst_slice_info.slice_num - 1)) ? (src_slice_info.last_slice_height * dst_slice_info.slice_height / src_slice_info.slice_height) : dst_slice_info.slice_height;
/* dst img */ /* dst img */
addr_dst[0] = dst_buffer_info.pa; addr_dst[0] = dst_buffer_info.pa;
loff_dst[0] = dst_slice_info.width; loff_dst[0] = dst_slice_info.width;
addr_dst[1] = addr_dst[0] + loff_dst[0] * dst_slice_height; addr_dst[1] = addr_dst[0] + loff_dst[0] * dst_slice_height;
loff_dst[1] = dst_slice_info.width; loff_dst[1] = dst_slice_info.width;
ret = vf_init_ex(&vf_gfx_scale_param->dst_img, dst_slice_info.width, dst_slice_height, video_frame->pxlfmt, loff_dst, addr_dst); ret = vf_init_ex(&vf_gfx_scale_param->dst_img, dst_slice_info.width, dst_slice_height, video_frame->pxlfmt, loff_dst, addr_dst);
if (ret != HD_OK) { if (ret != HD_OK) {
DBG_ERR("vf_init_ex dst failed(%d)\r\n", ret); DBG_ERR("vf_init_ex dst failed(%d)\r\n", ret);
return E_SYS; return E_SYS;
} }
vf_gfx_scale_param->engine = 0; vf_gfx_scale_param->engine = 0;
vf_gfx_scale_param->src_region.x = 0; vf_gfx_scale_param->src_region.x = 0;
vf_gfx_scale_param->src_region.y = 0; vf_gfx_scale_param->src_region.y = 0;
vf_gfx_scale_param->src_region.w = src_slice_info.width; vf_gfx_scale_param->src_region.w = src_slice_info.width;
vf_gfx_scale_param->src_region.h = scr_slice_height; vf_gfx_scale_param->src_region.h = scr_slice_height;
vf_gfx_scale_param->dst_region.x = 0; vf_gfx_scale_param->dst_region.x = 0;
vf_gfx_scale_param->dst_region.y = 0; vf_gfx_scale_param->dst_region.y = 0;
vf_gfx_scale_param->dst_region.w = dst_slice_info.width; vf_gfx_scale_param->dst_region.w = dst_slice_info.width;
vf_gfx_scale_param->dst_region.h = dst_scale_slice_height; vf_gfx_scale_param->dst_region.h = dst_scale_slice_height;
vf_gfx_scale_param->dst_img.blk = dst_buffer_info.blk; vf_gfx_scale_param->dst_img.blk = dst_buffer_info.blk;
vf_gfx_scale_param->quality = HD_GFX_SCALE_QUALITY_NULL; vf_gfx_scale_param->quality = HD_GFX_SCALE_QUALITY_NULL;
offset = video_frame->loff[HD_VIDEO_PINDEX_Y] * slice_idx * src_slice_info.slice_height; offset = video_frame->loff[HD_VIDEO_PINDEX_Y] * slice_idx * src_slice_info.slice_height;
addr_src[0] = video_frame->phy_addr[HD_VIDEO_PINDEX_Y] + offset; addr_src[0] = video_frame->phy_addr[HD_VIDEO_PINDEX_Y] + offset;
addr_src[1] = video_frame->phy_addr[HD_VIDEO_PINDEX_UV] + offset/2; addr_src[1] = video_frame->phy_addr[HD_VIDEO_PINDEX_UV] + offset/2;
loff_src[0] = video_frame->loff[HD_VIDEO_PINDEX_Y]; loff_src[0] = video_frame->loff[HD_VIDEO_PINDEX_Y];
loff_src[1] = video_frame->loff[HD_VIDEO_PINDEX_UV]; loff_src[1] = video_frame->loff[HD_VIDEO_PINDEX_UV];
if ((ret = vf_init_ex(&vf_gfx_scale_param->src_img, src_slice_info.width, scr_slice_height, video_frame->pxlfmt, loff_src, addr_src)) != HD_OK) { if ((ret = vf_init_ex(&vf_gfx_scale_param->src_img, src_slice_info.width, scr_slice_height, video_frame->pxlfmt, loff_src, addr_src)) != HD_OK) {
DBG_ERR("vf_init_ex dst failed(%d)\r\n", ret); DBG_ERR("vf_init_ex dst failed(%d)\r\n", ret);
return E_SYS; return E_SYS;
} }
PHOTOFAST_SLICE_ENC_DUMP("[Slice %lu] src dim{%lu, %lu} src region{%lu, %lu, %lu, %lu} addr{y:%lx uv:%lx}\r\n", PHOTOFAST_SLICE_ENC_DUMP("[Slice %lu] src dim{%lu, %lu} src region{%lu, %lu, %lu, %lu} addr{y:%lx uv:%lx}\r\n",
slice_idx, slice_idx,
vf_gfx_scale_param->src_img.dim.w, vf_gfx_scale_param->src_img.dim.w,
vf_gfx_scale_param->src_img.dim.h, vf_gfx_scale_param->src_img.dim.h,
vf_gfx_scale_param->src_region.x, vf_gfx_scale_param->src_region.x,
vf_gfx_scale_param->src_region.y, vf_gfx_scale_param->src_region.y,
vf_gfx_scale_param->src_region.w, vf_gfx_scale_param->src_region.w,
vf_gfx_scale_param->src_region.h, vf_gfx_scale_param->src_region.h,
addr_src[0], addr_src[1] addr_src[0], addr_src[1]
); );
PHOTOFAST_SLICE_ENC_DUMP("[Slice %lu] dst dim{%lu, %lu} dst region{%lu, %lu, %lu, %lu} addr{y:%lx uv:%lx}\r\n", PHOTOFAST_SLICE_ENC_DUMP("[Slice %lu] dst dim{%lu, %lu} dst region{%lu, %lu, %lu, %lu} addr{y:%lx uv:%lx}\r\n",
slice_idx, slice_idx,
vf_gfx_scale_param->dst_img.dim.w, vf_gfx_scale_param->dst_img.dim.w,
vf_gfx_scale_param->dst_img.dim.h, vf_gfx_scale_param->dst_img.dim.h,
vf_gfx_scale_param->dst_region.x, vf_gfx_scale_param->dst_region.x,
vf_gfx_scale_param->dst_region.y, vf_gfx_scale_param->dst_region.y,
vf_gfx_scale_param->dst_region.w, vf_gfx_scale_param->dst_region.w,
vf_gfx_scale_param->dst_region.h, vf_gfx_scale_param->dst_region.h,
addr_dst[0], addr_dst[1] addr_dst[0], addr_dst[1]
); );
if(slice_idx == (dst_slice_info.slice_num - 1)){ if(slice_idx == (dst_slice_info.slice_num - 1) &&
dst_scale_slice_height < dst_slice_info.last_slice_height
){
HD_GFX_DRAW_RECT draw_rect = {0}; HD_GFX_DRAW_RECT draw_rect = {0};
draw_rect.dst_img.dim = vf_gfx_scale_param->dst_img.dim; draw_rect.dst_img.dim = vf_gfx_scale_param->dst_img.dim;
draw_rect.dst_img.ddr_id = vf_gfx_scale_param->dst_img.ddr_id; draw_rect.dst_img.ddr_id = vf_gfx_scale_param->dst_img.ddr_id;
draw_rect.dst_img.format = vf_gfx_scale_param->dst_img.pxlfmt; draw_rect.dst_img.format = vf_gfx_scale_param->dst_img.pxlfmt;
draw_rect.dst_img.p_phy_addr[0] = vf_gfx_scale_param->dst_img.phy_addr[0]; draw_rect.dst_img.p_phy_addr[0] = vf_gfx_scale_param->dst_img.phy_addr[0];
draw_rect.dst_img.p_phy_addr[1] = vf_gfx_scale_param->dst_img.phy_addr[1]; draw_rect.dst_img.p_phy_addr[1] = vf_gfx_scale_param->dst_img.phy_addr[1];
draw_rect.dst_img.lineoffset[0] = vf_gfx_scale_param->dst_img.loff[0]; draw_rect.dst_img.lineoffset[0] = vf_gfx_scale_param->dst_img.loff[0];
draw_rect.dst_img.lineoffset[1] = vf_gfx_scale_param->dst_img.loff[1]; draw_rect.dst_img.lineoffset[1] = vf_gfx_scale_param->dst_img.loff[1];
draw_rect.color = LV_USER_CFG_STAMP_COLOR_BACKGROUND; draw_rect.color = LV_USER_CFG_STAMP_COLOR_BACKGROUND;
draw_rect.thickness = 1; draw_rect.thickness = 1;
draw_rect.type = HD_GFX_RECT_SOLID; draw_rect.type = HD_GFX_RECT_SOLID;
draw_rect.rect = (HD_IRECT){0, 0, vf_gfx_scale_param->dst_img.dim.w, vf_gfx_scale_param->dst_img.dim.h}; draw_rect.rect = (HD_IRECT){0, 0, vf_gfx_scale_param->dst_img.dim.w, vf_gfx_scale_param->dst_img.dim.h};
hd_gfx_draw_rect(&draw_rect); hd_gfx_draw_rect(&draw_rect);
} }
return E_OK; return E_OK;
} }
#if 1//PHOTOFAST_SLICE_ENC_DBG_PRIMARY_YUV #if 1//PHOTOFAST_SLICE_ENC_DBG_PRIMARY_YUV
@ -1116,7 +1238,7 @@ EXIT:
DBG_ERR("hd_videoenc_stop failed(%d)\r\n", ret); DBG_ERR("hd_videoenc_stop failed(%d)\r\n", ret);
} }
return (ret == HD_OK) ? E_OK : E_SYS; return (ret == HD_OK) ? E_OK : ret;
} }
@ -1196,7 +1318,6 @@ static INT32 PhotoFast_SliceEncode_Encode_Primary(
dst_slice_info, dst_slice_info,
slice_idx); slice_idx);
if(vf_gfx_scale(&vf_gfx_scale_param, 1) != HD_OK){ if(vf_gfx_scale(&vf_gfx_scale_param, 1) != HD_OK){
goto EXIT; goto EXIT;
} }
@ -1427,15 +1548,18 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME
ret = hd_videoproc_get(vproc_path_id, HD_VIDEOPROC_PARAM_OUT, (VOID*)&vproc_out); ret = hd_videoproc_get(vproc_path_id, HD_VIDEOPROC_PARAM_OUT, (VOID*)&vproc_out);
if(ret != HD_OK){ if(ret != HD_OK){
DBG_ERR("hd_videoproc_get HD_VIDEOPROC_PARAM_OUT failed(path_id=%lx, ret=%d)!", vproc_path_id, ret); DBG_ERR("hd_videoproc_get HD_VIDEOPROC_PARAM_OUT failed(path_id=%lx, ret=%d)!", vproc_path_id, ret);
goto EXIT; vproc_out_pxlfmt = HD_VIDEO_PXLFMT_YUV420;
}
else{
vproc_out_pxlfmt = vproc_out.pxlfmt;
} }
vproc_out_pxlfmt = vproc_out.pxlfmt;
/******************************************************************* /*******************************************************************
* Calculate dst slice info * Calculate dst slice info
******************************************************************/ ******************************************************************/
if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info) != E_OK){ if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info, video_frame) != E_OK){
return NVTEVT_CONSUME; return NVTEVT_CONSUME;
} }
@ -1482,11 +1606,12 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME
} }
// slice_encode_primary_info->bs_buf_mem_info.blk_size = (VDO_YUV_BUFSIZE(dst_slice_info.width, dst_slice_info.height, video_frame.pxlfmt) / (CFG_PHOTOFAST_SLICE_ENC_BS_BUF_RATIO)) + CFG_JPG_HEADER_SIZE + PhotoFast_GetScreenNailSize() ; // slice_encode_primary_info->bs_buf_mem_info.blk_size = (VDO_YUV_BUFSIZE(dst_slice_info.width, dst_slice_info.height, video_frame.pxlfmt) / (CFG_PHOTOFAST_SLICE_ENC_BS_BUF_RATIO)) + CFG_JPG_HEADER_SIZE + PhotoFast_GetScreenNailSize() ;
slice_encode_primary_info->bs_buf_mem_info.blk_size = ((PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(HD_VIDEO_PXLFMT_YUV420)/ 8) * (dst_slice_info.slice_num + 2)) + CFG_JPG_HEADER_SIZE + PhotoFast_GetScreenNailSize() ; slice_encode_primary_info->bs_buf_mem_info.blk_size = ((PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(HD_VIDEO_PXLFMT_YUV420)/ 8) * (dst_slice_info.slice_num + 1)) + CFG_JPG_HEADER_SIZE + PhotoFast_GetScreenNailSize() ;
if(PhotoFast_SliceEncode_Alloc_Buffer(&slice_encode_primary_info->bs_buf_mem_info, "slice_enc_primary") != E_OK){ if(PhotoFast_SliceEncode_Alloc_Buffer(&slice_encode_primary_info->bs_buf_mem_info, "slice_enc_primary") != E_OK){
goto EXIT; goto EXIT;
} }
PhotoFastCapDateImprint_GenYuvData(&video_frame);
/* check free mem */ /* check free mem */
#if POWERON_FAST_BOOT_MSG == ENABLE #if POWERON_FAST_BOOT_MSG == ENABLE
nvt_cmdsys_runcmd("nvtmpp info"); nvt_cmdsys_runcmd("nvtmpp info");
@ -1617,7 +1742,7 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME
DBG_DUMP("elapsed time of slice encode without write file = %lu us\n", tick_end - tick_start); DBG_DUMP("elapsed time of slice encode without write file = %lu us\n", tick_end - tick_start);
extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId); extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* path);
if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){
@ -1632,6 +1757,7 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME
dst_jpg_file.addr, dst_jpg_file.addr,
dst_jpg_file.size, dst_jpg_file.size,
NAMERULE_FMT_JPG, NAMERULE_FMT_JPG,
0,
0); 0);
EXIT: EXIT:
@ -1740,6 +1866,12 @@ typedef struct {
PhotoFast_MEM_Info mem_info_combined; PhotoFast_MEM_Info mem_info_combined;
PhotoFast_MEM_Info mem_info_thumb; PhotoFast_MEM_Info mem_info_thumb;
PhotoFast_SliceEncode_Queue_Comm_Param comm; PhotoFast_SliceEncode_Queue_Comm_Param comm;
#if PHOTOFAST_FAST_CLOSE
char file_path[NMC_TOTALFILEPATH_MAX_LEN];
UINT32 nextFolderID;
UINT32 nextFileID;
#endif
} PhotoFast_SliceEncode_Queue23_Param; } PhotoFast_SliceEncode_Queue23_Param;
typedef struct { typedef struct {
@ -1841,17 +1973,11 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data)
hd_ret = hd_videoproc_get(vproc_path_id, HD_VIDEOPROC_PARAM_OUT, (VOID*)&vproc_out); hd_ret = hd_videoproc_get(vproc_path_id, HD_VIDEOPROC_PARAM_OUT, (VOID*)&vproc_out);
if(hd_ret != HD_OK){ if(hd_ret != HD_OK){
DBG_ERR("hd_videoproc_get HD_VIDEOPROC_PARAM_OUT failed(path_id=%lx, ret=%d)!", vproc_path_id, ret); DBG_ERR("hd_videoproc_get HD_VIDEOPROC_PARAM_OUT failed(path_id=%lx, ret=%d)!", vproc_path_id, ret);
goto EXIT; vproc_out_pxlfmt = HD_VIDEO_PXLFMT_YUV420;
}
vproc_out_pxlfmt = vproc_out.pxlfmt;
/*******************************************************************
* Calculate dst slice info
******************************************************************/
if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info) != E_OK){
return NVTEVT_CONSUME;
} }
else{
vproc_out_pxlfmt = vproc_out.pxlfmt;
}
/* pull out vprc frame is in the CB1 */ /* pull out vprc frame is in the CB1 */
@ -1894,7 +2020,21 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data)
goto EXIT; goto EXIT;
} }
DBG_IND("process frame %lu\n", param->cnt); DBG_DUMP("process frame %lu\n", param->cnt);
/*******************************************************************
* Fast Stamp (higher speed, lower quality)
******************************************************************/
#if PHOTOFAST_FAST_STAMP
PhotoFastCapDateImprint_GenYuvData(&queue_ele_in->frame);
#endif
/*******************************************************************
* Calculate dst slice info
******************************************************************/
if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info, queue_ele_in->frame) != E_OK){
goto EXIT;
}
/******************************************************************* /*******************************************************************
* Calculate src slice info * Calculate src slice info
@ -1921,13 +2061,6 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data)
goto EXIT; goto EXIT;
} }
/*******************************************************************
* Fast Stamp (higher speed, lower quality)
******************************************************************/
#if PHOTOFAST_FAST_STAMP
PhotoFastCapDateImprint_GenYuvData(&queue_ele_in->frame);
#endif
/******************************************************************* /*******************************************************************
* Screennail & Thumbnail Scale * Screennail & Thumbnail Scale
******************************************************************/ ******************************************************************/
@ -2041,6 +2174,16 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data)
queue_ele_out->mem_info_combined = slice_encode_primary_info->bs_buf_mem_info; queue_ele_out->mem_info_combined = slice_encode_primary_info->bs_buf_mem_info;
queue_ele_out->mem_info_thumb = slice_encode_screennail_info->bs_buf_mem_info; queue_ele_out->mem_info_thumb = slice_encode_screennail_info->bs_buf_mem_info;
#if PHOTOFAST_FAST_CLOSE
UINT32 nextFolderID = 0, nextFileID = 0;
DCF_GetNextID(&nextFolderID,&nextFileID);
queue_ele_out->nextFolderID = nextFolderID;
queue_ele_out->nextFileID = nextFileID;
DCF_MakeObjPath(nextFolderID, nextFileID, DCF_FILE_TYPE_JPG, queue_ele_out->file_path);
DCF_AddDBfile(queue_ele_out->file_path);
DBG_DUMP("%s added to DCF\r\n", queue_ele_out->file_path);
#endif
while (lfqueue_enq(param->queue23, (void*) queue_ele_out) == -1) while (lfqueue_enq(param->queue23, (void*) queue_ele_out) == -1)
{ {
DBG_ERR("ENQ Full ?\r\n"); DBG_ERR("ENQ Full ?\r\n");
@ -2125,7 +2268,7 @@ INT32 PhotoFast_SliceEncode_CB3(void* user_data)
/******************************************************************* /*******************************************************************
* Output jpg file * Output jpg file
******************************************************************/ ******************************************************************/
extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId); extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* Path);
if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){
goto EXIT; goto EXIT;
@ -2135,17 +2278,40 @@ INT32 PhotoFast_SliceEncode_CB3(void* user_data)
goto EXIT; goto EXIT;
} }
#if !PHOTOFAST_FAST_CLOSE
PhotoFast_WriteFile( PhotoFast_WriteFile(
(UINT32)queue_ele_in->jpg_combined_addr, (UINT32)queue_ele_in->jpg_combined_addr,
queue_ele_in->jpg_combined_size, queue_ele_in->jpg_combined_size,
NAMERULE_FMT_JPG, NAMERULE_FMT_JPG,
0,
0); 0);
#else
PhotoFast_WriteFile(
(UINT32)queue_ele_in->jpg_combined_addr,
queue_ele_in->jpg_combined_size,
NAMERULE_FMT_JPG,
0,
queue_ele_in->file_path);
#endif
{ {
extern CHAR* PhotoFast_GetLastWriteFilePath(void); char tmp[NMC_TOTALFILEPATH_MAX_LEN] = {'\0'};
char* file_path = PhotoFast_GetLastWriteFilePath();
char tmp[256] = {'\0'}; #if !PHOTOFAST_FAST_CLOSE
extern CHAR* PhotoFast_GetLastWriteFilePath(void);
char* file_path = PhotoFast_GetLastWriteFilePath();
#else
char file_path[NMC_TOTALFILEPATH_MAX_LEN];
#if HUNTING_CAMERA_MCU == ENABLE
sprintf(tmp, "W%03ld%04ld.JPG", queue_ele_in->nextFolderID, queue_ele_in->nextFileID);
strncpy(file_path, tmp, strlen(queue_ele_in->file_path) - 1);
DBG_IND("last send file:%s\r\n", file_path);
#else
strncpy(file_path, FilePath, strlen(queue_ele_in->file_path) - 1);
#endif
#endif
#if HUNTING_CAMERA_MCU == ENABLE #if HUNTING_CAMERA_MCU == ENABLE
char tmp2[64] = {'\0'}; char tmp2[64] = {'\0'};
#endif #endif

View File

@ -31,7 +31,7 @@ typedef struct
INT32 PhotoFast_SliceEncode_Open(const HD_PATH_ID vproc_path_id); INT32 PhotoFast_SliceEncode_Open(const HD_PATH_ID vproc_path_id);
INT32 PhotoFast_SliceEncode_Close(void); INT32 PhotoFast_SliceEncode_Close(void);
INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME *p_video_frame); INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME *p_video_frame);
INT32 PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(PhotoFast_SliceSize_Info *info); INT32 PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(PhotoFast_SliceSize_Info *info, const HD_VIDEO_FRAME src_frame);
INT32 PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(HD_VIDEO_PXLFMT pxl_fmt); INT32 PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(HD_VIDEO_PXLFMT pxl_fmt);
#if POWERON_FAST_SLICE_ENC_VER2 == ENABLE #if POWERON_FAST_SLICE_ENC_VER2 == ENABLE