From 7ca1371987736e8b3c51818afcbd245ca6286bc0 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Wed, 5 Apr 2017 15:42:22 +0100 Subject: [PATCH] DngCreator: Populate baseline exposure tag "postRawSensitivityBoost" contains the gain value applied after RAW. Take this value in to account and populate the baseline exposure accordingly. Bug: 33623101 Test: runtest -x cts/tests/camera/src/android/hardware/camera2/cts/DngCreatorTest.java Change-Id: Ib90a5c1791c422fd36ec44fb6ef695ba8a1dc475 --- .../android_hardware_camera2_DngCreator.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/jni/android_hardware_camera2_DngCreator.cpp b/core/jni/android_hardware_camera2_DngCreator.cpp index d2932e43fe5bd..3d021d6cc6b25 100644 --- a/core/jni/android_hardware_camera2_DngCreator.cpp +++ b/core/jni/android_hardware_camera2_DngCreator.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -1374,6 +1375,23 @@ static sp DngCreator_setup(JNIEnv* env, jobject thiz, uint32_t image TIFF_IFD_0), env, TAG_ISOSPEEDRATINGS, writer); } + { + // Baseline exposure + camera_metadata_entry entry = + results.find(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST); + BAIL_IF_EMPTY_RET_NULL_SP(entry, env, TAG_BASELINEEXPOSURE, writer); + + // post RAW gain should be boostValue / 100 + double postRAWGain = static_cast (entry.data.i32[0]) / 100.f; + // Baseline exposure should be in EV units so log2(gain) = + // log10(gain)/log10(2) + double baselineExposure = std::log(postRAWGain) / std::log(2.0f); + int32_t baseExposureSRat[] = { static_cast (baselineExposure * 100), + 100 }; + BAIL_IF_INVALID_RET_NULL_SP(writer->addEntry(TAG_BASELINEEXPOSURE, 1, + baseExposureSRat, TIFF_IFD_0), env, TAG_BASELINEEXPOSURE, writer); + } + { // focal length camera_metadata_entry entry =