[vlc-commits] directx_va: adjust the Xbox constraints

Steve Lhomme git at videolan.org
Mon Feb 19 18:11:01 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 19 12:39:10 2018 +0100| [1a5ea023b3d1a2ad9be246808ae939e107f0a932] | committer: Steve Lhomme

directx_va: adjust the Xbox constraints

It can't handle 4K aligned to 128 but is fine when aligned to 16.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a5ea023b3d1a2ad9be246808ae939e107f0a932
---

 modules/codec/avcodec/d3d11va.c    | 2 +-
 modules/codec/avcodec/directx_va.c | 8 ++++++--
 modules/codec/avcodec/directx_va.h | 2 +-
 modules/codec/avcodec/dxva2.c      | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 4a83ab1a15..de4ebea8ca 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -378,7 +378,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     if (err!=VLC_SUCCESS)
         goto error;
 
-    err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt);
+    err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, isXboxHardware(sys->d3d_dev.d3ddevice));
     if (err != VLC_SUCCESS)
         goto error;
 
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index f7ee9f75c8..3efed0f1f0 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -283,7 +283,7 @@ char *directx_va_GetDecoderName(const GUID *guid)
 
 /* */
 int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, const AVCodecContext *avctx,
-                     const es_format_t *fmt)
+                     const es_format_t *fmt, int flag_xbox)
 {
     /* */
     if (FindVideoServiceConversion(va, dx_sys, fmt, avctx)) {
@@ -306,7 +306,11 @@ int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, const AVCodecContext *
     case AV_CODEC_ID_HEVC:
         /* the HEVC DXVA2 spec asks for 128 pixel aligned surfaces to ensure
            all coding features have enough room to work with */
-        surface_alignment = 128;
+           /* On the Xbox 1/S, the decoder cannot do 4K aligned to 128 but is OK with 64 */
+        if (flag_xbox)
+            surface_alignment = 16;
+        else
+            surface_alignment = 128;
         surface_count += 16;
         break;
     case AV_CODEC_ID_H264:
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 7dbef97abb..b8e62aa2c8 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -80,7 +80,7 @@ typedef struct
 
 int directx_va_Open(vlc_va_t *, directx_sys_t *);
 void directx_va_Close(vlc_va_t *, directx_sys_t *);
-int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *);
+int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *, int flag_xbox);
 char *directx_va_GetDecoderName(const GUID *guid);
 
 #endif /* AVCODEC_DIRECTX_VA_H */
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 25de31de83..42f517212d 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -315,7 +315,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
     if (err!=VLC_SUCCESS)
         goto error;
 
-    err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt);
+    err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, 0);
     if (err != VLC_SUCCESS)
         goto error;
 



More information about the vlc-commits mailing list