Hi
DM8168 EVM using ezsdk 5.02.01.59
I want to Use the DEI but do not want to display, I only want to send data to Encoder. Is this possible??
Back ground:
I would like to convert a stream of HDMI DATA(HDMI camera sreaming into FPGA and into bufffer which is consumed by the DEI) and encode it to a H.264 stream.
As a test to just get the DEI working with the Encoder. I have setup 2 components OMX.TI.VPSSM3.VFPC.DEIHDUALOUT and OMX.TI.DUCATI.VIDENC. (I setup buffers which I populate with a colour bar and pass it to the DEI whcih outputs to the ENC. My set up with call backs works because the Parameters are set when I call OMX_GetHandle. First I setup the DEI Handle This returns OK Enabling the Output ports first which only works if I enable OMX_VFPC_OUTPUT_PORT_START_INDEX this works fine (I presume this is port 16)
( next ) if I enable OMX_VFPC_OUTPUT_PORT_START_INDEX + 1 my program stops at the SempPend and freezes.
I then Enable Input port OMX_VFPC_INPUT_PORT_START_INDEX = 0 this works fine if I ommit the last line.
I then setup the encoder input and output port (fine)
When i Allocate buffers the DEI allocates buffers for the DEI Output and Input for that component and then freezes at SempPend
So my questions are .
Question 1
Can I set the DEI to use a single output port or do I have to configure 2 output ports ?
Question 2
Why does the code stop when I try enable the second output port (If I leave this out and only enable the input and output it carrys on)?
Question 3
Why does my code stop at SempPend when I set up the ALLOCATE buffer comand on the input and output buffers (I alocate all input buffers and then all output buffers and then pend on Semaphore)?
Question 4
Do I have to setup the DEI number of inputs and ou puts and start index's using the "OMX_IndexParamVideoInit" command ?
Question 5
Can I fill a buffer with grey and give it to the DEI like the VPCC would?
Thanks
Robin
static OMX_ERRORTYPE VidEncSetDeiParams (OMX_PTR ptrAppData)
{ //TODO
TVidComponent *pComp;
pComp = ptrAppData;
TVidDeiParams* pParams = (TVidDeiParams*) pComp->pParams;
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_PORT_PARAM_TYPE portInit;
/* Setting Memory type at input port to Raw Memory */
OMX_INIT_PARAM (&memTypeCfg);
memTypeCfg.nPortIndex = pComp->nPortInput;
memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT;
eError = OMX_SetParameter (pComp->pHandle, OMX_TI_IndexParamBuffMemType,
&memTypeCfg);
if (eError != OMX_ErrorNone)
{
printf ("failed to set memory Type at input port\n");
}
/* Setting Memory type at output port 16 to Raw Memory */
OMX_INIT_PARAM (&memTypeCfg);
memTypeCfg.nPortIndex = pComp->nPortOutput;
memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT;
eError = OMX_SetParameter (pComp->pHandle, OMX_TI_IndexParamBuffMemType,
&memTypeCfg);
if (eError != OMX_ErrorNone)
{
printf ("failed to set memory Type at output port\n");
}
// /* Setting Memory type at output port 17 to Raw Memory */
// OMX_INIT_PARAM (&memTypeCfg);
// memTypeCfg.nPortIndex = pComp->nPortOutput + 1;
// memTypeCfg.eBufMemoryType = OMX_BUFFER_MEMORY_DEFAULT;
// eError = OMX_SetParameter (pComp->pHandle, OMX_TI_IndexParamBuffMemType,
// &memTypeCfg);
// if (eError != OMX_ErrorNone)
// {
// printf ("failed to set memory Type at output port\n");
// }
/* set input height/width and colour format input port */
OMX_INIT_PARAM (¶mPort);
paramPort.nPortIndex = pComp->nPortInput;
OMX_GetParameter (pComp->pHandle, OMX_IndexParamPortDefinition, ¶mPort);
paramPort.nPortIndex = pComp->nPortInput;
paramPort.eDir = OMX_DirInput;
paramPort.format.video.nFrameWidth = pParams->nWidth;
paramPort.format.video.nFrameHeight = pParams->nHeight;
paramPort.format.video.nStride = pParams->nWidth;
paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
paramPort.nBufferSize =(paramPort.format.video.nStride * pParams->nHeight * 3) >> 1;
/*set buffer size to allocate buffers*/
pComp->nInPortBufferSize = paramPort.nBufferSize;
paramPort.nBufferAlignment = 0;
paramPort.bBuffersContiguous = 0;
paramPort.nBufferCountActual = pComp->nInputBuffers;
printf ("set input port params (width = %u, height = %u) \n",(int)pParams->nWidth, (int)pParams->nHeight);
OMX_SetParameter (pComp->pHandle, OMX_IndexParamPortDefinition, ¶mPort);
/*set output height/width and colour format Output port 16 */
OMX_INIT_PARAM (¶mPort);
paramPort.nPortIndex = pComp->nPortOutput;
OMX_GetParameter (pComp->pHandle, OMX_IndexParamPortDefinition,¶mPort);
paramPort.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX;
paramPort.eDir = OMX_DirOutput;
paramPort.format.video.nFrameWidth = pParams->nWidth;
paramPort.format.video.nFrameHeight = pParams->nHeight;
paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
paramPort.nBufferAlignment = 0;
//paramPort.nBufferCountActual = pComp->nOutputBuffers/2;
paramPort.nBufferCountActual = pComp->nOutputBuffers;
paramPort.format.video.nStride = pParams->nWidth;
/* This port is connected to encoder and provides 420 o/p */
paramPort.nBufferSize = (paramPort.format.video.nStride * paramPort.format.video.nFrameHeight * 3) >> 1;
pComp->nOutPortBufferSize = paramPort.nBufferSize;
printf ("set output port 1 params (width = %d, height = %d )\n",(int) pParams->nWidth,(int)pParams->nHeight);
OMX_SetParameter (pComp->pHandle, OMX_IndexParamPortDefinition, ¶mPort);
OMX_INIT_PARAM (&sNumChPerHandle);
sNumChPerHandle.nNumChannelsPerHandle = 1;
eError = OMX_SetParameter (pComp->pHandle, (OMX_INDEXTYPE) OMX_TI_IndexParamVFPCNumChPerHandle, &sNumChPerHandle);
printf ("set number of channels %d \n",(int)sNumChPerHandle.nNumChannelsPerHandle);
if (eError != OMX_ErrorNone)
{
printf ("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 = pParams->nWidth;
chResolution.Frm0Height = pParams->nHeight;
chResolution.Frm0Pitch = pParams->nWidth;;
chResolution.Frm1Width = 0;
chResolution.Frm1Height = 0;
chResolution.Frm1Pitch = 0;
chResolution.FrmStartX = 0;
chResolution.FrmStartY = 0;
chResolution.FrmCropWidth = pParams->nWidth;
chResolution.FrmCropHeight = pParams->nHeight;
chResolution.eDir = OMX_DirInput;
chResolution.nChId = 0;
eError = OMX_SetConfig (pComp->pHandle,
(OMX_INDEXTYPE) OMX_TI_IndexConfigVidChResolution,
&chResolution);
if (eError != OMX_ErrorNone)
{
printf ("failed to set input channel resolution\n");
}
printf ("set output resolution\n");
OMX_INIT_PARAM (&chResolution);
/* first output to display */
chResolution.Frm0Width = pParams->nWidth;
chResolution.Frm0Height = pParams->nHeight;
chResolution.Frm0Pitch = pParams->nWidth;
/* second output to encode */
chResolution.Frm1Width = pParams->nWidth;
chResolution.Frm1Height = pParams->nHeight;
chResolution.Frm1Pitch = pParams->nWidth;
chResolution.FrmStartX = 0;
chResolution.FrmStartY = 0;
chResolution.FrmCropWidth = 0;
chResolution.FrmCropHeight = 0;
chResolution.eDir = OMX_DirOutput;
chResolution.nChId = 0;
eError = OMX_SetConfig (pComp->pHandle,
(OMX_INDEXTYPE) OMX_TI_IndexConfigVidChResolution,
&chResolution);
if (eError != OMX_ErrorNone)
{
printf ("failed to set output channel resolution\n");
}
return eError
}