From patchwork Thu Sep 8 18:48:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Roumegue X-Patchwork-Id: 17351 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 6DB6AC3280 for ; Thu, 8 Sep 2022 18:49:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 304CA620D7; Thu, 8 Sep 2022 20:49:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662662968; bh=VLwGBIGV3/rf3PXhQC2E7C2nenUzbwpxRWanMYMGKBY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ifbBVNj8cbK/+uqTndq3w059UadIB/cDPERoMyFfnzBOOso31VH8xGgAovo2pbesk eFQ7QxKb87YSC3zn0EPX4JR8hnkG/pEJFOtDUaJrYQVbyclRRo0wdMD9aDvltmIchY pcf7l2kUjpnaVGhqvp2/TNKKdIDGE12Mt21Em3BTqh3Uq1DTfLwMBObFQXY/wGpCUI CMzul0hYTLbTyDvMLaVIIyuk1BTsMtGpcIazB6lwrhCfak1fkdyf8jg4+WGxw4CDkV Tx0cNKZV2fljG9FQeQZiJaSeCo/6bHAVMElc+h0ylhnR1AEFO6YCH7kHMJBB1i/7Yz TYPFs+PK7tOjQ== Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60070.outbound.protection.outlook.com [40.107.6.70]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3FBEA620C1 for ; Thu, 8 Sep 2022 20:49:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="RzrITWnQ"; dkim-atps=neutral ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nLxBwGKzvpgQGzEHpwNEEXUgsvJg9xizUSGW15G+JoUYkDO3QHbs9oEq580Y6pz7gvJmTfaLVXobAxCa7DPr0SyS3B6EQ3iSPjselGlYGYifG+de95R1M4rdLc2QcnmZFmduk8U+XUgBXOvUOTTcj/1GjJca+UIXmGFEEv9coBwPdqymy9GQpifnwEsBXdJlZT2YLGAWV1WRvlPg5reC+SFdmyjhn6zEOwgha4ihN75mWw+Ur4W4xvLR7ZBDa59eGUSDrpksfYLZaRmtJ2xUGdzx0oowQYRYGDHjaUyUilPkrH6CejXZxoCmySv2rUaqy+8mm9Oy+8iQ8pGLZpcEMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LYXpDQknnxUnTUmztLoxVgzvsHO5mzB2h16T6Di2D94=; b=OJxzvdeR489jRnDdU3Gs4x7ZtmaniTVbO3j+f6aqPBeSdCh7STsslw3DA91R0fh3YHLozjXXBd9g3M5zsp1QugPNUMZWA/kt0dyg0orB+hR+2gcLpNl7imFULE0ZOTJw+J4YMcR2Ol1fIk/72rN7T2HvtvkGK5vf2w1TsmulQFTOTKYkjCrLvoZ8XTKcPS9baM/bSpanRt/+QyQ1KLnirgKAzLUQSoxaSA9zar/pbYL/e4Eevmn66CQa3QzWM4Sf6McJ/C0AExACgyaaAPFRwICJS7Jqungfyl2Uro7lMcuVhw7sKfgGeSr3XtSxnNKn6m1xEG21e9fR4sX4S0uDOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LYXpDQknnxUnTUmztLoxVgzvsHO5mzB2h16T6Di2D94=; b=RzrITWnQWJtdHkGZCiOnq3c551ThMjELUgr5TQMqXZxyK64E1VeUahciFKFGKZN6yG5j44Tw6unebMj89Vd5sC7Fih24Uz4v7AFxeLjX5PlIBCia08GFhYJyCJZE51s3DdWsQkFMsthWHx5LEvGu3pVceM1vvKG2Ir7XQfhxCAM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) by AS8PR04MB8852.eurprd04.prod.outlook.com (2603:10a6:20b:42f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Thu, 8 Sep 2022 18:49:20 +0000 Received: from PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::485:adba:7081:715a]) by PAXPR04MB8703.eurprd04.prod.outlook.com ([fe80::485:adba:7081:715a%3]) with mapi id 15.20.5612.019; Thu, 8 Sep 2022 18:49:20 +0000 To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Sep 2022 20:48:45 +0200 Message-Id: <20220908184850.1874303-10-xavier.roumegue@oss.nxp.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> References: <20220908184850.1874303-1-xavier.roumegue@oss.nxp.com> X-ClientProxiedBy: PR3P250CA0001.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:57::6) To PAXPR04MB8703.eurprd04.prod.outlook.com (2603:10a6:102:21e::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8703:EE_|AS8PR04MB8852:EE_ X-MS-Office365-Filtering-Correlation-Id: f41eb887-341b-4c8d-5df1-08da91cad735 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nh44cFwZw7sgnbprfc1xF+cDtC4N9+iHeNJNuwHCmpfrRaOdERifcMgPbTRutdjSPI+3T0Y1F+wuRvznUWgtrSoWI/B284seq10VY2cOTO4jn/nucvZj07eF/QzVw5ZziMoDP1d8tARPFx2vDN1DCS+EZ/ZGCv5JS3EQNtXakD74zQSSk+BvKFaG6kuqNPilT4P1d8P7DYcOTXWFiFCdQHQxARZhPW0c9UPxK6iBZFaq0dVGc4DL2pVlbVheRu053zLDH8uY7i9kRYD9kDtyWA+TVnE9a0mWerHSjOwyodWdzTor5uj2GrV9fSljrqEc+oFsDln5a0UV2BKh04hijlw8n4pa8xxMZYieNIxDC3EPCg+m9zhGtCVih6Capr5FKSHXDTmiKTfcw7JTOc7997ZBz0Bv0ovejt6zpB0oXZ0hvge/fX1u9oO1G/+eBfglW0hSai/1DgZIO9g0PDevmimzXnbcmdVuo1+kCkTgKUextpoX46uyNbOABXlDdfKYg0SuHLcbHeT0zO/K8ZXkofQpZbdZYQgqzGRUAr/R9Suglcx7Sx54Tc0gUA4JOC46gGsb361frhq3t22NZe7LMcGdtfi3BgDV8ThN71kfIHM6B9mkjPT2+faXU99WSda+Xm5spTmSKXxVWwr9h3h6mB8w/Q9495l+GNcfJ32kFbhDy/kWWh1LJ2W5C2HfJkqOKoz8DdGuJoYVZH4xSB5yiA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8703.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(346002)(376002)(396003)(136003)(366004)(38100700002)(66556008)(66476007)(66946007)(8936002)(44832011)(5660300002)(4326008)(8676002)(6916009)(316002)(41300700001)(186003)(1076003)(2616005)(2906002)(478600001)(6666004)(86362001)(6512007)(52116002)(6506007)(83380400001)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0hJZs3sG1pOW4XBW4R+tDu1qY80Gy8tT5GzFMiW1JY9i2m1ArxQFja6kO356/LH7BXHVDhLLTvvuUCaUvI0dtu5CDn0CGZeivKUtWf4upz6Wic8PQZuB5/ZU2PEKv2Fd/uUhdEJe0GyUmaZXNJypWQavIKz+GWKqvl8kUuBuKmYyQd1X8LUeRhoNUaZquFzHvTca6Zvt/av9lOD37PClsDofHgWn7Nhb2dO8rCNUeDIxM7uLOQfHWjv+y5hl+MoZBgbbnOC7It3a9Ku8dO7wUGSxwfXhqpg5zclnlcIzVzjkiTS0SKb9zW1r8W6h2tzYkCvIUhHkCcd33HmRBlbR1I8W0P4jD9PVo/Vf63RHtY5toDFbxHYi70xFIA5khhFyokvuluaW81ja00opKHw59lTGPZ4Wk6toOcDVLFxlYGnf2baaN78xm5b27ow45S6ehltCCQi8nJCzRbcWeorME2LBhAc7FwT93xM9TpmtodT7PaGhP/iK1US3uYCDZBbfuy+Zx5wZeUB4Y+XUnp3/Hm6Mk4Y1LmiGEl/7ASPu5Hcgxrq8paxmJGrCZLN40fNJUl8pmxKsZ4BmpXvMRJi5rLtSs225IqKlvAlqDAXLcLdFgc3dp5bhQQZbbHz/qt5KKHuehqIhiXJgWDYDFi0+LGBC352g+bqgnsIddSoDItspOU8n6M7X2fv2NRhfd+zC4rp+XPySRVNgRTSzST0jW3CtI5gaQSGRXbgL9r0JxWPJ8urhTi2ljqQfMvC/+KPz/GE0FK+QmxXgLxrubRCn/WVqrhB9XrzmZydJpXY0cuIL5PO0bcSPVOlr0FnMuR+cbi7dZvxn/XCJYvdnH/Ne1qS8sFI5py6q61ppJx9Imvno+S4yYZDCudfWon8E1v/kln6T4jHRU1MZ4LHjKf14kpvJjSPXdbEsOuy8Op3YF7TV/eo2s2LWtU6I3A7RUqQg5N48T7EzXaqGm/tC4kHB0JrjbFcYMfgkRMD/ppx16KbEskCkMKn+O4LO4X58f4J4dzV4hXCAYi6SC075ab9tPryL1noExduqFg0HEznMGjpMLswW7qYBvahl+LwkcSQBQQzyJ4SaWtj3lEHZkViEtYInumkSEZiksSzrXGlf0Jb/1W89829N5IbJRb2xnq4vVrxiJdO9uhkg8L4gWwFCeCRhHiC4nWvje5BpYBJvacLMW+xiCBGS5UK4hDYu8neBzwLeNwhVLEvyT/8j5YHDxVKfaBchgcM/d5MO1pRL9sD6/fvWuGNZx1xLgKsOXHm265dmloTRki2HfWKUg5RxcrsPnh0vAkT+nvVAAqP5WMroiAYTMucIIaTo4QwJMWHwRl7K2EKYVOnO9AyFZoVMoRTyvXz11bAyHauaoLdeXctWDoK3RqxRa2VSgniYdXWibENZ4/5HzBsChEmMvy/1j7KZWUY9osfMbY8SGb5Tg3Um699e7ia4j3Re85Grq3UubU4u3MP2RDgJa+HzFjTQBdgwK8ztqE7dJHBynvlExr9vbvU/VhyDBBa7kxZEKXk3ZRLlnsTiqjlIHxPEz15rglteu5zqpvw70KYwcaq0RyQdM1iTb+XybPdKRpME5BNiMr86PxuvEimr5h3hkBP4pgQfjHC70Dlxvi+X6+nH8AW5Ys2pSZ/QoHR9XTN5urQbkt1HuInR6O5jKTf1b6Y9PQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f41eb887-341b-4c8d-5df1-08da91cad735 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8703.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 18:49:20.7474 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Q87LNvqpK/IczLt40KhZMt5PdspR5/oD3xxx8L8nShdyK6ij8wfToxdgyvTdYrC2bDYi1xG1D+zkpQTT2I/ZdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8852 Subject: [libcamera-devel] [PATCH 09/14] libcamera: converter: Introduce dw100 converter 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: , X-Patchwork-Original-From: Xavier Roumegue via libcamera-devel From: Xavier Roumegue Reply-To: Xavier Roumegue Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add converter support for the Vivante DW100 Dewarp Processor IP core found on i.MX8MP SoC. The processor core applies a programmable geometrical transformation on input images to correct distorsion introduced by lenses. The transformation function is exposed as a grid map with 16x16 pixel macroblocks indexed using X, Y vertex coordinates. A set of input/output vertices mapping can be loaded at runtime through a configuration file. If no mapping is loaded, the vertices mapping fallbacks to an identity transformation. Scaling and pixel format conversion can be used independently of the vertices remapping. Signed-off-by: Xavier Roumegue --- include/libcamera/internal/converter_dw100.h | 25 +++++++++++++++ include/libcamera/internal/meson.build | 1 + src/libcamera/converter_dw100.cpp | 32 ++++++++++++++++++++ src/libcamera/meson.build | 1 + 4 files changed, 59 insertions(+) create mode 100644 include/libcamera/internal/converter_dw100.h create mode 100644 src/libcamera/converter_dw100.cpp diff --git a/include/libcamera/internal/converter_dw100.h b/include/libcamera/internal/converter_dw100.h new file mode 100644 index 00000000..1972d6a2 --- /dev/null +++ b/include/libcamera/internal/converter_dw100.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright 2022 NXP + * + * converter_dw100.h - V4l2 M2M dw100 format converter interface + */ + +#pragma once + +#include + +#include "libcamera/internal/converter_v4l2_m2m.h" +#include "libcamera/internal/media_device.h" + +namespace libcamera { + +class DW100Converter : public V4L2M2MConverter +{ +public: + DW100Converter(MediaDevice *media) + : V4L2M2MConverter(media){}; + virtual int applyMapping(Stream *stream, Mapping &mapping) override; +}; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 132de5ef..c2dd094f 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -20,6 +20,7 @@ libcamera_internal_headers = files([ 'control_serializer.h', 'control_validator.h', 'converter.h', + 'converter_dw100.h', 'converter_v4l2_m2m.h', 'delayed_controls.h', 'device_enumerator.h', diff --git a/src/libcamera/converter_dw100.cpp b/src/libcamera/converter_dw100.cpp new file mode 100644 index 00000000..b079fb37 --- /dev/null +++ b/src/libcamera/converter_dw100.cpp @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright 2022 NXP + * + * converter_dw100.cpp - V4L2 M2M dw100 format converter + */ + +#include "libcamera/internal/converter_dw100.h" + +#include + +#include + +#include "libcamera/internal/v4l2_videodevice.h" + +namespace libcamera { + +LOG_DECLARE_CATEGORY(Converter) + +int DW100Converter::applyMapping(Stream *stream, Mapping &mapping) +{ + ControlList ctrls; + auto value = Span(reinterpret_cast(mapping.getMapping()), mapping.getLength()); + ControlValue c(value); + ctrls.set(V4L2_CID_DW100_DEWARPING_16x16_VERTEX_MAP, c); + stream->m2m_->capture()->setControls(&ctrls); + return 0; +} + +REGISTER_CONVERTER("dw100", DW100Converter) + +} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index b12c8401..83da3e5f 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -14,6 +14,7 @@ libcamera_sources = files([ 'control_serializer.cpp', 'control_validator.cpp', 'converter.cpp', + 'converter_dw100.cpp', 'converter_v4l2_m2m.cpp', 'delayed_controls.cpp', 'device_enumerator.cpp',