Message ID | 20210126173008.446321-6-jacopo@jmondi.org |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Jacopo, Thank you for the patch. On Tue, Jan 26, 2021 at 06:30:07PM +0100, Jacopo Mondi wrote: > The request template returned by requestTemplatePreview() uses an > arbitrary {15, 30} Auto-Exposure algorithm FPS range. Use the one > calculated at static metadata creation time, which is consistent with > the camera limits. > > Once template generation will be performed inspecting the requested > capture intent, the FPS range over which the AE algorithm can range > shall be tuned accordingly. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > src/android/camera_device.cpp | 26 ++++++++++++++++++++------ > 1 file changed, 20 insertions(+), 6 deletions(-) > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > index 5a8072a8a007..f3f59f7dcb77 100644 > --- a/src/android/camera_device.cpp > +++ b/src/android/camera_device.cpp > @@ -1339,12 +1339,26 @@ CameraMetadata *CameraDevice::requestTemplatePreview() > requestTemplate->addEntry(ANDROID_CONTROL_AE_LOCK, > &aeLock, 1); > > - std::vector<int32_t> aeFpsTarget = { > - 15, 30, > - }; > - requestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, > - aeFpsTarget.data(), > - aeFpsTarget.size()); > + /* Get the FPS range registered in the static metadata. */ > + camera_metadata_ro_entry_t entry; > + bool found = staticMetadata_->getEntry(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, > + &entry); > + if (found) { > + /* > + * \todo Depending on the requested CaptureIntent, the FPS range > + * needs to be adjusted. For example, the capture template for > + * video capture intent shall report a fixed value. > + * > + * Also assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata > + * has been assembled as {{min, max} {max, max}}. > + */ > + const int32_t *data = entry.data.i32; > + std::vector<int32_t> aeFpsTarget = { std::array<int32_t, 2> will be more efficient. > + data[0], data[1], > + }; > + requestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, > + aeFpsTarget.data(), aeFpsTarget.size()); But you could even write requestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, entry.data.i32, 2); Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + } > > uint8_t aeAntibandingMode = ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO; > requestTemplate->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE,
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 5a8072a8a007..f3f59f7dcb77 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1339,12 +1339,26 @@ CameraMetadata *CameraDevice::requestTemplatePreview() requestTemplate->addEntry(ANDROID_CONTROL_AE_LOCK, &aeLock, 1); - std::vector<int32_t> aeFpsTarget = { - 15, 30, - }; - requestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, - aeFpsTarget.data(), - aeFpsTarget.size()); + /* Get the FPS range registered in the static metadata. */ + camera_metadata_ro_entry_t entry; + bool found = staticMetadata_->getEntry(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, + &entry); + if (found) { + /* + * \todo Depending on the requested CaptureIntent, the FPS range + * needs to be adjusted. For example, the capture template for + * video capture intent shall report a fixed value. + * + * Also assume the AE_AVAILABLE_TARGET_FPS_RANGE static metadata + * has been assembled as {{min, max} {max, max}}. + */ + const int32_t *data = entry.data.i32; + std::vector<int32_t> aeFpsTarget = { + data[0], data[1], + }; + requestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, + aeFpsTarget.data(), aeFpsTarget.size()); + } uint8_t aeAntibandingMode = ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO; requestTemplate->addEntry(ANDROID_CONTROL_AE_ANTIBANDING_MODE,
The request template returned by requestTemplatePreview() uses an arbitrary {15, 30} Auto-Exposure algorithm FPS range. Use the one calculated at static metadata creation time, which is consistent with the camera limits. Once template generation will be performed inspecting the requested capture intent, the FPS range over which the AE algorithm can range shall be tuned accordingly. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- src/android/camera_device.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)