From patchwork Thu Sep 16 09:51:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13859 X-Patchwork-Delegate: paul.elder@ideasonboard.com Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7B1C7BF01C for ; Thu, 16 Sep 2021 09:51:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CC31969186; Thu, 16 Sep 2021 11:51:21 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Aiebl/T9"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6B5FB69181 for ; Thu, 16 Sep 2021 11:51:20 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A89C22A5; Thu, 16 Sep 2021 11:51:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631785879; bh=LKOtPhlzBv5P8nIaswy3WDoyMdWHiGH01Zi9LP2XSVE=; h=From:To:Cc:Subject:Date:From; b=Aiebl/T9IECNsmkSD/toh33pvHhVcao6zkeCXVv7sPfH7ViytKD7waMcf2ttb7esz N0+A3ddoePFRhJ9ZijjeurLQrDXD0v8WnFBEU1okKrP05xBAiGtcsOB4KLZWgF2te9 M5sI+NBjiWwTh4B+lTs76jhl+BcXqZi5jDqdfXVw= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 16 Sep 2021 18:51:09 +0900 Message-Id: <20210916095109.3500965-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] android: Plumb lens filter density X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Plumb the lens filter density android control through the HAL. Hardcode the template and result controls to zero, and ignore the request control. Report only the zero filter density in the static metadata. Signed-off-by: Paul Elder --- src/android/camera_capabilities.cpp | 11 +++++++++++ src/android/camera_device.cpp | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index cf0ce0b3..40b74274 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -734,6 +734,7 @@ int CameraCapabilities::initializeStaticMetadata() ANDROID_JPEG_MAX_SIZE, ANDROID_LENS_FACING, ANDROID_LENS_INFO_AVAILABLE_APERTURES, + ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES, ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS, ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION, ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION, @@ -787,6 +788,7 @@ int CameraCapabilities::initializeStaticMetadata() ANDROID_JPEG_THUMBNAIL_QUALITY, ANDROID_JPEG_THUMBNAIL_SIZE, ANDROID_LENS_APERTURE, + ANDROID_LENS_FILTER_DENSITY, ANDROID_LENS_OPTICAL_STABILIZATION_MODE, ANDROID_NOISE_REDUCTION_MODE, ANDROID_SCALER_CROP_REGION, @@ -824,6 +826,7 @@ int CameraCapabilities::initializeStaticMetadata() ANDROID_JPEG_THUMBNAIL_QUALITY, ANDROID_JPEG_THUMBNAIL_SIZE, ANDROID_LENS_APERTURE, + ANDROID_LENS_FILTER_DENSITY, ANDROID_LENS_FOCAL_LENGTH, ANDROID_LENS_FOCUS_DISTANCE, ANDROID_LENS_OPTICAL_STABILIZATION_MODE, @@ -1241,6 +1244,11 @@ int CameraCapabilities::initializeStaticMetadata() staticMetadata_->addEntry(ANDROID_LENS_INFO_AVAILABLE_APERTURES, lensApertures); + /* Only required for FULL, but it's hardcoded anyway. */ + std::vector availableFilterDensities = { 0 }; + staticMetadata_->addEntry(ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES, + availableFilterDensities); + uint8_t lensFacing; switch (facing_) { default: @@ -1543,6 +1551,9 @@ std::unique_ptr CameraCapabilities::requestTemplatePreview() con float lensAperture = 2.53 / 100; requestTemplate->addEntry(ANDROID_LENS_APERTURE, lensAperture); + float filterDensity = 0.0f; + requestTemplate->addEntry(ANDROID_LENS_FILTER_DENSITY, filterDensity); + uint8_t opticalStabilization = ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF; requestTemplate->addEntry(ANDROID_LENS_OPTICAL_STABILIZATION_MODE, opticalStabilization); diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index c1f8847f..724b39b1 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1428,6 +1428,9 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons if (settings.getEntry(ANDROID_LENS_APERTURE, &entry)) resultMetadata->addEntry(ANDROID_LENS_APERTURE, entry.data.f, 1); + float filterDensity = 0.0f; + resultMetadata->addEntry(ANDROID_LENS_FILTER_DENSITY, filterDensity); + float focal_length = 1.0; resultMetadata->addEntry(ANDROID_LENS_FOCAL_LENGTH, focal_length);