From patchwork Tue Jul 21 22:01:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 8914 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 ACE21C2E68 for ; Tue, 21 Jul 2020 22:01:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7A48C609C6; Wed, 22 Jul 2020 00:01:38 +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="Svj7XbPq"; 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 2724160948 for ; Wed, 22 Jul 2020 00:01:33 +0200 (CEST) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 897831299; Wed, 22 Jul 2020 00:01:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1595368892; bh=LCrMLvsUn9JLcZDYM8uiorYJgASmezU9eYP0VlSs79E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Svj7XbPqhnOf7TKXA6xMAW9nzHYA97vNTbsbbho/UFqL3W4eardw0uw0ZI5lrWsdt mIGBlTg/i3URs1FrDqSTs+KAODlBt7fbyyqwroz93OBfMLW1HTFyN9Npg7NWmjyFJH nbyb7BY51pAilNPMaqCsSucU39eY1kAcRCTpkdKw= From: Kieran Bingham To: libcamera devel Date: Tue, 21 Jul 2020 23:01:25 +0100 Message-Id: <20200721220126.202065-6-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200721220126.202065-1-kieran.bingham@ideasonboard.com> References: <20200721220126.202065-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 5/6] [HACK]: android: camera_device: Define JPEG size and quality 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" Providing these two keys allows the camera application to capture without crashing. It does not /succeed/ but it doesn't crash. The camera application and cros-camera-test still need exif information to be able to successfully capture or pass the tests. These metadata values are hardcoded, as there is not yet an easy way to add dynamic data to the request metadata. I would like to see all of the infrastructure around adding request metadata support a more dynamic means of addition, which blocks easily adding and updating key value pairs otherwise. But as all of that is a lot of work, here's a hack-ity work around for the time being. Otherwise no form of the JPEG series will ever be posted. Please don't review this. ;-) Signed-off-by: Kieran Bingham --- src/android/camera_device.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 7323d4e58f68..23dde1cfaf98 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -846,6 +846,8 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() ANDROID_SENSOR_EXPOSURE_TIME, ANDROID_STATISTICS_LENS_SHADING_MAP_MODE, ANDROID_STATISTICS_SCENE_FLICKER, + ANDROID_JPEG_SIZE, + ANDROID_JPEG_QUALITY, }; staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, availableResultKeys.data(), @@ -1444,10 +1446,10 @@ std::unique_ptr CameraDevice::getResultMetadata(int frame_number { /* * \todo Keep this in sync with the actual number of entries. - * Currently: 12 entries, 36 bytes + * Currently: 17 entries, 58 bytes */ std::unique_ptr resultMetadata = - std::make_unique(15, 50); + std::make_unique(17, 58); if (!resultMetadata->isValid()) { LOG(HAL, Error) << "Failed to allocate static metadata"; return nullptr; @@ -1497,6 +1499,14 @@ std::unique_ptr CameraDevice::getResultMetadata(int frame_number resultMetadata->addEntry(ANDROID_STATISTICS_SCENE_FLICKER, &scene_flicker, 1); + const uint32_t jpeg_size = 1 << 13; + resultMetadata->addEntry(ANDROID_JPEG_SIZE, + &jpeg_size, 1); + + const uint32_t jpeg_quality = 95; + resultMetadata->addEntry(ANDROID_JPEG_QUALITY, + &jpeg_quality, 1); + /* * Return the result metadata pack even is not valid: get() will return * nullptr.