summaryrefslogtreecommitdiff
path: root/linux/drivers/media
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
commit8c986b899b3f035b94b4ee568ce00a8a48c12f45 (patch)
tree8ee1abf7d0311b5161117af6405e75c78422ea18 /linux/drivers/media
parentfc32b7aec72765c7ee074348f4bf6f8f920aacc4 (diff)
downloadmediapointer-dvb-s2-8c986b899b3f035b94b4ee568ce00a8a48c12f45.tar.gz
mediapointer-dvb-s2-8c986b899b3f035b94b4ee568ce00a8a48c12f45.tar.bz2
zoran: Use v4l bounding/alignment functiob
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>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/zoran/zoran_driver.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/linux/drivers/media/video/zoran/zoran_driver.c b/linux/drivers/media/video/zoran/zoran_driver.c
index 793395074..8c17d47b3 100644
--- a/linux/drivers/media/video/zoran/zoran_driver.c
+++ b/linux/drivers/media/video/zoran/zoran_driver.c
@@ -2096,16 +2096,10 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,
return -EINVAL;
}
- bpp = (zoran_formats[i].depth + 7) / 8;
- fmt->fmt.pix.width &= ~((bpp == 2) ? 1 : 3);
- if (fmt->fmt.pix.width > BUZ_MAX_WIDTH)
- fmt->fmt.pix.width = BUZ_MAX_WIDTH;
- if (fmt->fmt.pix.width < BUZ_MIN_WIDTH)
- fmt->fmt.pix.width = BUZ_MIN_WIDTH;
- if (fmt->fmt.pix.height > BUZ_MAX_HEIGHT)
- fmt->fmt.pix.height = BUZ_MAX_HEIGHT;
- if (fmt->fmt.pix.height < BUZ_MIN_HEIGHT)
- fmt->fmt.pix.height = BUZ_MIN_HEIGHT;
+ bpp = DIV_ROUND_UP(zoran_formats[i].depth, 8);
+ v4l_bound_align_image(
+ &fmt->fmt.pix.width, BUZ_MIN_WIDTH, BUZ_MAX_WIDTH, bpp == 2 ? 1 : 2,
+ &fmt->fmt.pix.height, BUZ_MIN_HEIGHT, BUZ_MAX_HEIGHT, 0, 0);
mutex_unlock(&zr->resource_lock);
return 0;