[libcamera-devel,v6,0/8] 2D transforms
mbox series

Message ID 20200902104410.7569-1-david.plowman@raspberrypi.com
Headers show
Series
  • 2D transforms
Related show

Message

David Plowman Sept. 2, 2020, 10:44 a.m. UTC
Hi everyone

Another version of 2D transforms! There's actually been a bit more
churn than I wanted because I liked the suggestion that was made of
storing the "native" Bayer order (with no transforms) at startup, and
then applying transforms to that. Unfortunately I found the various
pixel formats rather difficult to work with (as the Bayer information
is opaque in the encoding) so I decided to add a BayerFormat class to
make everything explicit.

So there's a bit of a hit converting to the BayerFormat and back out
again, but once you're there it's easy to transform them without
having to worry about the bit depth or packing.

With this change, the original method of transforming Bayer
V4L2PixelFormats is redundant, so I've dropped it.  Anyway, see what
you think.

This leaves the following commits:

1. Revert the same commit as before. Unchanged.

2. Rename the queryCtrl() method to controlInfo(). I've made it a
const function too, but otherwise this commit unchanged.

3. Add Transform enum. Unchanged apart from adding operator~.

4. This commit replaces the previous V4L2PixelFormat one and adds a
BayerFormat type instead.

5. Add user Transform to CameraConfiguration. Unchanged.

6. Set flips correctly in RPi pipeline handler. Apart from the new
class in commit #4, the other significant changes are here. I guess I
have a bit of a question about how you find the "native" Bayer order -
is there any circumstance where a sensor might return different Bayer
orders in different modes (even when the transform doesn't change)?

7 and 8. Unchanged.

Thanks and best regards
David

David Plowman (8):
  libcamera: pipeline: raspberrypi: Revert "Set sensor default
    orientation before configure()"
  libcamera: Allow access to v4l2_query_ext_ctrl structure for a V4L2
    control
  libcamera: Add Transform enum to represent 2D plane transforms.
  libcamera: Add BayerFormat type
  libcamera: Add user Transform to CameraConfiguration
  libcamera: raspberrypi: Set camera flips correctly from user transform
  libcamera: raspberrypi: Plumb user transform through to IPA
  libcamera: ipa: raspberrypi: ALSC: Handle user transform

 include/libcamera/camera.h                    |   3 +
 include/libcamera/internal/bayer_format.h     |  63 ++++
 include/libcamera/internal/v4l2_device.h      |   2 +
 include/libcamera/meson.build                 |   1 +
 include/libcamera/transform.h                 |  78 +++++
 src/ipa/raspberrypi/controller/camera_mode.h  |   4 +
 src/ipa/raspberrypi/controller/rpi/alsc.cpp   |  13 +-
 src/ipa/raspberrypi/raspberrypi.cpp           |  48 +--
 src/libcamera/bayer_format.cpp                | 223 ++++++++++++
 src/libcamera/camera.cpp                      |  16 +-
 src/libcamera/meson.build                     |   2 +
 src/libcamera/pipeline/ipu3/ipu3.cpp          |   5 +
 .../pipeline/raspberrypi/raspberrypi.cpp      | 152 ++++++++-
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      |   5 +
 src/libcamera/pipeline/simple/simple.cpp      |   5 +
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp  |   5 +
 src/libcamera/pipeline/vimc/vimc.cpp          |   5 +
 src/libcamera/transform.cpp                   | 322 ++++++++++++++++++
 src/libcamera/v4l2_device.cpp                 |  15 +
 19 files changed, 933 insertions(+), 34 deletions(-)
 create mode 100644 include/libcamera/internal/bayer_format.h
 create mode 100644 include/libcamera/transform.h
 create mode 100644 src/libcamera/bayer_format.cpp
 create mode 100644 src/libcamera/transform.cpp