Camera: use proper input size in ZslProcessor

Test: API1 CTS + partner testing
Bug: 79405555
Change-Id: Idba9233aa671beda7bceaa3d0181706df2610012
gugelfrei
Yin-Chia Yeh 6 years ago
parent 527da4c9d3
commit 66814d4c3b

@ -1215,6 +1215,35 @@ status_t Parameters::buildFastInfo() {
fastInfo.maxJpegSize = getMaxSize(getAvailableJpegSizes());
isZslReprocessPresent = false;
camera_metadata_ro_entry_t availableCapabilities =
staticInfo(ANDROID_REQUEST_AVAILABLE_CAPABILITIES);
if (0 < availableCapabilities.count) {
const uint8_t *caps = availableCapabilities.data.u8;
for (size_t i = 0; i < availableCapabilities.count; i++) {
if (ANDROID_REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING ==
caps[i]) {
isZslReprocessPresent = true;
break;
}
}
}
if (isZslReprocessPresent) {
Vector<StreamConfiguration> scs = getStreamConfigurations();
Size maxPrivInputSize = {0, 0};
for (const auto& sc : scs) {
if (sc.isInput == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT &&
sc.format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
if (sc.width * sc.height > maxPrivInputSize.width * maxPrivInputSize.height) {
maxPrivInputSize = {sc.width, sc.height};
}
}
}
fastInfo.maxZslSize = maxPrivInputSize;
} else {
fastInfo.maxZslSize = {0, 0};
}
return OK;
}

@ -242,6 +242,7 @@ struct Parameters {
float minFocalLength;
bool useFlexibleYuv;
Size maxJpegSize;
Size maxZslSize;
} fastInfo;
// Quirks information; these are short-lived flags to enable workarounds for

@ -231,63 +231,9 @@ status_t ZslProcessor::updateStream(const Parameters &params) {
return INVALID_OPERATION;
}
if ((mZslStreamId != NO_STREAM) || (mInputStreamId != NO_STREAM)) {
// Check if stream parameters have to change
CameraDeviceBase::StreamInfo streamInfo;
res = device->getStreamInfo(mZslStreamId, &streamInfo);
if (res != OK) {
ALOGE("%s: Camera %d: Error querying capture output stream info: "
"%s (%d)", __FUNCTION__,
client->getCameraId(), strerror(-res), res);
return res;
}
if (streamInfo.width != (uint32_t)params.fastInfo.arrayWidth ||
streamInfo.height != (uint32_t)params.fastInfo.arrayHeight) {
if (mZslStreamId != NO_STREAM) {
ALOGV("%s: Camera %d: Deleting stream %d since the buffer "
"dimensions changed",
__FUNCTION__, client->getCameraId(), mZslStreamId);
res = device->deleteStream(mZslStreamId);
if (res == -EBUSY) {
ALOGV("%s: Camera %d: Device is busy, call updateStream again "
" after it becomes idle", __FUNCTION__, mId);
return res;
} else if(res != OK) {
ALOGE("%s: Camera %d: Unable to delete old output stream "
"for ZSL: %s (%d)", __FUNCTION__,
client->getCameraId(), strerror(-res), res);
return res;
}
mZslStreamId = NO_STREAM;
}
if (mInputStreamId != NO_STREAM) {
ALOGV("%s: Camera %d: Deleting stream %d since the buffer "
"dimensions changed",
__FUNCTION__, client->getCameraId(), mInputStreamId);
res = device->deleteStream(mInputStreamId);
if (res == -EBUSY) {
ALOGV("%s: Camera %d: Device is busy, call updateStream again "
" after it becomes idle", __FUNCTION__, mId);
return res;
} else if(res != OK) {
ALOGE("%s: Camera %d: Unable to delete old output stream "
"for ZSL: %s (%d)", __FUNCTION__,
client->getCameraId(), strerror(-res), res);
return res;
}
mInputStreamId = NO_STREAM;
}
if (nullptr != mInputProducer.get()) {
mInputProducer->disconnect(NATIVE_WINDOW_API_CPU);
mInputProducer.clear();
}
}
}
if (mInputStreamId == NO_STREAM) {
res = device->createInputStream(params.fastInfo.arrayWidth,
params.fastInfo.arrayHeight, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
res = device->createInputStream(params.fastInfo.maxZslSize.width,
params.fastInfo.maxZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
&mInputStreamId);
if (res != OK) {
ALOGE("%s: Camera %d: Can't create input stream: "
@ -309,8 +255,8 @@ status_t ZslProcessor::updateStream(const Parameters &params) {
mProducer->setName(String8("Camera2-ZslRingBufferConsumer"));
sp<Surface> outSurface = new Surface(producer);
res = device->createStream(outSurface, params.fastInfo.arrayWidth,
params.fastInfo.arrayHeight, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
res = device->createStream(outSurface, params.fastInfo.maxZslSize.width,
params.fastInfo.maxZslSize.height, HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
HAL_DATASPACE_UNKNOWN, CAMERA3_STREAM_ROTATION_0, &mZslStreamId,
String8());
if (res != OK) {

Loading…
Cancel
Save