summaryrefslogtreecommitdiff
path: root/src/qcam/viewfinder_gl.cpp
diff options
context:
space:
mode:
authorAndrey Konovalov <andrey.konovalov@linaro.org>2021-06-22 16:46:46 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-06-30 04:07:58 +0300
commit6424e8640781939bcb9a1a56c6447a8046b9cfe0 (patch)
tree93b29ef6448c2de0b66f0c6296bbe2995138294d /src/qcam/viewfinder_gl.cpp
parentc4259493dc8db1a78bdbf47b912d24b899c0f45c (diff)
qcam: viewfinder_gl: Add support for RAW12 packed formats
All the four Bayer orders are supported. The 4 LS bits of the 12-bit colour values are dropped as the RGBA format we convert into has only 8 bits per colour. Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/qcam/viewfinder_gl.cpp')
-rw-r--r--src/qcam/viewfinder_gl.cpp48
1 files changed, 43 insertions, 5 deletions
diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp
index ffbbc6c5..a6aa2b44 100644
--- a/src/qcam/viewfinder_gl.cpp
+++ b/src/qcam/viewfinder_gl.cpp
@@ -41,6 +41,11 @@ static const QList<libcamera::PixelFormat> supportedFormats{
libcamera::formats::SGBRG10_CSI2P,
libcamera::formats::SGRBG10_CSI2P,
libcamera::formats::SRGGB10_CSI2P,
+ /* Raw Bayer 12-bit packed */
+ libcamera::formats::SBGGR12_CSI2P,
+ libcamera::formats::SGBRG12_CSI2P,
+ libcamera::formats::SGRBG12_CSI2P,
+ libcamera::formats::SRGGB12_CSI2P,
};
ViewFinderGL::ViewFinderGL(QWidget *parent)
@@ -218,28 +223,56 @@ bool ViewFinderGL::selectFormat(const libcamera::PixelFormat &format)
case libcamera::formats::SBGGR10_CSI2P:
firstRed_.setX(1.0);
firstRed_.setY(1.0);
- fragmentShaderDefines_.append("#define BPP_X 1.25");
+ fragmentShaderDefines_.append("#define RAW10P");
fragmentShaderFile_ = ":bayer_1x_packed.frag";
textureMinMagFilters_ = GL_NEAREST;
break;
case libcamera::formats::SGBRG10_CSI2P:
firstRed_.setX(0.0);
firstRed_.setY(1.0);
- fragmentShaderDefines_.append("#define BPP_X 1.25");
+ fragmentShaderDefines_.append("#define RAW10P");
fragmentShaderFile_ = ":bayer_1x_packed.frag";
textureMinMagFilters_ = GL_NEAREST;
break;
case libcamera::formats::SGRBG10_CSI2P:
firstRed_.setX(1.0);
firstRed_.setY(0.0);
- fragmentShaderDefines_.append("#define BPP_X 1.25");
+ fragmentShaderDefines_.append("#define RAW10P");
fragmentShaderFile_ = ":bayer_1x_packed.frag";
textureMinMagFilters_ = GL_NEAREST;
break;
case libcamera::formats::SRGGB10_CSI2P:
firstRed_.setX(0.0);
firstRed_.setY(0.0);
- fragmentShaderDefines_.append("#define BPP_X 1.25");
+ fragmentShaderDefines_.append("#define RAW10P");
+ fragmentShaderFile_ = ":bayer_1x_packed.frag";
+ textureMinMagFilters_ = GL_NEAREST;
+ break;
+ case libcamera::formats::SBGGR12_CSI2P:
+ firstRed_.setX(1.0);
+ firstRed_.setY(1.0);
+ fragmentShaderDefines_.append("#define RAW12P");
+ fragmentShaderFile_ = ":bayer_1x_packed.frag";
+ textureMinMagFilters_ = GL_NEAREST;
+ break;
+ case libcamera::formats::SGBRG12_CSI2P:
+ firstRed_.setX(0.0);
+ firstRed_.setY(1.0);
+ fragmentShaderDefines_.append("#define RAW12P");
+ fragmentShaderFile_ = ":bayer_1x_packed.frag";
+ textureMinMagFilters_ = GL_NEAREST;
+ break;
+ case libcamera::formats::SGRBG12_CSI2P:
+ firstRed_.setX(1.0);
+ firstRed_.setY(0.0);
+ fragmentShaderDefines_.append("#define RAW12P");
+ fragmentShaderFile_ = ":bayer_1x_packed.frag";
+ textureMinMagFilters_ = GL_NEAREST;
+ break;
+ case libcamera::formats::SRGGB12_CSI2P:
+ firstRed_.setX(0.0);
+ firstRed_.setY(0.0);
+ fragmentShaderDefines_.append("#define RAW12P");
fragmentShaderFile_ = ":bayer_1x_packed.frag";
textureMinMagFilters_ = GL_NEAREST;
break;
@@ -595,8 +628,13 @@ void ViewFinderGL::doRender()
case libcamera::formats::SGBRG10_CSI2P:
case libcamera::formats::SGRBG10_CSI2P:
case libcamera::formats::SRGGB10_CSI2P:
+ case libcamera::formats::SBGGR12_CSI2P:
+ case libcamera::formats::SGBRG12_CSI2P:
+ case libcamera::formats::SGRBG12_CSI2P:
+ case libcamera::formats::SRGGB12_CSI2P:
/*
- * Packed raw Bayer 10-bit formats are stored in GL_RED texture.
+ * Packed raw Bayer 10-bit and 12-bit formats are stored in
+ * GL_RED texture.
* The texture width is equal to the stride.
*/
glActiveTexture(GL_TEXTURE0);