summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2015-06-16 23:03:09 -0700
committerRuben Brunk <rubenbrunk@google.com>2015-06-16 23:08:26 -0700
commitfe81662cc5c0f04ecd2ef2d96b1d8890500d69a5 (patch)
tree7c69befd31ab3aec47312e5805125d1457b1b3be
parent1c52669d1f35e11feaad52a65507a9c4f1f4c876 (diff)
downloadframeworks_base-fe81662cc5c0f04ecd2ef2d96b1d8890500d69a5.zip
frameworks_base-fe81662cc5c0f04ecd2ef2d96b1d8890500d69a5.tar.gz
frameworks_base-fe81662cc5c0f04ecd2ef2d96b1d8890500d69a5.tar.bz2
Move distortion correction to correct opcode list.
- Prior to this, the lens distortion correction was applying resampling to the bayer mosaic, resulting in magenta output images (oops). Bug: 20491394 Change-Id: Ia244364954062d1c38ef3ec3b7a1d087904112f9
-rw-r--r--core/jni/android_hardware_camera2_DngCreator.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/core/jni/android_hardware_camera2_DngCreator.cpp b/core/jni/android_hardware_camera2_DngCreator.cpp
index 304de8c..7d8d151 100644
--- a/core/jni/android_hardware_camera2_DngCreator.cpp
+++ b/core/jni/android_hardware_camera2_DngCreator.cpp
@@ -1466,6 +1466,26 @@ static void DngCreator_init(JNIEnv* env, jobject thiz, jobject characteristicsPt
}
}
+ size_t listSize = builder.getSize();
+ uint8_t opcodeListBuf[listSize];
+ err = builder.buildOpList(opcodeListBuf);
+ if (err == OK) {
+ BAIL_IF_INVALID(writer->addEntry(TAG_OPCODELIST2, listSize, opcodeListBuf,
+ TIFF_IFD_0), env, TAG_OPCODELIST2, writer);
+ } else {
+ ALOGE("%s: Could not build list of opcodes for distortion correction and lens shading"
+ "map.", __FUNCTION__);
+ jniThrowRuntimeException(env, "failed to construct opcode list for distortion"
+ " correction and lens shading map");
+ return;
+ }
+ }
+
+ {
+ // Set up opcode List 3
+ OpcodeListBuilder builder;
+ status_t err = OK;
+
// Set up rectilinear distortion correction
camera_metadata_entry entry3 =
results.find(ANDROID_LENS_RADIAL_DISTORTION);
@@ -1484,13 +1504,12 @@ static void DngCreator_init(JNIEnv* env, jobject thiz, jobject characteristicsPt
}
}
-
size_t listSize = builder.getSize();
uint8_t opcodeListBuf[listSize];
err = builder.buildOpList(opcodeListBuf);
if (err == OK) {
- BAIL_IF_INVALID(writer->addEntry(TAG_OPCODELIST2, listSize, opcodeListBuf,
- TIFF_IFD_0), env, TAG_OPCODELIST2, writer);
+ BAIL_IF_INVALID(writer->addEntry(TAG_OPCODELIST3, listSize, opcodeListBuf,
+ TIFF_IFD_0), env, TAG_OPCODELIST3, writer);
} else {
ALOGE("%s: Could not build list of opcodes for distortion correction and lens shading"
"map.", __FUNCTION__);
@@ -1718,6 +1737,7 @@ static void DngCreator_nativeSetThumbnail(JNIEnv* env, jobject thiz, jobject buf
tagsToMove.add(TAG_DEFAULTCROPORIGIN);
tagsToMove.add(TAG_DEFAULTCROPSIZE);
tagsToMove.add(TAG_OPCODELIST2);
+ tagsToMove.add(TAG_OPCODELIST3);
if (moveEntries(writer, TIFF_IFD_0, TIFF_IFD_SUB1, tagsToMove) != OK) {
jniThrowException(env, "java/lang/IllegalStateException", "Failed to move entries");