[PATCH v4 00/20] rkisp1: Fix aspect ratio and ScalerCrop

Stefan Klug stefan.klug at ideasonboard.com
Mon Dec 16 16:40:40 CET 2024


Hi all,

This series contains fixes for a few issues on the imx8mp that I'd like
to get in before the next release.

Version 3 is a major extension which is described in the last paragraph.

Patch 1 is a drive by fix

Patch 2 Fixes the aspect ratio on the imx8mp. There is code to keep the
aspect ratio in the rkisp1 pipeline that adjust the input crop on the
resizer stage. On the imx8mp however the resizer hardware is missing
that functionality and cropping needs to be done on the ISP output.
Patch 2 implements that.

Patches 3-12 fix the ScalerCrop control. The existing implementation
implements ScalerCrop in dewarper coordinates (After scaling down).
This is incorrect as ScalerCrop is specified to be in sensor
coordinates. To fix that, patches 3-10 do preparatory changes and patch
11 implements the correct ScalerCrop control. Patch 12 adds
ScalerMaximumCrop for completeness sake.

Note that this solution while being correct on the numbers is still not
ideal, because the aspect ratio preserving crop on the ISP output is
still applied unconditionally. That will get fixed in an upcoming
series, where the full sensor size get's passed to the dewarper and all
cropping/scaling gets handled there.

Patches 12-20 were added after version 2 because it got clear that the
current master is completely missing the dewarper size validation and
that requires fixing. So patches 12-18 do the necessary plumbing and
implementation of the validation. Thanks Jacopo for helping with that.
Patches 19-20 fix another bug found during that work where the sensor
might get configured to a size not supported by the isp.

Best regards,
Stefan

Changes in v4:
- Added override specifiers to converter_v4l2_m2m (patch 6)
- Split former patch 6 libcamera: converter_v4l2_m2m: Improve crop
  bounds support into 3 patches with applied review feedback
- Renamed a few title prefixes from "libcamera: rkisp1:" to "pipeline:
  rkisp1:"
- Applied fixups from mailing list
- Collected tags

Changes in v3:
- Fixes from review (see individual changelogs)
- Added pipeline validation for the dewarper
- Fixed bug where sensor might be configured to a format incompatible
  with the isp

Changes in v2:
- Some smaller fixes from review (see individual changelogs)
- Added [PATCH v2 6/8] libcamera: converter_v4l2_m2m: Improve crop
  bounds support to be able to provide sane default values for
ScalerCrop before configure()

Jacopo Mondi (1):
  libcamera: converter: Add functions to adjust config

Stefan Klug (19):
  pipeline: rkisp1: Fix scope of dewarper stop() exit action
  pipeline: rkisp1: Keep aspect ratio on imx8mp
  libcamera: geometry: Add Rectangle::transformedBetween()
  pipeline: rkisp1: Split inputCrop and outputCrop
  pipeline: rkisp1: Reorder sensorInfo collection code
  libcamera: converter_v4l2_m2m: Add missing override specifier
  libcamera: converter_v4l2_m2m: Refactor get crop bounds code
  libcamera: converter: Add function to query crop bounds
  libcamera: converter: Add function to check if a stream was configured
  pipeline: rkisp1: Query dewarper crop bounds if no stream configured
  pipeline: rkisp1: Fix ScalerCrop to be in sensor coordinates
  pipeline: rkisp1: Add ScalerMaximumCrop property
  pipeline: rkisp1: Refactor path validation
  pipeline: rkisp1: Enable the dewarper unconditionally
  libcamera: camera: Add a const version of the pipe() function
  pipeline: rkisp1: make RkISP1CameraConfiguration a friend of the
    pipeline handler
  pipeline: rkisp1: Fix config validation when dewarper is used
  libcamera: camera_sensor: Add parameter to limit returned sensor size
  pipeline: rkisp1: Limit sensor size to max resolution

 include/libcamera/geometry.h                  |   3 +
 include/libcamera/internal/camera.h           |   1 +
 include/libcamera/internal/camera_sensor.h    |   2 +-
 include/libcamera/internal/converter.h        |  17 +
 .../internal/converter/converter_v4l2_m2m.h   |  39 ++-
 src/libcamera/camera.cpp                      |   5 +
 src/libcamera/converter.cpp                   |  60 ++++
 .../converter/converter_v4l2_m2m.cpp          | 295 ++++++++++++++----
 src/libcamera/geometry.cpp                    |  49 +++
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 189 ++++++++---
 src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |  13 +-
 src/libcamera/pipeline/rkisp1/rkisp1_path.h   |   1 +
 src/libcamera/sensor/camera_sensor.cpp        |   3 +
 src/libcamera/sensor/camera_sensor_legacy.cpp |   9 +-
 test/geometry.cpp                             |  11 +
 15 files changed, 576 insertions(+), 121 deletions(-)

-- 
2.43.0



More information about the libcamera-devel mailing list