| Message ID | 20251015012251.17508-15-bryan.odonoghue@linaro.org |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Quoting Bryan O'Donoghue (2025-10-15 02:22:26) > isStandardBayerOrder is useful to both CPU and GPU debayer logic and > reusable as-is for both. > > Move to shared location in base class. > > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> > --- > src/libcamera/software_isp/debayer.cpp | 10 ++++++++++ > src/libcamera/software_isp/debayer.h | 2 ++ > src/libcamera/software_isp/debayer_cpu.cpp | 6 ------ > 3 files changed, 12 insertions(+), 6 deletions(-) > > diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp > index 96737c45..db225ed6 100644 > --- a/src/libcamera/software_isp/debayer.cpp > +++ b/src/libcamera/software_isp/debayer.cpp > @@ -229,4 +229,14 @@ void Debayer::dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *inpu > } > } > > +/** > + * \fn void Debayer::isStandardBayerOrder(BayerFormat::Order order) No need to specify this if it's a /** right before the function as far as I recall. Just something that could bitrot otherwise. > + * \brief Common method to validate standard 2x2 Bayer pattern of 2 Green, 1 Blue, 1 Red pixels. * \param[in] order The BayerFormat to check * \return True if the BayerFormat is standard Tedious - but I think usually required to satiate doxygen. With that: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > + */ > +bool Debayer::isStandardBayerOrder(BayerFormat::Order order) > +{ > + return order == BayerFormat::BGGR || order == BayerFormat::GBRG || > + order == BayerFormat::GRBG || order == BayerFormat::RGGB; > +} > + > } /* namespace libcamera */ > diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h > index 98d88fb3..c5eb0d38 100644 > --- a/src/libcamera/software_isp/debayer.h > +++ b/src/libcamera/software_isp/debayer.h > @@ -20,6 +20,7 @@ > #include <libcamera/geometry.h> > #include <libcamera/stream.h> > > +#include "libcamera/internal/bayer_format.h" > #include "libcamera/internal/dma_buf_allocator.h" > #include "libcamera/internal/global_configuration.h" > #include "libcamera/internal/software_isp/benchmark.h" > @@ -98,6 +99,7 @@ private: > protected: > void setParams(DebayerParams ¶ms); > void dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output); > + bool isStandardBayerOrder(BayerFormat::Order order); > }; > > } /* namespace libcamera */ > diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp > index 8f1b4e53..00738c56 100644 > --- a/src/libcamera/software_isp/debayer_cpu.cpp > +++ b/src/libcamera/software_isp/debayer_cpu.cpp > @@ -288,12 +288,6 @@ void DebayerCpu::debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[]) > } > } > > -static bool isStandardBayerOrder(BayerFormat::Order order) > -{ > - return order == BayerFormat::BGGR || order == BayerFormat::GBRG || > - order == BayerFormat::GRBG || order == BayerFormat::RGGB; > -} > - > /* > * Setup the Debayer object according to the passed in parameters. > * Return 0 on success, a negative errno value on failure > -- > 2.51.0 >
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes: > isStandardBayerOrder is useful to both CPU and GPU debayer logic and > reusable as-is for both. > > Move to shared location in base class. > > Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> > --- > src/libcamera/software_isp/debayer.cpp | 10 ++++++++++ > src/libcamera/software_isp/debayer.h | 2 ++ > src/libcamera/software_isp/debayer_cpu.cpp | 6 ------ > 3 files changed, 12 insertions(+), 6 deletions(-) > > diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp > index 96737c45..db225ed6 100644 > --- a/src/libcamera/software_isp/debayer.cpp > +++ b/src/libcamera/software_isp/debayer.cpp > @@ -229,4 +229,14 @@ void Debayer::dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *inpu > } > } > > +/** > + * \fn void Debayer::isStandardBayerOrder(BayerFormat::Order order) > + * \brief Common method to validate standard 2x2 Bayer pattern of 2 Green, 1 Blue, 1 Red pixels. > + */ > +bool Debayer::isStandardBayerOrder(BayerFormat::Order order) > +{ > + return order == BayerFormat::BGGR || order == BayerFormat::GBRG || > + order == BayerFormat::GRBG || order == BayerFormat::RGGB; > +} > + > } /* namespace libcamera */ > diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h > index 98d88fb3..c5eb0d38 100644 > --- a/src/libcamera/software_isp/debayer.h > +++ b/src/libcamera/software_isp/debayer.h > @@ -20,6 +20,7 @@ > #include <libcamera/geometry.h> > #include <libcamera/stream.h> > > +#include "libcamera/internal/bayer_format.h" > #include "libcamera/internal/dma_buf_allocator.h" > #include "libcamera/internal/global_configuration.h" > #include "libcamera/internal/software_isp/benchmark.h" > @@ -98,6 +99,7 @@ private: > protected: > void setParams(DebayerParams ¶ms); > void dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output); > + bool isStandardBayerOrder(BayerFormat::Order order); > }; > > } /* namespace libcamera */ > diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp > index 8f1b4e53..00738c56 100644 > --- a/src/libcamera/software_isp/debayer_cpu.cpp > +++ b/src/libcamera/software_isp/debayer_cpu.cpp > @@ -288,12 +288,6 @@ void DebayerCpu::debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[]) > } > } > > -static bool isStandardBayerOrder(BayerFormat::Order order) > -{ > - return order == BayerFormat::BGGR || order == BayerFormat::GBRG || > - order == BayerFormat::GRBG || order == BayerFormat::RGGB; > -} > - > /* > * Setup the Debayer object according to the passed in parameters. > * Return 0 on success, a negative errno value on failure
diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 96737c45..db225ed6 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -229,4 +229,14 @@ void Debayer::dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *inpu } } +/** + * \fn void Debayer::isStandardBayerOrder(BayerFormat::Order order) + * \brief Common method to validate standard 2x2 Bayer pattern of 2 Green, 1 Blue, 1 Red pixels. + */ +bool Debayer::isStandardBayerOrder(BayerFormat::Order order) +{ + return order == BayerFormat::BGGR || order == BayerFormat::GBRG || + order == BayerFormat::GRBG || order == BayerFormat::RGGB; +} + } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h index 98d88fb3..c5eb0d38 100644 --- a/src/libcamera/software_isp/debayer.h +++ b/src/libcamera/software_isp/debayer.h @@ -20,6 +20,7 @@ #include <libcamera/geometry.h> #include <libcamera/stream.h> +#include "libcamera/internal/bayer_format.h" #include "libcamera/internal/dma_buf_allocator.h" #include "libcamera/internal/global_configuration.h" #include "libcamera/internal/software_isp/benchmark.h" @@ -98,6 +99,7 @@ private: protected: void setParams(DebayerParams ¶ms); void dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *input, FrameBuffer *output); + bool isStandardBayerOrder(BayerFormat::Order order); }; } /* namespace libcamera */ diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp index 8f1b4e53..00738c56 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -288,12 +288,6 @@ void DebayerCpu::debayer10P_RGRG_BGR888(uint8_t *dst, const uint8_t *src[]) } } -static bool isStandardBayerOrder(BayerFormat::Order order) -{ - return order == BayerFormat::BGGR || order == BayerFormat::GBRG || - order == BayerFormat::GRBG || order == BayerFormat::RGGB; -} - /* * Setup the Debayer object according to the passed in parameters. * Return 0 on success, a negative errno value on failure
isStandardBayerOrder is useful to both CPU and GPU debayer logic and reusable as-is for both. Move to shared location in base class. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- src/libcamera/software_isp/debayer.cpp | 10 ++++++++++ src/libcamera/software_isp/debayer.h | 2 ++ src/libcamera/software_isp/debayer_cpu.cpp | 6 ------ 3 files changed, 12 insertions(+), 6 deletions(-)