diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2020-04-24 12:01:49 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2020-04-28 22:25:23 +0200 |
commit | fd554f9dba3171b624e584d50c7554f9c5f9cc52 (patch) | |
tree | 2c2cdf6a92aeed7de55107333f51be1f2ce3ca78 /src/libcamera/ipa_context_wrapper.cpp | |
parent | ee4bb92aaeefaed04603d0b0c279d0d4f0be0197 (diff) |
libcamera: ipa: Add support for CameraSensorInfo
Add support for camera sensor information in the libcamera IPA protocol.
Define a new 'struct ipa_sensor_info' structure in the IPA context and
use it to perform translation between the C and the C++ API.
Update the IPAInterface::configure() operation to accept a new
CameraSensorInfo parameter and port all users of that function to
the new interface.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/ipa_context_wrapper.cpp')
-rw-r--r-- | src/libcamera/ipa_context_wrapper.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/libcamera/ipa_context_wrapper.cpp b/src/libcamera/ipa_context_wrapper.cpp index 5bd5d916..0bd3a1ae 100644 --- a/src/libcamera/ipa_context_wrapper.cpp +++ b/src/libcamera/ipa_context_wrapper.cpp @@ -12,6 +12,7 @@ #include <libcamera/controls.h> #include "byte_stream_buffer.h" +#include "camera_sensor.h" #include "utils.h" /** @@ -107,17 +108,33 @@ void IPAContextWrapper::stop() ctx_->ops->stop(ctx_); } -void IPAContextWrapper::configure(const std::map<unsigned int, IPAStream> &streamConfig, +void IPAContextWrapper::configure(const CameraSensorInfo &sensorInfo, + const std::map<unsigned int, IPAStream> &streamConfig, const std::map<unsigned int, const ControlInfoMap &> &entityControls) { if (intf_) - return intf_->configure(streamConfig, entityControls); + return intf_->configure(sensorInfo, streamConfig, entityControls); if (!ctx_) return; serializer_.reset(); + /* Translate the camera sensor info. */ + struct ipa_sensor_info sensor_info = {}; + sensor_info.model = sensorInfo.model.c_str(); + sensor_info.bits_per_pixel = sensorInfo.bitsPerPixel; + sensor_info.active_area.width = sensorInfo.activeAreaSize.width; + sensor_info.active_area.height = sensorInfo.activeAreaSize.height; + sensor_info.analog_crop.left = sensorInfo.analogCrop.x; + sensor_info.analog_crop.top = sensorInfo.analogCrop.y; + sensor_info.analog_crop.width = sensorInfo.analogCrop.width; + sensor_info.analog_crop.height = sensorInfo.analogCrop.height; + sensor_info.output_size.width = sensorInfo.outputSize.width; + sensor_info.output_size.height = sensorInfo.outputSize.height; + sensor_info.pixel_rate = sensorInfo.pixelRate; + sensor_info.line_length = sensorInfo.lineLength; + /* Translate the IPA stream configurations map. */ struct ipa_stream c_streams[streamConfig.size()]; @@ -157,7 +174,7 @@ void IPAContextWrapper::configure(const std::map<unsigned int, IPAStream> &strea ++i; } - ctx_->ops->configure(ctx_, c_streams, streamConfig.size(), + ctx_->ops->configure(ctx_, &sensor_info, c_streams, streamConfig.size(), c_info_maps, entityControls.size()); } |