From 13b76d6209afc98f013b080131c9f3488d38acd0 Mon Sep 17 00:00:00 2001 From: Hirokazu Honda Date: Wed, 1 Sep 2021 17:03:01 +0900 Subject: android: camera_stream: Support PostProcessorYuv in CameraStream CameraStream creates PostProcessorYuv if the destination format is NV12. Signed-off-by: Hirokazu Honda Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/android/camera_device.cpp | 4 ++-- src/android/camera_stream.cpp | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src/android') diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index ab31bdda..a3ad27b8 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1131,12 +1131,12 @@ void CameraDevice::requestComplete(Request *request) resultMetadata = std::make_unique(0, 0); } - /* Handle any JPEG compression. */ + /* Handle post-processing. */ for (camera3_stream_buffer_t &buffer : descriptor.buffers_) { CameraStream *cameraStream = static_cast(buffer.stream->priv); - if (cameraStream->camera3Stream().format != HAL_PIXEL_FORMAT_BLOB) + if (cameraStream->type() == CameraStream::Type::Direct) continue; FrameBuffer *src = request->findBuffer(cameraStream->stream()); diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 4a1658b8..e30c7ee4 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -9,13 +9,15 @@ #include +#include + +#include "jpeg/post_processor_jpeg.h" +#include "yuv/post_processor_yuv.h" + #include "camera_buffer.h" #include "camera_capabilities.h" #include "camera_device.h" #include "camera_metadata.h" -#include "jpeg/post_processor_jpeg.h" - -#include using namespace libcamera; @@ -67,8 +69,14 @@ int CameraStream::configure() cameraDevice_->capabilities()->toPixelFormat(camera3Stream_->format); StreamConfiguration output = configuration(); output.pixelFormat = outFormat; + output.size.width = camera3Stream_->width; + output.size.height = camera3Stream_->height; switch (outFormat) { + case formats::NV12: + postProcessor_ = std::make_unique(); + break; + case formats::MJPEG: postProcessor_ = std::make_unique(cameraDevice_); break; -- cgit v1.2.1