Loading services/camera/libcameraservice/api1/client2/Parameters.cpp +31 −4 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include "Parameters.h" #include "system/camera.h" #include <android-base/properties.h> #include <android/hardware/ICamera.h> #include <media/MediaProfiles.h> #include <media/mediarecorder.h> Loading Loading @@ -1247,6 +1248,7 @@ status_t Parameters::buildFastInfo(CameraDeviceBase *device) { } } fastInfo.maxZslSize = maxPrivInputSize; fastInfo.usedZslSize = maxPrivInputSize; } else { fastInfo.maxZslSize = {0, 0}; } Loading Loading @@ -2047,12 +2049,33 @@ status_t Parameters::set(const String8& paramString) { slowJpegMode = false; Size pictureSize = { pictureWidth, pictureHeight }; int64_t minFrameDurationNs = getJpegStreamMinFrameDurationNs(pictureSize); if (previewFpsRange[1] > 1e9/minFrameDurationNs + FPS_MARGIN) { bool zslFrameRateSupported = false; int64_t jpegMinFrameDurationNs = getJpegStreamMinFrameDurationNs(pictureSize); if (previewFpsRange[1] > 1e9/jpegMinFrameDurationNs + FPS_MARGIN) { slowJpegMode = true; } if (isDeviceZslSupported || slowJpegMode || property_get_bool("camera.disable_zsl_mode", false)) { if (isZslReprocessPresent) { unsigned int firstApiLevel = android::base::GetUintProperty<unsigned int>("ro.product.first_api_level", 0); Size chosenSize; if ((firstApiLevel >= __ANDROID_API_S__) && !android::base::GetBoolProperty("ro.camera.enableCamera1MaxZsl", false)) { chosenSize = pictureSize; } else { // follow old behavior of keeping max zsl size as the input / output // zsl stream size chosenSize = fastInfo.maxZslSize; } int64_t zslMinFrameDurationNs = getZslStreamMinFrameDurationNs(chosenSize); if (zslMinFrameDurationNs > 0 && previewFpsRange[1] <= (1e9/zslMinFrameDurationNs + FPS_MARGIN)) { zslFrameRateSupported = true; fastInfo.usedZslSize = chosenSize; } } if (isDeviceZslSupported || slowJpegMode || !zslFrameRateSupported || android::base::GetBoolProperty("camera.disable_zsl_mode", false)) { allowZslMode = false; } else { allowZslMode = isZslReprocessPresent; Loading Loading @@ -3056,6 +3079,10 @@ int64_t Parameters::getJpegStreamMinFrameDurationNs(Parameters::Size size) { return getMinFrameDurationNs(size, HAL_PIXEL_FORMAT_BLOB); } int64_t Parameters::getZslStreamMinFrameDurationNs(Parameters::Size size) { return getMinFrameDurationNs(size, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED); } int64_t Parameters::getMinFrameDurationNs(Parameters::Size size, int fmt) { const int STREAM_DURATION_SIZE = 4; const int STREAM_FORMAT_OFFSET = 0; Loading services/camera/libcameraservice/api1/client2/Parameters.h +6 −0 Original line number Diff line number Diff line Loading @@ -248,6 +248,7 @@ struct Parameters { bool useFlexibleYuv; Size maxJpegSize; Size maxZslSize; Size usedZslSize; bool supportsPreferredConfigs; } fastInfo; Loading Loading @@ -426,6 +427,11 @@ private: // return -1 if input jpeg size cannot be found in supported size list int64_t getJpegStreamMinFrameDurationNs(Parameters::Size size); // Helper function to get minimum frame duration for a // IMPLEMENTATION_DEFINED stream of size 'size' // return -1 if input size cannot be found in supported size list int64_t getZslStreamMinFrameDurationNs(Parameters::Size size); // Helper function to get minimum frame duration for a size/format combination // return -1 if input size/format combination cannot be found. int64_t getMinFrameDurationNs(Parameters::Size size, int format); Loading services/camera/libcameraservice/api1/client2/ZslProcessor.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -235,8 +235,8 @@ status_t ZslProcessor::updateStream(const Parameters ¶ms) { } if (mInputStreamId == NO_STREAM) { res = device->createInputStream(params.fastInfo.maxZslSize.width, params.fastInfo.maxZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, res = device->createInputStream(params.fastInfo.usedZslSize.width, params.fastInfo.usedZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, /*isMultiResolution*/false, &mInputStreamId); if (res != OK) { ALOGE("%s: Camera %d: Can't create input stream: " Loading @@ -258,8 +258,8 @@ status_t ZslProcessor::updateStream(const Parameters ¶ms) { mProducer->setName(String8("Camera2-ZslRingBufferConsumer")); sp<Surface> outSurface = new Surface(producer); res = device->createStream(outSurface, params.fastInfo.maxZslSize.width, params.fastInfo.maxZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, res = device->createStream(outSurface, params.fastInfo.usedZslSize.width, params.fastInfo.usedZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, HAL_DATASPACE_UNKNOWN, CAMERA_STREAM_ROTATION_0, &mZslStreamId, String8(), std::unordered_set<int32_t>{ANDROID_SENSOR_PIXEL_MODE_DEFAULT}); if (res != OK) { Loading Loading
services/camera/libcameraservice/api1/client2/Parameters.cpp +31 −4 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ #include "Parameters.h" #include "system/camera.h" #include <android-base/properties.h> #include <android/hardware/ICamera.h> #include <media/MediaProfiles.h> #include <media/mediarecorder.h> Loading Loading @@ -1247,6 +1248,7 @@ status_t Parameters::buildFastInfo(CameraDeviceBase *device) { } } fastInfo.maxZslSize = maxPrivInputSize; fastInfo.usedZslSize = maxPrivInputSize; } else { fastInfo.maxZslSize = {0, 0}; } Loading Loading @@ -2047,12 +2049,33 @@ status_t Parameters::set(const String8& paramString) { slowJpegMode = false; Size pictureSize = { pictureWidth, pictureHeight }; int64_t minFrameDurationNs = getJpegStreamMinFrameDurationNs(pictureSize); if (previewFpsRange[1] > 1e9/minFrameDurationNs + FPS_MARGIN) { bool zslFrameRateSupported = false; int64_t jpegMinFrameDurationNs = getJpegStreamMinFrameDurationNs(pictureSize); if (previewFpsRange[1] > 1e9/jpegMinFrameDurationNs + FPS_MARGIN) { slowJpegMode = true; } if (isDeviceZslSupported || slowJpegMode || property_get_bool("camera.disable_zsl_mode", false)) { if (isZslReprocessPresent) { unsigned int firstApiLevel = android::base::GetUintProperty<unsigned int>("ro.product.first_api_level", 0); Size chosenSize; if ((firstApiLevel >= __ANDROID_API_S__) && !android::base::GetBoolProperty("ro.camera.enableCamera1MaxZsl", false)) { chosenSize = pictureSize; } else { // follow old behavior of keeping max zsl size as the input / output // zsl stream size chosenSize = fastInfo.maxZslSize; } int64_t zslMinFrameDurationNs = getZslStreamMinFrameDurationNs(chosenSize); if (zslMinFrameDurationNs > 0 && previewFpsRange[1] <= (1e9/zslMinFrameDurationNs + FPS_MARGIN)) { zslFrameRateSupported = true; fastInfo.usedZslSize = chosenSize; } } if (isDeviceZslSupported || slowJpegMode || !zslFrameRateSupported || android::base::GetBoolProperty("camera.disable_zsl_mode", false)) { allowZslMode = false; } else { allowZslMode = isZslReprocessPresent; Loading Loading @@ -3056,6 +3079,10 @@ int64_t Parameters::getJpegStreamMinFrameDurationNs(Parameters::Size size) { return getMinFrameDurationNs(size, HAL_PIXEL_FORMAT_BLOB); } int64_t Parameters::getZslStreamMinFrameDurationNs(Parameters::Size size) { return getMinFrameDurationNs(size, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED); } int64_t Parameters::getMinFrameDurationNs(Parameters::Size size, int fmt) { const int STREAM_DURATION_SIZE = 4; const int STREAM_FORMAT_OFFSET = 0; Loading
services/camera/libcameraservice/api1/client2/Parameters.h +6 −0 Original line number Diff line number Diff line Loading @@ -248,6 +248,7 @@ struct Parameters { bool useFlexibleYuv; Size maxJpegSize; Size maxZslSize; Size usedZslSize; bool supportsPreferredConfigs; } fastInfo; Loading Loading @@ -426,6 +427,11 @@ private: // return -1 if input jpeg size cannot be found in supported size list int64_t getJpegStreamMinFrameDurationNs(Parameters::Size size); // Helper function to get minimum frame duration for a // IMPLEMENTATION_DEFINED stream of size 'size' // return -1 if input size cannot be found in supported size list int64_t getZslStreamMinFrameDurationNs(Parameters::Size size); // Helper function to get minimum frame duration for a size/format combination // return -1 if input size/format combination cannot be found. int64_t getMinFrameDurationNs(Parameters::Size size, int format); Loading
services/camera/libcameraservice/api1/client2/ZslProcessor.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -235,8 +235,8 @@ status_t ZslProcessor::updateStream(const Parameters ¶ms) { } if (mInputStreamId == NO_STREAM) { res = device->createInputStream(params.fastInfo.maxZslSize.width, params.fastInfo.maxZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, res = device->createInputStream(params.fastInfo.usedZslSize.width, params.fastInfo.usedZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, /*isMultiResolution*/false, &mInputStreamId); if (res != OK) { ALOGE("%s: Camera %d: Can't create input stream: " Loading @@ -258,8 +258,8 @@ status_t ZslProcessor::updateStream(const Parameters ¶ms) { mProducer->setName(String8("Camera2-ZslRingBufferConsumer")); sp<Surface> outSurface = new Surface(producer); res = device->createStream(outSurface, params.fastInfo.maxZslSize.width, params.fastInfo.maxZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, res = device->createStream(outSurface, params.fastInfo.usedZslSize.width, params.fastInfo.usedZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, HAL_DATASPACE_UNKNOWN, CAMERA_STREAM_ROTATION_0, &mZslStreamId, String8(), std::unordered_set<int32_t>{ANDROID_SENSOR_PIXEL_MODE_DEFAULT}); if (res != OK) { Loading