diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-03-21 07:03:25 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-15 15:10:20 -0400 |
commit | 8929c96378a162263c8e3e547975e283dfd17e7f (patch) | |
tree | e5fad4df40a1e6848b370e34e9d072058c44ccde /drivers | |
parent | 4e0e620ce713893b2883522a16a71b5589e8e3db (diff) |
[media] soc-camera: Add soc_mbus_image_size
The function returns the minimum size of an image for a given number of
bytes per line (as per the V4L2 specification), width and format.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/soc_mediabus.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/media/video/soc_mediabus.c b/drivers/media/video/soc_mediabus.c index a7073142f9f1..89dce097a827 100644 --- a/drivers/media/video/soc_mediabus.c +++ b/drivers/media/video/soc_mediabus.c | |||
@@ -397,6 +397,24 @@ s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf) | |||
397 | } | 397 | } |
398 | EXPORT_SYMBOL(soc_mbus_bytes_per_line); | 398 | EXPORT_SYMBOL(soc_mbus_bytes_per_line); |
399 | 399 | ||
400 | s32 soc_mbus_image_size(const struct soc_mbus_pixelfmt *mf, | ||
401 | u32 bytes_per_line, u32 height) | ||
402 | { | ||
403 | if (mf->layout == SOC_MBUS_LAYOUT_PACKED) | ||
404 | return bytes_per_line * height; | ||
405 | |||
406 | switch (mf->packing) { | ||
407 | case SOC_MBUS_PACKING_2X8_PADHI: | ||
408 | case SOC_MBUS_PACKING_2X8_PADLO: | ||
409 | return bytes_per_line * height * 2; | ||
410 | case SOC_MBUS_PACKING_1_5X8: | ||
411 | return bytes_per_line * height * 3 / 2; | ||
412 | default: | ||
413 | return -EINVAL; | ||
414 | } | ||
415 | } | ||
416 | EXPORT_SYMBOL(soc_mbus_image_size); | ||
417 | |||
400 | const struct soc_mbus_pixelfmt *soc_mbus_find_fmtdesc( | 418 | const struct soc_mbus_pixelfmt *soc_mbus_find_fmtdesc( |
401 | enum v4l2_mbus_pixelcode code, | 419 | enum v4l2_mbus_pixelcode code, |
402 | const struct soc_mbus_lookup *lookup, | 420 | const struct soc_mbus_lookup *lookup, |