summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorUmang Jain <umang.jain@ideasonboard.com>2022-08-30 13:17:23 +0530
committerUmang Jain <umang.jain@ideasonboard.com>2022-09-01 16:49:59 +0530
commit4aa71c2cd26e672d04ea1c696de45f1c630062c3 (patch)
treebbab2c8f187ab806a25ad9357a8ca86db7da011c /include
parentd09c2bb127d5f96f4f397bd3ca11839840888b46 (diff)
libcamera: color_space: Move color space adjustment to ColorSpace class
The CameraConfiguration::validateColorSpaces() function performs color space validation on a camera configuration, by validating the color space of each stream individually, and optionally ensuring that all streams share the same color space. The individual validation is very basic, limited to ensuring that raw formats use a raw color space. Color spaces are more constrained than that: - The Y'CbCr encoding and quantization range for RGB formats must be YcbcrEncoding::None and Range::Full respectively. - The Y'CbCr encoding for YUV formats must not be YcbcrEncoding::None. Instead of open-coding these constraints in the validateColorSpaces() function, create a new ColorSpace::adjust() function to centralize color space validation and adjustment, and use it in validateColorSpaces(). Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/color_space.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/libcamera/color_space.h b/include/libcamera/color_space.h
index f493f72d..6d6c2829 100644
--- a/include/libcamera/color_space.h
+++ b/include/libcamera/color_space.h
@@ -12,6 +12,8 @@
namespace libcamera {
+class PixelFormat;
+
class ColorSpace
{
public:
@@ -61,6 +63,8 @@ public:
static std::string toString(const std::optional<ColorSpace> &colorSpace);
static std::optional<ColorSpace> fromString(const std::string &str);
+
+ bool adjust(PixelFormat format);
};
bool operator==(const ColorSpace &lhs, const ColorSpace &rhs);