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:18 -0400 |
commit | b0d3159be9a36fd8b7b1cf88b812d951add53d11 (patch) | |
tree | eb2be10df0843457ed94f8560ceb956fd37dd60c /include/media | |
parent | 2c0b19ac3b73199fe7b3fbff884051046554c048 (diff) |
V4L/DVB (11901): v4l2: Create helper function for bounding and aligning images
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.
Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/v4l2-common.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 95f4364322eb..33a18426ab9b 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -209,4 +209,14 @@ struct v4l2_routing { | |||
209 | u32 output; | 209 | u32 output; |
210 | }; | 210 | }; |
211 | 211 | ||
212 | /* ------------------------------------------------------------------------- */ | ||
213 | |||
214 | /* Miscellaneous helper functions */ | ||
215 | |||
216 | void v4l_bound_align_image(unsigned int *w, unsigned int wmin, | ||
217 | unsigned int wmax, unsigned int walign, | ||
218 | unsigned int *h, unsigned int hmin, | ||
219 | unsigned int hmax, unsigned int halign, | ||
220 | unsigned int salign); | ||
221 | |||
212 | #endif /* V4L2_COMMON_H_ */ | 222 | #endif /* V4L2_COMMON_H_ */ |