diff options
author | Trent Piepho <xyzzy@speakeasy.org> | 2009-05-30 20:45:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-23 02:21:19 -0400 |
commit | 653dc59b6468c2ba51f3b4aee609daa8f67d3e3a (patch) | |
tree | 0393e9e767257d0696e8d27b8ba7b3b9f6026905 /drivers/media | |
parent | 2449afcbcc654dbaa9dabeda9daecb69719b0aaa (diff) |
V4L/DVB (11910): mt9: Use v4l bounding/alignment function
The v4l function has a better algorithm for aligning image size.
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/mt9m001.c | 12 | ||||
-rw-r--r-- | drivers/media/video/mt9t031.c | 14 | ||||
-rw-r--r-- | drivers/media/video/mt9v022.c | 12 |
3 files changed, 9 insertions, 29 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index 459c04cbf69d..4d794b42d6cd 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c | |||
@@ -280,15 +280,9 @@ static int mt9m001_try_fmt(struct soc_camera_device *icd, | |||
280 | { | 280 | { |
281 | struct v4l2_pix_format *pix = &f->fmt.pix; | 281 | struct v4l2_pix_format *pix = &f->fmt.pix; |
282 | 282 | ||
283 | if (pix->height < 32 + icd->y_skip_top) | 283 | v4l_bound_align_image(&pix->width, 48, 1280, 1, |
284 | pix->height = 32 + icd->y_skip_top; | 284 | &pix->height, 32 + icd->y_skip_top, |
285 | if (pix->height > 1024 + icd->y_skip_top) | 285 | 1024 + icd->y_skip_top, 0, 0); |
286 | pix->height = 1024 + icd->y_skip_top; | ||
287 | if (pix->width < 48) | ||
288 | pix->width = 48; | ||
289 | if (pix->width > 1280) | ||
290 | pix->width = 1280; | ||
291 | pix->width &= ~0x01; /* has to be even, unsure why was ~3 */ | ||
292 | 286 | ||
293 | return 0; | 287 | return 0; |
294 | } | 288 | } |
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c index f72aeb7c4deb..4207fb342670 100644 --- a/drivers/media/video/mt9t031.c +++ b/drivers/media/video/mt9t031.c | |||
@@ -385,17 +385,9 @@ static int mt9t031_try_fmt(struct soc_camera_device *icd, | |||
385 | { | 385 | { |
386 | struct v4l2_pix_format *pix = &f->fmt.pix; | 386 | struct v4l2_pix_format *pix = &f->fmt.pix; |
387 | 387 | ||
388 | if (pix->height < MT9T031_MIN_HEIGHT) | 388 | v4l_bound_align_image( |
389 | pix->height = MT9T031_MIN_HEIGHT; | 389 | &pix->width, MT9T031_MIN_WIDTH, MT9T031_MAX_WIDTH, 1, |
390 | if (pix->height > MT9T031_MAX_HEIGHT) | 390 | &pix->height, MT9T031_MIN_HEIGHT, MT9T031_MAX_HEIGHT, 1, 0); |
391 | pix->height = MT9T031_MAX_HEIGHT; | ||
392 | if (pix->width < MT9T031_MIN_WIDTH) | ||
393 | pix->width = MT9T031_MIN_WIDTH; | ||
394 | if (pix->width > MT9T031_MAX_WIDTH) | ||
395 | pix->width = MT9T031_MAX_WIDTH; | ||
396 | |||
397 | pix->width &= ~0x01; /* has to be even */ | ||
398 | pix->height &= ~0x01; /* has to be even */ | ||
399 | 391 | ||
400 | return 0; | 392 | return 0; |
401 | } | 393 | } |
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index be20d312b1dc..dbdcc86ae50d 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c | |||
@@ -364,15 +364,9 @@ static int mt9v022_try_fmt(struct soc_camera_device *icd, | |||
364 | { | 364 | { |
365 | struct v4l2_pix_format *pix = &f->fmt.pix; | 365 | struct v4l2_pix_format *pix = &f->fmt.pix; |
366 | 366 | ||
367 | if (pix->height < 32 + icd->y_skip_top) | 367 | v4l_bound_align_image(&pix->width, 48, 752, 2 /* ? */, |
368 | pix->height = 32 + icd->y_skip_top; | 368 | &pix->height, 32 + icd->y_skip_top, |
369 | if (pix->height > 480 + icd->y_skip_top) | 369 | 480 + icd->y_skip_top, 0, 0); |
370 | pix->height = 480 + icd->y_skip_top; | ||
371 | if (pix->width < 48) | ||
372 | pix->width = 48; | ||
373 | if (pix->width > 752) | ||
374 | pix->width = 752; | ||
375 | pix->width &= ~0x03; /* ? */ | ||
376 | 370 | ||
377 | return 0; | 371 | return 0; |
378 | } | 372 | } |