[libcamera-devel,v6,0/7] Colour spaces
mbox series

Message ID 20211118151933.15627-1-david.plowman@raspberrypi.com
Headers show
Series
  • Colour spaces
Related show

Message

David Plowman Nov. 18, 2021, 3:19 p.m. UTC
Hi everyone

Thanks very much to everyone who took part in the call the other day,
I think it's a big help in trying to get important topics unblocked!

Following on from that, here's a v6 version of this patch set. There
are a few things to point out:

* std::optional has reappeared, so you can now avoid saying what
  colour space you want. std::optional percolates all the way down to
  our V4L2 interface where an unset colour space will result in
  passing "all default" to the actual driver.

* The set of colour spaces I've defined for the ColorSpace class is
  pretty minimal, though it includes, I expect, the vast majority of
  real use cases. But we should add others that folks expect to use.

* If a device uses a colour space that isn't included in the
  ColorSpace class list, then an error message will be output though
  the program will continue. This indicates that you really ought to
  take a look and consider adding the missing ColorSpace.

* Actually, given that we use std::optional, if a device's colour
  space doesn't have a matching ColorSpace, then it will return an
  "unset" value. (Whenever you get "unset" back as the colour space,
  then that's definitely a warning sign.)

* There's a corner case about metadata pads - unsurprisingly we can't
  find a matching ColorSpace so you get a warning printed out. Is
  there a "proper" way to detect that it's a metadata pad in that bit
  of code?

* We did talk about having the StreamConfiguration contain a list of
  the acceptable colour spaces. I haven't added that yet, do we want
  to? We could do so as an extra patch.

I'm sorry if it feels a bit like we're starting again here, but
hopefully we're now moving forwards rather than round in circles, with
minimal risk of completely changing our minds!

Thanks again
David


David Plowman (7):
  libcamera: Add ColorSpace class
  libcamera: Add ColorSpace fields to StreamConfiguration
  libcamera: Convert between ColorSpace class and V4L2 formats
  libcamera: Support passing ColorSpaces to V4L2 video devices
  libcamera: Support passing ColorSpaces to V4L2 subdevices
  libcamera: Add validateColorSpaces to CameraConfiguration class
  libcamera: pipeline: raspberrypi: Support color spaces

 include/libcamera/camera.h                    |   2 +
 include/libcamera/color_space.h               |  79 ++++++
 include/libcamera/internal/v4l2_device.h      |   7 +
 include/libcamera/internal/v4l2_subdevice.h   |   2 +
 include/libcamera/internal/v4l2_videodevice.h |   2 +
 include/libcamera/meson.build                 |   1 +
 include/libcamera/stream.h                    |   3 +
 src/libcamera/camera.cpp                      |  51 ++++
 src/libcamera/camera_sensor.cpp               |   1 +
 src/libcamera/color_space.cpp                 | 243 ++++++++++++++++++
 src/libcamera/meson.build                     |   1 +
 .../pipeline/raspberrypi/raspberrypi.cpp      |  42 +++
 src/libcamera/stream.cpp                      |  14 +
 src/libcamera/v4l2_device.cpp                 | 190 ++++++++++++++
 src/libcamera/v4l2_subdevice.cpp              |  35 ++-
 src/libcamera/v4l2_videodevice.cpp            |  53 +++-
 16 files changed, 721 insertions(+), 5 deletions(-)
 create mode 100644 include/libcamera/color_space.h
 create mode 100644 src/libcamera/color_space.cpp