[vlc-commits] hw:d3d9:dxa9: swap UV only when the source is YV12

Thomas Guillem git at videolan.org
Tue Nov 28 16:34:02 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Nov 28 16:21:47 2017 +0100| [d0734d5054a6dae87191dfce738621630f56a711] | committer: Thomas Guillem

hw:d3d9:dxa9: swap UV only when the source is YV12

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

 modules/hw/d3d9/dxa9.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/modules/hw/d3d9/dxa9.c b/modules/hw/d3d9/dxa9.c
index d31139c48f..887b3bf8ee 100644
--- a/modules/hw/d3d9/dxa9.c
+++ b/modules/hw/d3d9/dxa9.c
@@ -78,14 +78,15 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
     if (!GetLock(p_filter, p_sys->surface, &lock, &desc))
         return;
 
-    if (dst->format.i_chroma == VLC_CODEC_I420) {
-        uint8_t *tmp = dst->p[1].p_pixels;
-        dst->p[1].p_pixels = dst->p[2].p_pixels;
-        dst->p[2].p_pixels = tmp;
-    }
-
     if (desc.Format == MAKEFOURCC('Y','V','1','2') ||
         desc.Format == MAKEFOURCC('I','M','C','3')) {
+
+        if (dst->format.i_chroma == VLC_CODEC_I420) {
+            uint8_t *tmp = dst->p[1].p_pixels;
+            dst->p[1].p_pixels = dst->p[2].p_pixels;
+            dst->p[2].p_pixels = tmp;
+        }
+
         bool imc3 = desc.Format == MAKEFOURCC('I','M','C','3');
         size_t chroma_pitch = imc3 ? lock.Pitch : (lock.Pitch / 2);
 
@@ -108,6 +109,12 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
             plane[2] = V;
         }
         Copy420_P_to_P(dst, plane, pitch, src->format.i_height, p_copy_cache);
+
+        if (dst->format.i_chroma == VLC_CODEC_I420) {
+            uint8_t *tmp = dst->p[1].p_pixels;
+            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')) {
         const uint8_t *plane[2] = {
             lock.pBits,
@@ -124,12 +131,6 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
         msg_Err(p_filter, "Unsupported DXA9 conversion from 0x%08X to YV12", desc.Format);
     }
 
-    if (dst->format.i_chroma == VLC_CODEC_I420) {
-        uint8_t *tmp = dst->p[1].p_pixels;
-        dst->p[1].p_pixels = dst->p[2].p_pixels;
-        dst->p[2].p_pixels = tmp;
-    }
-
     /* */
     IDirect3DSurface9_UnlockRect(p_sys->surface);
 }



More information about the vlc-commits mailing list