OpenVisualCloud / Media-Transport-Library

A real-time media transport(DPDK, AF_XDP, RDMA) stack for both raw and compressed video based on COTS hardware.
BSD 3-Clause "New" or "Revised" License
168 stars 54 forks source link

Segfaults in st20p_tx when sending interlaced content #481

Closed gizahNL closed 11 months ago

gizahNL commented 1 year ago

Segfaults are happening at "random" spots (depending on how application is constructed, frame size etc.) when running st20p_tx pipeline with interlaced enabled. Likely something is writing out of bounds and causing havoc.

Documentation also isn't truly clear on this: should I set the height to the full frame height? Or to field height? Documentation suggests that FPS for example should be field FPS, so one would assume height is field height as well. When copying in lines does one only fill the alternating lines on the st_frame? Or does one fill the first half worth of lines for each field?

Example code attached that shows the crash. mtl-interlaced-test.zip

frankdjx commented 1 year ago

Can you change the input format to the native ST2110 format below?

opts.input_fmt = ST_FRAME_FMT_YUV422RFC4175PG2BE10;

We're encountering an issue with interlaced video handling when the input format is ST_FRAME_FMT_YUV422PLANAR10LE. This problem stems from the fact that our current converter doesn't support interlaced video in this specific format.

gizahNL commented 1 year ago

Can you change the input format to the native ST2110 format below?

opts.input_fmt = ST_FRAME_FMT_YUV422RFC4175PG2BE10;

We're encountering an issue with interlaced video handling when the input format is ST_FRAME_FMT_YUV422PLANAR10LE. This problem stems from the fact that our current converter doesn't support interlaced video in this specific format.

Doesn't that defeat the purpose of the pipeline? (to have it convert the format) ;) Then I'd still have to write my own SIMD to do the conversion ;)

frankdjx commented 1 year ago

Can you change the input format to the native ST2110 format below?

opts.input_fmt = ST_FRAME_FMT_YUV422RFC4175PG2BE10;

We're encountering an issue with interlaced video handling when the input format is ST_FRAME_FMT_YUV422PLANAR10LE. This problem stems from the fact that our current converter doesn't support interlaced video in this specific format.

Doesn't that defeat the purpose of the pipeline? (to have it convert the format) ;) Then I'd still have to write my own SIMD to do the conversion ;)

No need to write your own. I think it's a bug in the current converter framework not handle interlaced. The converter framework seems to be treating an interlaced frame as a full frame. We should be able to rectify this problem soon.

frankdjx commented 1 year ago

Can you help to rebase to latest? This PR https://github.com/OpenVisualCloud/Media-Transport-Library/pull/484 fix the issue.

gizahNL commented 1 year ago

What is the correct usage? It's unfortunately unclear :/

When setting up my st20p_tx_ops I set the interlaced boolean to true. Do I then set the FPS to the fieldrate, or full frame rate? Do I set my height to the full frame height, or to the field height (frame height/2)?

Then in my frame production loop, do I fill a single frame with both fields? Do I fill each field separately into a frame?

frankdjx commented 1 year ago

When setting up my st20p_tx_ops I set the interlaced boolean to true. Do I then set the FPS to the fieldrate, or full frame rate? Do I set my height to the full frame height, or to the field height (frame height/2)?

[Frank] For example, for a 1080i50 case, the fps set to 50, width 1920, height 1080, interlaced set to true.

Then in my frame production loop, do I fill a single frame with both fields? Do I fill each field separately into a frame?

[Frank] The later, fill each field separately into a frame.

We don't has a dedicated field API, all functions reused from the progressive frame mode. It remind us to provide a guide for how to set a interlaced mode.

gizahNL commented 1 year ago

When setting up my st20p_tx_ops I set the interlaced boolean to true. Do I then set the FPS to the fieldrate, or full frame rate? Do I set my height to the full frame height, or to the field height (frame height/2)?

[Frank] For example, for a 1080i50 case, the fps set to 50, width 1920, height 1080, interlaced set to true.

Then in my frame production loop, do I fill a single frame with both fields? Do I fill each field separately into a frame?

[Frank] The later, fill each field separately into a frame.

We don't has a dedicated field API, all functions reused from the progressive frame mode. It remind us to provide a guide for how to set a interlaced mode.

Great thanks!

I presume the field I'll fill in production is half height, so in the case of 1080 I fill 540 lines? Or is it full height and do I fill alternating lines?

frankdjx commented 1 year ago

I presume the field I'll fill in production is half height, so in the case of 1080 I fill 540 lines? Or is it full height and do I fill alternating lines?

[Frank] Yes, fill 540 lines in one frame for 1080i. One frame here is really one field.

frankdjx commented 11 months ago

Ping. Do you still has problems on interlaced support?

gizahNL commented 11 months ago

Ping. Do you still has problems on interlaced support?

It works for us! Thanks!