[vlc-commits] dxva2: add more preferred decoder pixel format based on chroma sub-sampling
Steve Lhomme
git at videolan.org
Fri Mar 13 10:28:55 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Mar 11 15:01:58 2020 +0100| [42c45b9603729eb4ffbd4d8457b9496f59f8947a] | committer: Steve Lhomme
dxva2: add more preferred decoder pixel format based on chroma sub-sampling
If this format is available for decoding it should give the best result and
performance. If not, something else will be picked.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=42c45b9603729eb4ffbd4d8457b9496f59f8947a
---
modules/codec/avcodec/dxva2.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 050e54d46e..8846975b77 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -320,7 +320,9 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat hwfmt, const
goto error;
}
- if (sys->render == MAKEFOURCC('P','0','1','0'))
+ if (sys->render == MAKEFOURCC('P','0','1','0') ||
+ sys->render == MAKEFOURCC('Y','4','1','0') ||
+ sys->render == MAKEFOURCC('Y','2','1','0'))
final_fmt.i_chroma = VLC_CODEC_D3D9_OPAQUE_10B;
else
final_fmt.i_chroma = VLC_CODEC_D3D9_OPAQUE;
@@ -471,6 +473,19 @@ static int DxSetupOutput(vlc_va_t *va, const directx_va_mode_t *mode, const vide
D3DFORMAT preferredOutput;
if (mode->bit_depth > 8)
+ {
+ if (mode->log2_chroma_w == 0 && mode->log2_chroma_h == 0)
+ preferredOutput = MAKEFOURCC('Y','4','1','0'); // 10 bits 4:4:4
+ else if (mode->log2_chroma_w == 1 && mode->log2_chroma_h == 0)
+ preferredOutput = MAKEFOURCC('Y','2','1','0'); // 10 bits 4:2:2
+ else
+ preferredOutput = MAKEFOURCC('P','0','1','0');
+ }
+ else if (mode->log2_chroma_w == 0 && mode->log2_chroma_h == 0)
+ preferredOutput = MAKEFOURCC('A','Y','U','V'); // 8 bits 4:4:4
+ else if (mode->log2_chroma_w == 1 && mode->log2_chroma_h == 0)
+ preferredOutput = MAKEFOURCC('Y','U','Y','2'); // 8 bits 4:2:2
+ else if (mode->bit_depth > 8)
preferredOutput = MAKEFOURCC('P','0','1','0');
else
preferredOutput = MAKEFOURCC('N','V','1','2');
More information about the vlc-commits
mailing list