aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUmang Jain <umang.jain@ideasonboard.com>2021-10-19 17:17:54 +0530
committerUmang Jain <umang.jain@ideasonboard.com>2021-10-19 19:15:27 +0530
commit1976179623b832052c37e577b2f375f569d28ab0 (patch)
treee996d4b2378be8ad9865d75db26cb2f3ae468dc2
parent1abdcf803d9cfc8df15361fbbd627654f1eb82c9 (diff)
android: camera_stream: Plumb process() with Camera3RequestDescriptor
Data (or broader context) required for post processing of a camera request is saved via Camera3RequestDescriptor. Instead of passing individual arguments to CameraStream::process(), pass the Camera3RequestDescriptor pointer to it. All the arguments necessary to run the post-processor can be accessed from the descriptor. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
-rw-r--r--src/android/camera_device.cpp5
-rw-r--r--src/android/camera_stream.cpp5
-rw-r--r--src/android/camera_stream.h5
-rw-r--r--src/android/jpeg/post_processor_jpeg.cpp6
-rw-r--r--src/android/jpeg/post_processor_jpeg.h3
-rw-r--r--src/android/post_processor.h5
-rw-r--r--src/android/yuv/post_processor_yuv.cpp3
-rw-r--r--src/android/yuv/post_processor_yuv.h3
8 files changed, 15 insertions, 20 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 38132cbd..a8c66a79 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1153,9 +1153,8 @@ void CameraDevice::requestComplete(Request *request)
continue;
}
- int ret = cameraStream->process(*src, buffer,
- descriptor->settings_,
- descriptor->resultMetadata_.get());
+ int ret = cameraStream->process(*src, buffer, descriptor);
+
/*
* Return the FrameBuffer to the CameraStream now that we're
* done processing it.
diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp
index 3b96d2e9..8f47e4d8 100644
--- a/src/android/camera_stream.cpp
+++ b/src/android/camera_stream.cpp
@@ -144,8 +144,7 @@ int CameraStream::waitFence(int fence)
int CameraStream::process(const FrameBuffer &source,
camera3_stream_buffer_t &camera3Dest,
- const CameraMetadata &requestMetadata,
- CameraMetadata *resultMetadata)
+ Camera3RequestDescriptor *request)
{
/* Handle waiting on fences on the destination buffer. */
int fence = camera3Dest.acquire_fence;
@@ -175,7 +174,7 @@ int CameraStream::process(const FrameBuffer &source,
return -EINVAL;
}
- return postProcessor_->process(source, &dest, requestMetadata, resultMetadata);
+ return postProcessor_->process(source, &dest, request);
}
FrameBuffer *CameraStream::getBuffer()
diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h
index 03ecfa94..405b232d 100644
--- a/src/android/camera_stream.h
+++ b/src/android/camera_stream.h
@@ -19,8 +19,8 @@
#include <libcamera/geometry.h>
#include <libcamera/pixel_format.h>
+class Camera3RequestDescriptor;
class CameraDevice;
-class CameraMetadata;
class PostProcessor;
class CameraStream
@@ -120,8 +120,7 @@ public:
int configure();
int process(const libcamera::FrameBuffer &source,
camera3_stream_buffer_t &camera3Buffer,
- const CameraMetadata &requestMetadata,
- CameraMetadata *resultMetadata);
+ Camera3RequestDescriptor *request);
libcamera::FrameBuffer *getBuffer();
void putBuffer(libcamera::FrameBuffer *buffer);
diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp
index f6d47f63..699576ef 100644
--- a/src/android/jpeg/post_processor_jpeg.cpp
+++ b/src/android/jpeg/post_processor_jpeg.cpp
@@ -11,6 +11,7 @@
#include "../camera_device.h"
#include "../camera_metadata.h"
+#include "../camera_request.h"
#include "encoder_libjpeg.h"
#include "exif.h"
@@ -99,14 +100,15 @@ void PostProcessorJpeg::generateThumbnail(const FrameBuffer &source,
int PostProcessorJpeg::process(const FrameBuffer &source,
CameraBuffer *destination,
- const CameraMetadata &requestMetadata,
- CameraMetadata *resultMetadata)
+ Camera3RequestDescriptor *request)
{
if (!encoder_)
return 0;
ASSERT(destination->numPlanes() == 1);
+ const CameraMetadata &requestMetadata = request->settings_;
+ CameraMetadata *resultMetadata = request->resultMetadata_.get();
camera_metadata_ro_entry_t entry;
int ret;
diff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h
index 6fd31022..0184d77e 100644
--- a/src/android/jpeg/post_processor_jpeg.h
+++ b/src/android/jpeg/post_processor_jpeg.h
@@ -24,8 +24,7 @@ public:
const libcamera::StreamConfiguration &outcfg) override;
int process(const libcamera::FrameBuffer &source,
CameraBuffer *destination,
- const CameraMetadata &requestMetadata,
- CameraMetadata *resultMetadata) override;
+ Camera3RequestDescriptor *request) override;
private:
void generateThumbnail(const libcamera::FrameBuffer &source,
diff --git a/src/android/post_processor.h b/src/android/post_processor.h
index ab2b2c60..27eaef88 100644
--- a/src/android/post_processor.h
+++ b/src/android/post_processor.h
@@ -12,7 +12,7 @@
#include "camera_buffer.h"
-class CameraMetadata;
+class Camera3RequestDescriptor;
class PostProcessor
{
@@ -23,8 +23,7 @@ public:
const libcamera::StreamConfiguration &outCfg) = 0;
virtual int process(const libcamera::FrameBuffer &source,
CameraBuffer *destination,
- const CameraMetadata &requestMetadata,
- CameraMetadata *resultMetadata) = 0;
+ Camera3RequestDescriptor *request) = 0;
};
#endif /* __ANDROID_POST_PROCESSOR_H__ */
diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp
index 7b3b4960..8110a1f1 100644
--- a/src/android/yuv/post_processor_yuv.cpp
+++ b/src/android/yuv/post_processor_yuv.cpp
@@ -51,8 +51,7 @@ int PostProcessorYuv::configure(const StreamConfiguration &inCfg,
int PostProcessorYuv::process(const FrameBuffer &source,
CameraBuffer *destination,
- [[maybe_unused]] const CameraMetadata &requestMetadata,
- [[maybe_unused]] CameraMetadata *metadata)
+ [[maybe_unused]] Camera3RequestDescriptor *request)
{
if (!isValidBuffers(source, *destination))
return -EINVAL;
diff --git a/src/android/yuv/post_processor_yuv.h b/src/android/yuv/post_processor_yuv.h
index 12f7af07..a4e0ff5d 100644
--- a/src/android/yuv/post_processor_yuv.h
+++ b/src/android/yuv/post_processor_yuv.h
@@ -20,8 +20,7 @@ public:
const libcamera::StreamConfiguration &outcfg) override;
int process(const libcamera::FrameBuffer &source,
CameraBuffer *destination,
- const CameraMetadata &requestMetadata,
- CameraMetadata *metadata) override;
+ Camera3RequestDescriptor *request) override;
private:
bool isValidBuffers(const libcamera::FrameBuffer &source,

Privacy Policy