From patchwork Mon Dec 28 16:51:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10756 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 3C1F5C0F1B for ; Mon, 28 Dec 2020 16:51:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B1239615B4; Mon, 28 Dec 2020 17:51:53 +0100 (CET) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 16CC760111 for ; Mon, 28 Dec 2020 17:51:53 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id BA8061C000A for ; Mon, 28 Dec 2020 16:51:52 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Dec 2020 17:51:59 +0100 Message-Id: <20201228165203.53771-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/4] libcamera: Introduce sensor database 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" Hello, this v3 redesigns the sensor database to: - use a custom structure to report properties in place of a ControlList - This allows dropping the controversial list-initialization contructor for the ControlList class - make SensorDatabase a static class to only interface with the sensor database which is now not exposed anymore to the rest of the library - use a plain C-style array for the sensor database Here, I struggled quite a lot to make everything a constexpr, not even being 100% sure it -really- makes a difference compared to static const declaration (the documentation I found gave me conflicting suggestions, or maybe I didn't fully get it :) So, I had a map as the database underlying structure. Making a map a constexpr would have required sub-classing it, and exposing only constexpr methods, which I considered not worth it. So I used an array of std::pair. Constructing pairs has its own peculiarities, and I managed to get it work with clang on my laptop, but failed to have it compile on cros (which uses clang, but an older version). I assumed this was an indication I was looking for troubles, as supporting all compilers in the build compilers matrix would have been complex, so I fell back to plain C-style array, which are easier but indeed less C++-ish than using an STL container. Also, we lose a bit of efficiency in lookups, but I don't expect this to happen in critical paths, and I don't expect to have thousands of sensors to support. Series based on the two series I have in review (CFA and exposure times calculations). Thanks j Jacopo Mondi (4): libcamera: Introduce camera sensor database libcamera: camera_sensor: Register static properties android: camera_device: Report sensor physical size android: camera_device: Align style of active area size include/libcamera/internal/camera_sensor.h | 1 + include/libcamera/internal/meson.build | 1 + include/libcamera/internal/sensor_database.h | 28 +++++ src/android/camera_device.cpp | 49 +++++---- src/libcamera/camera_sensor.cpp | 21 +++- src/libcamera/meson.build | 1 + src/libcamera/sensor_database.cpp | 102 +++++++++++++++++++ 7 files changed, 180 insertions(+), 23 deletions(-) create mode 100644 include/libcamera/internal/sensor_database.h create mode 100644 src/libcamera/sensor_database.cpp Reviewed-by: Paul Elder Reviewed-by: Niklas Söderlund --- 2.29.2