summaryrefslogtreecommitdiff
path: root/v4l2-apps/lib/libv4l/libv4lconvert/flip.c
diff options
context:
space:
mode:
authorhans@localhost.localdomain <hans@localhost.localdomain>2008-08-22 23:23:50 +0200
committerhans@localhost.localdomain <hans@localhost.localdomain>2008-08-22 23:23:50 +0200
commita15825844ed72e4b0f13e10de4b7dd0ce31846ac (patch)
tree3b56e9a7fb825b1df514429fe40c03bfc9cd01b0 /v4l2-apps/lib/libv4l/libv4lconvert/flip.c
parent974d503f1d6934082aa2d8cd5f06b266726a144e (diff)
downloadmediapointer-dvb-s2-a15825844ed72e4b0f13e10de4b7dd0ce31846ac.tar.gz
mediapointer-dvb-s2-a15825844ed72e4b0f13e10de4b7dd0ce31846ac.tar.bz2
libv4l: add support for Pixart custom JPEG format
From: Hans de Goede <j.w.r.degoede@hhs.nl> libv4l: add support for Pixart custom JPEG format Priority: normal Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Diffstat (limited to 'v4l2-apps/lib/libv4l/libv4lconvert/flip.c')
-rw-r--r--v4l2-apps/lib/libv4l/libv4lconvert/flip.c53
1 files changed, 50 insertions, 3 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/flip.c b/v4l2-apps/lib/libv4l/libv4lconvert/flip.c
index de76ecc9a..cd3468a89 100644
--- a/v4l2-apps/lib/libv4l/libv4lconvert/flip.c
+++ b/v4l2-apps/lib/libv4l/libv4lconvert/flip.c
@@ -1,6 +1,6 @@
/*
-# RGB / YUV flip routines
+# RGB / YUV flip/rotate routines
# (C) 2008 Hans de Goede <j.w.r.degoede@hhs.nl>
@@ -22,7 +22,7 @@
#include "libv4lconvert-priv.h"
-void v4lconvert_flip_rgbbgr24(const unsigned char *src, unsigned char *dst,
+void v4lconvert_rotate180_rgbbgr24(const unsigned char *src, unsigned char *dst,
int width, int height)
{
int i;
@@ -38,7 +38,7 @@ void v4lconvert_flip_rgbbgr24(const unsigned char *src, unsigned char *dst,
}
}
-void v4lconvert_flip_yuv420(const unsigned char *src, unsigned char *dst,
+void v4lconvert_rotate180_yuv420(const unsigned char *src, unsigned char *dst,
int width, int height)
{
int i;
@@ -58,3 +58,50 @@ void v4lconvert_flip_yuv420(const unsigned char *src, unsigned char *dst,
for (i = 0; i < width * height / 4; i++)
*dst++ = *src--;
}
+
+void v4lconvert_rotate90_rgbbgr24(const unsigned char *src, unsigned char *dst,
+ int destwidth, int destheight)
+{
+ int x, y;
+#define srcwidth destheight
+#define srcheight destwidth
+
+ for (y = 0; y < destheight; y++)
+ for (x = 0; x < destwidth; x++) {
+ int offset = ((srcheight - x - 1) * srcwidth + y) * 3;
+ *dst++ = src[offset++];
+ *dst++ = src[offset++];
+ *dst++ = src[offset];
+ }
+}
+
+void v4lconvert_rotate90_yuv420(const unsigned char *src, unsigned char *dst,
+ int destwidth, int destheight)
+{
+ int x, y;
+
+ /* Y-plane */
+ for (y = 0; y < destheight; y++)
+ for (x = 0; x < destwidth; x++) {
+ int offset = (srcheight - x - 1) * srcwidth + y;
+ *dst++ = src[offset];
+ }
+
+ /* U-plane */
+ src += srcwidth * srcheight;
+ destwidth /= 2;
+ destheight /= 2;
+ for (y = 0; y < destheight; y++)
+ for (x = 0; x < destwidth; x++) {
+ int offset = (srcheight - x - 1) * srcwidth + y;
+ *dst++ = src[offset];
+ }
+
+ /* V-plane */
+ src += srcwidth * srcheight;
+ for (y = 0; y < destheight; y++)
+ for (x = 0; x < destwidth; x++) {
+ int offset = (srcheight - x - 1) * srcwidth + y;
+ *dst++ = src[offset];
+ }
+}