From 51c04c87bb11afe772c5cf797a12c71c602cff8c Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sat, 30 May 2009 17:45:46 -0700 Subject: v4l2: Create helper function for bounding and aligning images From: Trent Piepho Most hardware has limits on minimum and maximum image dimensions and also requirements about alignment. For example, image width must be even or a multiple of four. Some hardware has requirements that the total image size (width * height) be a multiple of some power of two. v4l_bound_align_image() will enforce min and max width and height, power of two alignment on width and height, and power of two alignment on total image size. It uses an efficient algorithm that will try to find the "closest" image size that meets the requirements. Priority: normal Signed-off-by: Trent Piepho --- linux/include/media/v4l2-common.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'linux/include/media/v4l2-common.h') diff --git a/linux/include/media/v4l2-common.h b/linux/include/media/v4l2-common.h index 2e1e3a293..54728d4c0 100644 --- a/linux/include/media/v4l2-common.h +++ b/linux/include/media/v4l2-common.h @@ -198,4 +198,14 @@ struct v4l2_routing { u32 output; }; +/* ------------------------------------------------------------------------- */ + +/* Miscellaneous helper functions */ + +void v4l_bound_align_image(unsigned int *w, unsigned int wmin, + unsigned int wmax, unsigned int walign, + unsigned int *h, unsigned int hmin, + unsigned int hmax, unsigned int halign, + unsigned int salign); + #endif /* V4L2_COMMON_H_ */ -- cgit v1.2.3