From patchwork Fri Jul 12 05:29:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 20652 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 73305BDB1C for ; Fri, 12 Jul 2024 05:29:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1542163380; Fri, 12 Jul 2024 07:29:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="vJzcLdMr"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 03EF063375 for ; Fri, 12 Jul 2024 07:29:38 +0200 (CEST) Received: from localhost.localdomain (unknown [IPv6:2405:201:2015:f873:55f8:639e:8e9f:12ec]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DAE1CCC8; Fri, 12 Jul 2024 07:29:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1720762143; bh=5tqWoobuZgvPGY3SNqsGS28koWPuZHeYd+jVzUHZLds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJzcLdMrPJ8FlT4vR7+r25ypRfYj8SCVrN47h0PXLgvY+Q7MUL391GpxSzQVz7Z3S fQlhJS0Bs9QML3VPg/r/RO1P5JDeKhc4vRiUtorTRWL+JNux0No3oDucQ4he5iSNgO Qr/DDRHAeT1VrSQ0KOEJumH0xSOHSW1mDWwn1orE= From: Umang Jain To: libcamera-devel@lists.libcamera.org Cc: Xavier Roumegue , Umang Jain Subject: [RFC PATCH 4/6] libcamera: converter_v4l2_m2m: Add vertex mapping class Date: Fri, 12 Jul 2024 10:59:18 +0530 Message-ID: <20240712052920.33396-5-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240712052920.33396-1-umang.jain@ideasonboard.com> References: <20240712052920.33396-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 --- .../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 getCropBounds(const Stream *stream); +protected: + class Mapping + { + public: + Mapping(const Size &input, const Size &output, const std::vector &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 map_; + }; + + int applyMapping(const Stream *stream, Mapping &mapping); + std::vector mappings_; + private: class V4L2M2MStream : protected Loggable {