-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in D3D11VA Deinterlacing #15197
Comments
I don't have a build and development workflow for MPV that's why I'm filing an issue rather than a PR, but I think I've gotten behind the reasons why it doesn't work properly. Issue 1The first part that is wrong is this: mpv/video/filter/vf_d3d11vpp.c Lines 418 to 428 in a210639
wm4 had commited this code with the following comment:
The answer to this is simple: you don't have to do that, because the result frames that you get from the DXVA decoders always include both fields already. |
Issue 2This is about the deinterlacing modes. For illustration, here some screenshots from DXVAChecker (nice tool): NvidiaIntelAMDSummaryIntel and Nvidia have one "video processor", AMD has two (separate one for deinterlacing), but all of them are indicating multiple deinterlacing methods, so there's not one for method X and another one for method Y. Original CommitNot a new question at all - this is another part from the original commit of the D3D11VPP filter:
I came to wonder about the same thing yesterday and even 8 years later it's still been tough to find out, because it's just not documented clearly.
That's also the answer to this line in the code: mpv/video/filter/vf_d3d11vpp.c Line 274 in a210639
Conclusions
|
Issue 3When we set input and output framerate on the processor, there's still one question remaining: When input and output rate are different, how to transform N input frames into M output frames? The key to that are frame numbers for input and output side. These need to be set in the right way which reflects the relation between input and output frame and in the current code, that not right either. I had looked into verious other implementations - all different and most of them wrong (as I know now). I had my own theory but wasn't sure about it (yet I was right, hehe). Required Changesmpv/video/filter/vf_d3d11vpp.c Lines 457 to 463 in a210639
Then all should be good... |
Thank you for the detailed analysis. I’m aware this filter is glued together, and when adding scaling, I was really hoping not to run into issues with the rest of this code. That being said, it’s not as simple as you suggest; neither of your recommendations improves the situation, and in fact, they make it worse. But I did like 10 minutes try only, so don't take my word too seriously.
I can look into this when I find the time. Frankly, though, you’re already well ahead with the research you’ve done. Building mpv with MSYS2 is actually quite straightforward. If you want to give it a try, see compile-windows.md. I can do it too, but it’s not a high priority for me and probably will not do it quite soon. |
I'm sure it's not related to the scaling you have added, it has always been like that (one of our beta users mentioned it's a long-standing issue in MPV).
I kind of hoped it might be like a 10 minute thing for someone who has a working dev environment.
Originally I had expected having to do this at some point, but mpv is very flexible and working very reliably, so my integration via libmpv is almost complete and that's the first issue where dealing with mpv source would be needed. Right now, I'm a bit short on time, so let's see who may first to find some time and passion for looking into this. 😆 Thanks |
Yes, I suspect this has to be set properly. In fact mpv has all the queue for frames, so we can do it without much trouble, except understanding what exactly API expects from us. I've tested in madVR which has all this implemented properly (I think) and it produces proper result, but also there is little bit of flicker just after the new elements show, so this make me think that it indeed uses previous frames. And this makes sense, but it needs so love to put into mpv to make it all correctly set-up. |
I have reviewes all implementations on GitHub which are using those APIs, if you like I can send you the links. Those known to be good are all providing reference frames, the two samples from Microsoft don't, but well, it's just samples, keeping things simple. The important thing to consider is that the D3D11 APIs are meaning 2 combined fields in a frame while the frames in the refqueue have one frame per field (even though each two frames are containing both fields), so if the current refqueue frame is frame 0 and the deinterlacer wants two future frames, we need to provide refqueue frames 2 and 4 (not 1 and 2). |
mpv Information
Other Information
Reproduction Steps
Playback some interlaced video which has some sharp horizontal edges or text/graphics.
Play with D3D11 hw decoding and deinterlacing enabled.
It's not always immediately obvious - you need to look closely: Use a fixed scaling of 1.0 or 2.0, or set the resolution of a 4k display to 1600:900 and watch it there.
Expected Behavior
This is how it looks with bwdif (software) deinterlacing:
flickering_bwdif.mp4
Actual Behavior
And here are the results with D3D11VPP deinterlacing:
Intel & AMD
flickering_intel.mp4
The example is with Intel GPU and it looks the same with AMD GPUs.
Nvidia
Nvidia looks more like bwdif at first sight, but that's just because it supports the "blend" deinterlacing mode. The result is that it doesn't show that flickering/shaking, but with degraded appearance.
Here's a screenshot from Nvidia:
And this from Intel:
Sample Files
mpv_d3d11_deint_sample.zip
The text was updated successfully, but these errors were encountered: