From cea7388d9ade977e5272664e27e10f11689e9fb5 Mon Sep 17 00:00:00 2001 From: Csaba Nagy Date: Sat, 14 Sep 2024 02:52:01 -0600 Subject: [PATCH] core: Add 14-bit format support Add a 14-bit entry to the supported format table. Signed-off-by: Csaba Nagy --- core/options.cpp | 4 ++++ core/rpicam_app.cpp | 2 ++ core/rpicam_app.hpp | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/options.cpp b/core/options.cpp index da49e58a..bb9931c6 100644 --- a/core/options.cpp +++ b/core/options.cpp @@ -43,6 +43,10 @@ static const std::map bayer_formats = { libcamera::formats::SGRBG12_CSI2P, 12 }, { libcamera::formats::SBGGR12_CSI2P, 12 }, { libcamera::formats::SGBRG12_CSI2P, 12 }, + { libcamera::formats::SRGGB14_CSI2P, 14 }, + { libcamera::formats::SGRBG14_CSI2P, 14 }, + { libcamera::formats::SBGGR14_CSI2P, 14 }, + { libcamera::formats::SGBRG14_CSI2P, 14 }, { libcamera::formats::SRGGB16, 16 }, { libcamera::formats::SGRBG16, 16 }, { libcamera::formats::SBGGR16, 16 }, diff --git a/core/rpicam_app.cpp b/core/rpicam_app.cpp index 7c1174fa..bf7cc2dd 100644 --- a/core/rpicam_app.cpp +++ b/core/rpicam_app.cpp @@ -39,6 +39,8 @@ static libcamera::PixelFormat mode_to_pixel_format(Mode const &mode) { Mode(0, 0, 10, true), libcamera::formats::SBGGR10_CSI2P }, { Mode(0, 0, 12, false), libcamera::formats::SBGGR12 }, { Mode(0, 0, 12, true), libcamera::formats::SBGGR12_CSI2P }, + { Mode(0, 0, 14, false), libcamera::formats::SBGGR14 }, + { Mode(0, 0, 14, true), libcamera::formats::SBGGR14_CSI2P }, }; auto it = std::find_if(table.begin(), table.end(), [&mode] (auto &m) { return mode.bit_depth == m.first.bit_depth && mode.packed == m.first.packed; }); diff --git a/core/rpicam_app.hpp b/core/rpicam_app.hpp index 3f312608..4a6ab108 100644 --- a/core/rpicam_app.hpp +++ b/core/rpicam_app.hpp @@ -95,7 +95,8 @@ class RPiCamApp std::string fmt = format.toString(); unsigned int mode_depth = fmt.find("8") != std::string::npos ? 8 : fmt.find("10") != std::string::npos ? 10 : - fmt.find("12") != std::string::npos ? 12 : 16; + fmt.find("12") != std::string::npos ? 12 : + fmt.find("14") != std::string::npos ? 14 : 16; return mode_depth; } libcamera::Size size;