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

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

Message

David Plowman Aug. 29, 2020, 11:54 a.m. UTC
Hi everyone

Here's another version of 2D transforms, after the previous version
slightly set the cat among the pigeons! Of course, the basic way in
which transforms work is unchanged, but we now avoid touching the
sensor until the configure() method. The number of separate commits
has gone up to eight, let me walk through them:

1. This reverts that same patch as we did previously.

(Note that there was previously a commit here that moved the sensor
H/VFLIP manipulation into validate(), but this one has been dropped,
leaving it in configure().)

2. This is a new commit that gives pipeline handlers access to the
v4l2_query_ext_ctrl structure for a V4L2 control. The V4L2Device has
already retrieved this information, but doesn't make it publicly
available. I went with a simple extra queryCtrl function as it seemed
simplest and touches least stuff, but I did wonder about other ways of
doing it. Perhaps the flags could be stored also in the
V4L2ControlInfo structure and made available from there? But currently
the V4L2Device appears to give out ControlInfos, not
V4L2ControlInfos... anyway, there's perhaps a bit of a discussion to
have here.

3. The third commit adds the transform enum and is unchanged.

4. This is also a new commit, and adds a transform method to the
V4L2PixelFormat class that operates only on Bayer formats. I thought
it was worth adding this function in a place where it would be helpful
to other pipeline handlers, rather than burying it in the RPi one. I'm
afraid I don't have a more elegant implementation of it other than by
using tables.

5. Adds the transform field to the CameraConfiguration. Unchanged.

6. This is where we handle the transforms properly in the RPi pipeline
handler. validate() now works out what the Bayer order of any raw
streams _will_ be, given the transform. The actual updating of the
flip bits in the sensor is still in configure(), as it was a couple of
versions ago!

7 and 8. Both unchanged.

I think that's everything.

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: Allow Bayer pixel formats to be transformed
  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/v4l2_device.h      |   2 +
 include/libcamera/internal/v4l2_pixelformat.h |   3 +
 include/libcamera/meson.build                 |   1 +
 include/libcamera/transform.h                 |  73 ++++
 src/ipa/raspberrypi/controller/camera_mode.h  |   4 +
 src/ipa/raspberrypi/controller/rpi/alsc.cpp   |  13 +-
 src/ipa/raspberrypi/raspberrypi.cpp           |  48 +--
 src/libcamera/camera.cpp                      |  16 +-
 src/libcamera/meson.build                     |   1 +
 src/libcamera/pipeline/ipu3/ipu3.cpp          |   5 +
 .../pipeline/raspberrypi/raspberrypi.cpp      |  96 +++++-
 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                   | 312 ++++++++++++++++++
 src/libcamera/v4l2_device.cpp                 |  15 +
 src/libcamera/v4l2_pixelformat.cpp            |  94 +++++-
 19 files changed, 668 insertions(+), 38 deletions(-)
 create mode 100644 include/libcamera/transform.h
 create mode 100644 src/libcamera/transform.cpp