[libcamera-devel] [PATCH] android: yuv: Fix wrong access of source buffer
Hirokazu Honda
hiroh at chromium.org
Thu Aug 5 15:28:05 CEST 2021
File descriptors of FrameBuffer given in PostProcessor::process()
for all the planes point the same buffer. To access the beginning
of the second or later plane, it is necessary to add offsets to
the beginning of the buffer.
Fix the wrong access to the second plane of NV12 in
PostProcessorYuv.
Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
---
src/android/yuv/post_processor_yuv.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/android/yuv/post_processor_yuv.cpp b/src/android/yuv/post_processor_yuv.cpp
index 772e805b..3b801e96 100644
--- a/src/android/yuv/post_processor_yuv.cpp
+++ b/src/android/yuv/post_processor_yuv.cpp
@@ -62,9 +62,12 @@ int PostProcessorYuv::process(const FrameBuffer &source,
return -EINVAL;
}
- int ret = libyuv::NV12Scale(sourceMapped.maps()[0].data(),
+ const uint8_t *sourceY = sourceMapped.maps()[0].data();
+ const uint8_t *sourceUV = sourceY + sourceStride_[0] * sourceSize_.height;
+
+ int ret = libyuv::NV12Scale(sourceY,
sourceStride_[0],
- sourceMapped.maps()[1].data(),
+ sourceUV,
sourceStride_[1],
sourceSize_.width, sourceSize_.height,
destination->plane(0).data(),
--
2.32.0.554.ge1b32706d8-goog
More information about the libcamera-devel
mailing list