diff options
author | Mansoor Aftab <maftab@codeaurora.org> | 2015-04-13 00:59:23 -0700 |
---|---|---|
committer | Zhijun He <zhijunhe@google.com> | 2015-04-13 08:54:31 -0700 |
commit | 72e2ca765b40dd3882d59a2e5349d690e2bec8c1 (patch) | |
tree | 43657b0020a3700e91c9c4f4a4b66d26d2ce291d /camera | |
parent | c5eaac4b8457c7292c76789fae02e132a92b3769 (diff) | |
download | shamu-72e2ca765b40dd3882d59a2e5349d690e2bec8c1.tar.gz |
Camera3: Match input stream size to larget output size
-Modify advertised i/p stream size to match largest output
-Relax code to safegaurd against multiple ZSL candidates
Change-Id: I94d44be719f205322e640e577855799c0b06c3d0
Diffstat (limited to 'camera')
-rw-r--r-- | camera/QCamera2/HAL3/QCamera3HWI.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp index 04fc86a7..aae104be 100644 --- a/camera/QCamera2/HAL3/QCamera3HWI.cpp +++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp @@ -669,16 +669,6 @@ int QCamera3HardwareInterface::validateStreamDimensions( case HAL_PIXEL_FORMAT_YCbCr_420_888: - if (inputStream) { - if (inputStream->format == newStream->format) { - if ((int32_t)(newStream->width) == - gCamCapability[mCameraId]->active_array_size.width - && (int32_t)(newStream->height) == - gCamCapability[mCameraId]->active_array_size.height) { - sizeFound = true; - } - } - } case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: default: /* ZSL stream will be full active array size validate that*/ @@ -950,7 +940,7 @@ int QCamera3HardwareInterface::configureStreams( return rc; } - camera3_stream_t *zslStream = NULL; + camera3_stream_t *zslStream = NULL; //Only use this for size and not actual handle! camera3_stream_t *jpegStream = NULL; cam_stream_size_info_t stream_config_info; memset(&stream_config_info, 0, sizeof(cam_stream_size_info_t)); @@ -1001,9 +991,14 @@ int QCamera3HardwareInterface::configureStreams( && inputStream->width == newStream->width && inputStream->height == newStream->height) { if (zslStream != NULL) { - ALOGE("%s: Multiple input/reprocess streams requested!", __func__); - pthread_mutex_unlock(&mMutex); - return BAD_VALUE; + /* This scenario indicates multiple YUV streams with same size + * as input stream have been requested, since zsl stream handle + * is solely use for the purpose of overriding the size of streams + * which share h/w streams we will just make a guess here as to + * which of the stream is a ZSL stream, this will be refactored + * once we make generic logic for streams sharing encoder output + */ + CDBG_HIGH("%s: Warning, Multiple ip/reprocess streams requested!", __func__); } zslStream = newStream; } @@ -1257,7 +1252,7 @@ int QCamera3HardwareInterface::configureStreams( /* This override is possible since the f/w gaurantees that the ZSL stream will always be the active array size in case of Bidirectional or will be limited to the max i/p stream size which we can control to - be equal to active array size + be equal to be the largest YUV/Opaque stream size */ mPictureChannel->overrideYuvSize(zslStream->width, zslStream->height); } else if (mPictureChannel && m_bIs4KVideo) { @@ -4382,16 +4377,11 @@ int QCamera3HardwareInterface::initStaticMetadata(int cameraId) } break; - /*For below to format we also support i/p streams for reprocessing advertise those*/ case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: case HAL_PIXEL_FORMAT_YCbCr_420_888: - available_stream_configs[idx] = scalar_formats[j]; - available_stream_configs[idx+1] = gCamCapability[cameraId]->active_array_size.width; - available_stream_configs[idx+2] = gCamCapability[cameraId]->active_array_size.height; - available_stream_configs[idx+3] = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT; - idx+=4; - /* Missing break;-) Continue to advertise o/p stream configs for these formats*/ default: + cam_dimension_t largest_picture_size; + memset(&largest_picture_size, 0, sizeof(cam_dimension_t)); for (int i = 0; i < gCamCapability[cameraId]->picture_sizes_tbl_cnt; i++) { available_stream_configs[idx] = scalar_formats[j]; @@ -4402,9 +4392,24 @@ int QCamera3HardwareInterface::initStaticMetadata(int cameraId) available_stream_configs[idx+3] = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT; idx+=4; - } + /* Book keep largest */ + if (gCamCapability[cameraId]->picture_sizes_tbl[i].width + >= largest_picture_size.width && + gCamCapability[cameraId]->picture_sizes_tbl[i].height + >= largest_picture_size.height) + largest_picture_size = gCamCapability[cameraId]->picture_sizes_tbl[i]; + } + /*For below 2 formats we also support i/p streams for reprocessing advertise those*/ + if (scalar_formats[j] == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED || + scalar_formats[j] == HAL_PIXEL_FORMAT_YCbCr_420_888) { + available_stream_configs[idx] = scalar_formats[j]; + available_stream_configs[idx+1] = largest_picture_size.width; + available_stream_configs[idx+2] = largest_picture_size.height; + available_stream_configs[idx+3] = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT; + idx+=4; + } break; } } |