@@ -47,7 +47,7 @@ public:
const Transform &transform() const { return transform_; }
void setScale(const float scale) { scale_ = scale; }
- float effectiveScale() const { return (effectiveScaleX_ + effectiveScaleY_) * 0.5; }
+ std::array<float, 2> effectiveScale() const { return { static_cast<float>(effectiveScaleX_), static_cast<float>(effectiveScaleY_) }; }
void setRotation(const float rotation) { rotation_ = rotation; }
float rotation() const { return rotation_; }
@@ -206,6 +206,51 @@ controls:
available only on this camera device are at least this numeric
value. All of the custom test patterns will be static (that is the
raw image must not vary from frame to frame).
+ - Dw100ScaleMode:
+ type: int32_t
+ direction: inout
+ description: |
+ Scale mode of the dewarper.
+ enum:
+ - name: Fill
+ value: 0
+ description: |
+ Fills the given output size with the largest rectangle possible.
+ Aspect ratio is not preserved. Dw100Scale is ignored.
+ - name: Crop
+ value: 1
+ description: |
+ Crops to the given output size. The scale factor can be specified
+ using Dw100Scale. Aspect ratio is preserved.
+ - Dw100Scale:
+ type: float
+ direction: inout
+ description: |
+ Scale factor applied to the image when Dw100ScaleMode is set to Crop.
+ This value is clamped, so that all pixels have valid input data.
+ Therefore a value of 0 always provides the largest possible field of
+ view. Scaling happens centered around the center of the ScalerCrop +
+ Dw10Offset.
+ - Dw100Rotation:
+ type: float
+ direction: inout
+ description: |
+ Rotates the image by the given angle in degrees in clockwise direction
+ around the center of ScalerCrop + Dw100Offset
+ - Dw100Offset:
+ type: Point
+ direction: inout
+ description: |
+ Moves the image by the given values in x and y direction in sensor
+ coordinate space. This is clamped, so that all output pixels contain
+ valid data. The offset is therefore ignored when the Dw100Scale value is
+ too small.
+ - Dw100EffectiveScale:
+ type: float
+ direction: out
+ description: |
+ Effective scale
+ size: [2]
- FaceDetectMode:
type: int32_t
@@ -1500,13 +1500,18 @@ int PipelineHandlerRkISP1::updateControls(RkISP1CameraData *data)
maxCrop);
}
- if (data->dewarpParams_.has_value()) {
- if (dewarper_->supportsRequests())
+ if (dewarper_->supportsRequests()) {
+ controls[&controls::draft::Dw100Scale] = ControlInfo(0.2f, 8.0f, 1.0f);
+ controls[&controls::draft::Dw100Rotation] = ControlInfo(-180.0f, 180.0f, 0.0f);
+ controls[&controls::draft::Dw100Offset] = ControlInfo(Point(-10000, -10000), Point(10000, 10000), Point(0, 0));
+ controls[&controls::draft::Dw100ScaleMode] = ControlInfo(controls::draft::Dw100ScaleModeValues, controls::draft::Fill);
+
+ if (data->dewarpParams_.has_value())
controls[&controls::LensDewarpEnable] = ControlInfo(false, true, true);
- else
- LOG(RkISP1, Warning)
- << "dw100 kernel driver has no requests support."
- " No dynamic configuration possible.";
+ } else {
+ LOG(RkISP1, Warning)
+ << "dw100 kernel driver has no requests support."
+ " No dynamic configuration possible.";
}
}
@@ -1784,6 +1789,30 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer)
bool update = false;
auto &vertexMap = dewarper_->vertexMap(&data->mainPathStream_);
+ const auto &scale = request->controls().get(controls::draft::Dw100Scale);
+ if (scale) {
+ vertexMap.setScale(*scale);
+ update = true;
+ }
+
+ const auto &rotation = request->controls().get(controls::draft::Dw100Rotation);
+ if (rotation) {
+ vertexMap.setRotation(*rotation);
+ update = true;
+ }
+
+ const auto &offset = request->controls().get(controls::draft::Dw100Offset);
+ if (offset) {
+ vertexMap.setOffset(*offset);
+ update = true;
+ }
+
+ const auto &scaleMode = request->controls().get(controls::draft::Dw100ScaleMode);
+ if (scaleMode) {
+ vertexMap.setMode(static_cast<Dw100VertexMap::ScaleMode>(*scaleMode));
+ update = true;
+ }
+
const auto &lensDewarpEnable = request->controls().get(controls::LensDewarpEnable);
if (lensDewarpEnable) {
vertexMap.setLensDewarpEnable(*lensDewarpEnable);
@@ -1836,6 +1865,11 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer)
}
auto &meta = request->metadata();
+ std::array<float, 2> effectiveScale = vertexMap.effectiveScale();
+ meta.set(controls::draft::Dw100EffectiveScale, effectiveScale);
+ meta.set(controls::draft::Dw100Scale, (effectiveScale[0] + effectiveScale[1]) / 2.0);
+ meta.set(controls::draft::Dw100Rotation, vertexMap.rotation());
+ meta.set(controls::draft::Dw100Offset, vertexMap.effectiveOffset());
meta.set(controls::ScalerCrop, vertexMap.effectiveScalerCrop());
if (vertexMap.dewarpParamsValid())
The dw100 allows more features implemented in the dw100 vertex map. Implement these features for the rkisp1 pipeline. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- Changes in v2: - Marked as DoNotIntegrate because the puplic interface needs further discussions - Added Dw100EffectiveScale metadata --- .../converter/converter_dw100_vertexmap.h | 2 +- src/libcamera/control_ids_draft.yaml | 45 ++++++++++++++++++ src/libcamera/pipeline/rkisp1/rkisp1.cpp | 46 ++++++++++++++++--- 3 files changed, 86 insertions(+), 7 deletions(-)