[vlc-devel] [PATCH] video-chroma: copy: update CopyFrom{N, Y}v12 to more explicit names

Victorien Le Couviour--Tuffet victorien.lecouviour.tuffet at gmail.com
Mon May 15 17:26:10 CEST 2017


---
 modules/codec/avcodec/vaapi.c        |  6 ++++--
 modules/codec/omxil/utils.c          |  3 ++-
 modules/video_chroma/copy.c          | 30 ++++++++++++++----------------
 modules/video_chroma/copy.h          |  8 ++++----
 modules/video_chroma/d3d11_surface.c |  6 ++++--
 modules/video_chroma/dxa9.c          |  6 ++++--
 6 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
index bec05d1c42..b19395441a 100644
--- a/modules/codec/avcodec/vaapi.c
+++ b/modules/codec/avcodec/vaapi.c
@@ -341,7 +341,8 @@ static int Extract( vlc_va_t *va, picture_t *p_picture, uint8_t *data )
             pp_plane[i] = (uint8_t*)p_base + image.offsets[i_src_plane];
             pi_pitch[i] = image.pitches[i_src_plane];
         }
-        CopyFromYv12( p_picture, pp_plane, pi_pitch, sys->height, &sys->image_cache );
+        CopyFromYv12ToYv12( p_picture, pp_plane, pi_pitch,
+                            sys->height, &sys->image_cache );
     }
     else
     {
@@ -354,7 +355,8 @@ static int Extract( vlc_va_t *va, picture_t *p_picture, uint8_t *data )
             pp_plane[i] = (uint8_t*)p_base + image.offsets[i];
             pi_pitch[i] = image.pitches[i];
         }
-        CopyFromNv12( p_picture, pp_plane, pi_pitch, sys->height, &sys->image_cache );
+        CopyFromNv12ToYv12( p_picture, pp_plane, pi_pitch,
+                            sys->height, &sys->image_cache );
     }
 
     vaUnmapBuffer(sys->hw_ctx.display, image.buf);
diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c
index ab62f0bacf..a7d7ee1abf 100644
--- a/modules/codec/omxil/utils.c
+++ b/modules/codec/omxil/utils.c
@@ -223,7 +223,8 @@ void CopyOmxPicture( int i_color_format, picture_t *p_pic,
         copy_cache_t *p_surface_cache = (copy_cache_t*)p_architecture_specific->data;
         uint8_t *ppi_src_pointers[2] = { p_src, p_src + i_src_stride * i_slice_height };
         size_t pi_src_strides[2] = { i_src_stride, i_src_stride };
-        CopyFromNv12( p_pic, ppi_src_pointers, pi_src_strides, i_slice_height, p_surface_cache );
+        CopyFromNv12ToYv12( p_pic, ppi_src_pointers, pi_src_strides,
+                            i_slice_height, p_surface_cache );
         return;
     }
 #endif
diff --git a/modules/video_chroma/copy.c b/modules/video_chroma/copy.c
index 444d47a7a7..2977477a9b 100644
--- a/modules/video_chroma/copy.c
+++ b/modules/video_chroma/copy.c
@@ -320,10 +320,10 @@ static void SSE_SplitPlanes(uint8_t *dstu, size_t dstu_pitch,
     }
 }
 
-static void SSE_CopyFromNv12(picture_t *dst,
-                             uint8_t *src[2], size_t src_pitch[2],
-                             unsigned height,
-                             copy_cache_t *cache, unsigned cpu)
+static void SSE_CopyFromNv12ToYv12(picture_t *dst,
+                                   uint8_t *src[2], size_t src_pitch[2],
+                                   unsigned height,
+                                   copy_cache_t *cache, unsigned cpu)
 {
     SSE_CopyPlane(dst->p[0].p_pixels, dst->p[0].i_pitch,
                   src[0], src_pitch[0],
@@ -337,10 +337,10 @@ static void SSE_CopyFromNv12(picture_t *dst,
     asm volatile ("emms");
 }
 
-static void SSE_CopyFromYv12(picture_t *dst,
-                             uint8_t *src[3], size_t src_pitch[3],
-                             unsigned height,
-                             copy_cache_t *cache, unsigned cpu)
+static void SSE_CopyFromYv12ToYv12(picture_t *dst,
+                                   uint8_t *src[3], size_t src_pitch[3],
+                                   unsigned height,
+                                   copy_cache_t *cache, unsigned cpu)
 {
     for (unsigned n = 0; n < 3; n++) {
         const unsigned d = n > 0 ? 2 : 1;
@@ -436,14 +436,13 @@ static void SplitPlanes(uint8_t *dstu, size_t dstu_pitch,
     }
 }
 
-void CopyFromNv12(picture_t *dst, uint8_t *src[2], size_t src_pitch[2],
-                  unsigned height, copy_cache_t *cache)
+void CopyFromNv12ToYv12(picture_t *dst, uint8_t *src[2], size_t src_pitch[2],
+                        unsigned height, copy_cache_t *cache)
 {
 #ifdef CAN_COMPILE_SSE2
     unsigned cpu = vlc_CPU();
     if (vlc_CPU_SSE2())
-        return SSE_CopyFromNv12(dst, src, src_pitch, height,
-                                cache, cpu);
+        return SSE_CopyFromNv12ToYv12(dst, src, src_pitch, height, cache, cpu);
 #else
     (void) cache;
 #endif
@@ -562,14 +561,13 @@ void CopyFromI420_10ToP010(picture_t *dst, uint8_t *src[3], size_t src_pitch[3],
 }
 
 
-void CopyFromYv12(picture_t *dst, uint8_t *src[3], size_t src_pitch[3],
-                  unsigned height, copy_cache_t *cache)
+void CopyFromYv12ToYv12(picture_t *dst, uint8_t *src[3], size_t src_pitch[3],
+                        unsigned height, copy_cache_t *cache)
 {
 #ifdef CAN_COMPILE_SSE2
     unsigned cpu = vlc_CPU();
     if (vlc_CPU_SSE2())
-        return SSE_CopyFromYv12(dst, src, src_pitch, height,
-                                cache, cpu);
+        return SSE_CopyFromYv12ToYv12(dst, src, src_pitch, height, cache, cpu);
 #else
     (void) cache;
 #endif
diff --git a/modules/video_chroma/copy.h b/modules/video_chroma/copy.h
index f5a56cc75c..02b015c101 100644
--- a/modules/video_chroma/copy.h
+++ b/modules/video_chroma/copy.h
@@ -35,11 +35,11 @@ int  CopyInitCache(copy_cache_t *cache, unsigned width);
 void CopyCleanCache(copy_cache_t *cache);
 
 /* Copy planes from NV12 to YV12 */
-void CopyFromNv12(picture_t *dst, uint8_t *src[2], size_t src_pitch[2],
-                  unsigned height, copy_cache_t *cache);
+void CopyFromNv12ToYv12(picture_t *dst, uint8_t *src[2], size_t src_pitch[2],
+                        unsigned height, copy_cache_t *cache);
 /* Copy planes from YV12 to YV12 */
-void CopyFromYv12(picture_t *dst, uint8_t *src[3], size_t src_pitch[3],
-                  unsigned height, copy_cache_t *cache);
+void CopyFromYv12ToYv12(picture_t *dst, uint8_t *src[3], size_t src_pitch[3],
+                        unsigned height, copy_cache_t *cache);
 
 void CopyFromNv12ToNv12(picture_t *dst, uint8_t *src[2], size_t src_pitch[2],
                         unsigned height, copy_cache_t *cache);
diff --git a/modules/video_chroma/d3d11_surface.c b/modules/video_chroma/d3d11_surface.c
index 36974d8b40..929e3b9ac3 100644
--- a/modules/video_chroma/d3d11_surface.c
+++ b/modules/video_chroma/d3d11_surface.c
@@ -149,7 +149,8 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
                                  + pitch[1] * src->format.i_height / 2,
         };
 
-        CopyFromYv12(dst, plane, pitch, src->format.i_height, &sys->cache);
+        CopyFromYv12ToYv12(dst, plane, pitch,
+                           src->format.i_height, &sys->cache);
     } else if (desc.Format == DXGI_FORMAT_NV12) {
         uint8_t *plane[2] = {
             lock.pData,
@@ -159,7 +160,8 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
             lock.RowPitch,
             lock.RowPitch,
         };
-        CopyFromNv12(dst, plane, pitch, src->format.i_height, &sys->cache);
+        CopyFromNv12ToYv12(dst, plane, pitch,
+                           src->format.i_height, &sys->cache);
     } else {
         msg_Err(p_filter, "Unsupported D3D11VA conversion from 0x%08X to YV12", desc.Format);
     }
diff --git a/modules/video_chroma/dxa9.c b/modules/video_chroma/dxa9.c
index 6a415455c6..03ee26206f 100644
--- a/modules/video_chroma/dxa9.c
+++ b/modules/video_chroma/dxa9.c
@@ -109,7 +109,8 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
             plane[1] = plane[2];
             plane[2] = V;
         }
-        CopyFromYv12(dst, plane, pitch, src->format.i_height, p_copy_cache);
+        CopyFromYv12ToYv12(dst, plane, pitch,
+                           src->format.i_height, p_copy_cache);
     } else if (desc.Format == MAKEFOURCC('N','V','1','2')) {
         uint8_t *plane[2] = {
             lock.pBits,
@@ -119,7 +120,8 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
             lock.Pitch,
             lock.Pitch,
         };
-        CopyFromNv12(dst, plane, pitch, src->format.i_height, p_copy_cache);
+        CopyFromNv12ToYv12(dst, plane, pitch,
+                           src->format.i_height, p_copy_cache);
     } else {
         msg_Err(p_filter, "Unsupported DXA9 conversion from 0x%08X to YV12", desc.Format);
     }
-- 
2.12.0



More information about the vlc-devel mailing list