Intel-Media-SDK / MediaSDK

The Intel® Media SDK
MIT License
932 stars 458 forks source link

Generating Correct Number of Frames in 3:2 Pull Down #1954

Closed Nastooh-Inca closed 4 years ago

Nastooh-Inca commented 4 years ago

Hi Referring to issue https://github.com/Intel-Media-SDK/MediaSDK/issues/1801, I can confirm that by setting ExtendedPicStruct to 1, proper picture structure can be retrieved, via MFXVideoDECODE_GetVideoParam call. However, I can't figure out how to force the decoder to generate the correct number of frames at the end of the cadence, e.g., for TBT,BT,BTB input to generate TB,TB,TB,TB. Any ideas? Cheers,

dmitryermilov commented 4 years ago

Hi @Nastooh-Inca ,

Sorry for delayed reply. Is my understanding correct that you're asking about Inverse Telecine: 29,97 telecined to 24p ? If so, our decoders don't do this. It's out of their scope. This functionality was available in PTIR (Premium Telecine Interlace Reverser). PTIR was distributed as a part of MediaServerStudio Professional. Let me take a pause to clarify our strategy regarding PTIR.

@alariono , can our regular VPP do IVTC?

alariono commented 4 years ago

@dmitryermilov better to ask VPP onwers

dmitryermilov commented 4 years ago

@FurongZhang , can you please check and reply

FurongZhang commented 4 years ago

Sure.

dmitryermilov commented 4 years ago

Hi Nastooh,

Sorry for delayed reply. Please try it via MSDK VPP. To check the idea, you can use sample_vpp this way: sample_vpp -i in.nv12 -o out.nv12 -lib hw -sh 144 -sw 176 -dh 144 -dw 176 -sf 30 -df 24 -spic 0 -dpic 1 -iopattern d3d_to_d3d -pts_check -di_mode 1

It enables framerate conversion with deinterlacing. FRC is 30i -> 24p. If it works for you, you can integrate VPP with corresponding setting in your pipeline.

Rgeards, Dmitry

Nastooh-Inca commented 4 years ago

Hi Dmitry, Thank you for your reply.Our use case is somewhat opposite, i.e., we need to go from 4 frames to 5. I suppose then the flow would be: 1- Use MFXVideoDECODE_Query to detect MFX_PICSTRUCT_FIELD_REPEATED 2- Signal VPP to create the new frame Regarding Step 2, does MSDK have any capacities to weave top field of a frame with bottom field of the next one? Cheers,

dmitryermilov commented 4 years ago

Hi Nastooh,

Ahh. Sorry for misleading then.

Regarding Step 2, does MSDK have any capacities to weave top field of a frame with bottom field of the next one? Yes. But in a "manual" mode: please see https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#vppfieldprocessingmode

It means you can trigger two copy operations (per each field) but it would require two RunVPPFrameAsync calls.

Also, feel free to refer to implementations of this field copy: https://github.com/Intel-Media-SDK/MediaSDK/blob/ba78c36cb0a0e52ececc8ab6bea2000f8fa09767/_studio/mfx_lib/vpp/src/mfx_vpp_hw.cpp#L3987 (this is an actual call to GPU copy kernel) and code related to imfxFPMode (it defines copy mode.)

Regards, Dmitry

dmitryermilov commented 4 years ago

Seems it was addressed. Feel free to reopen if not.