summaryrefslogtreecommitdiff
path: root/src/android/jpeg
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2021-01-28 22:42:15 +0000
committerJacopo Mondi <jacopo@jmondi.org>2021-02-02 19:14:14 +0100
commitfb9051ff7407d6e1abcfafb40a951f55c38dafe9 (patch)
tree42c05fe8a0931e60542f4da23af41332e1f9ad19 /src/android/jpeg
parentbc6440792bbae533a4f9a5837dbed628ec664cc4 (diff)
android: post_processor: Change the type destination in process()
The type of the destination buffer in PostProcessor::process() is libcamera::Span. libcamera::Span is used for one dimension buffer (e.g. blob buffer). The destination can be multiple dimensions buffer (e.g. yuv frame). Therefore, this changes the type of the destination buffer to MappedFrameBuffer. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/jpeg')
-rw-r--r--src/android/jpeg/post_processor_jpeg.cpp7
-rw-r--r--src/android/jpeg/post_processor_jpeg.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp
index 1cbab30c..ab5b6384 100644
--- a/src/android/jpeg/post_processor_jpeg.cpp
+++ b/src/android/jpeg/post_processor_jpeg.cpp
@@ -83,7 +83,7 @@ void PostProcessorJpeg::generateThumbnail(const FrameBuffer &source,
}
int PostProcessorJpeg::process(const FrameBuffer &source,
- Span<uint8_t> destination,
+ libcamera::MappedBuffer *destination,
const CameraMetadata &requestMetadata,
CameraMetadata *resultMetadata)
{
@@ -172,7 +172,8 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
const uint8_t quality = ret ? *entry.data.u8 : 95;
resultMetadata->addEntry(ANDROID_JPEG_QUALITY, &quality, 1);
- int jpeg_size = encoder_->encode(source, destination, exif.data(), quality);
+ int jpeg_size = encoder_->encode(source, destination->maps()[0],
+ exif.data(), quality);
if (jpeg_size < 0) {
LOG(JPEG, Error) << "Failed to encode stream image";
return jpeg_size;
@@ -190,7 +191,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source,
* \todo Investigate if the buffer size mismatch is an issue or
* expected behaviour.
*/
- uint8_t *resultPtr = destination.data() +
+ uint8_t *resultPtr = destination->maps()[0].data() +
cameraDevice_->maxJpegBufferSize() -
sizeof(struct camera3_jpeg_blob);
auto *blob = reinterpret_cast<struct camera3_jpeg_blob *>(resultPtr);
diff --git a/src/android/jpeg/post_processor_jpeg.h b/src/android/jpeg/post_processor_jpeg.h
index d2dfa450..7689de73 100644
--- a/src/android/jpeg/post_processor_jpeg.h
+++ b/src/android/jpeg/post_processor_jpeg.h
@@ -25,7 +25,7 @@ public:
int configure(const libcamera::StreamConfiguration &incfg,
const libcamera::StreamConfiguration &outcfg) override;
int process(const libcamera::FrameBuffer &source,
- libcamera::Span<uint8_t> destination,
+ libcamera::MappedBuffer *destination,
const CameraMetadata &requestMetadata,
CameraMetadata *resultMetadata) override;