Intel-Media-SDK / MediaSDK

The Intel® Media SDK
MIT License
940 stars 460 forks source link

N (1-N) pipeline with display - is that possible with multi_transcode sample code #2854

Open APrashant opened 2 years ago

APrashant commented 2 years ago

Hi,

We are trying to achieve below pipeline. Image: Untitled Diagram (6)

whether it is possible with Intel msdk. Could be please share us if any limitation we have to consider for creating this pipeline.

Thanks in advance

dmitryermilov commented 2 years ago

Hi @APrashant ,

It's possible but not trivial to code. Unfortunately we don't have building blocks which would allow to set-up such pipeline in a simple way on app side. So you'll need to code this pipeline manually. What you need inside each Nth pipeline: 1) Thee MSDK sessions: one for decoder and some of VPP and the other two sessions for the other two VPP correspondingly. It's MSDK limitation that one session can contain one decoder, one VPP and one encoder. 2) Be able to allocates right number of surfaces with right resolution. So you need a 'master' logic which would ask each component how many surfaces it needs, allocate this pool and then provides access (method like mfxFrameSurface1* MyPool::GetFreeSurface(unit32_t width, unit32_t height) ) to these surfaces for components from the pipeline 3) Set-up a surfaces flow from one component to another: either connect components in a chain so that an upstream components sends a surface to downstream component directly or make a kind of 'master' component which would handle data flow: call decoder, take decoded surface then call VPP1, then call VPP2, then ... etc. Please pay attention to this part. I mean which option you want to follow 1st or 2nd one.

Success of this solution depends on good design. I don't recommend to rely on sample_multi_transcode code to build such app. Better to make it from scratch. It shouldn't be really hard. Try to code pipeline №1 only. After than you'll be able to repeat N times. After than add composition. As for limitations, I'm not sure about your perf expectations. 16 such pipelines might be too much for real time processing. But it depends on resolution. BTW, from perf considerations if VPPs are doing downscaling it's better to put VPP 1/2/3 in a sequence so that next VPP gets smaller size surfaces from previous VPP. It will work faster than 1->N when each VPP needs to handle original size surface.

APrashant commented 2 years ago

Hi @dmitryermilov

Thanks for the inputs.

Regarding performance expectations,

We will be having Input stream - 4MP 10fps h264 dump - 1280x720 Raw dump - 320x240 Display - 640x360 and it differs based on the display matrix (goes upto 1920x1080)

whether 16 such pipelines with above resolutions will be too much for real time processing?

Thanks in advance.