History

vf_d3d11vpp: add NVIDIA RTX Video HDR support

Kacper Michajłow committed 2 years ago

Commit 6ca37521 parent ffb40ab3 files · +41 −1Browse files

Unified · Split

3 files
  1. DOCS/interface-changes/nvidia-true-hdr.txt +1 −0
  2. DOCS/man/vf.rst +2 −0
  3. video/filter/vf_d3d11vpp.c +38 −1
DOCS/interface-changes/nvidia-true-hdr.txt+1−0
@@ -0,0 +1 @@
1+add `--vf=d3d11vpp=nvidia-true-hdr`
DOCS/man/vf.rst+2−0
@@ -722,6 +722,8 @@ Available mpv-only filters are: · 721 unmodified lines
722722 which algorithm is actually selected. ``none`` always falls back. On
723723 most if not all hardware, this option will probably do nothing, because
724724 a video processor usually supports all modes or none.
725+ ``nvidia-true-hdr``
726+ Enable NVIDIA RTX Video HDR processing.
725727
726728 ``fingerprint=...``
727729 Compute video frame fingerprints and provide them as metadata. Actually, it
video/filter/vf_d3d11vpp.c+38−1
@@ -43,6 +43,12 @@ DEFINE_GUID(NVIDIA_PPE_INTERFACE_GUID, · 42 unmodified lines
4343 0xc3, 0xc2, 0x53, 0x75, 0xe6, 0xf7);
4444 #endif
4545
46+#ifndef NVIDIA_TRUE_HDR_INTERFACE_GUID
47+DEFINE_GUID(NVIDIA_TRUE_HDR_INTERFACE_GUID,
48+ 0xfdd62bb4, 0x620b, 0x4fd7, 0x9a, 0xb3,
49+ 0x1e, 0x59, 0xd0, 0xd5, 0x44, 0xb3);
50+#endif
51+
4652 #ifndef INTEL_VPE_INTERFACE_GUID
4753 DEFINE_GUID(INTEL_VPE_INTERFACE_GUID,
4854 0xedd1d4b9, 0x8659, 0x4cbc, 0xa4, 0xd6,
@@ -72,6 +78,7 @@ struct opts { · 23 unmodified lines
7278 int mode;
7379 int field_parity;
7480 int format;
81+ bool nvidia_true_hdr;
7582 };
7683
7784 struct priv {
@@ -142,6 +149,31 @@ static void enable_nvidia_rtx_extension(struct mp_filter *vf) · 64 unmodified lines
142149 }
143150 }
144151
152+static void enable_nvidia_true_hdr(struct mp_filter *vf)
153+{
154+ struct priv *p = vf->priv;
155+
156+ struct nvidia_ext {
157+ unsigned int version;
158+ unsigned int method;
159+ unsigned int enable : 1;
160+ unsigned int reserved : 31;
161+ } ext = {4, 3, 1};
162+
163+ HRESULT hr = ID3D11VideoContext_VideoProcessorSetStreamExtension(p->video_ctx,
164+ p->video_proc,
165+ 0,
166+ &NVIDIA_TRUE_HDR_INTERFACE_GUID,
167+ sizeof(ext),
168+ &ext);
169+
170+ if (FAILED(hr)) {
171+ MP_WARN(vf, "Failed to enable NVIDIA RTX Video HDR: %s\n", mp_HRESULT_to_str(hr));
172+ } else {
173+ MP_VERBOSE(vf, "NVIDIA RTX Video HDR enabled\n");
174+ }
175+}
176+
145177 static void enable_intel_vsr_extension(struct mp_filter *vf)
146178 {
147179 struct priv *p = vf->priv;
@@ -289,6 +321,9 @@ create: · 141 unmodified lines
289321 break;
290322 }
291323
324+ if (p->opts->nvidia_true_hdr)
325+ enable_nvidia_true_hdr(vf);
326+
292327 return 0;
293328 fail:
294329 destroy_video_proc(vf);
@@ -468,7 +503,8 @@ static void vf_d3d11vpp_process(struct mp_filter *vf) · 173 unmodified lines
468503
469504 p->require_filtering = p->params.hw_subfmt != p->out_params.hw_subfmt ||
470505 p->params.w != p->out_params.w ||
471− p->params.h != p->out_params.h;
506+ p->params.h != p->out_params.h ||
507+ p->opts->nvidia_true_hdr;
472508 }
473509
474510 if (!mp_refqueue_can_output(p->queue))
@@ -617,6 +653,7 @@ static const m_option_t vf_opts_fields[] = { · 142 unmodified lines
617653 {"tff", MP_FIELD_PARITY_TFF},
618654 {"bff", MP_FIELD_PARITY_BFF},
619655 {"auto", MP_FIELD_PARITY_AUTO})},
656+ {"nvidia-true-hdr", OPT_BOOL(nvidia_true_hdr)},
620657 {0}
621658 };
622659

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t