summaryrefslogtreecommitdiff
path: root/src/libcamera/bayer_format.cpp
AgeCommit message (Collapse)Author
2021-06-28libcamera: Add support for monochrome sensorsDavid Plowman
This commit adds support for monochrome (greyscale) raw sensors. These are sensors that have no colour filter array, so all pixels are the same and there are no distinct colour channels. These sensors still require many of an ISP's processing stages, such as denoise, tone mapping, but not those that involve colours (such as demosaic, or colour matrices). Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-04libcamera: bayer_format: Add the transpose transformationSebastian Fricke
To transpose a BayerFormat means to flip it over its main diagonal. For example: G B G R -> R G B G The main diagonal goes from the top left to the bottom right. This means, that the only two orders affected by a transpose are GBRG & GRBG. When a transpose is used in combination with horizontal and/or vertical flips it is performed after the flips. Therefore add the functionality by switching GBRG (index 1) with GRBG (index 2), after the flips have been applied. Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-04libcamera: bayer_format: Overload ==/!= operators for BayerFormatsSebastian Fricke
Enable to test two Bayer formats for equality by checking if the order of the color channels, the bit depth of the pattern, and the packing scheme match. Additionally, add the reverse operation (!=), which negates the equality test result. Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-04libcamera: bayer_format: Remove unnecessary constructorSebastian Fricke
The new `fromV4l2PixelFormat` static member function renders an old BayerFormat constructor useless, remove it together with the `v4l2ToBayer` mapping table. The new function searches for a matching mapped value instead of a matching key, therefore the `bayerToV4l2` table is sufficient. Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-04libcamera: bayer_format: Add the fromV4L2PixelFormat functionSebastian Fricke
Add a static member function to get the corresponding BayerFormat from a given V4L2PixelFormat. The motivation behind this patch is to align the overall structure of the BayerFormat class with other parts of the code base, such as the V4L2PixelFormat class. The downside of this change is a slightly worse time complexity, but the upside is a smaller codebase and lower memory consumption. As the function is probably not used very frequently, I tend to favor the mentioned upsides. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-12-30libcamera: bayer_format: Add support for mbus codesJacopo Mondi
The existing implementation of the BayerFormat class supports converting a V4L2PixelFormat to a BayerFormat and vice-versa. Expand the class by adding support for converting a media bus code to a BayerFormat instance, by providing a conversion table and a dedicated static methods. Do not provide support for converting a BayerFormat to a media bus code as there's no 1-to-1 mapping between the two. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-09-29libcamera: Add BayerFormat typeDavid Plowman
This type encodes BayerFormats in an explicit way, that makes them easier to use than some of the other more opaque type formats. This makes the BayerFormat useful for editing or manipulating Bayer types more easily. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>