summaryrefslogtreecommitdiff
path: root/devices
diff options
context:
space:
mode:
authorEmilian Peev <epeev@google.com>2020-01-18 19:05:54 -0800
committerEmilian Peev <epeev@google.com>2020-01-20 11:27:58 -0800
commite58c696d11e5d8650764735b3e9185dea6503662 (patch)
treeeddb1e369e982eed5b2b3e990be6604eb870993b /devices
parent306bd67f37df97e29603f3bedc847d8602acef19 (diff)
downloadcamera-e58c696d11e5d8650764735b3e9185dea6503662.tar.gz
EmulatedCamera: Clamp U/V planes during encoding
The jpeg encoder will process the input YUV in batches. The height can be padded at the end so it can be aligned with the batch size. The padding must consist of the very last line of the respective input buffer plane. This requirement must be fulfilled for all planes including U/V. Test: Camera CTS Bug: 148018763 Change-Id: I47a1e28d9a29db82a27a93b349ac03aed5aa1b3b
Diffstat (limited to 'devices')
-rw-r--r--devices/EmulatedCamera/hwl/JpegCompressor.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/devices/EmulatedCamera/hwl/JpegCompressor.cpp b/devices/EmulatedCamera/hwl/JpegCompressor.cpp
index 3f29867..7a512b3 100644
--- a/devices/EmulatedCamera/hwl/JpegCompressor.cpp
+++ b/devices/EmulatedCamera/hwl/JpegCompressor.cpp
@@ -337,6 +337,7 @@ size_t JpegCompressor::CompressYUV420Frame(YUV420Frame frame) {
int li = std::min(i, cinfo->image_height - 1);
y_lines[i] = static_cast<JSAMPROW>(py + li * frame.yuv_planes.y_stride);
if (i < padded_height / c_vsub_sampling) {
+ li = std::min(i, (cinfo->image_height - 1) / c_vsub_sampling);
cr_lines[i] =
static_cast<JSAMPROW>(pcr + li * frame.yuv_planes.cbcr_stride);
cb_lines[i] =