[vlc-commits] d3d9: handle VLC_CODEC_D3D9_OPAQUE_10B upload/download

Thomas Guillem git at videolan.org
Mon Mar 19 12:15:40 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 16 16:03:31 2018 +0100| [972c6f846b9834531623ff6e80f67fa773759cf8] | committer: Thomas Guillem

d3d9: handle VLC_CODEC_D3D9_OPAQUE_10B upload/download

(cherry picked from commit b373aea13890437adb257860888784d653988d82)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=972c6f846b9834531623ff6e80f67fa773759cf8
---

 modules/hw/d3d9/dxa9.c | 48 ++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 38 insertions(+), 10 deletions(-)

diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index bfd0bb48ed..eb6d31438d 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -122,7 +122,8 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
             dst->p[1].p_pixels = dst->p[2].p_pixels;
             dst->p[2].p_pixels = tmp;
         }
-    } else if (desc.Format == MAKEFOURCC('N','V','1','2')) {
+    } else if (desc.Format == MAKEFOURCC('N','V','1','2')
+            || desc.Format == MAKEFOURCC('P','0','1','0')) {
         const uint8_t *plane[2] = {
             lock.pBits,
             (uint8_t*)lock.pBits + lock.Pitch * desc.Height
@@ -131,11 +132,16 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
             lock.Pitch,
             lock.Pitch,
         };
-        Copy420_SP_to_P(dst, plane, pitch,
-                        __MIN(desc.Height, src->format.i_y_offset + src->format.i_visible_height),
-                        p_copy_cache);
-
-        if (dst->format.i_chroma != VLC_CODEC_I420)
+        if (desc.Format == MAKEFOURCC('N','V','1','2'))
+            Copy420_SP_to_P(dst, plane, pitch,
+                            __MIN(desc.Height, src->format.i_y_offset + src->format.i_visible_height),
+                            p_copy_cache);
+        else
+            Copy420_16_SP_to_P(dst, plane, pitch,
+                              __MIN(desc.Height, src->format.i_y_offset + src->format.i_visible_height),
+                              6, p_copy_cache);
+
+        if (dst->format.i_chroma != VLC_CODEC_I420 && dst->format.i_chroma != VLC_CODEC_I420_10L)
             picture_SwapUV(dst);
     } else {
         msg_Err(p_filter, "Unsupported DXA9 conversion from 0x%08X to YV12", desc.Format);
@@ -155,7 +161,8 @@ static void DXA9_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
     if (!GetLock(p_filter, p_sys->surface, &lock, &desc))
         return;
 
-    if (desc.Format == MAKEFOURCC('N','V','1','2')) {
+    if (desc.Format == MAKEFOURCC('N','V','1','2')
+     || desc.Format == MAKEFOURCC('P','0','1','0')) {
         const uint8_t *plane[2] = {
             lock.pBits,
             (uint8_t*)lock.pBits + lock.Pitch * desc.Height
@@ -304,20 +311,38 @@ int D3D9OpenConverter( vlc_object_t *obj )
 {
     filter_t *p_filter = (filter_t *)obj;
 
-    if ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
+    if ( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE &&
+         p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
         return VLC_EGENERIC;
 
     if ( p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
          || p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width )
         return VLC_EGENERIC;
 
+    uint8_t pixel_bytes = 1;
     switch( p_filter->fmt_out.video.i_chroma ) {
     case VLC_CODEC_I420:
     case VLC_CODEC_YV12:
+        if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
+            return VLC_EGENERIC;
+        p_filter->pf_video_filter = DXA9_YV12_Filter;
+        break;
+    case VLC_CODEC_I420_10L:
+        if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
+            return VLC_EGENERIC;
         p_filter->pf_video_filter = DXA9_YV12_Filter;
+        pixel_bytes = 2;
         break;
     case VLC_CODEC_NV12:
+        if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
+            return VLC_EGENERIC;
+        p_filter->pf_video_filter = DXA9_NV12_Filter;
+        break;
+    case VLC_CODEC_P010:
+        if( p_filter->fmt_in.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
+            return VLC_EGENERIC;
         p_filter->pf_video_filter = DXA9_NV12_Filter;
+        pixel_bytes = 2;
         break;
     default:
         return VLC_EGENERIC;
@@ -327,7 +352,7 @@ int D3D9OpenConverter( vlc_object_t *obj )
     if (!p_sys)
          return VLC_ENOMEM;
 
-    if (CopyInitCache(&p_sys->cache, p_filter->fmt_in.video.i_width ))
+    if (CopyInitCache(&p_sys->cache, p_filter->fmt_in.video.i_width * pixel_bytes))
     {
         free(p_sys);
         return VLC_ENOMEM;
@@ -353,7 +378,8 @@ int D3D9OpenCPUConverter( vlc_object_t *obj )
     picture_t *p_dst = NULL;
     video_format_t fmt_staging;
 
-    if ( p_filter->fmt_out.video.i_chroma != VLC_CODEC_D3D9_OPAQUE )
+    if ( p_filter->fmt_out.video.i_chroma != VLC_CODEC_D3D9_OPAQUE
+      && p_filter->fmt_out.video.i_chroma != VLC_CODEC_D3D9_OPAQUE_10B )
         return VLC_EGENERIC;
 
     if ( p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
@@ -363,6 +389,8 @@ int D3D9OpenCPUConverter( vlc_object_t *obj )
     switch( p_filter->fmt_in.video.i_chroma ) {
     case VLC_CODEC_I420:
     case VLC_CODEC_YV12:
+    case VLC_CODEC_I420_10L:
+    case VLC_CODEC_P010:
         p_filter->pf_video_filter = YV12_D3D9_Filter;
         break;
     default:



More information about the vlc-commits mailing list