bool ParamsManager:: splitInt(String8 const& s8Input, Vector<int>& rOutput) { rOutput.clear(); // if ( s8Input.isEmpty() ) { MY_LOGW("empty string"); return false; } // char const*start = s8Input.string(); char *end = NULL; do { int value = ::strtol(start, &end, 10); if ( start == end ) { MY_LOGW_IF(0, "no digits in str:%s", s8Input.string()); return false; } rOutput.push_back(value); MY_LOGD_IF(0, "%d", value); start = end + 1; } while ( end && *end ); // return (rOutput.size() > 0); }
MINT32 halASD::mHalAsdDoSceneDet(void* src, MUINT16 imgw, MUINT16 imgh) { MINT32 Retcode = S_ASD_OK; // MY_LOGD("[mHalAsdDoSceneDet] \n"); MUINT16* img = (MUINT16*)src; MUINT16 times; MUINT32 count=0; ASD_SCD_INFO_STRUCT gMyAsdInfo; //if((imgw%ASD_IM_WIDTH!=0)||(imgh%ASD_IM_HEIGHT!=0)||((imgh%ASD_IM_HEIGHT)!=(imgw%ASD_IM_WIDTH))) if(imgw%ASD_IM_WIDTH!=0) { MY_LOGD("[mHalAsdDoSceneDet] can not resize img\n"); Retcode=E_ASD_WRONG_CMD_PARAM; return Retcode; } times=imgw/ASD_IM_WIDTH; for(int i=0;i<imgh;i+=times) { for(int j=0;j<imgw;j+=times) { *(img+count)=*(img+(i*imgw)+j); count++; } } #ifdef ASDdebug char szFileName[100]; sprintf(szFileName, "/sdcard/ASDResize%04d_%04d_%04d.raw", imgw/times, imgh/times,filecun); filecun++; FILE * pRawFp = fopen(szFileName, "wb"); if (NULL == pRawFp ) { MY_LOGE("Can't open file to save RAW Image\n"); while(1); } int i4WriteCnt = fwrite((void *)img,2, ( (imgw/times) * (imgh/times) * 1),pRawFp); fflush(pRawFp); fclose(pRawFp); #endif gMyAsdInfo.src_buffer_addr = (MUINT32)src; // MY_LOGD("[mHalAsdDoSceneDet] src 0x%x \n",(MUINT32)src); if(m_pMTKAsdObj == NULL) { m_pMTKAsdObj = MTKAsd::createInstance(DRV_ASD_OBJ_SW); MY_LOGW_IF(m_pMTKAsdObj == NULL, "Err"); } m_pMTKAsdObj->AsdMain(ASD_PROC_MAIN, &gMyAsdInfo); return Retcode; }
static MBOOL impConstructStaticMetadata_by_SymbolName( String8 const& s8Symbol, Info const& rInfo, IMetadata& rMetadata ) { typedef MBOOL (*PFN_T)( IMetadata & metadata, Info const& info ); // PFN_T pfn; MBOOL ret = MTRUE; String8 const s8LibPath = String8::format("libcam.halsensor.so"); void *handle = ::dlopen(s8LibPath.string(), RTLD_GLOBAL); if ( ! handle ) { char const *err_str = ::dlerror(); MY_LOGW("dlopen library=%s %s", s8LibPath.string(), err_str?err_str:"unknown"); ret = MFALSE; goto lbExit; } pfn = (PFN_T)::dlsym(handle, s8Symbol.string()); if ( ! pfn ) { MY_LOGW("%s not found", s8Symbol.string()); ret = MFALSE; goto lbExit; } // ret = pfn(rMetadata, rInfo); MY_LOGW_IF(!ret, "%s fail", s8Symbol.string()); // lbExit: if ( handle ) { ::dlclose(handle); handle = NULL; } return ret; }
status_t MetadataProvider:: impConstructStaticMetadata_by_SymbolName( String8 const& s8Symbol, IMetadata &metadata ) { typedef status_t (*PFN_T)( IMetadata & metadata, Info const& info ); // PFN_T pfn = (PFN_T)::dlsym(RTLD_DEFAULT, s8Symbol.string()); if ( ! pfn ) { MY_LOGW("%s not found", s8Symbol.string()); return NAME_NOT_FOUND; } // status_t const status = pfn(metadata, mInfo); MY_LOGW_IF(OK != status, "%s returns status[%s(%d)]", s8Symbol.string(), ::strerror(-status), -status); // return status; }
MINT32 halASD::mHalAsdInit(void* AAAData,void* working_buffer,MUINT8 SensorType, MINT32 Asd_Buf_Width, MINT32 Asd_Buf_Height) { g_udCount++; MY_LOGD("[halASD] g_udCount++:%d \n", g_udCount); AAA_ASD_PARAM* rASDInfo=(AAA_ASD_PARAM*)AAAData; MINT32 Retcode = S_ASD_OK; MUINT32* AFtable=(MUINT32*)malloc((rASDInfo->i4AFTableIdxNum + 1)*sizeof(MUINT32)); //********************************************************************************// //********Binchang 20110810 Add ASD Debug Opition****************// char value[PROPERTY_VALUE_MAX] = {'\0'}; property_get("ASD.debug.dump", value, "0"); mHalASDDumpOPT = atoi(value); //********************************************************************************// //********************************************************************************// gMyAsdInitInfo.pInfo = &gMyAsdEnvInfo; gMyAsdInitInfo.pDeciderInfo = &gMyDeciderEnvInfo; gMyAsdInitInfo.pDeciderTuningInfo = &gMyDeciderTuningInfo; gMyAsdInitInfo.pInfo->ext_mem_start_addr=(MUINT32)working_buffer; // working buffer, size: ASD_WORKING_BUFFER_SIZE gMyAsdInitInfo.pInfo->image_width =Asd_Buf_Width; // source image width (160) gMyAsdInitInfo.pInfo->image_height=Asd_Buf_Height; // source image height gMyAsdInitInfo.pInfo->asd_tuning_data.num_of_ort=ASD_ORT; // num_of_ort, drfault = 4 //*********************************************************************************************************************************************// //Please fix me Bin if(SensorType) { MY_LOGD("[YUV Sensor] \n"); gMyAsdInitInfo.pDeciderInfo->DeciderInfoVer = ASD_DECIDER_INFO_SRC_YUV; // Smart Phone Info } else { MY_LOGD("[SP_RAW_Sensor] \n"); gMyAsdInitInfo.pDeciderInfo->DeciderInfoVer = ASD_DECIDER_INFO_SRC_SP_RAW; // Smart Phone Info } //*********************************************************************************************************************************************// /* if(SensorType==ISP_SENSOR_TYPE_YUV) { gMyAsdInitInfo.pDeciderInfo->DeciderInfoVer = ASD_DECIDER_INFO_SRC_YUV; // Smart Phone Info } else { gMyAsdInitInfo.pDeciderInfo->DeciderInfoVer = ASD_DECIDER_INFO_SRC_SP_RAW; // Smart Phone Info } */ //*********************************************************************************************************************************************// gMyAsdInitInfo.pDeciderInfo->RefAwbD65Rgain = rASDInfo->i4AWBRgain_D65_X128; // reference 3A info, get from sensor or AWB data gMyAsdInitInfo.pDeciderInfo->RefAwbD65Bgain = rASDInfo->i4AWBBgain_D65_X128; // reference 3A info, get from sensor or AWB data gMyAsdInitInfo.pDeciderInfo->RefAwbCwfRgain = rASDInfo->i4AWBRgain_CWF_X128; // reference 3A info, get from sensor or AWB data gMyAsdInitInfo.pDeciderInfo->RefAwbCwfBgain = rASDInfo->i4AWBBgain_CWF_X128; // reference 3A info, get from sensor or AWB data *AFtable=rASDInfo->i4AFTableMacroIdx; memcpy((AFtable+1),rASDInfo->pAFTable,(rASDInfo->i4AFTableIdxNum*sizeof(MUINT32))); MY_LOGD("[mHalAsdInit] i4AFTableMacroIdx %d i4AFTableIdxNum %d i4AFTableOffset %d\n",rASDInfo->i4AFTableMacroIdx,rASDInfo->i4AFTableIdxNum,rASDInfo->i4AFTableOffset); for(int i=1;i<rASDInfo->i4AFTableIdxNum+1;i++) { *(AFtable+i) = *(AFtable+i) + rASDInfo->i4AFTableOffset; MY_LOGD("[mHalAsdInit] After (Offset) AF table %d \n",*(AFtable+i)); } //BinChang 20121228 //gMyAsdInitInfo.pDeciderInfo->RefAfTbl = (void *)AFtable; // reference 3A info, get from lens or AF data if(rASDInfo->i4AFTableMacroIdx != 0) gMyAsdInitInfo.pDeciderInfo->RefAfTbl = (void *)AFtable; else gMyAsdInitInfo.pDeciderInfo->RefAfTbl = NULL; gMyAsdInitInfo.pDeciderTuningInfo = 0; // use default value if (m_pMTKAsdObj) { Retcode = E_ASD_ERR; MY_LOGD("[v] Err, Init has been called \n"); } /* Create MTKPano Interface */ if(m_pMTKAsdObj == NULL) { m_pMTKAsdObj = MTKAsd::createInstance(DRV_ASD_OBJ_SW); MY_LOGW_IF(m_pMTKAsdObj == NULL, "Err"); } m_pMTKAsdObj->AsdInit(&gMyAsdInitInfo, 0); if (AFtable) { free(AFtable); } return Retcode; }