Message ID | 20250611013245.133785-12-bryan.odonoghue@linaro.org |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Hi Bryan, 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> > --- > src/libcamera/software_isp/debayer.cpp | 10 ++++++++++ > src/libcamera/software_isp/debayer.h | 2 ++ > src/libcamera/software_isp/debayer_cpu.cpp | 6 ------ > src/libcamera/software_isp/debayer_cpu.h | 1 - > 4 files changed, 12 insertions(+), 7 deletions(-) > > diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp > index 75e4bffa..d0e17d20 100644 > --- a/src/libcamera/software_isp/debayer.cpp > +++ b/src/libcamera/software_isp/debayer.cpp > @@ -227,4 +227,14 @@ void Debayer::dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *inpu > dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write); > } > > +/** > + * \fn void Debayer::isStandardBayerOrder(BayerFormat::Order order) > + * \brief Common method to validate standard Bayer order When adding this, it might be useful to explain what "standard Bayer order" is. > + */ > +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 0af66b55..214bcdd3 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/software_isp/benchmark.h" > #include "libcamera/internal/software_isp/debayer_params.h" > @@ -87,6 +88,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 4ef573a3..e5649284 100644 > --- a/src/libcamera/software_isp/debayer_cpu.cpp > +++ b/src/libcamera/software_isp/debayer_cpu.cpp > @@ -282,12 +282,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_cpu.h b/src/libcamera/software_isp/debayer_cpu.h > index 0b4b16e1..a043a954 100644 > --- a/src/libcamera/software_isp/debayer_cpu.h > +++ b/src/libcamera/software_isp/debayer_cpu.h > @@ -17,7 +17,6 @@ > > #include <libcamera/base/object.h> > > -#include "libcamera/internal/bayer_format.h" > #include "libcamera/internal/software_isp/swstats_cpu.h" > > #include "debayer.h"
diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp index 75e4bffa..d0e17d20 100644 --- a/src/libcamera/software_isp/debayer.cpp +++ b/src/libcamera/software_isp/debayer.cpp @@ -227,4 +227,14 @@ void Debayer::dmaSyncBegin(std::vector<DmaSyncer> &dmaSyncers, FrameBuffer *inpu dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write); } +/** + * \fn void Debayer::isStandardBayerOrder(BayerFormat::Order order) + * \brief Common method to validate standard Bayer order + */ +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 0af66b55..214bcdd3 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/software_isp/benchmark.h" #include "libcamera/internal/software_isp/debayer_params.h" @@ -87,6 +88,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 4ef573a3..e5649284 100644 --- a/src/libcamera/software_isp/debayer_cpu.cpp +++ b/src/libcamera/software_isp/debayer_cpu.cpp @@ -282,12 +282,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_cpu.h b/src/libcamera/software_isp/debayer_cpu.h index 0b4b16e1..a043a954 100644 --- a/src/libcamera/software_isp/debayer_cpu.h +++ b/src/libcamera/software_isp/debayer_cpu.h @@ -17,7 +17,6 @@ #include <libcamera/base/object.h> -#include "libcamera/internal/bayer_format.h" #include "libcamera/internal/software_isp/swstats_cpu.h" #include "debayer.h"
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 ------ src/libcamera/software_isp/debayer_cpu.h | 1 - 4 files changed, 12 insertions(+), 7 deletions(-)