[libcamera-devel] [PATCH v3 0/4] libcamera: Introduce sensor database
Jacopo Mondi
jacopo at jmondi.org
Mon Dec 28 17:51:59 CET 2020
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
--
2.29.2
More information about the libcamera-devel
mailing list