summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2009-05-30 17:45:46 -0700
committerTrent Piepho <xyzzy@speakeasy.org>2009-05-30 17:45:46 -0700
commit89238d5360d8f8530addc8728b8681f05921fbb0 (patch)
tree5c50491289e2a34137e61dd26e00a862aca08415
parent63242b556aeb302ca2feab368b784eb1e8ff2df0 (diff)
downloadmediapointer-dvb-s2-89238d5360d8f8530addc8728b8681f05921fbb0.tar.gz
mediapointer-dvb-s2-89238d5360d8f8530addc8728b8681f05921fbb0.tar.bz2
cx231xx: Use v4l bounding/alignment function
From: Trent Piepho <xyzzy@speakeasy.org> The v4l function has a better algorithm for aligning image size. Priority: normal Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> CC: Srinivasa Deevi <srinivasa.deevi@conexant.com>
-rw-r--r--linux/drivers/media/video/cx231xx/cx231xx-video.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/linux/drivers/media/video/cx231xx/cx231xx-video.c b/linux/drivers/media/video/cx231xx/cx231xx-video.c
index 638a8d3e4..6ed752c22 100644
--- a/linux/drivers/media/video/cx231xx/cx231xx-video.c
+++ b/linux/drivers/media/video/cx231xx/cx231xx-video.c
@@ -955,8 +955,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
{
struct cx231xx_fh *fh = priv;
struct cx231xx *dev = fh->dev;
- int width = f->fmt.pix.width;
- int height = f->fmt.pix.height;
+ unsigned int width = f->fmt.pix.width;
+ unsigned int height = f->fmt.pix.height;
unsigned int maxw = norm_maxw(dev);
unsigned int maxh = norm_maxh(dev);
unsigned int hscale, vscale;
@@ -971,17 +971,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
/* width must even because of the YUYV format
height must be even because of interlacing */
- height &= 0xfffe;
- width &= 0xfffe;
-
- if (unlikely(height < 32))
- height = 32;
- if (unlikely(height > maxh))
- height = maxh;
- if (unlikely(width < 48))
- width = 48;
- if (unlikely(width > maxw))
- width = maxw;
+ v4l_bound_align_image(&width, 48, maxw, 1, &height, 32, maxh, 1, 0);
get_scale(dev, width, height, &hscale, &vscale);