Aleksoid1978 / VideoRenderer

Внешний видео-рендерер
GNU General Public License v3.0
997 stars 110 forks source link

Any plans to make the renderer compatible with the upcoming nvidia driver update with "RTX Video HDR"? #116

Closed geahad closed 6 months ago

geahad commented 6 months ago

The renderer already supports "requesting" VSR, and it functions splenditily! So, as Nvidia announced that with this months driver update (probably due on the 17th of this month) they'll introduce RTX Video HDR, something that, by the description of it, would function similarly like AutoHDR for games, essentially automatically inverse-tonemapping SDR video content to HDR. Link to nvidia blog (scroll down to relevant section): https://blogs.nvidia.com/blog/studio-rtx-hdr-video-twitch-obs-istock-getty-super-laptop-desktop/

By their description, this function will be enabled by a toggle in the driver that's sepparate from VSR itself.

I hope this will not be problematic to implement, as it sounds absolutely awesome.

Thank you for reading, and thank you for this renderer of yours -- it already provided much joy to my video collection!

Aleksoid1978 commented 6 months ago

Developer don't have supported hardware (Nvidia >= 2xxx series). If someone can provide/buy the appropriate equipment for developers, then yes, we will do it.

geahad commented 6 months ago

Thank you for your answer! I'll try aksing other devs if they can help.

v0lt commented 6 months ago

(probably due on the 17th of this month)

I don’t see the point in planning support for something that doesn’t exist.

maxsteep commented 5 months ago

it exists now

clsid2 commented 5 months ago

Provide link to the developer documentation.

emoose commented 5 months ago

Haven't been able to find any public docs about NV's VSR/HDR stuff, but like VSR the code to enable HDR is available in the chromium src.

https://github.com/chromium/chromium/commit/b2fae4c98404bec282f24cd7d8a63aced9070fda seems to be commit that added it, but they did change some things since then, latest code is here: https://github.com/chromium/chromium/blob/04fa180dc7aea16a905f79c715dc2ee5cc6f742b/ui/gl/swap_chain_presenter.cc#L358 (ToggleNvidiaVpTrueHDR func in case link doesn't go there directly)

Seems to be enabled the same way as VSR by passing a kNvidiaTrueHDRInterfaceGUID guid over to VideoProcessorSetStreamExtension, no telling if VideoRenderer can work with it as easily as VSR though.

Aleksoid1978 commented 5 months ago

Developer don't have supported hardware (Nvidia >= 2xxx series).

clsid2 commented 5 months ago

Make a simple test build. Then I am sure others can confirm if it works?

clsid2 commented 5 months ago

[removed] This test build unconditionally enables RTX Video HDR.

@Aleksoid1978 According to NVIDIA FAQ, superres works with inputs up to 1440p. I think old driver only did up to 1080p. Current code uses 1088 as max height. Current code also enables superres for HDR. Why was the HDR check removed? NVIDIA FAQ says that HDR is still not supported.

BreakPoints commented 5 months ago

@clsid2 Doesn't seem to trigger for me. Also did a side by side with another renderer and both had identical brightness/colours.

image

geahad commented 5 months ago

Can also confirm that it does not trigger. Had the recommended settings for VSR still set:

Btw. I REALLY appreciate that you're trying to get this to work!

clsid2 commented 5 months ago

https://nvidia.custhelp.com/app/answers/detail/a_id/5448/~/rtx-video-faq

You need yesterdays NVIDIA driver. You need to enable HDR in Windows. You need HDR10 compatible screen.

geahad commented 5 months ago

Appologies, I didn't list that I had all that enabled too. It triggers fine in chrome for me. Under the same conditions, it does not trigger with the test renderer.

BreakPoints commented 5 months ago

You need yesterdays NVIDIA driver. You need to enable HDR in Windows. You need HDR10 compatible screen.

@clsid2 Yes, I have all of the preceding as can be seen in my screenshot.

clsid2 commented 5 months ago

Figured out why. HDR swapchain must also be enabled in the renderer. https://github.com/chromium/chromium/blob/04fa180dc7aea16a905f79c715dc2ee5cc6f742b/ui/gl/swap_chain_presenter.cc#L2002

clsid2 commented 5 months ago

MpcVideoRenderer64_RTX_HDR_test2.zip MpcVideoRenderer64_RTX_HDR_test3.zip

Maybe this works.

geahad commented 5 months ago

For me, under the same conditions as before, both _test2 and _test3 versions do not trigger the desired HDR functionality.

MarcG2 commented 5 months ago

I confirmed as well test2 and test3 didn't trigger HDR. It works for me in Chrome without issue.

Aleksoid1978 commented 5 months ago

Give me a video card and I will do everything that you are suffering here. And I won’t write code at random, much less upload it to the project.

clsid2 commented 5 months ago

I give up. Someone with RTX card should try to make it work. Here is WIP patch. RTX-Video-HDR-work-in-progress.zip

MarcG2 commented 5 months ago

Give me a video card and I will do everything that you are suffering here. And I won’t write code at random, much less upload it to the project.

I don't suppose you can set up an Amazon wish list? Are you located in Russia?

emoose commented 5 months ago

E: pushed a github release for this at https://github.com/emoose/VideoRenderer/releases/tag/rtx-hdr-1.0 with instructions for setup, hope it helps!


I give up. Someone with RTX card should try to make it work. Here is WIP patch.

Thanks, tried testing with this, seems we get S_INVALIDARG from the VideoProcessorSetStreamExtension call when we call it early on, but moving the SetRtxHdrNvidia call to after we've ran VideoProcessorSetOutputTargetRect (as chrome seems to) gets it to return S_OK.

There was something up with the colorspaces too, had to remove a SourceIsHDR check inside InitSwapChain() so that bHdrOutput would be set to true, and remove the bVPUseAutoHDR bool since it was too early for NV to give us the right result.

With those changed NVCP shows HDR is active for me & changing the setting there seems to dim the image a bit, not really sure if it's having the complete effect or not though.

If anyone wants to try: RTXVideoHDR-wip2.zip

(would guess this might break stuff with non-hdr displays though, so not really recommended for general use)

E: if there's no effect you may need to change internal filters -> video decoder -> hardware decoder to D3D11 and select a hardware device for it too, doesn't seem to activate if it's left on automatic.

Noz0mizore commented 5 months ago

나는 포기한다. RTX 카드를 가진 사람이 이를 작동시키도록 노력해야 합니다. 다음은 WIP 패치입니다.

감사합니다. 이것으로 테스트해 보니 VideoProcessorSetStreamExtension 호출을 초기에 호출할 때 S_INVALIDARG를 얻는 것 같습니다. 그러나 호출을 SetRtxHdrNvidia실행한 후로 이동하면 VideoProcessorSetOutputTargetRect(크롬에서 보이는 것처럼) S_OK를 반환하게 됩니다.

색상 공간에도 문제가 있었고, InitSwapChain()bHdrOutput이 true로 설정되도록 내부에서 SourceIsHDR 검사를 제거해야 했으며, bVPUseAutoHDRNV가 올바른 결과를 제공하기에는 너무 이르기 때문에 부울을 제거해야 했습니다.

변경된 NVCP를 사용하면 HDR이 활성화되어 있고 설정을 변경하면 이미지가 약간 어두워지는 것처럼 보이지만 완전한 효과가 있는지 여부는 확실하지 않습니다.

누구든지 시도하고 싶다면: RTXVideoHDR-wip2.zip

(이렇게 하면 HDR이 아닌 디스플레이의 문제가 발생할 수 있으므로 일반적인 사용에는 권장되지 않습니다.)

E: 효과가 없으면 내부 필터 -> 비디오 디코더 -> 하드웨어 디코더를 D3D11로 변경하고 하드웨어 장치도 선택해야 할 수 있습니다. 자동으로 놔두면 활성화되지 않는 것 같습니다.

I did what you said and it works. I'll have to see if there's something different about how it works in chrome.

Noz0mizore commented 5 months ago

Chrome-HDR

chrome (HDR->SDR tone mapping)

MPC-HC-HDR

MPC-BE (HDR->SDR tone mapping)

Aleksoid1978 commented 5 months ago

Give me a video card and I will do everything that you are suffering here. And I won’t write code at random, much less upload it to the project.

I don't suppose you can set up an Amazon wish list? Are you located in Russia?

AliExpress.

terrainer commented 5 months ago

I give up. Someone with RTX card should try to make it work. Here is WIP patch.

Thanks, tried testing with this, seems we get S_INVALIDARG from the VideoProcessorSetStreamExtension call when we call it early on, but moving the SetRtxHdrNvidia call to after we've ran VideoProcessorSetOutputTargetRect (as chrome seems to) gets it to return S_OK.

There was something up with the colorspaces too, had to remove a SourceIsHDR check inside InitSwapChain() so that bHdrOutput would be set to true, and remove the bVPUseAutoHDR bool since it was too early for NV to give us the right result.

With those changed NVCP shows HDR is active for me & changing the setting there seems to dim the image a bit, not really sure if it's having the complete effect or not though.

If anyone wants to try: RTXVideoHDR-wip2.zip

(would guess this might break stuff with non-hdr displays though, so not really recommended for general use)

E: if there's no effect you may need to change internal filters -> video decoder -> hardware decoder to D3D11 and select a hardware device for it too, doesn't seem to activate if it's left on automatic.

This is working for me too. Using a 3080. I'm not sure what the .patch file is for, I just used the .ax and it had no problems.

clsid2 commented 5 months ago

SetRtxHdrNvidia function can be split into two parts. One to check for availability of the extension, and one to activate it. Call the availability function before init of videoprocessor. Store result in bool, and use that later for bHdrPassthrough and bHdrOutput.

clsid2 commented 5 months ago

Regarding hardware decoder. Does it work with NONE and DXVA2 Copyback? Can others confirm that D3D11 Native does not work? If that is the case, then Native could possibly be disabled in the renderer when RTX HDR is used. Then no changes would be needed in video decoder. But forcing copyback would of course be bad for performance. So weird that if it doesn't work.

emoose commented 5 months ago

SetRtxHdrNvidia function can be split into two parts. One to check for availability of the extension, and one to activate it. Call the availability function before init of videoprocessor. Store result in bool, and use that later for bHdrPassthrough and bHdrOutput.

Hm, seems both GetStreamExtension & SetStreamExtension are returning SINVALIDARG when calling them early, guess it maybe needs ID3D11VideoProcessor to be created before it gives valid results (really a shame NV aren't releasing any docs for these ;;)

Does it work with NONE and DXVA2 Copyback?

For me it's working with None and both DXVA2 Copyback & DXVA2 Native, but D3D11 Automatic/Native makes it stop having any effect.

clsid2 commented 5 months ago

Try to call GetStreamExtension as early as possible, preferably before deciding whether to output as HDR. That could help prevent washed out video issues. Or do a re-init when extension is unavailable.

D3D11 Native is a choice that is made in the renderer during connection with decoder. If we know early enough that RTX HDR will be used, then renderer can decide to use copyback mode.