qcam: viewfinder_gl: Set no-op Bayer shader values
Populate qcam viewfinder_gl to set default Bayer values so that the shaders can be used in their original mode without conditional compilation. Set an identity CCM, identity Black Level and set Gamma and Contrast to 1.0f respectively. Once this change is made we can use the Bayer shaders in their original format in qcam with raw streams. Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Robert Mader <robert.mader@collabora.com> Tested-by: Hans de Goede <johannes.goede@oss.qualcomm.com> # ThinkPad T14s gen 6 (arm64) ov02c10 + X1c gen 12 ov08x40 Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> # Lenovo X13s Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Kieran Bingham
parent
99fd2e669c
commit
76973876b8
@@ -473,6 +473,10 @@ bool ViewFinderGL::createFragmentShader()
|
||||
textureUniformSize_ = shaderProgram_.uniformLocation("tex_size");
|
||||
textureUniformStrideFactor_ = shaderProgram_.uniformLocation("stride_factor");
|
||||
textureUniformBayerFirstRed_ = shaderProgram_.uniformLocation("tex_bayer_first_red");
|
||||
ccmUniformDataIn_ = shaderProgram_.uniformLocation("ccm");
|
||||
blackLevelUniformDataIn_ = shaderProgram_.uniformLocation("blacklevel");
|
||||
gammaUniformDataIn_ = shaderProgram_.uniformLocation("gamma");
|
||||
contrastExpUniformDataIn_ = shaderProgram_.uniformLocation("contrastExp");
|
||||
|
||||
/* Create the textures. */
|
||||
for (std::unique_ptr<QOpenGLTexture> &texture : textures_) {
|
||||
@@ -542,6 +546,16 @@ void ViewFinderGL::doRender()
|
||||
/* Stride of the first plane, in pixels. */
|
||||
unsigned int stridePixels;
|
||||
|
||||
/* Identity CCM */
|
||||
float ccm[] = { 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f };
|
||||
|
||||
QMatrix3x3 qCcmMat(ccm);
|
||||
|
||||
/* Black Level */
|
||||
QVector3D qBlackLevelVec(0.0f, 0.0f, 0.0f);
|
||||
|
||||
switch (format_) {
|
||||
case libcamera::formats::NV12:
|
||||
case libcamera::formats::NV21:
|
||||
@@ -788,6 +802,18 @@ void ViewFinderGL::doRender()
|
||||
* the generic stride factor to 1.0.
|
||||
*/
|
||||
stridePixels = size_.width();
|
||||
|
||||
/* Colour Correction Matrix */
|
||||
shaderProgram_.setUniformValue(ccmUniformDataIn_, qCcmMat);
|
||||
|
||||
/* Black Level */
|
||||
shaderProgram_.setUniformValue(blackLevelUniformDataIn_, qBlackLevelVec);
|
||||
|
||||
/* Gamma */
|
||||
shaderProgram_.setUniformValue(gammaUniformDataIn_, 1.0f);
|
||||
|
||||
/* Contrast */
|
||||
shaderProgram_.setUniformValue(contrastExpUniformDataIn_, 1.0f);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -103,5 +103,17 @@ private:
|
||||
GLuint textureUniformBayerFirstRed_;
|
||||
QPointF firstRed_;
|
||||
|
||||
/* Represent per-frame CCM as a uniform vector of floats 3 x 3 */
|
||||
GLint ccmUniformDataIn_;
|
||||
|
||||
/* Black Level compensation */
|
||||
GLint blackLevelUniformDataIn_;
|
||||
|
||||
/* Gamma */
|
||||
GLint gammaUniformDataIn_;
|
||||
|
||||
/* Contrast */
|
||||
GLint contrastExpUniformDataIn_;
|
||||
|
||||
QMutex mutex_; /* Prevent concurrent access to image_ */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user