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.

IVAHD Decoder output YUV format to feed HW deinterlacer

Hello,

I am trying to feed Hardware deinterlacer (testvpe application) available on Jaconto-6 EVM with YUV output from IVAHD decoder (MPEG2/H264) configured with chorma format XDM_YUV_420SP.

deionterlacer configured with NV12 as input chroma format, expectc YUV in the below format.

Yodd

UVodd

Yeven

UVeven

Where, odd and even refers to the two fields of interlaced video.

But YUV output given by IVAHD decoder is in the below format.

Yodd

Yeven

UVodd

UVeven

Could someone help me how IVAHD and HW-deinterlacer on J6 should be configured so that they understand the YUV format from one to the other.

Thanks,

Srinivas.

  • Hi Srinivas,

    Decoder will decoded YUV output for both Y and UV. For interlace stream if application provides one field, say Odd field, decoder will decode this and gives output belongs to this field i.e  Yodd and UVodd. 

    I am not sure how you are concluding decoder is giving Yodd and Yeven and then UVodd and UVeven. Its not correct.  

    Thanks,

    Veeranna

  • Hi Veeranna,

    Thanks for the response.

    We need output for both fields of interlaced video.

    I allocated 2 buffers (for Y and UV, multiplanar) for output. After every process call, if I save 1st half of Y buffer and 1st half of UV buffer, then 2nd half of Y buffer and 2nd half of UV buffer, then only I am able to view the output properly in YUV viewer as NV12 with 2 fields individually (resolution: width x height/2).  With resolution (width X height), i can see two almost similar pictures appear one above and one below. This is how i concluded these are two fields.

    Then I tried with a single output buffer , I see that the decoder output is in Yodd-Yeven-UVodd-UVeven format. If I try to open it in YUV viewer as NV12 with width x height/2,  the output is not proper.

    This made me concluded that the decoder is giving  "Yodd-Yeven-UVodd-UVeven" format.

    Could you please let me know,

    1) if i use a single output buffer, and an interlaced input, How does the YUV output buffer arranged  (Actual NV12 format says, it should be in Yodd-UVodd-Yeven-UVeven format) ?

    2) If i have to get the output in Yodd-UVodd-Yeven-UVeven format, what settings do i have to give to the decoder params ?

    Thanks,

    Srinivas.

  • Hi Srinivas,
    All IVAHD decoders will output in field separated mode only(i,e Yodd, UVodd, Yeven, UVeven). With your multiplanar buffers you can see one below the other confirms this.

    For single buffer also it is true. You can try decoding the interlaced stream with viddec3test application from omapdrmtest with -1 option for single-buffer
  • Ramprasad,

    I saw the two fields one below the other only after i re-arranged the data (to form Yodd UVodd Yeven UVeven) that i got from decoder. It wont be the case if i use the output directly from the decoder.

    I have not seen any option in viddec3test to write the decoded YUV to a file. What is the option to do so?

    Basically my issue is, i should pass the decoded output from IVAHD decoder to HW de-interlacer (testvpe) without re-arranging the decoded output buffer. How colud i do that?
    Looks like setting Decoder configuration and testvpe input format to XDM_YUV_420SP is not sufficient. Is there any extra configuration that i should be looking at?

    Thanks,
    Srinivas.
  • Hi Srinivas,
    You don't need to arrange the buffers. You should pass same output buffer for second process call for interlaced stream if outBufsInUseFlag is set. Unfortunately these changes are not in viddec3test. You can refer H264 decoder userGuide for outBufsInUseFlag .

    or you can do one more experiment.
    Extend IVIDDEC3_Params to IH264DEC_params and set processCallLevel to 1. This will make sure in one VIDDEC3_process call you will get both the fields decoded provided the input buffer has data for both fields.

    testvpe accepts both type of input for de-interlacing. Search for " interlace" in testvpe.c If this is 2 then it expects field-separated mode and if it is 1 it expects field-interleaved mode.
  • Ramprasad,

    Thanks for the response.

    1) what i mean by re-arranging the buffer data is an input to testvpe (not re-arranging the DRM bffers for IVAHD). When i get output YUV from IVAHD decoder (MPEG), i see that the YUV data is arreanged in Yodd-Yeven-UVodd-UVeven format. And now before i pass this YUV to testvpe, i re-arrange the YUV data as Yodd-UVodd-Yeven-UVeven.

    2) IN YUV output from IVAHD, both fields are available.

    3) in testvpe.c, it seems "interlace" is an input argument to be passed which is used as below (as per code)  for allocating V4L2 buffers,

    if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && interlace)
    fmt.fmt.pix_mp.field = V4L2_FIELD_ALTERNATE;
    else
    fmt.fmt.pix_mp.field = V4L2_FIELD_ANY;

    giving interlace as 1 or 2, don't seem to be changing the output that i get.

     

    Thanks,

    Srinivas.

     

     

  • Ramprasad,

    What you said about YUV format from decoder seems to be true for H264, but my case is with MPEG2.

    Please confirm YUV format for MPEG2 decoder

    Thanks,

    Srinivas.

  • Hi Srinivas,
    Yuv format is field separated for all IVAHD decoders.
  • Ramprasad,

    Thanks a lot for your response.

    It seems there was miscommunication in our previous discussion above. I was using an older version of testvpe sample application where, when interlace=2, filed= V4L2_FIELD_SEQ_TB, was mentioned.  It is mentioned in the latest version available on the TI git repository.

    I have few queries, i am referring to the below file.

    git.ti.com/.../filevpedisplay.c

     Why the number of bufs is fixed at 6. I tried with lesser number of buffers, it seems not working (getting stuck on dqinbufs). What changes are required to use less number of buffers particularly taking it as one buf?

    2) vpe_output_dqbuf and vpe_output_qbuf combination is used twice (and rendering twice aswell) for each single combination of input. Why is it this way. I tried removed the second combination, but it didnt work.

    3) as per query 2), if the output is taken twice, the number deinterlaced output frames is twice that of input frames, this is increasing the play duration (if the frame rate is not changed).

    4) If we take output only once, we are still observing some interlacing artifacts, what should be done to remove them by taking output only once?

    Thanks,

    Srinivas.

  • Hi Srinivas,


    1)  6 is the V4L2 recommended number of buffers and you can manage with minimum 4. Since the input to VPE is from decoder, you need to allocate atleast 4 for VPE output.

    2) Yes, this is expected behaviour of VPE. For 60 fields you will get 60 frames. You need to call twice both que and deque.

    3) For 60 fields you will get 60 frames.

    4) You can drop the alternate output from VPE for displaying but you can't avoid calling que and deque twice.