summaryrefslogtreecommitdiff
path: root/src/qcam/viewfinder_gl.h
diff options
context:
space:
mode:
authorAndrey Konovalov <andrey.konovalov@linaro.org>2021-06-22 16:46:45 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-06-30 04:07:58 +0300
commitc4259493dc8db1a78bdbf47b912d24b899c0f45c (patch)
treeba5e4d2d8d80559b4f0cdae14179f4248ec47396 /src/qcam/viewfinder_gl.h
parentfa52c0f22faa239a3d1ddeede6f3b36ec35bdf5c (diff)
qcam: viewfinder_gl: Add shader to render packed RAW10 formats
The shader supports all 4 packed RAW10 variants. Simple bi-linear Bayer interpolation of nearest pixels is implemented. The 2 LS bits of the 10-bit colour values are dropped as the RGBA format we convert into has only 8 bits per colour. The texture coordinates passed to the fragment shader are adjusted to point to the nearest pixel in the image. This prevents artifacts when the image is scaled from the frame resolution to the window size. Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/qcam/viewfinder_gl.h')
-rw-r--r--src/qcam/viewfinder_gl.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h
index 1b1faa91..508155b1 100644
--- a/src/qcam/viewfinder_gl.h
+++ b/src/qcam/viewfinder_gl.h
@@ -66,6 +66,7 @@ private:
libcamera::FrameBuffer *buffer_;
libcamera::PixelFormat format_;
QSize size_;
+ unsigned int stride_;
unsigned char *data_;
/* Shaders */
@@ -81,6 +82,9 @@ private:
/* Textures */
std::array<std::unique_ptr<QOpenGLTexture>, 3> textures_;
+ /* Common texture parameters */
+ GLuint textureMinMagFilters_;
+
/* YUV texture parameters */
GLuint textureUniformU_;
GLuint textureUniformV_;
@@ -89,6 +93,11 @@ private:
unsigned int horzSubSample_;
unsigned int vertSubSample_;
+ /* Raw Bayer texture parameters */
+ GLuint textureUniformSize_;
+ GLuint textureUniformBayerFirstRed_;
+ QPointF firstRed_;
+
QMutex mutex_; /* Prevent concurrent access to image_ */
};