[vlc-commits] transform: use single optimized (memcpy()) function for vflip

Rémi Denis-Courmont git at videolan.org
Tue Aug 7 22:10:01 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug  7 23:06:56 2012 +0300| [c1bb567c78cb5628ae9097937f7066ec3f0c4058] | committer: Rémi Denis-Courmont

transform: use single optimized (memcpy()) function for vflip

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

 modules/video_filter/transform.c |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
index 97841c1..9a8a2ac 100644
--- a/modules/video_filter/transform.c
+++ b/modules/video_filter/transform.c
@@ -132,6 +132,19 @@ static void Plane##bits##_##f(plane_t *restrict dst, const plane_t *restrict src
     } \
 }
 
+static void Plane_VFlip(plane_t *restrict dst, const plane_t *restrict src)
+{
+    const uint8_t *src_pixels = src->p_pixels;
+    uint8_t *restrict dst_pixels = dst->p_pixels;
+
+    dst_pixels += dst->i_pitch * dst->i_visible_lines;
+    for (int y = 0; y < dst->i_visible_lines; y++) {
+        dst_pixels -= dst->i_pitch;
+        memcpy(dst_pixels, src_pixels, dst->i_visible_pitch);
+        src_pixels += src->i_pitch;
+    }
+}
+
 #define YUY2(f) \
 static void PlaneYUY2_##f(plane_t *restrict dst, const plane_t *restrict src) \
 { \
@@ -171,7 +184,9 @@ static void PlaneYUY2_##f(plane_t *restrict dst, const plane_t *restrict src) \
 PLANE(f,8) PLANE(f,16) PLANE(f,32)
 
 PLANES(HFlip)
-PLANES(VFlip)
+#define Plane8_VFlip Plane_VFlip
+#define Plane16_VFlip Plane_VFlip
+#define Plane32_VFlip Plane_VFlip
 PLANES(Transpose)
 PLANES(AntiTranspose)
 PLANES(R90)
@@ -179,7 +194,7 @@ PLANES(R180)
 PLANES(R270)
 
 #define PlaneYUY2_HFlip Plane32_HFlip
-#define PlaneYUY2_VFlip Plane32_VFlip
+#define PlaneYUY2_VFlip Plane_VFlip
 #define PlaneYUY2_R180  Plane32_R180
 YUY2(Transpose)
 YUY2(AntiTranspose)



More information about the vlc-commits mailing list