| Message ID | 20251202134544.662446-4-bryan.odonoghue@linaro.org |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
On 02/12/2025 13:45, Bryan O'Donoghue wrote:
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
I forgot the commit log
"Populate qcam viewfinder_gl to set default bayer values so that the
shaders can be used in their original mode without conditional compilation.
Set and identity CCM, identity Black Level and set Gamma and Contrast to
1.0f respectively.
Once done the raw debayer image is available in qcam when using a raw
stream."
If there's no other significant commentary on this series, could we
fixup the commit log on the way in ?
Otherwise I'll send a v7.
---
bod
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > On 02/12/2025 13:45, Bryan O'Donoghue wrote: >> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > I forgot the commit log > > "Populate qcam viewfinder_gl to set default bayer values so that the shaders can be used > in their original mode without conditional compilation. > > Set and identity CCM, identity Black Level and set Gamma and Contrast to 1.0f "Set and"? > respectively. > > Once done the raw debayer image is available in qcam when using a raw stream." I'm having trouble to understand the last sentence. The patch itself makes sense to me. > If there's no other significant commentary on this series, could we fixup the commit log > on the way in ? > > Otherwise I'll send a v7. > > --- > bod
On 03/12/2025 16:12, Milan Zamazal wrote: >> Set and identity CCM, identity Black Level and set Gamma and Contrast to 1.0f > "Set and"? Set an >> respectively. >> >> Once done the raw debayer image is available in qcam when using a raw stream." > I'm having trouble to understand the last sentence. > > The patch itself makes sense to me. My Hiberno-English raises its head, doffs its cap. I'll translate ;) --- bod
diff --git a/src/apps/qcam/viewfinder_gl.cpp b/src/apps/qcam/viewfinder_gl.cpp index 1554c94d5..69b7c6e59 100644 --- a/src/apps/qcam/viewfinder_gl.cpp +++ b/src/apps/qcam/viewfinder_gl.cpp @@ -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"); + contrastUniformDataIn_ = shaderProgram_.uniformLocation("contrast"); /* Create the textures. */ for (std::unique_ptr<QOpenGLTexture> &texture : textures_) { @@ -542,6 +546,15 @@ 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 +801,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(contrastUniformDataIn_, 1.0f); break; default: diff --git a/src/apps/qcam/viewfinder_gl.h b/src/apps/qcam/viewfinder_gl.h index 23c657bcf..c1b2d9d51 100644 --- a/src/apps/qcam/viewfinder_gl.h +++ b/src/apps/qcam/viewfinder_gl.h @@ -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 contrastUniformDataIn_; + QMutex mutex_; /* Prevent concurrent access to image_ */ };
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- src/apps/qcam/viewfinder_gl.cpp | 25 +++++++++++++++++++++++++ src/apps/qcam/viewfinder_gl.h | 12 ++++++++++++ 2 files changed, 37 insertions(+)