From patchwork Thu Jan 28 10:22:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11044 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 3F26FBD808 for ; Thu, 28 Jan 2021 10:22:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0C4E368383; Thu, 28 Jan 2021 11:22:24 +0100 (CET) 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="Je+95ynM"; 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 C8F2D6030A for ; Thu, 28 Jan 2021 11:22:22 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5C011331; Thu, 28 Jan 2021 11:22:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1611829342; bh=VIcB+dMKsOM9BBmKe9Y0SnbfyhgH6+GhywZb7Ho72IA=; h=From:To:Cc:Subject:Date:From; b=Je+95ynMdfq4ynjFfDeEXcyE+ZaaE6MltNWExAviaqrkmE+RT16yA4Jl9sEQOYso+ /lKqDHfa3czLnNwLhpkgkAVGY3ksUyNHgQl5s9DSEh1ZZYO5StUuWRM5tEBg0muBI/ 5zXbtslmxF6bon6p3C3/YsL9PckBTOTxIeXeJp1Q= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Thu, 28 Jan 2021 19:22:14 +0900 Message-Id: <20210128102214.160250-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] android: camera_device: Fix exposure time tag in exif and android 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" The exposure time libcamera control is in microseconds while android and our exif component use nanoseconds. Convert it appropriately. CTS also expects the exposure time exif tag to match the exposure time set in the android result metadata. Fix it. Signed-off-by: Paul Elder Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 2 +- src/android/jpeg/post_processor_jpeg.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index f5066709..36382941 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -2058,7 +2058,7 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, } if (metadata.contains(controls::ExposureTime)) { - int32_t exposure = metadata.get(controls::ExposureTime); + int64_t exposure = metadata.get(controls::ExposureTime) * 1000; resultMetadata->addEntry(ANDROID_SENSOR_EXPOSURE_TIME, &exposure, 1); } diff --git a/src/android/jpeg/post_processor_jpeg.cpp b/src/android/jpeg/post_processor_jpeg.cpp index cac0087b..6250b050 100644 --- a/src/android/jpeg/post_processor_jpeg.cpp +++ b/src/android/jpeg/post_processor_jpeg.cpp @@ -113,7 +113,8 @@ int PostProcessorJpeg::process(const FrameBuffer &source, exif.setTimestamp(std::time(nullptr), 0ms); /* \todo Get this information from libcamera::Request::metadata */ - exif.setExposureTime(0); + ret = resultMetadata->getEntry(ANDROID_SENSOR_EXPOSURE_TIME, &entry); + exif.setExposureTime(ret ? *entry.data.i64 : 0); ret = requestMetadata.getEntry(ANDROID_LENS_APERTURE, &entry); if (ret) exif.setAperture(*entry.data.f);