summaryrefslogtreecommitdiff
path: root/v4l2-apps
diff options
context:
space:
mode:
authorhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-06-16 23:59:06 +0200
committerhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-06-16 23:59:06 +0200
commitb530bfbf669215b30f2821355ffdb9f7c4b161b6 (patch)
treea10ebc555bc4402dcd870640994371d02a927f19 /v4l2-apps
parente4998840d5667668db3e89356e0a681f70149bd3 (diff)
downloadmediapointer-dvb-s2-b530bfbf669215b30f2821355ffdb9f7c4b161b6.tar.gz
mediapointer-dvb-s2-b530bfbf669215b30f2821355ffdb9f7c4b161b6.tar.bz2
libv4l: Make sure Y and UV or from the same 2x2 pixel block when cropping
From: Hans de Goede <hdegoede@redhat.com> libv4l: Make sure Y and UV or from the same 2x2 pixel block when cropping Priority: normal Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'v4l2-apps')
-rw-r--r--v4l2-apps/libv4l/libv4lconvert/crop.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/v4l2-apps/libv4l/libv4lconvert/crop.c b/v4l2-apps/libv4l/libv4lconvert/crop.c
index f01772c07..46c87f0ce 100644
--- a/v4l2-apps/libv4l/libv4lconvert/crop.c
+++ b/v4l2-apps/libv4l/libv4lconvert/crop.c
@@ -69,8 +69,8 @@ static void v4lconvert_reduceandcrop_yuv420(
int x,y;
int dest_height_half = dest_fmt->fmt.pix.height / 2;
int dest_width_half = dest_fmt->fmt.pix.width / 2;
- int startx = src_fmt->fmt.pix.width / 2 - dest_fmt->fmt.pix.width;
- int starty = src_fmt->fmt.pix.height / 2 - dest_fmt->fmt.pix.height;
+ int startx = (src_fmt->fmt.pix.width / 2 - dest_fmt->fmt.pix.width) & ~1;
+ int starty = (src_fmt->fmt.pix.height / 2 - dest_fmt->fmt.pix.height) & ~1;
unsigned char *mysrc, *mysrc2;
/* Y */
@@ -113,8 +113,8 @@ static void v4lconvert_crop_yuv420(unsigned char *src, unsigned char *dest,
const struct v4l2_format *src_fmt, const struct v4l2_format *dest_fmt)
{
int x;
- int startx = (src_fmt->fmt.pix.width - dest_fmt->fmt.pix.width) / 2;
- int starty = (src_fmt->fmt.pix.height - dest_fmt->fmt.pix.height) / 2;
+ int startx = ((src_fmt->fmt.pix.width - dest_fmt->fmt.pix.width) / 2) & ~1;
+ int starty = ((src_fmt->fmt.pix.height - dest_fmt->fmt.pix.height) / 2) & ~1;
unsigned char *mysrc = src + starty * src_fmt->fmt.pix.bytesperline + startx;
/* Y */
@@ -181,8 +181,8 @@ static void v4lconvert_add_border_yuv420(
const struct v4l2_format *src_fmt, const struct v4l2_format *dest_fmt)
{
int y;
- int borderx = (dest_fmt->fmt.pix.width - src_fmt->fmt.pix.width) / 2;
- int bordery = (dest_fmt->fmt.pix.height - src_fmt->fmt.pix.height) / 2;
+ int borderx = ((dest_fmt->fmt.pix.width - src_fmt->fmt.pix.width) / 2) & ~1;
+ int bordery = ((dest_fmt->fmt.pix.height - src_fmt->fmt.pix.height) / 2) & ~1;
/* Y */
for (y = 0; y < bordery; y++) {