Message ID | 20210105190522.682324-9-jacopo@jmondi.org |
---|---|
State | Accepted |
Delegated to: | Jacopo Mondi |
Headers | show |
Series |
|
Related | show |
Hi Jacopo, Thank you for the patch. On Tue, Jan 05, 2021 at 08:05:18PM +0100, Jacopo Mondi wrote: > Register the ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM static metadata > inspecting the ScalerCrop control's limits. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > src/android/camera_device.cpp | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > index e6cee75581f2..99297270598f 100644 > --- a/src/android/camera_device.cpp > +++ b/src/android/camera_device.cpp > @@ -1011,9 +1011,26 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() > } > > /* Scaler static metadata. */ > - float maxDigitalZoom = 1; > - staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, > - &maxDigitalZoom, 1); > + { > + /* > + * \todo The digital zoom factor is a property that depends > + * on the desired output configuration and the sensor frame size > + * input to the ISP. These information are not available to the s/These information/This information/ > + * Android HAL, not at initialization time at least. > + * > + * Rely on pipeline handlers initializing the ScalerCrop control Maybe "As a workaround, rely for now on ..." ? > + * with the camera default configuration and use the maximum > + * and minimum crop rectangles to calculate the digital zoom > + * factor. > + */ > + const auto info = controlsInfo.find(&controls::ScalerCrop); > + Rectangle min = info->second.min().get<Rectangle>(); > + Rectangle max = info->second.max().get<Rectangle>(); > + float maxZoom = std::min<float>(1.0f * max.width / min.width, > + 1.0f * max.height / min.height); As both arguments are float, you can drop the <float>. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, > + &maxZoom, 1); > + } > > std::vector<uint32_t> availableStreamConfigurations; > availableStreamConfigurations.reserve(streamConfigurations_.size() * 4);
Hi Jacopo, Thanks for your work. On 2021-01-05 20:05:18 +0100, Jacopo Mondi wrote: > Register the ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM static metadata > inspecting the ScalerCrop control's limits. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > src/android/camera_device.cpp | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp > index e6cee75581f2..99297270598f 100644 > --- a/src/android/camera_device.cpp > +++ b/src/android/camera_device.cpp > @@ -1011,9 +1011,26 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() > } > > /* Scaler static metadata. */ > - float maxDigitalZoom = 1; > - staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, > - &maxDigitalZoom, 1); > + { > + /* > + * \todo The digital zoom factor is a property that depends > + * on the desired output configuration and the sensor frame size > + * input to the ISP. These information are not available to the > + * Android HAL, not at initialization time at least. > + * > + * Rely on pipeline handlers initializing the ScalerCrop control > + * with the camera default configuration and use the maximum > + * and minimum crop rectangles to calculate the digital zoom > + * factor. > + */ > + const auto info = controlsInfo.find(&controls::ScalerCrop); > + Rectangle min = info->second.min().get<Rectangle>(); > + Rectangle max = info->second.max().get<Rectangle>(); > + float maxZoom = std::min<float>(1.0f * max.width / min.width, > + 1.0f * max.height / min.height); > + staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, > + &maxZoom, 1); > + } > > std::vector<uint32_t> availableStreamConfigurations; > availableStreamConfigurations.reserve(streamConfigurations_.size() * 4); > -- > 2.29.2 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index e6cee75581f2..99297270598f 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1011,9 +1011,26 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() } /* Scaler static metadata. */ - float maxDigitalZoom = 1; - staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, - &maxDigitalZoom, 1); + { + /* + * \todo The digital zoom factor is a property that depends + * on the desired output configuration and the sensor frame size + * input to the ISP. These information are not available to the + * Android HAL, not at initialization time at least. + * + * Rely on pipeline handlers initializing the ScalerCrop control + * with the camera default configuration and use the maximum + * and minimum crop rectangles to calculate the digital zoom + * factor. + */ + const auto info = controlsInfo.find(&controls::ScalerCrop); + Rectangle min = info->second.min().get<Rectangle>(); + Rectangle max = info->second.max().get<Rectangle>(); + float maxZoom = std::min<float>(1.0f * max.width / min.width, + 1.0f * max.height / min.height); + staticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, + &maxZoom, 1); + } std::vector<uint32_t> availableStreamConfigurations; availableStreamConfigurations.reserve(streamConfigurations_.size() * 4);
Register the ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM static metadata inspecting the ScalerCrop control's limits. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- src/android/camera_device.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)