From patchwork Fri Sep 10 10:47:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13809 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 61CF2BDB1D for ; Fri, 10 Sep 2021 10:47:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3065069170; Fri, 10 Sep 2021 12:47:41 +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="ntKYrMUV"; 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 2533469169 for ; Fri, 10 Sep 2021 12:47:39 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.149]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1BC15883; Fri, 10 Sep 2021 12:47:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631270858; bh=pw0qmNyimkXbhD1+lrgNVu8mGBhDRpBDLJRsy8lHbMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ntKYrMUV23dh51BnZVuNsHxloT2k1Ht8K9W8LQOmORRHfgvHjbHCuSC2ZRObjCEyS sKhBC5SMdFtDZ2J9ztzmn3s1Tc88jxiK29ywDhfOIb0SOr0Ay3+1a0m3QItjCltBU3 ARAjRt+P0FsQuvwhlbiu+ol+4upcG9LQMbj8RywE= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Fri, 10 Sep 2021 16:17:28 +0530 Message-Id: <20210910104729.542779-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210910104729.542779-1-umang.jain@ideasonboard.com> References: <20210910104729.542779-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 1/2] android: jpeg: Rectify variable naming style. 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" Rectify variable renaming style for YPlaneSize, UVPlaneSize. libcamera uses camelCase where first letter should be in lower case. Fixes: e355ca0087cd9("android: jpeg: Split and pass the thumbnail planes to encoder") Signed-off-by: Umang Jain Reviewed-by: Hirokazu Honda Reviewed-by: Laurent Pinchart --- src/android/jpeg/post_processor_jpeg.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp index ef2d98cc..f6d47f63 100644 --- a/src/android/jpeg/post_processor_jpeg.cpp +++ b/src/android/jpeg/post_processor_jpeg.cpp @@ -82,10 +82,10 @@ void PostProcessorJpeg::generateThumbnail(const FrameBuffer &source, */ std::vector> thumbnailPlanes; const PixelFormatInfo &formatNV12 = PixelFormatInfo::info(formats::NV12); - size_t YPlaneSize = formatNV12.planeSize(targetSize, 0); - size_t UVPlaneSize = formatNV12.planeSize(targetSize, 1); - thumbnailPlanes.push_back({ rawThumbnail.data(), YPlaneSize }); - thumbnailPlanes.push_back({ rawThumbnail.data() + YPlaneSize, UVPlaneSize }); + size_t yPlaneSize = formatNV12.planeSize(targetSize, 0); + size_t uvPlaneSize = formatNV12.planeSize(targetSize, 1); + thumbnailPlanes.push_back({ rawThumbnail.data(), yPlaneSize }); + thumbnailPlanes.push_back({ rawThumbnail.data() + yPlaneSize, uvPlaneSize }); int jpeg_size = thumbnailEncoder_.encode(thumbnailPlanes, *thumbnail, {}, quality); From patchwork Fri Sep 10 10:47:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13810 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 D5DD3BDB1D for ; Fri, 10 Sep 2021 10:47:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 943B569180; Fri, 10 Sep 2021 12:47:43 +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="j07J7mD+"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1DF696916A for ; Fri, 10 Sep 2021 12:47:42 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.149]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1241A883; Fri, 10 Sep 2021 12:47:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631270861; bh=DD/bgEqmwrB2Sr4qEVYX22q/uI3+AqdUDNwcoUs9aIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j07J7mD+P4tJHvV9v0+tklA1y1N3Yq4RnCJesDOiH6Kk16B4bIdoWybRFCTpYMWGQ ruRWGfaFKWVkuQufANJLknF20GNlmq8ljDvdhNnyS+gDtIdBCz3tvuKL2ZmTtCcSGM ITPn08JNRPtIVvfTOXIfsIK91AnXeghbOgar25xQ= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Fri, 10 Sep 2021 16:17:29 +0530 Message-Id: <20210910104729.542779-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210910104729.542779-1-umang.jain@ideasonboard.com> References: <20210910104729.542779-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 2/2] android: Fix generation of thumbnail for EXIF data 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 thumbnail is not occuring currently because ANDROID_JPEG_THUMBNAIL_SIZE is not set for request metadata passed to PostProcessorJpeg::process(). This is a regression introduced in 1264628d3c92("android: jpeg: Configure thumbnailer based on request metadata"). The patch fixes this issue by setting ANDROID_JPEG_THUMBNAIL_SIZE in the request metadata template populated by CameraCapabilities::requestTemplatePreview(). The value for ANDROID_JPEG_THUMBNAIL_SIZE is set to be the first non-zero size reported by static metadata ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES. Fixes: 1264628d3c92("android: jpeg: Configure thumbnailer based on request metadata") Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/android/camera_capabilities.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index e92bca42..ba551b86 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -1341,9 +1341,9 @@ std::unique_ptr CameraCapabilities::requestTemplatePreview() con { /* * \todo Keep this in sync with the actual number of entries. - * Currently: 20 entries, 35 bytes + * Currently: 21 entries, 37 bytes */ - auto requestTemplate = std::make_unique(21, 36); + auto requestTemplate = std::make_unique(22, 38); if (!requestTemplate->isValid()) { return nullptr; } @@ -1364,6 +1364,19 @@ 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 the first non-zero + * size to the template. + */ + found = staticMetadata_->getEntry(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES, + &entry); + if (!found) { + LOG(HAL, Error) << "availableThumbnailSizes not found in static metadata"; + return nullptr; + } + requestTemplate->addEntry(ANDROID_JPEG_THUMBNAIL_SIZE, + entry.data.i32 + 2, 2); + uint8_t aeMode = ANDROID_CONTROL_AE_MODE_ON; requestTemplate->addEntry(ANDROID_CONTROL_AE_MODE, aeMode);