This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Noise in the output data of DEI Component

Hi all,

I am  working on DM8148 Custom Board , i am using latest EZSDK 5.05 . My OMX application has got a capture component ,DEI component and display component .

The VFDC component is connected to the DEI second output port ( VIP0/1 ) ,the DEI first output port is left idle . when i am capturing 576i and bypass through DEI without deinterlacing and display on OnchipSD ,i see some noise at the top and bottom of the display .

In another case with the same OMX app when i deinterlace 576i , upscale it to 1080P resolution and display on OnchipHDMI ,i see noise at the top and bottom of the display .

Below is the code for SetDeiParams() ,


OMX_ERRORTYPE IL_ClientSetDeiParams (IL_Client *pAppData, int sdimode)
{
  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 (&paramPort);
  paramPort.nPortIndex = OMX_VFPC_INPUT_PORT_START_INDEX;

  OMX_GetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition,
                    &paramPort);
  paramPort.nPortIndex = OMX_VFPC_INPUT_PORT_START_INDEX;

  paramPort.format.video.nFrameWidth = pAppData->nWidth1;
  paramPort.format.video.nFrameHeight = pAppData->nHeight1;
  paramPort.format.video.nStride = pAppData->nWidth1;
  paramPort.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
  paramPort.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
  paramPort.nBufferSize =
    (paramPort.format.video.nStride * pAppData->nHeight1 * 3)>>1;

/*
  paramPort.format.video.eColorFormat = OMX_COLOR_FormatYCbYCr ;
  paramPort.nBufferSize =
    (paramPort.format.video.nStride * pAppData->nHeight1 );
*/

  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->nWidth1, (int) pAppData->nHeight1);

  printf ("Dei input Params: Buffer Size computed: %d\n", (int) paramPort.nBufferSize);

  OMX_SetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition,
                    &paramPort);

  /* set output height/width and color format */
  OMX_INIT_PARAM (&paramPort);
  paramPort.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX;
  OMX_GetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition,
                    &paramPort);

  paramPort.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX;

  paramPort.format.video.nFrameWidth = pAppData->nWidth1;
  paramPort.format.video.nFrameHeight = pAppData->nHeight1;
  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 left idle  and provides 422 o/p */
  paramPort.format.video.nStride =  pAppData->nWidth1 * 2;

  paramPort.nBufferSize = paramPort.format.video.nStride *
                          paramPort.format.video.nFrameHeight;
    
  printf ("set output port params (width = %d, height = %d)",
          (int) pAppData->nWidth1, (int) pAppData->nHeight1);

  OMX_SetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition,
                    &paramPort);

#if 1

  OMX_INIT_PARAM (&paramPort);
  paramPort.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX + 1;
  OMX_GetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition,
                    &paramPort);
  paramPort.nPortIndex = OMX_VFPC_OUTPUT_PORT_START_INDEX + 1;
  paramPort.format.video.nFrameWidth = pAppData->nWidth3;
  paramPort.format.video.nFrameHeight = pAppData->nHeight3;
  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;
  paramPort.format.video.nStride = pAppData->nWidth3 * 2;

  /* This port is connected to Display and provides 420 o/p or 422 o/p*/
  paramPort.nBufferSize = (paramPort.format.video.nStride * paramPort.format.video.nFrameHeight);


  if (strcmp ((char *) pAppData->mode3, "OnchipSd") == 0){
    paramPort.format.video.nStride =  pAppData->nWidth3;
    paramPort.format.video.eColorFormat =  OMX_COLOR_FormatYUV420SemiPlanar;
    paramPort.nBufferSize = (paramPort.format.video.nStride * paramPort.format.video.nFrameHeight * 3)>>1;
  }

  printf ("set output port params (width = %d, height = %d)",
          (int) pAppData->nWidth3, (int) pAppData->nHeight3);

  printf ("Dei Output Params: Buffer Size computed: %d\n", (int) paramPort.nBufferSize);

  OMX_SetParameter (pAppData->pDeiHandle, OMX_IndexParamPortDefinition,
                    &paramPort);

#endif

  /* set number of channles */
  printf ("set number of channels");

  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");

  OMX_INIT_PARAM (&chResolution);
  chResolution.Frm0Width = pAppData->nWidth1;
  chResolution.Frm0Height = pAppData->nHeight1/2;
  chResolution.Frm0Pitch = pAppData->nWidth1;
  chResolution.Frm1Width = 0;
  chResolution.Frm1Height = 0;
  chResolution.Frm1Pitch = 0;
  chResolution.FrmStartX = 0;
  chResolution.FrmStartY = 0;
  chResolution.FrmCropWidth = pAppData->nWidth1;
  chResolution.FrmCropHeight = pAppData->nHeight1/2;
  chResolution.eDir = OMX_DirInput;
  chResolution.nChId = 0;

  if ((strcmp ((char *) pAppData->mode1, "576i") == 0)){
  chResolution.Frm0Height = pAppData->nHeight1;
  chResolution.FrmCropHeight = pAppData->nHeight1;
 }

 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");
  OMX_INIT_PARAM (&chResolution);

  /* first output left idle*/
  chResolution.Frm0Width = pAppData->nWidth1;
  chResolution.Frm0Height = pAppData->nHeight1;
  chResolution.Frm0Pitch = pAppData->nWidth1 * 2;
 
  /* second output to display */
  chResolution.Frm1Width = pAppData->nWidth3;
  chResolution.Frm1Height = pAppData->nHeight3;
  chResolution.Frm1Pitch = pAppData->nWidth3 * 2;

  chResolution.FrmStartX = 0;
  chResolution.FrmStartY = 0;
  chResolution.FrmCropWidth = 0;
  chResolution.FrmCropHeight = 0;
  chResolution.eDir = OMX_DirOutput;
  chResolution.nChId = 0;

  if (strcmp ((char *)pAppData->mode3, "OnchipSd") == 0) {
     chResolution.Frm1Width = pAppData->nWidth3;
     chResolution.Frm1Height = pAppData->nHeight3;
     chResolution.Frm1Pitch = pAppData->nWidth3;

}
 
 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;
  /* capture providing progressive input, alg is bypassed */
  algEnable.bAlgBypass = 0;

 if ( (strcmp ((char *)pAppData->mode3, "OnchipSd") == 0){
 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);
}

I am attaching the snapshots taken when the noise is present in the display ,

use case 1 : 576i capture and bypass through DEI and displayed on OnChipSD :

As we can see there is green noise at the top and bottom .

use case 2 : 576i capture ,deinterlaced and upscaled to 1080P using DEI and displayed on Onchip HDMI

We have got a camera which provides 576i (PAL) input to the VIN0 PORTA , i tried changing the input source and i can see the similar noise with that too .

I have also tried capturing 576i (PAL ) video data and storing into a file with OMX application , when i play the file on the host machine ,i don't see any noise in this case . I suspect that DEI component is causing some problem .

Has anyone noticed this noise when you are using DEI component in the above use cases . Can anyone suggest me what might be wrong ? Any help is appreciated .

Thanks,

N Sivaramkrishna .