{"id":20272,"url":"https://patchwork.libcamera.org/api/1.1/covers/20272/?format=json","web_url":"https://patchwork.libcamera.org/cover/20272/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240613013944.23344-1-laurent.pinchart@ideasonboard.com>","date":"2024-06-13T01:39:33","name":"[00/11] ipa: libipa: Vector and Pwl improvements","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/cover/20272/mbox/","series":[{"id":4386,"url":"https://patchwork.libcamera.org/api/1.1/series/4386/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4386","date":"2024-06-13T01:39:33","name":"ipa: libipa: Vector and Pwl improvements","version":1,"mbox":"https://patchwork.libcamera.org/series/4386/mbox/"}],"comments":"https://patchwork.libcamera.org/api/covers/20272/comments/","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DFD63C3237\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 Jun 2024 01:40:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 04C386548E;\n\tThu, 13 Jun 2024 03:40:07 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1B7E361A1C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Jun 2024 03:40:05 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 10ADDBEB;\n\tThu, 13 Jun 2024 03:39:51 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"YP8tqTsz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1718242791;\n\tbh=jOKiP6BODrVaxp0GvsbHsAmdqlc0v+Z48biOThgOhFk=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=YP8tqTszNFOs1HlPG/42ADhPz2yeFR106wL0qWUn4kaoH61e7MnJUruyPkhcA8SJB\n\txnFazdU8vmFA6QjVXF5HDiETDwZDWlqhQ80J5TlGeftH05MYecWnKOJuzb1J4Krpqd\n\tvKhu3MUXklq0Z5RWxaPP78ooPbKARrEPV0UuCjvA=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Paul Elder <paul.elder@ideasonboard.com>,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Subject":"[PATCH 00/11] ipa: libipa: Vector and Pwl improvements","Date":"Thu, 13 Jun 2024 04:39:33 +0300","Message-ID":"<20240613013944.23344-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.44.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Hello,\n\nThis patch series tries to improve the ipa::Vector and ipa::Pwl classes\nthat have been recently merged. They started from an attempt to replace\nthe readYaml() member of those two classes with a better (in my opinion)\nalternative, and grew beyond that.\n\nThe main change in this series is the removal of the readYaml() function\nfrom the Vector and Pwl classes. The rationale for this is that the two\nclasses are generic math objects, and should not be tied to a particular\nserialization mechanism. For the same reason, we have currently no\nSize::readYaml() function, but a specialization of YamlObject::get() for\nthe Size type.\n\nCopying the implementation of YamlObject::get() for the Size type would\nhave been the most straightforward option, but isn't an option as the\nVector and Pwl classes, unlike the Size class, are part of libipa, while\nYamlObject is part of libcamera. libipa links to libcamera, but\nlibcamera doesn't link to libipa.\n\nAs the YamlObject::get() function is a template function with support\nfor different data types implemented through template specializations, I\ndecided to try and implement specializations for the Vector and Pwl\nclasses inside libipa. This was blocked by std::enable_if_t guards in\nYamlObject::get(), which are removed by patch 01/11.\n\nThe second issue is that specializing the function template for another\ntemplate type (e.g. ipa::Vector<T, Rows>) is a partial specialization of\na function, which is not allowed by C++. Only partial specializations of\nclasses and variables are supported by the language. Patch 02/11 works\naround that issue by delegating the YamlObject::get() function template\nto a new YamlObject::Getter structure template, which implements a\nnon-template get() function.\n\nWith that in place, a specialization of the getter for ipa::Vector is\nimplemented in patch 03/11. The ipa::Vector::readYaml() is then dropped\nin patch 04/11 without further ado, as it turned out the function wasn't\nused. I would be fine dropping patch 03/11 until reading a Vector from\nYAML data becomes needed if preferred.\n\nPatches 05/11 to 08/11 follow with miscellaneous cleanups and\nenhancements for the ipa::Pwl class, in preparation of patch 09/11 that\nadds a getter specialization for ipa::Pwl. Patch 10/11 switches the\nusers of the ipa::Pwl::readYaml() function to YamlObject::get() (unlike\nipa::Vector, we read ipa::Pwl instances from YAML data). This showcases\nusage of the new API. Finally, patch 11/11 drops the\nipa::Pwl::readYaml() function.\n\nBeside thinking that C++ and/or myself are crazy, does anyone have an\nopinion ?\n\nLaurent Pinchart (11):\n  libcamera: yaml_parser: Drop std::enable_if_t guards for get()\n    function\n  libcamera: yaml_parser: Delegate YamlObject::get() to helper structure\n  ipa: libipa: vector: Specialize YamlObject getter\n  ipa: libipa: vector: Drop readYaml() function\n  ipa: libipa: pwl: Suffix \\param with direction\n  ipa: libipa: pwl: Make the empty() function inline\n  ipa: libipa: pwl: Add a size() function\n  ipa: libipa: pwl: Add a constructor that moves a Point vector\n  ipa: libipa: pwl: Specialize YamlObject getter\n  ipa: rpi: controller: Replace Pwl::readYaml() with YamlObject::get()\n  ipa: libipa: pwl: Drop readYaml() function\n\n include/libcamera/internal/yaml_parser.h   |  27 ++---\n src/ipa/libipa/pwl.cpp                     | 132 +++++++++++----------\n src/ipa/libipa/pwl.h                       |   6 +-\n src/ipa/libipa/vector.cpp                  |  30 +++--\n src/ipa/libipa/vector.h                    |  48 ++++----\n src/ipa/rpi/controller/rpi/af.cpp          |   2 +-\n src/ipa/rpi/controller/rpi/agc_channel.cpp |   9 +-\n src/ipa/rpi/controller/rpi/awb.cpp         |   3 +-\n src/ipa/rpi/controller/rpi/ccm.cpp         |   6 +-\n src/ipa/rpi/controller/rpi/contrast.cpp    |   4 +-\n src/ipa/rpi/controller/rpi/geq.cpp         |   6 +-\n src/ipa/rpi/controller/rpi/hdr.cpp         |   4 +-\n src/ipa/rpi/controller/rpi/tonemap.cpp     |   2 +-\n src/libcamera/yaml_parser.cpp              |  78 ++++++------\n 14 files changed, 193 insertions(+), 164 deletions(-)\n\n\nbase-commit: 20b8538a197c45597eecf5c7a51058263e816eb9"}