From a69bf3c93974a6d22fe5c55d72022125d482e631 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Mon, 17 Apr 2023 12:52:28 -0700 Subject: [PATCH] Camera: Bump up the extension jpeg processor blob size Increase the Jpeg/blob buffer capacity from width * height to (width * height * 3) / 2 + JPEG APP1 segment size. Bug: 278153054 Test: Camera CTS Change-Id: Ib24fc01012ef3faf67e8b254561434575f180419 --- .../hardware/camera2/impl/CameraExtensionJpegProcessor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/android/hardware/camera2/impl/CameraExtensionJpegProcessor.java b/core/java/android/hardware/camera2/impl/CameraExtensionJpegProcessor.java index aee20db6783ef..e9777515ecdb1 100644 --- a/core/java/android/hardware/camera2/impl/CameraExtensionJpegProcessor.java +++ b/core/java/android/hardware/camera2/impl/CameraExtensionJpegProcessor.java @@ -46,6 +46,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; public class CameraExtensionJpegProcessor implements ICaptureProcessorImpl { public final static String TAG = "CameraExtensionJpeg"; private final static int JPEG_QUEUE_SIZE = 1; + private final static int JPEG_APP_SEGMENT_SIZE = 64 * 1024; private final Handler mHandler; private final HandlerThread mHandlerThread; @@ -225,9 +226,10 @@ public class CameraExtensionJpegProcessor implements ICaptureProcessorImpl { private void initializePipeline() throws RemoteException { if ((mFormat != -1) && (mOutputSurface != null) && (mResolution != null) && (mYuvReader == null)) { - // Jpeg/blobs are expected to be configured with (w*h)x1 + // Jpeg/blobs are expected to be configured with (w*h)x1.5 + 64k Jpeg APP1 segment mOutputWriter = ImageWriter.newInstance(mOutputSurface, 1 /*maxImages*/, - ImageFormat.JPEG, mResolution.width * mResolution.height, 1); + ImageFormat.JPEG, + (mResolution.width * mResolution.height * 3)/2 + JPEG_APP_SEGMENT_SIZE, 1); mYuvReader = ImageReader.newInstance(mResolution.width, mResolution.height, mFormat, JPEG_QUEUE_SIZE); mYuvReader.setOnImageAvailableListener(new YuvCallback(), mHandler);