| Message ID | 20260708201816.299983-3-mzamazal@redhat.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
On 08/07/2026 21:18, Milan Zamazal wrote: > From: Xander Pronk <xander.c.pronk@gmail.com> > > Add a lookup table for grid-based lens shading correction to debayer > params. The lookup table is in the format of an RGB texture to be > passed to debayering. > > The parameter is filled in by Lsc algorithm implemented in a followup LSC follow-up > patch. If the algorithm is not enabled, the parameter content is > arbitrary and the parameter may not be used. The parameter is currently > unused, its handling is implemented in a followup patch. > > There is no special meaning about the selected grid size, it's > just one of the smaller common sizes. > > Co-developed-by: Rick ten Wolde <rick_libcamera@wolde.info> > Signed-off-by: Rick ten Wolde <rick_libcamera@wolde.info> > Signed-off-by: Xander Pronk <xander.c.pronk@gmail.com> > Signed-off-by: Milan Zamazal <mzamazal@redhat.com> > --- > .../internal/software_isp/debayer_params.h | 9 +++++ > src/libcamera/software_isp/debayer.cpp | 33 +++++++++++++++++++ > 2 files changed, 42 insertions(+) > > diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h > index 1074720d7..4eb6c7e8d 100644 > --- a/include/libcamera/internal/software_isp/debayer_params.h > +++ b/include/libcamera/internal/software_isp/debayer_params.h > @@ -10,6 +10,7 @@ > > #pragma once > > +#include <array> > #include <stdint.h> > > #include "libcamera/internal/matrix.h" > @@ -25,6 +26,14 @@ struct DebayerParams { > float gamma = 1.0; > float contrastExp = 1.0; > RGB<double> gains = RGB<double>({ 1.0, 1.0, 1.0 }); > + > + static constexpr unsigned int kLscGridSize = 16; > + static constexpr unsigned int kLscValuesPerCell = 3; > + using LscValueType = float; > + using LscLookupTable = > + std::array<LscValueType, kLscGridSize * kLscGridSize * kLscValuesPerCell>; Is there really a use-case for having LscvalueType at all - we will pretty much be float forever right ? Otherwise seems reasonable to me.
Bryan O'Donoghue <bod.linux@nxsw.ie> writes: > On 08/07/2026 21:18, Milan Zamazal wrote: >> From: Xander Pronk <xander.c.pronk@gmail.com> >> Add a lookup table for grid-based lens shading correction to debayer > >> params. The lookup table is in the format of an RGB texture to be >> passed to debayering. >> The parameter is filled in by Lsc algorithm implemented in a followup > > LSC LSC = Lens Shading Correction Lsc = the name of the LSC algorithm in `simple' pipeline > follow-up ack >> patch. If the algorithm is not enabled, the parameter content is >> arbitrary and the parameter may not be used. The parameter is currently >> unused, its handling is implemented in a followup patch. >> There is no special meaning about the selected grid size, it's >> just one of the smaller common sizes. >> Co-developed-by: Rick ten Wolde <rick_libcamera@wolde.info> >> Signed-off-by: Rick ten Wolde <rick_libcamera@wolde.info> >> Signed-off-by: Xander Pronk <xander.c.pronk@gmail.com> >> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> >> --- >> .../internal/software_isp/debayer_params.h | 9 +++++ >> src/libcamera/software_isp/debayer.cpp | 33 +++++++++++++++++++ >> 2 files changed, 42 insertions(+) >> diff --git a/include/libcamera/internal/software_isp/debayer_params.h >> b/include/libcamera/internal/software_isp/debayer_params.h >> index 1074720d7..4eb6c7e8d 100644 >> --- a/include/libcamera/internal/software_isp/debayer_params.h >> +++ b/include/libcamera/internal/software_isp/debayer_params.h >> @@ -10,6 +10,7 @@ >> #pragma once >> +#include <array> >> #include <stdint.h> >> #include "libcamera/internal/matrix.h" >> @@ -25,6 +26,14 @@ struct DebayerParams { >> float gamma = 1.0; >> float contrastExp = 1.0; >> RGB<double> gains = RGB<double>({ 1.0, 1.0, 1.0 }); >> + >> + static constexpr unsigned int kLscGridSize = 16; >> + static constexpr unsigned int kLscValuesPerCell = 3; >> + using LscValueType = float; >> + using LscLookupTable = >> + std::array<LscValueType, kLscGridSize * kLscGridSize * kLscValuesPerCell>; > > Is there really a use-case for having LscvalueType at all Since it is used only in two locations close to each other, it's not worth it, I'll remove it. > - we will pretty much be float forever right ? Would you like to take a bet? :-) > Otherwise seems reasonable to me.
diff --git a/include/libcamera/internal/software_isp/debayer_params.h b/include/libcamera/internal/software_isp/debayer_params.h index 1074720d7..4eb6c7e8d 100644 --- a/include/libcamera/internal/software_isp/debayer_params.h +++ b/include/libcamera/internal/software_isp/debayer_params.h @@ -10,6 +10,7 @@ #pragma once +#include <array> #include <stdint.h> #include "libcamera/internal/matrix.h" @@ -25,6 +26,14 @@ struct DebayerParams { float gamma = 1.0; float contrastExp = 1.0; RGB<double> gains = RGB<double>({ 1.0, 1.0, 1.0 }); + + static constexpr unsigned int kLscGridSize = 16; + static constexpr unsigned int kLscValuesPerCell = 3; + using LscValueType = float; + using LscLookupTable = + std::array<LscValueType, kLscGridSize * kLscGridSize * kLscValuesPerCell>; + LscLookupTable lscLut{}; + bool lscEnabled; }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 56446f55d..5a0102a27 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -43,6 +43,39 @@ namespace libcamera { * \brief Contrast value to be used as an exponent */ +/** + * \var DebayerParams::kLscGridSize + * \brief Number of lens shading grid areas in one direction + */ + +/** + * \var DebayerParams::kLscValuesPerCell + * \brief Number of pixel values per each of the lens shading grid areas + */ + +/** + * \typedef DebayerParams::LscValueType + * \brief Type of LSC grid values + */ + +/** + * \typedef DebayerParams::LscLookupTable + * \brief Lookup table for lens shading correction + * + * It's an array of values to be later used as a texture. + * The values are in row - column - RGB order. + */ + +/** + * \var DebayerParams::lscLut + * \brief Lens shading lookup table + */ + +/** + * \var DebayerParams::lscEnabled + * \brief Whether lens shading should be applied + */ + /** * \class Debayer * \brief Base debayering class