From patchwork Tue Sep 7 06:01:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13709 X-Patchwork-Delegate: umang.jain@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 04FB4BDC71 for ; Tue, 7 Sep 2021 06:01:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 66F9E6916C; Tue, 7 Sep 2021 08:01:54 +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="C10jaiET"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F4BD69168 for ; Tue, 7 Sep 2021 08:01:52 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.180]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C7582499; Tue, 7 Sep 2021 08:01:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1630994511; bh=T8P5omgSbIbYVbHyDNTLeEpJaIfDQA8VlrI5LPqnjf4=; h=From:To:Cc:Subject:Date:From; b=C10jaiETUfiqqZfGbw/ckpUGJZfZaMWou2bl1XebI1vBB1AdpSVLBg49AdnedwEEn IiOhiFpeKPVZF0VKEgtusaTSJT4HEkcUqli28LDGZLPVe/htgLvN760x8EpjWv9ZMm oB4on6Z7eL01mhaDbXYEsj5dE3vgRhxIpVNs/XVw= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Tue, 7 Sep 2021 11:31:45 +0530 Message-Id: <20210907060145.97676-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] wip: android: Fix generation of EXIF thumbnail 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" Generation of EXIF thumbnail seems to have regressed due to 1264628d3c92("android: jpeg: Configure thumbnailer based on request metadata"). The patch tries to fix the issue of ANDROID_JPEG_THUMBNAIL_SIZE not being available in request metadata template. However, there are a few open questions marked as comments in the patch, which should be addressed before merging the fix. Signed-off-by: Umang Jain --- src/android/camera_capabilities.cpp | 17 ++++++++++++++++- src/android/jpeg/post_processor_jpeg.cpp | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index e92bca42..e7f91020 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -951,7 +951,7 @@ int CameraCapabilities::initializeStaticMetadata() */ constexpr Size maxJpegThumbnail(160, 160); std::vector thumbnailSizes; - thumbnailSizes.push_back({ 0, 0 }); + // thumbnailSizes.push_back({ 0, 0 }); not sure why this was added in first place? for (const auto &entry : streamConfigurations_) { if (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB) continue; @@ -1364,6 +1364,21 @@ std::unique_ptr CameraCapabilities::requestTemplatePreview() con requestTemplate->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, entry.data.i32, 2); + /* + * Get Thumbnail sizes from static metadata and add to template. + * + * \todo Make sure you update entry size and byte size above to + * incorporate this. + */ + found = staticMetadata_->getEntry(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES, + &entry); + if (!found) { + LOG(HAL, Error) << "ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES not found"; + // return here? + } + requestTemplate->addEntry(ANDROID_JPEG_THUMBNAIL_SIZE, + entry.data.i32, 2); + uint8_t aeMode = ANDROID_CONTROL_AE_MODE_ON; requestTemplate->addEntry(ANDROID_CONTROL_AE_MODE, aeMode); diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp index 3160a784..2671a1ab 100644 --- a/src/android/jpeg/post_processor_jpeg.cpp +++ b/src/android/jpeg/post_processor_jpeg.cpp @@ -150,6 +150,7 @@ int PostProcessorJpeg::process(const FrameBuffer &source, generateThumbnail(source, thumbnailSize, quality, &thumbnail); if (!thumbnail.empty()) exif.setThumbnail(thumbnail, Exif::Compression::JPEG); + LOG(JPEG, Info) << "====THUMBNAIL GENERATED AND SET===="; } resultMetadata->addEntry(ANDROID_JPEG_THUMBNAIL_SIZE, data, 2);