libcamera: ipa: raspberrypi: Plumb in the libcamera sharpness control

This simply wires up the libcamera sharpness control in the Raspberry
Pi IPAs so that it controls the strength of the Raspberry Pi sharpness
control algorithm.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
David Plowman 2020-06-23 10:14:04 +01:00 committed by Laurent Pinchart
parent 0dbc6a507c
commit 58732e4b49
2 changed files with 13 additions and 0 deletions

View file

@ -51,6 +51,7 @@ static const ControlInfoMap RPiControls = {
{ &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, { &controls::Brightness, ControlInfo(-1.0f, 1.0f) },
{ &controls::Contrast, ControlInfo(0.0f, 32.0f) }, { &controls::Contrast, ControlInfo(0.0f, 32.0f) },
{ &controls::Saturation, ControlInfo(0.0f, 32.0f) }, { &controls::Saturation, ControlInfo(0.0f, 32.0f) },
{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },
}; };
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -47,6 +47,7 @@
#include "metadata.hpp" #include "metadata.hpp"
#include "noise_status.h" #include "noise_status.h"
#include "sdn_status.h" #include "sdn_status.h"
#include "sharpen_algorithm.hpp"
#include "sharpen_status.h" #include "sharpen_status.h"
namespace libcamera { namespace libcamera {
@ -633,6 +634,17 @@ void IPARPi::queueRequest(const ControlList &controls)
break; break;
} }
case controls::SHARPNESS: {
RPi::SharpenAlgorithm *sharpen = dynamic_cast<RPi::SharpenAlgorithm *>(
controller_.GetAlgorithm("sharpen"));
ASSERT(sharpen);
sharpen->SetStrength(ctrl.second.get<float>());
libcameraMetadata_.set(controls::Sharpness,
ctrl.second.get<float>());
break;
}
default: default:
LOG(IPARPI, Warning) LOG(IPARPI, Warning)
<< "Ctrl " << controls::controls.at(ctrl.first)->name() << "Ctrl " << controls::controls.at(ctrl.first)->name()