OMX_ERRORTYPE IFM_NmfProcessingComp::doBufferDeAllocation(OMX_U32 nPortIndex,OMX_U32 nBufferIndex, void * pBufferMetaData){ IN0("\n"); OMX_ERRORTYPE error = OMX_ErrorNone; OMX_PARAM_PORTDEFINITIONTYPE portdef; OMX_VERSIONTYPE version = {{0, 0, 0, 0}}; getOmxIlSpecVersion(&version); portdef.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE); portdef.nVersion = version; ENS_Port * port = mENSComponent.getPort(nPortIndex); port->getParameter(OMX_IndexParamPortDefinition, &portdef); if ((portdef.eDomain == OMX_PortDomainVideo)&&(nBufferIndex == 0)) { ENS_Port *port = mENSComponent.getPort(nPortIndex); MMHwBuffer *sharedChunk = port->getSharedChunk(); error = MMHwBuffer::Destroy(sharedChunk); if (error != OMX_ErrorNone) { OUTR(" ",error); return error; } } else if (portdef.eDomain != OMX_PortDomainVideo) { delete [] (char *) pBufferMetaData; } OUTR(" ",OMX_ErrorNone); return OMX_ErrorNone; }
/* * This function computes the dampers and queues the Page Elements */ t_damper_error_code CScorpioDamper::ComputeAndQueuePEs( CIspctlCom* pIspctlCom, const t_damper_base_values* pBaseValues) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CScorpioDamper::ComputeAndQueuePEs", (mTraceObject)); float pDampedValues[1] = { 0.0 }; float fCoringLevel = 0.0; t_damper_error_code err = DAMPER_OK; // Evaluate Scorpio dampers err = DoEvaluate( pBaseValues, pDampedValues); if(err!=DAMPER_OK) { DBGT_ERROR("Evaluation failed: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "Evaluation failed: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CScorpioDamper::ComputeAndQueuePEs (%d)", (mTraceObject), err); return err; } // Queue the Page Elements list fCoringLevel = pDampedValues[0]; MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(Scorpio_Ctrl_u8_CoringLevel_Ctrl_Byte0), fCoringLevel); OstTraceFiltStatic1(TRACE_DEBUG, "Scorpio_Ctrl_u8_CoringLevel_Ctrl = %f", (mTraceObject), fCoringLevel); pIspctlCom->queuePE( Scorpio_Ctrl_u8_CoringLevel_Ctrl_Byte0, (t_uint32)fCoringLevel); // Done OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CScorpioDamper::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * tuningloader_fileio write method */ t_fileio_error tuningloader_fileio::write(const void* pSrcBuffer, int aNumBytes) { IN0("\n"); size_t iNumBytesWritten = 0; // Sanity check if( pSrcBuffer == NULL || aNumBytes == 0) { // Bad parameter MSG2("Bad parameter: pSrcBuffer=%p aNumBytes=%d\n", pSrcBuffer, aNumBytes); OUTR(" ", FILEIO_BAD_ARGUMENT); return FILEIO_BAD_ARGUMENT; } if( pFile == NULL) { // File is not open MSG0("File not open\n"); OUTR(" ", FILEIO_FILE_NOT_OPEN); return FILEIO_FILE_NOT_OPEN; } // Write to file iNumBytesWritten = fwrite( pSrcBuffer, 1, (size_t)aNumBytes, pFile); if( iNumBytesWritten != (size_t)aNumBytes ) { // Could not write into file MSG0("Write failed, closing file\n"); OUTR(" ", FILEIO_WRITE_FAILED); return FILEIO_WRITE_FAILED; } // Sucessfully wrote to file OUTR(" ",FILEIO_OK); return FILEIO_OK; }
/* * This function sets the sharpening damper */ t_damper_error_code CSharpeningDamperLR::SetDamper( const t_sharpening_damper_lr_id aDamperId, const float* pValues, const int aNumRows, const int aNumCols) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CSharpeningDamperLR::SetDamper", (mTraceObject)); t_damper_error_code err = DAMPER_OK; if(aDamperId<0 || aDamperId>=SHARPENING_DAMPERS_LR_NUM) { DBGT_ERROR("Invalid damper Id: %d\n", aDamperId); OstTraceFiltStatic1(TRACE_ERROR, "Invalid damper Id: %d", (mTraceObject), aDamperId); OUTR(" ",DAMPER_INVALID_ARGUMENT); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::SetDamper (%d)", (mTraceObject), DAMPER_INVALID_ARGUMENT); return DAMPER_INVALID_ARGUMENT; } MSG3("[%s] NumRows=%d, NumCols=%d\n", SHARPENING_DAMPER_LR_NAME(aDamperId), aNumRows, aNumCols); OstTraceFiltStatic3(TRACE_DEBUG, "SHARPENING_DAMPER_LR_NAME(%d) NumRows=%d, NumCols=%d", (mTraceObject), aDamperId, aNumRows, aNumCols); err = DoSetDamper( aDamperId, pValues, aNumRows, aNumCols); if(err!=DAMPER_OK) { DBGT_ERROR("[%s] failed to set damper: err=%d\n", SHARPENING_DAMPER_LR_NAME(aDamperId), err); OstTraceFiltStatic2(TRACE_ERROR, "SHARPENING_DAMPER_LR_NAME(%d) failed to set damper: err=%d", (mTraceObject), aDamperId, err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::SetDamper (%d)", (mTraceObject), err); return err; } OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::SetDamper (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function computes the dampers and queues the Page Elements */ t_damper_error_code CNoiseFilterDamper::ComputeAndQueuePEs( CIspctlCom* pIspctlCom, const t_damper_base_values* pBaseValues) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CNoiseFilterDamper::ComputeAndQueuePEs", (mTraceObject)); float pDampedValues[1] = { 0.0 }; t_damper_error_code err = DAMPER_OK; // Evaluate Noise Filter dampers err = DoEvaluate( pBaseValues, pDampedValues); if(err!=DAMPER_OK) { DBGT_ERROR("Failed to evaluate damper: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "Failed to evaluate damper: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseFilterDamper::ComputeAndQueuePEs (%d)", (mTraceObject), err); return err; } // Queue the Page Elements float fGaussianWeightDamped = pDampedValues[0]; MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(DusterControl_u8_GaussianWeight_Byte0), fGaussianWeightDamped); OstTraceFiltStatic1(TRACE_DEBUG, "DusterControl_u8_GaussianWeight = %f", (mTraceObject), fGaussianWeightDamped); pIspctlCom->queuePE( DusterControl_u8_GaussianWeight_Byte0, (t_uint32)fGaussianWeightDamped); // Done OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseFilterDamper::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function sets the DefCor dampers */ t_damper_error_code CDefCorDamper::SetDamper( const t_defcor_damper_id aDamperId, const float* pValues, const int aNumRows, const int aNumCols) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CDefCorDamper::SetDamper", (mTraceObject)); t_damper_error_code err = DAMPER_OK; if(aDamperId<0 || aDamperId>=DEFCOR_DAMPERS_NUM) { DBGT_ERROR("Invalid damper Id: %d\n", aDamperId); OstTraceFiltStatic1(TRACE_ERROR, "Invalid damper Id: %d", (mTraceObject), aDamperId); OUTR(" ",DAMPER_INVALID_ARGUMENT); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), DAMPER_INVALID_ARGUMENT); return DAMPER_INVALID_ARGUMENT; } MSG3("[%s] NumRows=%d, NumCols=%d\n", KDefCorDamperInfo[aDamperId].name, aNumRows, aNumCols); OstTraceFiltStatic3(TRACE_DEBUG, "[KDefCorDamperInfo[%d].name] NumRows=%d, NumCols=%d", (mTraceObject), aDamperId, aNumRows, aNumCols); err = DoSetDamper( aDamperId, pValues, aNumRows, aNumCols); if(err!=DAMPER_OK) { DBGT_ERROR("[%s] failed to set damper: err=%d\n", KDefCorDamperInfo[aDamperId].name, err); OstTraceFiltStatic2(TRACE_ERROR, "[KDefCorDamperInfo[%d].name] failed to set damper: err=%d", (mTraceObject), aDamperId, err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), err); return err; } OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function launches the loading of the flash tuning data */ TuningLoaderMgrError_t CTuningLoaderManager::loadFlashTuningData(const t_flash_info* pFlashInfo) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CTuningLoaderManager::loadFlashTuningData", (mTraceObject)); // Check if constructed if(iNmfInstance == NULL) { MSG0("Instance not constructed\n"); OstTraceFiltStatic0(TRACE_ERROR, "Instance not constructed", (mTraceObject)); OUTR(" ",TUNING_LOADER_MGR_NOT_CONSTRUCTED); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadFlashTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_NOT_CONSTRUCTED); return TUNING_LOADER_MGR_NOT_CONSTRUCTED; } // Aguments sanity check if( pFlashInfo == NULL) { MSG1("Bad argument: pFlashInfo=%p\n", pFlashInfo); OstTraceFiltStatic1(TRACE_ERROR, "Bad argument: pFlashInfo=0x%x", (mTraceObject), (t_uint32)pFlashInfo); OUTR(" ",TUNING_LOADER_MGR_BAD_ARGUMENT); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadFlashTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_BAD_ARGUMENT); return TUNING_LOADER_MGR_BAD_ARGUMENT; } // Send command to NMF MSG0("Send 'loadFlashTuning' command to NMF\n"); OstTraceFiltStatic0(TRACE_DEBUG, "Send 'loadFlashTuning' command to NMF", (mTraceObject)); iNmfQueryIntf.loadFlashTuning(*pFlashInfo); OUTR(" ",TUNING_LOADER_MGR_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadFlashTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_OK); return TUNING_LOADER_MGR_OK; }
TuningLoaderMgrError_t CTuningLoaderManager::saveNvmTuningData(const t_camera_info* pCamInfo,unsigned char* pNvm, t_uint32 aSize) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CTuningLoaderManager::saveNvmTuningData", (mTraceObject)); // Check if constructed if(iNmfInstance == NULL) { MSG0("Instance not constructed\n"); OstTraceFiltStatic0(TRACE_ERROR, "Instance not constructed", (mTraceObject)); OUTR(" ",TUNING_LOADER_MGR_NOT_CONSTRUCTED); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadNvmTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_NOT_CONSTRUCTED); return TUNING_LOADER_MGR_NOT_CONSTRUCTED; } // Aguments sanity check if( (pCamInfo == NULL) || (pNvm ==NULL) || (aSize == 0)) { MSG1("Bad argument: pCamInfo=%x, pNvm=0x%x, aSize=%x\n", (unsigned int)pCamInfo,(unsigned int)pNvm,(unsigned int)aSize); OstTraceFiltStatic3(TRACE_ERROR, "Bad argument: pCamInfo=0x%x pNvm=0x%x, aSize=%d", (mTraceObject), (t_uint32)pCamInfo,(t_uint32)pNvm,aSize); OUTR(" ",TUNING_LOADER_MGR_BAD_ARGUMENT); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadNvmTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_BAD_ARGUMENT); return TUNING_LOADER_MGR_BAD_ARGUMENT; } // Send command to NMF MSG0("Send 'SaveNvmTuning' command to NMF\n"); OstTraceFiltStatic0(TRACE_DEBUG, "Send 'loadNvmTuning' command to NMF", (mTraceObject)); iNmfQueryIntf.saveNvmTuning(*pCamInfo,(t_uint32)pNvm,aSize); OUTR(" ",TUNING_LOADER_MGR_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::loadNvmTuningData (%d)", (mTraceObject), TUNING_LOADER_MGR_OK); return TUNING_LOADER_MGR_OK; }
/* * This function computes the dampers and queues the Page Elements */ t_damper_error_code CDefCorDamper::ComputeAndQueuePEs( CIspctlCom* pIspctlCom, const t_damper_base_values* pBaseValues) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CDefCorDamper::ComputeAndQueuePEs", (mTraceObject)); float pDamperValues[DEFCOR_DAMPERS_NUM] = {0.0, 0.0}; t_damper_error_code err = DAMPER_OK; // Evaluate DefCor dampers err = DoEvaluate( pBaseValues, pDamperValues); if(err!=DAMPER_OK) { DBGT_ERROR("Evaluation failed: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "Evaluation failed: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::ComputeAndQueuePEs (%d)", (mTraceObject), err); return err; } // Queue the Page Elements for(int i=0; i<DEFCOR_DAMPERS_NUM; i++) { MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(KDefCorDamperInfo[i].addr), pDamperValues[i]); //OstTraceFiltStatic2(TRACE_DEBUG, "%s = %f", (mTraceObject), CXp70::GetPeName(KDefCorDamperInfo[i].addr), pDamperValues[i]); pIspctlCom->queuePE( KDefCorDamperInfo[i].addr, (t_uint32)pDamperValues[i]); } // Done OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function computes the dampers and queues the Page Elements */ t_damper_error_code CSharpeningDamperLR::ComputeAndQueuePEs( CIspctlCom* pIspctlCom, const t_damper_base_values* pBaseValues) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CSharpeningDamperLR::ComputeAndQueuePEs", (mTraceObject)); float pDamperValues[SHARPENING_DAMPERS_LR_NUM] = { 0.0, 0.0}; t_damper_error_code err = DAMPER_OK; float fAdsocGain = 0.0; float fAdsocCoring = 0.0; float fScaleFactor = 0.0; // Evaluate Sharpening dampers err = DoEvaluate( pBaseValues, pDamperValues); if(err!=DAMPER_OK) { DBGT_ERROR("Evaluation failed: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "Evaluation failed: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::ComputeAndQueuePEs (%d)", (mTraceObject), err); return err; } // Compute and queue Adsoc Gain PE (scale against omx config and clip value) fAdsocGain = pDamperValues[SHARPENING_ADSOC_GAIN_LR]; fScaleFactor = (float)iOmxSharpness * iScaleFactorGain + iScaleFactorOffset; MSG1("Scale Factor = %f\n", fScaleFactor); OstTraceFiltStatic1(TRACE_DEBUG, "Scale Factor = %f", (mTraceObject), fScaleFactor); fAdsocGain *= fScaleFactor; if( fAdsocGain < 0.0) { fAdsocGain = 0.0; } else if ( fAdsocGain > 255.0 ) { fAdsocGain = 255.0; } MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Gain_Byte0), fAdsocGain); OstTraceFiltStatic1(TRACE_DEBUG, "Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Gain = %f", (mTraceObject), fAdsocGain); pIspctlCom->queuePE( Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Gain_Byte0, (t_uint32)fAdsocGain); // Compute and queue Adsoc Coring PE fAdsocCoring = pDamperValues[SHARPENING_ADSOC_CORING_LR]; if( fAdsocCoring < 0.0) { fAdsocCoring = 0.0; } else if ( fAdsocCoring > 31.0 ) { fAdsocCoring = 31.0; } MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Coring_Level_Byte0), fAdsocCoring); OstTraceFiltStatic1(TRACE_DEBUG, "Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Coring_Level = %f", (mTraceObject), fAdsocCoring); pIspctlCom->queuePE( Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Coring_Level_Byte0, (t_uint32)fAdsocCoring); // Done OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CSharpeningDamperLR::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
t_fileio_error tuningloader_calfile::process(t_cal_file_info* pCalFileInfo) { bool bCalStatusFound = false; bool bFuseIdFound = false; char cFileLine[128] = ""; char* pString = NULL; // Sanity check if( pCalFileInfo == NULL ) { // Bad parameter MSG3("Bad parameter: pCalFileInfo=%p \n", pCalFileInfo); OUTR(" ", FILEIO_BAD_ARGUMENT); return FILEIO_BAD_ARGUMENT; } pCalFileInfo->iCalStatus[0] = '\0'; pCalFileInfo->Fuse_Id4 =0; while(gets(cFileLine,sizeof(cFileLine))!= NULL) { if(bCalStatusFound == false) { if(strstr(cFileLine,"Success") != NULL) { bCalStatusFound = true; snprintf(pCalFileInfo->iCalStatus, sizeof(pCalFileInfo->iCalStatus)-1, "Success"); } else if(strstr(cFileLine,"Fail") != NULL) { bCalStatusFound = true; snprintf(pCalFileInfo->iCalStatus, sizeof(pCalFileInfo->iCalStatus)-1, "Fail"); } } if(bFuseIdFound == false) { if((pString = strstr(cFileLine,"Fuse_ID[4]")) != NULL) { bFuseIdFound = true; pString +=(sizeof("Fuse_ID[4]=0x") - 0x01); sscanf(pString,"%lx",&(pCalFileInfo->Fuse_Id4)); } } if(bFuseIdFound == true && bCalStatusFound == true) { // Got both Status and fuse id, so no need for further read MSG0("Found Both status and FuseId4 in Calibration file\n"); break; } } OUTR(" ", FILEIO_OK); return FILEIO_OK; }
void openmax_processor::setParam(t_sint32 portIndex, t_sint32 fifoSize, t_sint32 direction, t_sint32 buffSupplierType, t_sint32 correspondingPortIndex, t_sint32 width, t_sint32 height, t_sint32 colorFormat, t_sint32 stride) //************************************************************************************************************* { //DEfault initialisation of the ports IN0("\n"); MSG4("portIndex %ld, fifoSize %ld, direction %ld, buffSupplierType%ld\n", portIndex, fifoSize, direction, buffSupplierType); MSG4("correspondingPortIndex %ld, width %ld, height %ld, colorFormat %ld\n", correspondingPortIndex, width, height, colorFormat); MSG1("stride %ld\n", stride); if(portIndex >= (int)GetNbPorts()) // Sanity check { MSG0("ERROR in setParam OMX_ErrorBadParameter\n"); OUTR(" Error", OMX_ErrorBadParameter); return; } portInformation*pInfo= GetPortInfo(portIndex); if (pInfo) { pInfo->fifoSize = fifoSize; pInfo->width = width; pInfo->height = height; pInfo->colorFormat = (OMX_COLOR_FORMATTYPE)colorFormat; pInfo->omxPortIndex = portIndex; pInfo->stride = stride; pInfo->direction = (OMX_DIRTYPE) direction; pInfo->bufferSupplier= buffSupplierType; pInfo->omxPortIndex = correspondingPortIndex; } OUT0("\n"); }
//Warning this function can only by called when there is only one input and one output int womDemoCpt_processor::GetConvertionConfig (_tConvertionConfig &Config, bool bDequeue) //************************************************************************************************************* { //This method is called for preparing default ConvertionConfig struct IN0("\n"); int res=InitProcessingInfo(Config, bDequeue, eInputPort_Img, eOutputPort_Img, eOutputPort_Metadata); OUTR("", res); return(res); }
/* * Search and open a file for reading */ t_fileio_error tuningloader_fileio::search(const char** pPaths, const int aNumPaths, const char* pFileName) { IN0("\n"); // Close file in case previous one is still open if(pFile!=NULL) { MSG0("Attenmting to open a new file without having closed previous one\n"); OUTR(" ",FILEIO_FILE_NOT_CLOSED); return FILEIO_FILE_NOT_CLOSED; } // Loop on all root paths for(int i=0; i<aNumPaths; i++) { // Contruct file name snprintf(iFullyQualifiedFileName, sizeof(iFullyQualifiedFileName), "%s/%s", pPaths[i], pFileName); // Open file MSG1("Opening file (read only) '%s'\n", iFullyQualifiedFileName); pFile = fopen( iFullyQualifiedFileName, "rb"); if(pFile!=NULL) { // File sucessfully open, retrieve file size if( fseek( pFile, 0, SEEK_END) != 0) { // Seek failed MSG0("Failed to seek to end of file, aborting\n"); close(); OUTR(" ", FILEIO_SEEK_FAILED); return FILEIO_SEEK_FAILED; } iFileSize = (int)ftell(pFile); MSG1("File found, size=%d\n", iFileSize); (void)fseek(pFile, 0, SEEK_SET); OUTR(" ", FILEIO_OK); return FILEIO_OK; } MSG0("File not found, try next path\n"); } MSG0("All paths have been visited, file not found\n"); OUTR(" ", FILEIO_OPEN_FAILED); return FILEIO_OPEN_FAILED; }
/* * This function stops NMF */ TuningLoaderMgrError_t CTuningLoaderManager::stop() { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CTuningLoaderManager::stop", (mTraceObject)); if(iNmfInstance == NULL) { MSG0("NMF instance not constructed\n"); OstTraceFiltStatic0(TRACE_ERROR, "NMF instance not constructed", (mTraceObject)); OUTR(" ",TUNING_LOADER_MGR_NOT_CONSTRUCTED); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::stop (%d)", (mTraceObject), TUNING_LOADER_MGR_NOT_CONSTRUCTED); return TUNING_LOADER_MGR_NOT_CONSTRUCTED; } MSG0("Stopping NMF component\n"); OstTraceFiltStatic0(TRACE_DEBUG, "Stopping NMF component", (mTraceObject)); iNmfInstance->stop_flush(); OUTR(" ",TUNING_LOADER_MGR_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::stop (%d)", (mTraceObject), TUNING_LOADER_MGR_OK); return TUNING_LOADER_MGR_OK; }
/* * Open a file */ t_fileio_error tuningloader_fileio::open(const char* pFileName, t_fileio_mode aFileIoMode) { IN0("\n"); const char* pOpenMode = aFileIoMode==FILEIO_MODE_READ_ONLY ? "rb" : "wb"; // Close file in case previous one is still open if(pFile!=NULL) { MSG0("Attempting to open a new file without having closed previous one\n"); OUTR(" ",FILEIO_FILE_NOT_CLOSED); return FILEIO_FILE_NOT_CLOSED; } // Open file MSG2("Opening file (%s only) '%s'\n", aFileIoMode==FILEIO_MODE_READ_ONLY?"read":"write", pFileName); pFile = fopen( pFileName, pOpenMode); if(pFile==NULL) { MSG0("Failed to open file\n"); OUTR(" ",FILEIO_OPEN_FAILED); return FILEIO_OPEN_FAILED; } // File sucessfully open snprintf(iFullyQualifiedFileName, sizeof(iFullyQualifiedFileName), "%s", pFileName); if(aFileIoMode==FILEIO_MODE_READ_ONLY) { // File open in "read only" mode: retrieve file size if( fseek( pFile, 0, SEEK_END) != 0) { // Seek failed MSG0("Failed to seek to end of file, aborting\n"); close(); OUTR(" ", FILEIO_SEEK_FAILED); return FILEIO_SEEK_FAILED; } iFileSize = (int)ftell(pFile); (void)fseek(pFile, 0, SEEK_SET); } MSG1("File sucessfully open, size=%d\n", iFileSize); OUTR(" ", FILEIO_OK); return FILEIO_OK; }
//Not arm target --> x86-linux //Basic implementation without regarding type of buffers WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::useBuffer(OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_BUFFERHEADERTYPE* pBufferHdr, void **portPrivateInfo) //************************************************************************************************************* { IN0("\n"); OMX_ERRORTYPE err = OMX_ErrorNone; MSG4("OpenMax_Proxy[%s]::useBuffer[%lu] buffer=%lu Header=%p\n", GetComponentName(), nPortIndex, nBufferIndex, pBufferHdr); err = useBufferHeap(nPortIndex, nBufferIndex, pBufferHdr, portPrivateInfo); OUTR(" ", (err)); return err; }
/* * This function computes the dampers and queues the Page Elements */ t_damper_error_code CNoiseModelDamper::ComputeAndQueuePEs( CIspctlCom* pIspctlCom, const t_damper_base_values* pBaseValues, const float aAverageDigitalGain) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CNoiseModelDamper::ComputeAndQueuePEs", (mTraceObject)); float pDampedValues[1] = { 0.0 }; float fUserFrameSigma = 0.0; t_damper_error_code err = DAMPER_OK; // Evaluate Noise Model dampers err = DoEvaluate( pBaseValues, pDampedValues); if(err!=DAMPER_OK) { MSG1("Evaluation failed: err=%d\n", err); OstTraceFiltStatic1(TRACE_DEBUG, "Evaluation failed: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseModelDamper::ComputeAndQueuePEs (%d)", (mTraceObject), err); return err; } // Scale the damper output by the reference Shading Correction Gain, Average Digital Gain and pipeline dynamic range // NOTE: the damper output is now the noise sigma at pipeline input, normalized to pipeline dynamic range MSG2("iShadingCorrectionGain=%f, aAverageDigitalGain=%f\n", iShadingCorrectionGain, aAverageDigitalGain); OstTraceFiltStatic2(TRACE_DEBUG, "iShadingCorrectionGain=%f, aAverageDigitalGain=%f", (mTraceObject), iShadingCorrectionGain, aAverageDigitalGain); fUserFrameSigma = pDampedValues[0] * iShadingCorrectionGain * aAverageDigitalGain * 4095.0; // Clip against hardware limit if(fUserFrameSigma >= 1024) { fUserFrameSigma = 1024; } // Queue the Page Elements MSG2("%s = %f\n", CIspctlCom::pIspctlSensor->GetPeName(DusterControl_u16_FrameSigma_Byte0), fUserFrameSigma); OstTraceFiltStatic1(TRACE_DEBUG, "DusterControl_u16_FrameSigma = %f", (mTraceObject), fUserFrameSigma); pIspctlCom->queuePE( DusterControl_u16_FrameSigma_Byte0, (t_uint32)fUserFrameSigma); // Done OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseModelDamper::ComputeAndQueuePEs (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::allocateBuffer(OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_U32 nSizeBytes, OMX_U8 **ppData, void **bufferAllocInfo, void **portPrivateInfo) //************************************************************************************************************* { IN0("\n"); MSG3("Allocate buffer PortIndex %lu, nBufferIndex=%lu, nSizeBytes %lu\n", nPortIndex, nBufferIndex, nSizeBytes); OMX_ERRORTYPE err = OMX_ErrorNone; err = allocateBufferHeap(nPortIndex, nBufferIndex, nSizeBytes, ppData, bufferAllocInfo, portPrivateInfo); ++m_NbPortAllocated[nPortIndex]; OUTR("", (err)); return err; }
/* * This function get the config file name of the flash */ TuningLoaderMgrError_t CTuningLoaderManager::getFlashConfigFileName(const char** pFlashCfgFileName) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CTuningLoaderManager::getFlashConfigFileName", (mTraceObject)); // Check if constructed if(iNmfInstance == NULL) { MSG0("Instance not constructed\n"); OstTraceFiltStatic0(TRACE_ERROR, "Instance not constructed", (mTraceObject)); OUTR(" ",TUNING_LOADER_MGR_NOT_CONSTRUCTED); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::getFlashConfigFileName (%d)", (mTraceObject), TUNING_LOADER_MGR_NOT_CONSTRUCTED); return TUNING_LOADER_MGR_NOT_CONSTRUCTED; } // Ask file name to NMF component *pFlashCfgFileName = iNmfSyncIntf.flashConfigFileName(); OUTR(" ",TUNING_LOADER_MGR_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CTuningLoaderManager::getFlashConfigFileName (%d)", (mTraceObject), TUNING_LOADER_MGR_OK); return TUNING_LOADER_MGR_OK; }
/* * This function sets the Gaussian Weight damper */ t_damper_error_code CNoiseFilterDamper::SetDusterGaussianWeightDamper( const float* pValues, const int aNumRows, const int aNumCols) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CNoiseFilterDamper::SetDusterGaussianWeightDamper", (mTraceObject)); t_damper_error_code err = DAMPER_OK; MSG2("[Gaussian Weight] NumRows=%d, NumCols=%d\n", aNumRows, aNumCols); OstTraceFiltStatic2(TRACE_DEBUG, "[Gaussian Weight] NumRows=%d, NumCols=%d", (mTraceObject), aNumRows, aNumCols); err = DoSetDamper( pValues, aNumRows, aNumCols); if(err!=DAMPER_OK) { DBGT_ERROR("[Gaussian Weight] failed to set damper: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "[Gaussian Weight] failed to set damper: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), err); return err; } OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CDefCorDamper::SetDamper (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function sets the Noise Model damper */ t_damper_error_code CNoiseModelDamper::SetFrameSigmaDamper( const float* pValues, const int aNumRows, const int aNumCols) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CNoiseModelDamper::SetFrameSigmaDamper", (mTraceObject)); t_damper_error_code err = DAMPER_OK; MSG2("[Frame Sigma] NumRows=%d, NumCols=%d\n", aNumRows, aNumCols); OstTraceFiltStatic2(TRACE_DEBUG, "[Frame Sigma] NumRows=%d, NumCols=%d", (mTraceObject), aNumRows, aNumCols); err = DoSetDamper( pValues, aNumRows, aNumCols); if(err!=DAMPER_OK) { MSG1("[Frame Sigma] failed to set damper: err=%d\n", err); OstTraceFiltStatic1(TRACE_DEBUG, "[Frame Sigma] failed to set damper: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseModelDamper::SetFrameSigmaDamper (%d)", (mTraceObject), err); return err; } OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CNoiseModelDamper::SetFrameSigmaDamper (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
/* * This function sets the Coring Level damper */ t_damper_error_code CScorpioDamper::SetCoringLevelDamper( const float* pValues, const int aNumRows, const int aNumCols) { IN0("\n"); OstTraceFiltStatic0(TRACE_FLOW, "Entry CScorpioDamper::SetCoringLevelDamper", (mTraceObject)); t_damper_error_code err = DAMPER_OK; MSG2("[Coring Level] NumRows=%d, NumCols=%d\n", aNumRows, aNumCols); OstTraceFiltStatic2(TRACE_DEBUG, "[Coring Level] NumRows=%d, NumCols=%d", (mTraceObject), aNumRows, aNumCols); err = DoSetDamper( pValues, aNumRows, aNumCols); if(err!=DAMPER_OK) { DBGT_ERROR("[Coring Level] failed to set damper: err=%d\n", err); OstTraceFiltStatic1(TRACE_ERROR, "[Coring Level] failed to set damper: err=%d", (mTraceObject), err); OUTR(" ",err); OstTraceFiltStatic1(TRACE_FLOW, "Exit CScorpioDamper::SetCoringLevelDamper (%d)", (mTraceObject), err); return err; } OUTR(" ",DAMPER_OK); OstTraceFiltStatic1(TRACE_FLOW, "Exit CScorpioDamper::SetCoringLevelDamper (%d)", (mTraceObject), DAMPER_OK); return DAMPER_OK; }
OMX_ERRORTYPE IFM_HostNmfProcessingComp::freeBuffer( OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_BOOL bBufferAllocated, void *bufferAllocInfo, void *portPrivateInfo){ IN0("\n"); ENS_Port * port = mENSComponent.getPort(nPortIndex); OMX_PARAM_PORTDEFINITIONTYPE portdef; OMX_VERSIONTYPE version = {{0, 0, 0, 0}}; getOmxIlSpecVersion(&version); portdef.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE); portdef.nVersion = version; port->getParameter(OMX_IndexParamPortDefinition, &portdef); if(portdef.eDomain == OMX_PortDomainVideo){ //will free depending on bBufferAllocated //freeBufferVisual(nPortIndex,nBufferIndex,bBufferAllocated,NULL,portPrivateInfo); OMX_ERRORTYPE error; ENS_Port *port = mENSComponent.getPort(nPortIndex); MMHwBuffer *sharedChunk = (MMHwBuffer *)port->getSharedChunk(); if (sharedChunk) { if (nBufferIndex == port->getBufferCountActual()-1) { if (bBufferAllocated) { error = MMHwBuffer::Destroy(sharedChunk); DBC_ASSERT(error == OMX_ErrorNone); } else { error = MMHwBuffer::Close(sharedChunk); DBC_ASSERT(error == OMX_ErrorNone); } port->setSharedChunk(0); } }//else DBC_ASSERT(0); /* whatever : delete the sharedBuffer as in both case (allocation or use) it is allocated*/ delete (SharedBuffer *)portPrivateInfo; } else /* clock domain */ { freeBufferHeap(nPortIndex,nBufferIndex,bBufferAllocated,bufferAllocInfo,portPrivateInfo); } OUTR(" ",OMX_ErrorNone); return OMX_ErrorNone; }
/* * tuningloader_fileio read method */ t_fileio_error tuningloader_fileio::read(void* pDestBuffer, int aNumBytes) { IN0("\n"); size_t iNumBytesRead = 0; // Sanity check if( pDestBuffer == NULL || aNumBytes == 0) { // Bad parameter MSG2("Bad parameter: pDestBuffer=%p aNumBytes=%d\n", pDestBuffer, aNumBytes); OUTR(" ", FILEIO_BAD_ARGUMENT); return FILEIO_BAD_ARGUMENT; } if( pFile == NULL) { // File is not open MSG0("File not open\n"); OUTR(" ", FILEIO_FILE_NOT_OPEN); return FILEIO_FILE_NOT_OPEN; } // Read the file MSG1("Reading %d bytes from file\n", aNumBytes); iNumBytesRead = fread( pDestBuffer, 1, (size_t)aNumBytes, pFile); if( iNumBytesRead != (size_t)aNumBytes ) { // Could not read the file MSG2("Read failed, expected %d bytes, got %d bytes\n", aNumBytes, iNumBytesRead); OUTR(" ", FILEIO_READ_FAILED); return FILEIO_READ_FAILED; } // File sucessfully read OUTR(" ",FILEIO_OK); return FILEIO_OK; }
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::freeBuffer(OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_BOOL bBufferAllocated, void *bufferAllocInfo, void *portPrivateInfo) //************************************************************************************************************* { IN0("\n"); MSG3("freeBuffer nPortIndex %lu- nBufferIndex %lu bBufferAllocated=%s\n", nPortIndex, nBufferIndex, bBufferAllocated==true?"true":"false"); // WOM_BREAKPOINT; OMX_ERRORTYPE err = OMX_ErrorNone; if (m_NbPortAllocated[nPortIndex] > 0) { err = freeBufferHeap(nPortIndex, nBufferIndex, bBufferAllocated, bufferAllocInfo, portPrivateInfo); --m_NbPortAllocated[nPortIndex]; } OUTR("", (err)); return err; }
/** @brief Usually called by the processing component via nmf for backfitting info */ WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::setConfigFromProcessing(OMX_INDEXTYPE nConfigIndex, OMX_PTR pConfigStructure) //************************************************************************************************************* { // set config from processor to component_proxy IN0("\n"); OMX_ERRORTYPE res; if ((nConfigIndex < OMX_IndexComponentStartUnused) && (nConfigIndex < (OMX_INDEXTYPE)OMX_CommandMax)) { //It's a set param res=ENS_Component::SendCommand(&mENSComponent, (OMX_COMMANDTYPE)nConfigIndex, (OMX_U32 )pConfigStructure, 0); } else { //Make the set config res=mENSComponent.setConfig(nConfigIndex, pConfigStructure); } OUTR(" ", res); return res; }
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::useBufferHeader(OMX_DIRTYPE dir, OMX_BUFFERHEADERTYPE* pBufferHdr) //************************************************************************************************************* { IN0("\n"); OMX_ERRORTYPE err = OMX_ErrorNone; int portNb; if (dir == OMX_DirInput) portNb=pBufferHdr->nInputPortIndex; else portNb=pBufferHdr->nOutputPortIndex; MSG4("OpenMax_Proxy[%s]::useBufferHeader port %d dir=%u Header=%p\n", GetComponentName(), portNb, dir, pBufferHdr); err = useBufferHeaderHeap(dir, pBufferHdr); OUTR(" ", (err)); return err; }
/** @brief Configure the processing component by sending all relevant info */ WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::configure() //************************************************************************************************************* { // Send info to the host part IN0("\n"); PortOther * pPort; // OMX_ERRORTYPE result=OMX_ErrorNone; for (unsigned int portIndex=0; portIndex< mENSComponent.getPortCount(); ++portIndex) { //Iterate on each port pPort = (PortOther*)mENSComponent.getPort(portIndex); // Normally we could remove following function call m_IParam.setParam( portIndex, pPort->getBufferCountActual(), pPort->getDirection(), pPort->isBufferSupplier(), pPort->getPortIndex(), pPort->getParamPortDefinition().format.video.nFrameWidth, pPort->getParamPortDefinition().format.video.nFrameHeight, pPort->getParamPortDefinition().format.video.eColorFormat, pPort->getParamPortDefinition().format.video.nStride); //and use only this one //do the same but this time with the openmax structure OMX_PARAM_PORTDEFINITIONTYPE* portdef = new OMX_PARAM_PORTDEFINITIONTYPE; *portdef = pPort->getParamPortDefinition(); m_IParam.setParameter(OMX_IndexParamPortDefinition, portdef); } // Call User Configure to make default initialisation OpenMax_Component *pComp= GetOpenMax_Component(); if (pComp!=NULL) { int res=pComp->NMFConfigure(); if (res!=S_OK) result=OMX_ErrorUndefined; } OUTR(" ", result); return result; }
float IFM_NmfProcessingComp::getPixelDepth(OMX_U32 format) { IN0("\n"); float pixelDepth; switch(format) { case OMX_COLOR_FormatUnused : MSG0("Format unused, stride = 0. This should not occur !\n"); pixelDepth = 0; break; /* Monochrome & 8 bit RGB Formats */ case OMX_COLOR_FormatMonochrome : case OMX_COLOR_Format8bitRGB332 : pixelDepth = 1; break; /* 8 Bit RawBayer Format */ case OMX_COLOR_FormatRawBayer8bit : case OMX_COLOR_FormatRawBayer8bitcompressed: pixelDepth = 1; break; /* 10/12 Bit RawBayer Formats */ case OMX_COLOR_FormatRawBayer10bit : // is used for raw12!!! case OMX_SYMBIAN_COLOR_FormatRawBayer12bit: pixelDepth = 1.5; break; /* 16 bit Interleaved RGB Formats */ case OMX_COLOR_Format12bitRGB444 : case OMX_COLOR_Format16bitARGB4444 : case OMX_COLOR_Format16bitARGB1555 : case OMX_COLOR_Format16bitRGB565 : case OMX_COLOR_Format16bitBGR565 : pixelDepth = 2; break; /* Iterleaved YUV Formats */ case OMX_COLOR_FormatYCbYCr : case OMX_COLOR_FormatYCrYCb : case OMX_COLOR_FormatCbYCrY : case OMX_COLOR_FormatCrYCbY : pixelDepth = 2; break; /* 3 Bytes Iterleaved RGB Formats */ case OMX_COLOR_Format18bitRGB666 : case OMX_COLOR_Format18bitARGB1665 : case OMX_COLOR_Format19bitARGB1666 : case OMX_COLOR_Format24bitRGB888 : case OMX_COLOR_Format24bitBGR888 : case OMX_COLOR_Format24bitARGB1887 : case OMX_COLOR_Format18BitBGR666 : case OMX_COLOR_Format24BitARGB6666 : case OMX_COLOR_Format24BitABGR6666 : pixelDepth = 3; break; /* 4 Bytes Iterleaved RGB Formats */ case OMX_COLOR_Format25bitARGB1888 : case OMX_COLOR_Format32bitBGRA8888 : case OMX_COLOR_Format32bitARGB8888 : pixelDepth = 4; break; /* YUV 411/422 Planar and SemiPlanar Formats */ case OMX_COLOR_FormatYUV411Planar : case OMX_COLOR_FormatYUV411PackedPlanar : case OMX_COLOR_FormatYUV422Planar : case OMX_COLOR_FormatYUV422PackedPlanar : case OMX_COLOR_FormatYUV422SemiPlanar : case OMX_COLOR_FormatYUV422PackedSemiPlanar : pixelDepth = 1.5; break; /* YUV Interleaved Format */ case OMX_COLOR_FormatYUV444Interleaved : pixelDepth = 1.5; break; /* YUV 420 Planar and SemiPlanar Formats */ case OMX_COLOR_FormatYUV420PackedSemiPlanar : case OMX_COLOR_FormatYUV420Planar : case OMX_STE_COLOR_FormatYUV420PackedSemiPlanar_NV21: case OMX_STE_COLOR_FormatYUV420PackedSemiPlanar_NV12: case OMX_COLOR_FormatYUV420PackedPlanar : case OMX_COLOR_FormatYUV420SemiPlanar : pixelDepth = 1.5; break; /* YUV MBTiled Format */ case OMX_SYMBIAN_COLOR_FormatYUV420MBPackedSemiPlanar : case OMX_STE_COLOR_FormatYUV420MBSwap64bPackedSemiPlanar: pixelDepth = 1.5; break; case OMX_COLOR_FormatL2 : case OMX_COLOR_FormatL4 : case OMX_COLOR_FormatL8 : case OMX_COLOR_FormatL16 : case OMX_COLOR_FormatL24 : case OMX_COLOR_FormatL32 : default : MSG1("Could not evaluate stride for format 0x%lx", format); pixelDepth = 4; } OUTR(" ", (int)pixelDepth); //typecasting to int to remove warning return pixelDepth; }