[RFC PATCH 4/6] libcamera: converter_v4l2_m2m: Add vertex mapping class

Jacopo Mondi jacopo.mondi at ideasonboard.com
Wed Jul 24 15:52:20 CEST 2024


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 at 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
>


More information about the libcamera-devel mailing list