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.

DM8168 Problems with encode interlaced h264

Hello,

I'm working on DM8168 EVM platform, my EZSDK version is 5_03_01_15.

I try to encode a 1080i60 stream on the SD card with the OMX application. I use encode example.

I made some modification in file ilclient_utils.c to configure encoder for interlace encoding : I uncomment the part for interlace encoding.

For input , I use yuv file with field separated.

I encode the stream with the new application compiled with EZSDK.

But when I decode the h264 file with a software, I see all the input data (TOP and BOTTOM fields of the yuv file) are encoded in the TOP field (H264 file). In the BOTTOM field (H264 file) there is some other data... So it doesn't work.

I think there is a bad configuration but I don't find the good one.

If someone has a solution, thank you for your reply. 

  • hey ~

    I have the same problem as u, have u figured it out?

    I think it has sth to do with the parameter named ivideo2_bufdesc.

    But I don't know how to modify it, if u got the answer, please tell me~

    thx a lot

  • Hi,

    Are you giving both fields in single frame ? Or you are giving one filed in each call ?

    Regards

    Vimal

  • Hi Vimal,

    Thanks for your reply

    Honestly speaking, I did not find the exact function entrance for the call within the OMX frame in ezsdk5_04. I think I am giving both fields in one single frame as separated format (the input to the encoder is the output of the MPEG-2 decoder). I desparately want to know the paramter setting as well as the buffer management for the interlaced coding.

    Thank you in advance for your nice help!

    -Silient Tang

  • Hi,


    I am working with DM8168 and ezsdk-5_05_02_00. I am trying to encode 1080i and 480i. I made the following changes for interlaced encoding:


    1. I modified the codec static parameters to be set to interlaced encoding (http://processors.wiki.ti.com/index.php/OMX_VENC).

    OMX_VIDEO_PARAM_STATICPARAMS tStaticParam;
    OMX_INIT_PARAM (&tStaticParam);
    tStaticParam.nPortIndex = OMX_VIDENC_OUTPUT_PORT;
    
    eError = OMX_GetParameter (pHandle, OMX_TI_IndexParamVideoStaticParams,
    &tStaticParam);
    
    /* for interlace, base profile can not be used */
    tStaticParam.videoStaticParams.h264EncStaticParams.videnc2Params.profile = IH264_HIGH_PROFILE;
    tStaticParam.videoStaticParams.h264EncStaticParams.videnc2Params.level = IH264_LEVEL_42;
    
    /* setting Interlace mode */
    tStaticParam.videoStaticParams.h264EncStaticParams.videnc2Params.inputContentType = IVIDEO_INTERLACED;
    tStaticParam.videoStaticParams.h264EncStaticParams.bottomFieldIntra = 0;
    tStaticParam.videoStaticParams.h264EncStaticParams.interlaceCodingType = IH264_INTERLACE_FIELDONLY_ARF;
    
    tStaticParam.videoStaticParams.h264EncStaticParams.videnc2Params.encodingPreset = XDM_DEFAULT;
    tStaticParam.videoStaticParams.h264EncStaticParams.videnc2Params.rateControlPreset = IVIDEO_STORAGE;
    
    
    tStaticParam.videoStaticParams.h264EncStaticParams.intraCodingParams.lumaIntra4x4Enable = 0x1f;
    tStaticParam.videoStaticParams.h264EncStaticParams.intraCodingParams.lumaIntra8x8Enable = 0x1f;
    
    
    
    eError = OMX_SetParameter (pHandle, OMX_TI_IndexParamVideoStaticParams,
    &tStaticParam);


    2. I made the following changes in omx_source:

    File: ezsdk-5_05_02_00/component-sources/omx-ti81xx-src_05_02_00_48/src/ti/omx/comp/venc/src/omx_h264ve.c


    if ( frameDataContentType.eContentType == OMX_Video_Interlaced )
          {
            pVidEncComPvt->tVedEncInBufsPtr->contentType = IVIDEO_INTERLACED;
            pVidEncComPvt->tVedEncInBufsPtr->dataLayout = IVIDEO_FIELD_SEPARATED;
            pVidEncComPvt->tVedEncInBufsPtr->topFieldFirstFlag = 1;

            pVidEncComPvt->tVedEncInBufsPtr->secondFieldOffsetHeight[0] = 0;
            pVidEncComPvt->tVedEncInBufsPtr->secondFieldOffsetHeight[1] = 0;
            pVidEncComPvt->tVedEncInBufsPtr->secondFieldOffsetHeight[2] = 0;
            pVidEncComPvt->tVedEncInBufsPtr->secondFieldOffsetWidth[0] = 0;
            pVidEncComPvt->tVedEncInBufsPtr->secondFieldOffsetWidth[1] = 0;
            pVidEncComPvt->tVedEncInBufsPtr->secondFieldOffsetWidth[2] = 0;

          }

    3. I configured the frame height to half.

    It is working fine for 1080i but for 480i, sometimes it encodes fine the video and sometimes it seems to swap the fields. I attached 2 videos, video1 is encoded fine and video2 has the swap problem.

    I think I am missing some encoder settings.

    Does somebody meet the same problems or have some suggestion ?

    Thanks in advance,

    Eugenia




  • Hi Eugenia,

    Are you using VFCC to capture the input to encoder?

    Could you check the VFCC output?

    There is one patch available for VFCC for interlaced capture. 

    Thanks

    Ram

    diff -crB omx-ti81xx-src_05_02_00_48/src/ti/omx/comp/vfcc/src/omx_vfcc_drvif.c michael_field_merge/omx-ti81xx-src_05_02_00_48/src/ti/omx/comp/vfcc/src/omx_vfcc_drvif.c
    *** omx-ti81xx-src_05_02_00_48/src/ti/omx/comp/vfcc/src/omx_vfcc_drvif.c	2013-04-26 16:58:21.326176677 +0530
    --- michael_field_merge/omx-ti81xx-src_05_02_00_48/src/ti/omx/comp/vfcc/src/omx_vfcc_drvif.c	2013-04-26 18:47:55.850424171 +0530
    ***************
    *** 1209,1215 ****
              storagePrms.bufferFmt = FVID2_BUF_FMT_FRAME;
              /* capture would give fid as top or bottom field in case of interlace */
              if (pVFCCComPvt->hwPortProperties.eScanType == OMX_VIDEO_CaptureScanTypeInterlaced) {
    !          storagePrms.bufferFmt = FVID2_BUF_FMT_FIELD;
               }
              storagePrms.fieldMerged = pVFCCComPvt->bFieldMerged;
              status = FVID2_control (pVFCCComPvt->fvidHandle[handleId],
    --- 1209,1220 ----
              storagePrms.bufferFmt = FVID2_BUF_FMT_FRAME;
              /* capture would give fid as top or bottom field in case of interlace */
              if (pVFCCComPvt->hwPortProperties.eScanType == OMX_VIDEO_CaptureScanTypeInterlaced) {
    !            if(pVFCCComPvt->bFieldMerged == OMX_FALSE) {
    !               storagePrms.bufferFmt = FVID2_BUF_FMT_FIELD;
    !            }
    !            else {
    !               storagePrms.bufferFmt = FVID2_BUF_FMT_FRAME;
    ! 	   }
               }
              storagePrms.fieldMerged = pVFCCComPvt->bFieldMerged;
              status = FVID2_control (pVFCCComPvt->fvidHandle[handleId],
    

  • Hi Ram,


    Yes, I am using VFCC to capture the input to encoder. I applied the patch and the swap problem continues.

    Thanks,

    Eugenia