[vlc-commits] modules: use picture_SwapUV() instead of plane_SwapUV()

Steve Lhomme git at videolan.org
Tue Feb 20 14:31:24 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Feb 20 13:53:20 2018 +0100| [7c1608be1c79393e2c18ce81634fe82dd8687a18] | committer: Steve Lhomme

modules: use picture_SwapUV() instead of plane_SwapUV()

It has a check for the plane count.

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

 modules/codec/dmo/dmo.c                | 5 +++--
 modules/hw/d3d11/d3d11_surface.c       | 4 ++--
 modules/hw/d3d9/dxa9.c                 | 4 ++--
 modules/video_chroma/copy.c            | 2 +-
 modules/video_output/android/display.c | 2 +-
 modules/video_output/xcb/xvideo.c      | 8 ++++----
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/modules/codec/dmo/dmo.c b/modules/codec/dmo/dmo.c
index 435f4fb284..0277b47712 100644
--- a/modules/codec/dmo/dmo.c
+++ b/modules/codec/dmo/dmo.c
@@ -43,6 +43,7 @@
 
 #include <vlc_codecs.h>
 #include "dmo.h"
+#include "../../video_chroma/copy.h"
 
 #ifndef NDEBUG
 # define DMO_DEBUG 1
@@ -989,7 +990,7 @@ static void CopyPicture( picture_t *p_pic, uint8_t *p_in )
     int i_plane, i_line, i_width, i_dst_stride;
     uint8_t *p_dst, *p_src = p_in;
 
-    plane_SwapUV( p_pic->p );
+    picture_SwapUV( p_pic );
 
     for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
     {
@@ -1005,7 +1006,7 @@ static void CopyPicture( picture_t *p_pic, uint8_t *p_in )
         }
     }
 
-    plane_SwapUV( p_pic->p );
+    picture_SwapUV( p_pic );
 }
 
 static void *DecoderThread( void *data )
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 45196e35e1..bdec1a085d 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -353,7 +353,7 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
     }
 
     if (dst->format.i_chroma == VLC_CODEC_I420)
-        plane_SwapUV( dst->p );
+        picture_SwapUV( dst );
 
     ID3D11Texture2D_GetDesc(sys->staging, &desc);
 
@@ -394,7 +394,7 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
     }
 
     if (dst->format.i_chroma == VLC_CODEC_I420)
-        plane_SwapUV( dst->p );
+        picture_SwapUV( dst );
 
     /* */
     ID3D11DeviceContext_Unmap(p_sys->context, sys->staging_resource, 0);
diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index de56cf3312..ede3e9b644 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -82,7 +82,7 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
         desc.Format == MAKEFOURCC('I','M','C','3')) {
 
         if (dst->format.i_chroma == VLC_CODEC_I420)
-            plane_SwapUV( dst->p );
+            picture_SwapUV( dst );
 
         bool imc3 = desc.Format == MAKEFOURCC('I','M','C','3');
         size_t chroma_pitch = imc3 ? lock.Pitch : (lock.Pitch / 2);
@@ -108,7 +108,7 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
         Copy420_P_to_P(dst, plane, pitch, src->format.i_height, p_copy_cache);
 
         if (dst->format.i_chroma == VLC_CODEC_I420)
-            plane_SwapUV( dst->p );
+            picture_SwapUV( dst );
     } else if (desc.Format == MAKEFOURCC('N','V','1','2')) {
         const uint8_t *plane[2] = {
             lock.pBits,
diff --git a/modules/video_chroma/copy.c b/modules/video_chroma/copy.c
index 02da236e9b..ef0fa9b9e6 100644
--- a/modules/video_chroma/copy.c
+++ b/modules/video_chroma/copy.c
@@ -824,7 +824,7 @@ int picture_UpdatePlanes(picture_t *picture, uint8_t *data, unsigned pitch)
         }
         /* The dx/d3d buffer is always allocated as YV12 */
         if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12))
-            plane_SwapUV( picture->p );
+            picture_SwapUV( picture );
     }
     return VLC_SUCCESS;
 }
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 7e306da7c5..588a7dc52e 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -307,7 +307,7 @@ static void SetupPictureYV12(picture_t *p_picture, uint32_t i_in_stride)
 
     if (vlc_fourcc_AreUVPlanesSwapped(p_picture->format.i_chroma,
                                       VLC_CODEC_YV12))
-        plane_SwapUV( p_picture->p );
+        picture_SwapUV( p_picture );
 }
 
 static void AndroidWindow_DisconnectSurface(vout_display_sys_t *sys,
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 46d4fb2b29..5c82507521 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -627,14 +627,14 @@ static void PoolAlloc (vout_display_t *vd, unsigned requested_count)
         for (unsigned i = 1; i < num_planes; i++)
             res.p[i].p_pixels = res.p[0].p_pixels + offsets[i];
 
-        if (p_sys->swap_uv)
-            /* YVU: swap U and V planes */
-            plane_SwapUV( res.p );
-
         pic_array[count] = XCB_picture_NewFromResource (&vd->fmt, &res,
                                                         p_sys->conn);
         if (unlikely(pic_array[count] == NULL))
             break;
+
+        if (p_sys->swap_uv)
+            /* YVU: swap U and V planes */
+            picture_SwapUV( pic_array[count] );
     }
     xcb_flush (p_sys->conn);
 



More information about the vlc-commits mailing list