- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
My work is to split the decoded frame in D3D surface into N*N sub pictures in directshow pipeline. So I create N*N VPP sessions to share the same output of decoder session. To avoid data racing, each session just has a copy of inputs handle, i.e. mfxFrameSurface, but content of frame is NOT copied.
I have tried three ways to do this work. The pseudo codes are given below:
Method 1: The simple and naive way is to run each step one by one
for each(i = 0 to all) {
RunVPPAsync(sessions, inputSurf, outputSurf)
SyncOperation(sessions, syncp)
DoSomthing(outputSurf)
}
It runs well and gets the result successfully.
Method 2: I want to let MSDK runtime to schedule the sessions by itself, so I commit all the sessions before all sync operations
for each(i = 0 to all) {
RunVPPAsync(sessions, inputSurf, outputSurf)
}
for each(i = 0 to all) {
SyncOperation(sessions, syncp)
}
for each(i = 0 to all) {
DoSomthing(outputSurf)
}
It crashed at SyncOperation and MFX_ERR_DEVICE_FAILED is reported
Method 3: A better way is to run three steps in pipelining as following codes shown
RunVPPAsync(sessions[0], inputSurf, outputSurf[0])
SyncOperation(sessions[0], syncp[0])
for each(i = 1 to all) {
RunVPPAsync(sessions, inputSurf, outputSurf)
DoSomthing(outputSurf[i-1])
SyncOperation(sessions, syncp)
}
DoSomthing(outputSurf)
But it also crashed at SyncOperation and MFX_ERR_DEVICE_FAILED is reported too. Anyone can help me how to fix bugs of method 2 & 3. Or there is any other efficient ways?
Thanks a lot!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To be able to answer your question I'd like to better understand your use case. If you don't mind, could you please share a bit more of what you are trying to achieve with the sub pictures surfaces, such as what is "DoSomething()"?
Is the intent to apply different VPP operations (such as scale, brightness etc...) on all subpictures, or are you just using VPP to crop the specific sub picture. If you are only cropping I do not think you have to bother using VPP since creating independent Media SDK VPP sessions would result in lots of threading and resource overhead. If only cropping, then you may want to explore direct use of DirectX calls such as StretchRect.
Without implementing a somewhat equivalent setup as yours it is hard for me to say what the reason for theMFX_ERR_DEVICE_FAILED may be.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Petter
Thanks for your reply.
VPP operations I need are
1: Crop specific sub pictures of 720P picture
2: Scale sub pictures to 720P.
The DoSomething() will read the scaled picture and send it to our display device.
Is there any example of multiple sessions share the same input surface? Do you think whether my pseudo code is reasonable? The most suspicious part is that only the handle of surface, i.e. mfxFrameSurface, is saved, for each session. Do I need to save a copy of picture for each session? It may be an expensive way
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Furthermore I have tried to run each session in different thread when input surface is ready. But the same err is reported in each thread.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately we have no sample showcasing sessions reusing same input surface. However, if you need some guidance on how to use StretchRect please refer to the Media SDK 3.0 "sample_decode" sample.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page