OMX_ERRORTYPE IL_ClientSetDeiParams (IL_Client *pAppData) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_PARAM_BUFFER_MEMORYTYPE memTypeCfg; OMX_PARAM_PORTDEFINITIONTYPE paramPort; OMX_PARAM_VFPC_NUMCHANNELPERHANDLE sNumChPerHandle; OMX_CONFIG_ALG_ENABLE algEnable; OMX_CONFIG_VIDCHANNEL_RESOLUTION chResolution; OMX_CONFIG_SUBSAMPLING_FACTOR sSubSamplinginfo = {0}; OMX_INIT_PARAM(&sSubSamplinginfo); sSubSamplinginfo.nSubSamplingFactor = 1; eError = OMX_SetConfig ( pAppData->pDeiHandle, ( OMX_INDEXTYPE ) ( OMX_TI_IndexConfigSubSamplingFactor ), &sSubSamplinginfo ); OMX_INIT_PARAM (&memTypeCfg); memTypeCfg.nPortIndex = OMX_VFPC_INPUT_PORT_START_INDEX; memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; eError = OMX_SetParameter (pAppData->pDeiHandle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); if (eError != OMX_ErrorNone) { ERROR ("failed to set memory Type at input port\n"); } /* Setting Memory type at output port to Raw Memory */ OMX_INIT_PARAM (&memTypeCfg); memTypeCfg.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX; memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; eError = OMX_SetParameter (pAppData->pDeiHandle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); if (eError != OMX_ErrorNone) { ERROR ("failed to set memory Type at output port\n"); } OMX_INIT_PARAM (&memTypeCfg); memTypeCfg.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX + 1; memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT; eError = OMX_SetParameter (pAppData->pDeiHandle, OMX_TI_IndexParamBuffMemType, &memTypeCfg); if (eError != OMX_ErrorNone) { ERROR ("failed to set memory Type at output port\n"); } /* set input height/width and color format */ OMX_INIT_PARAM (¶mPort); paramPort.nPortIndex = OMX_VFPC_INPUT_PORT_START_INDEX; OMX_GetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition, ¶mPort); paramPort.nPortIndex = OMX_VFPC_INPUT_PORT_START_INDEX; paramPort.format.video.nFrameWidth = pAppData->nWidth; paramPort.format.video.nFrameHeight = pAppData->nHeight; paramPort.format.video.nStride = pAppData->nWidth; paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; paramPort.nBufferSize = (paramPort.format.video.nStride * pAppData->nHeight * 3) >> 1; if(pAppData->nScanFormat) { paramPort.format.video.nFrameHeight = pAppData->nHeight >> 1; paramPort.format.video.nStride = pAppData->nWidth << 1; paramPort.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr; paramPort.nBufferSize = (paramPort.format.video.nStride * pAppData->nHeight) >> 1; } paramPort.nBufferAlignment = 0; paramPort.bBuffersContiguous = 0; paramPort.nBufferCountActual = IL_CLIENT_DEI_INPUT_BUFFER_COUNT; printf ("set input port params (width = %d, height = %d) \n", (int) pAppData->nWidth, (int) pAppData->nHeight); OMX_SetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition, ¶mPort); /* set output height/width and color format */ OMX_INIT_PARAM (¶mPort); paramPort.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX; OMX_GetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition, ¶mPort); paramPort.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX; paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; paramPort.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr; paramPort.nBufferAlignment = 0; paramPort.nBufferCountActual = IL_CLIENT_DEI_OUTPUT_BUFFER_COUNT; /* This port is connected to display and provides 422 o/p */ paramPort.nBufferSize = paramPort.format.video.nStride * paramPort.format.video.nFrameHeight; /*For the case of On-chip HDMI as display device*/ paramPort.format.video.nFrameWidth = DISPLAY_WIDTH; paramPort.format.video.nFrameHeight = DISPLAY_HEIGHT; paramPort.format.video.nStride = DISPLAY_HEIGHT * 2; paramPort.nBufferSize = paramPort.format.video.nStride * paramPort.format.video.nFrameHeight; printf ("set output port params (width = %d, height = %d)\n", (int) pAppData->nWidth, (int) pAppData->nHeight); OMX_SetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition, ¶mPort); OMX_INIT_PARAM (¶mPort); paramPort.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX + 1; OMX_GetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition, ¶mPort); paramPort.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX + 1; paramPort.format.video.nFrameWidth = pAppData->nWidth; paramPort.format.video.nFrameHeight = pAppData->nHeight; paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; paramPort.nBufferAlignment = 0; paramPort.nBufferCountActual = IL_CLIENT_ENC_INPUT_BUFFER_COUNT; paramPort.format.video.nStride = pAppData->nWidth; /* This port is connected to encoder and provides 420 o/p */ paramPort.nBufferSize = (paramPort.format.video.nStride * paramPort.format.video.nFrameHeight * 3) >> 1; printf ("set output port params (width = %d, height = %d)\n", (int) paramPort.format.video.nFrameWidth, (int) paramPort.format.video.nFrameHeight); OMX_SetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition, ¶mPort); /* set number of channles */ printf ("set number of channels\n"); OMX_INIT_PARAM (&sNumChPerHandle); sNumChPerHandle.nNumChannelsPerHandle = 1; eError = OMX_SetParameter (pAppData->pDeiHandle, (OMX_INDEXTYPE) OMX_TI_IndexParamVFPCNumChPerHandle, &sNumChPerHandle); if (eError != OMX_ErrorNone) { ERROR ("failed to set num of channels\n"); } /* set VFPC input and output resolution information */ printf ("set input resolution\n"); OMX_INIT_PARAM (&chResolution); chResolution.Frm0Width = pAppData->nWidth; chResolution.Frm0Height = pAppData->nHeight; chResolution.Frm0Pitch = pAppData->nWidth;; chResolution.Frm1Width = 0; chResolution.Frm1Height = 0; chResolution.Frm1Pitch = 0; chResolution.FrmStartX = 0; chResolution.FrmStartY = 0; chResolution.FrmCropWidth = pAppData->nWidth; chResolution.FrmCropHeight = pAppData->nHeight; if(pAppData->nScanFormat) { chResolution.Frm0Height = pAppData->nHeight >> 1; chResolution.FrmCropHeight = pAppData->nHeight >> 1; chResolution.Frm0Pitch = pAppData->nWidth << 1; } chResolution.eDir = OMX_DirInput; chResolution.nChId = 0; eError = OMX_SetConfig (pAppData->pDeiHandle, (OMX_INDEXTYPE) OMX_TI_IndexConfigVidChResolution, &chResolution); if (eError != OMX_ErrorNone) { ERROR ("failed to set input channel resolution\n"); } printf ("set output resolution\n"); OMX_INIT_PARAM (&chResolution); /* on secondary display, it is scaled to display size */ chResolution.Frm0Width = DISPLAY_WIDTH; chResolution.Frm0Height = DISPLAY_HEIGHT; chResolution.Frm0Pitch = DISPLAY_WIDTH * 2; /* second output to encode */ chResolution.Frm1Width = pAppData->nWidth; chResolution.Frm1Height = pAppData->nHeight; chResolution.Frm1Pitch = pAppData->nWidth; chResolution.FrmStartX = 0; chResolution.FrmStartY = 0; chResolution.FrmCropWidth = 0; chResolution.FrmCropHeight = 0; chResolution.eDir = OMX_DirOutput; chResolution.nChId = 0; eError = OMX_SetConfig (pAppData->pDeiHandle, (OMX_INDEXTYPE) OMX_TI_IndexConfigVidChResolution, &chResolution); if (eError != OMX_ErrorNone) { ERROR ("failed to set output channel resolution\n"); } /* disable algo bypass mode */ OMX_INIT_PARAM (&algEnable); algEnable.nPortIndex = 0; algEnable.nChId = 0; algEnable.bAlgBypass = 1; if(pAppData->nScanFormat) { if(pAppData->evmAppInParams->deiEnable) { algEnable.bAlgBypass = 0; } else { algEnable.bAlgBypass = 1; } } eError = OMX_SetConfig (pAppData->pDeiHandle, (OMX_INDEXTYPE) OMX_TI_IndexConfigAlgEnable, &algEnable); if (eError != OMX_ErrorNone) { ERROR ("failed to disable algo by pass mode\n"); } return (eError); }