Message ID | 20240712052920.33396-5-umang.jain@ideasonboard.com |
---|---|
State | Not Applicable |
Headers | show |
Series |
|
Related | show |
Hi Umang On Fri, Jul 12, 2024 at 10:59:18AM GMT, Umang Jain wrote: > Add a vertex mapping protected class to V4L2M2M converter class. > Instances of this class will store a dewarp vertex mappings along > with their input/output configuration. > > Add a vector of Mapping class and applyMapping() helper as well, > to apply relevant mappings to V4L2Stream. ConverterDW100 will > use this helper to set vertex maps, in subsequent patch. > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> > --- > .../internal/converter/converter_v4l2_m2m.h | 20 +++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h > index 2697eed9..f61beef8 100644 > --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h > +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h > @@ -61,6 +61,26 @@ public: > int setCrop(const Stream *stream, Rectangle *rect); > std::pair<Rectangle, Rectangle> getCropBounds(const Stream *stream); > > +protected: > + class Mapping > + { > + public: > + Mapping(const Size &input, const Size &output, const std::vector<uint32_t> &map) > + : input_(input), output_(output), map_(map) {} > + Size inputSize() const { return input_; } > + Size outputSize() const { return output_; } > + std::size_t size() const { return map_.size(); } Is the size of the array directly dependent on the input or output sizes or it doesn't have a correlation with them ? > + const uint32_t *mapping() const { return map_.data(); } > + > + private: > + Size input_; > + Size output_; > + std::vector<uint32_t> map_; Maybe documentation will help, but how is mapping expressed with an array of uint32_t points ? > + }; > + > + int applyMapping(const Stream *stream, Mapping &mapping); Does this work without providing an implementation ? > + std::vector<Mapping> mappings_; > + > private: > class V4L2M2MStream : protected Loggable > { > -- > 2.45.0 >
On Wed, Jul 24, 2024 at 03:52:20PM +0200, Jacopo Mondi wrote: > On Fri, Jul 12, 2024 at 10:59:18AM GMT, Umang Jain wrote: > > Add a vertex mapping protected class to V4L2M2M converter class. Given the rationale explained in the cover letter (no design of a generic API with a single implementation), should this be part of the DW100 converter class ? > > Instances of this class will store a dewarp vertex mappings along > > with their input/output configuration. > > > > Add a vector of Mapping class and applyMapping() helper as well, > > to apply relevant mappings to V4L2Stream. ConverterDW100 will > > use this helper to set vertex maps, in subsequent patch. > > > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> > > --- > > .../internal/converter/converter_v4l2_m2m.h | 20 +++++++++++++++++++ > > 1 file changed, 20 insertions(+) > > > > diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h > > index 2697eed9..f61beef8 100644 > > --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h > > +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h > > @@ -61,6 +61,26 @@ public: > > int setCrop(const Stream *stream, Rectangle *rect); > > std::pair<Rectangle, Rectangle> getCropBounds(const Stream *stream); > > > > +protected: > > + class Mapping > > + { > > + public: > > + Mapping(const Size &input, const Size &output, const std::vector<uint32_t> &map) > > + : input_(input), output_(output), map_(map) {} > > + Size inputSize() const { return input_; } > > + Size outputSize() const { return output_; } > > + std::size_t size() const { return map_.size(); } > > Is the size of the array directly dependent on the input or output > sizes or it doesn't have a correlation with them ? > > > + const uint32_t *mapping() const { return map_.data(); } > > + > > + private: > > + Size input_; > > + Size output_; > > + std::vector<uint32_t> map_; > > Maybe documentation will help, but how is mapping expressed with an > array of uint32_t points ? > > > + }; > > + > > + int applyMapping(const Stream *stream, Mapping &mapping); > > Does this work without providing an implementation ? It would fail to link if the function was called. > > + std::vector<Mapping> mappings_; > > + > > private: > > class V4L2M2MStream : protected Loggable > > {
diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index 2697eed9..f61beef8 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -61,6 +61,26 @@ public: int setCrop(const Stream *stream, Rectangle *rect); std::pair<Rectangle, Rectangle> getCropBounds(const Stream *stream); +protected: + class Mapping + { + public: + Mapping(const Size &input, const Size &output, const std::vector<uint32_t> &map) + : input_(input), output_(output), map_(map) {} + Size inputSize() const { return input_; } + Size outputSize() const { return output_; } + std::size_t size() const { return map_.size(); } + const uint32_t *mapping() const { return map_.data(); } + + private: + Size input_; + Size output_; + std::vector<uint32_t> map_; + }; + + int applyMapping(const Stream *stream, Mapping &mapping); + std::vector<Mapping> mappings_; + private: class V4L2M2MStream : protected Loggable {
Add a vertex mapping protected class to V4L2M2M converter class. Instances of this class will store a dewarp vertex mappings along with their input/output configuration. Add a vector of Mapping class and applyMapping() helper as well, to apply relevant mappings to V4L2Stream. ConverterDW100 will use this helper to set vertex maps, in subsequent patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> --- .../internal/converter/converter_v4l2_m2m.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)