summaryrefslogtreecommitdiff
path: root/v4l2-apps/libv4l/libv4lconvert/flip.c
diff options
context:
space:
mode:
Diffstat (limited to 'v4l2-apps/libv4l/libv4lconvert/flip.c')
-rw-r--r--v4l2-apps/libv4l/libv4lconvert/flip.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/v4l2-apps/libv4l/libv4lconvert/flip.c b/v4l2-apps/libv4l/libv4lconvert/flip.c
index 5d881844a..8c4d8233c 100644
--- a/v4l2-apps/libv4l/libv4lconvert/flip.c
+++ b/v4l2-apps/libv4l/libv4lconvert/flip.c
@@ -222,24 +222,22 @@ void v4lconvert_rotate90(unsigned char *src, unsigned char *dest,
}
void v4lconvert_flip(unsigned char *src, unsigned char *dest,
- struct v4l2_format *fmt, int flags)
+ struct v4l2_format *fmt, int hflip, int vflip)
{
- switch (flags & (V4LCONTROL_VFLIPPED|V4LCONTROL_HFLIPPED)) {
-
- case V4LCONTROL_VFLIPPED:
+ if (vflip && hflip) {
switch (fmt->fmt.pix.pixelformat) {
case V4L2_PIX_FMT_RGB24:
case V4L2_PIX_FMT_BGR24:
- v4lconvert_vflip_rgbbgr24(src, dest, fmt);
+ v4lconvert_rotate180_rgbbgr24(src, dest, fmt->fmt.pix.width,
+ fmt->fmt.pix.height);
break;
case V4L2_PIX_FMT_YUV420:
case V4L2_PIX_FMT_YVU420:
- v4lconvert_vflip_yuv420(src, dest, fmt);
+ v4lconvert_rotate180_yuv420(src, dest, fmt->fmt.pix.width,
+ fmt->fmt.pix.height);
break;
}
- break;
-
- case V4LCONTROL_HFLIPPED:
+ } else if (hflip) {
switch (fmt->fmt.pix.pixelformat) {
case V4L2_PIX_FMT_RGB24:
case V4L2_PIX_FMT_BGR24:
@@ -250,22 +248,17 @@ void v4lconvert_flip(unsigned char *src, unsigned char *dest,
v4lconvert_hflip_yuv420(src, dest, fmt);
break;
}
- break;
-
- case (V4LCONTROL_VFLIPPED|V4LCONTROL_HFLIPPED):
+ } else if (vflip) {
switch (fmt->fmt.pix.pixelformat) {
case V4L2_PIX_FMT_RGB24:
case V4L2_PIX_FMT_BGR24:
- v4lconvert_rotate180_rgbbgr24(src, dest, fmt->fmt.pix.width,
- fmt->fmt.pix.height);
+ v4lconvert_vflip_rgbbgr24(src, dest, fmt);
break;
case V4L2_PIX_FMT_YUV420:
case V4L2_PIX_FMT_YVU420:
- v4lconvert_rotate180_yuv420(src, dest, fmt->fmt.pix.width,
- fmt->fmt.pix.height);
+ v4lconvert_vflip_yuv420(src, dest, fmt);
break;
}
- break;
}
/* Our newly written data has no padding */