summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2014-05-28 20:33:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-28 20:33:42 +0000
commitb9a65de1f79d92326abcccc295c18f24afb83053 (patch)
treeb845d0448dcfba7de3fa7d2ba5a95aeb56571a8d /media
parent10d1b4d0b7b845a29fb3bca0e11c86f3aee1e86d (diff)
parent574936894d3044445a272b39f2d925af40ece5d8 (diff)
downloadframeworks_base-b9a65de1f79d92326abcccc295c18f24afb83053.zip
frameworks_base-b9a65de1f79d92326abcccc295c18f24afb83053.tar.gz
frameworks_base-b9a65de1f79d92326abcccc295c18f24afb83053.tar.bz2
Merge changes Ia0f54124,I1e085f5e,Ic0a3ff0a,I141847df,I8ae4efa2 into lmp-preview-dev
* changes: camera2: Update native/managed key mappings. Camera2: switch API interface to java classses Camera2: Use ColorSpaceTransform and RggbChannelVector, replace enum byte[] camera2: Add new metadata keys, change types for existing range keys Camera2: Replace int[] by MeteringRectangle
Diffstat (limited to 'media')
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java
index a3caba2..fe51215 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/CameraMetadataTest.java
@@ -41,6 +41,7 @@ import android.hardware.camera2.params.RggbChannelVector;
import android.hardware.camera2.params.StreamConfiguration;
import android.hardware.camera2.params.StreamConfigurationDuration;
import android.hardware.camera2.params.StreamConfigurationMap;
+import android.hardware.camera2.params.TonemapCurve;
import android.hardware.camera2.utils.TypeReference;
import static android.hardware.camera2.impl.CameraMetadataNative.*;
@@ -49,6 +50,7 @@ import static com.android.mediaframeworktest.unit.ByteArrayHelpers.*;
import java.lang.reflect.Array;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
+import java.util.Arrays;
import java.util.List;
/**
@@ -1015,6 +1017,26 @@ public class CameraMetadataTest extends junit.framework.TestCase {
assertNull(resultSimpleFaces[i].getMouthPosition());
}
+ /**
+ * Read/Write TonemapCurve
+ */
+ float[] red = new float[] {0.0f, 0.0f, 1.0f, 1.0f};
+ float[] green = new float[] {0.0f, 1.0f, 1.0f, 0.0f};
+ float[] blue = new float[] {
+ 0.0000f, 0.0000f, 0.0667f, 0.2920f, 0.1333f, 0.4002f, 0.2000f, 0.4812f,
+ 0.2667f, 0.5484f, 0.3333f, 0.6069f, 0.4000f, 0.6594f, 0.4667f, 0.7072f,
+ 0.5333f, 0.7515f, 0.6000f, 0.7928f, 0.6667f, 0.8317f, 0.7333f, 0.8685f,
+ 0.8000f, 0.9035f, 0.8667f, 0.9370f, 0.9333f, 0.9691f, 1.0000f, 1.0000f};
+ TonemapCurve tcIn = new TonemapCurve(red, green, blue);
+ mMetadata.set(CaptureResult.TONEMAP_CURVE, tcIn);
+ float[] redOut = mMetadata.get(CaptureResult.TONEMAP_CURVE_RED);
+ float[] greenOut = mMetadata.get(CaptureResult.TONEMAP_CURVE_GREEN);
+ float[] blueOut = mMetadata.get(CaptureResult.TONEMAP_CURVE_BLUE);
+ assertTrue("Input and output tonemap curve should match", Arrays.equals(red, redOut));
+ assertTrue("Input and output tonemap curve should match", Arrays.equals(green, greenOut));
+ assertTrue("Input and output tonemap curve should match", Arrays.equals(blue, blueOut));
+ TonemapCurve tcOut = mMetadata.get(CaptureResult.TONEMAP_CURVE);
+ assertTrue("Input and output tonemap curve should match", tcIn.equals(tcOut));
}
/**
@@ -1166,6 +1188,48 @@ public class CameraMetadataTest extends junit.framework.TestCase {
}
}
+ private <T> void assertKeyValueEquals(T expected, CameraCharacteristics.Key<T> key) {
+ assertKeyValueEquals(expected, key.getNativeKey());
+ }
+
+ private <T> void assertKeyValueEquals(T expected, Key<T> key) {
+ T actual = mMetadata.get(key);
+
+ assertEquals("Expected value for key " + key + " to match", expected, actual);
+ }
+
+ @SmallTest
+ public void testOverrideMaxRegions() {
+ // All keys are null before doing any writes.
+ assertKeyValueEquals(null, CameraCharacteristics.CONTROL_MAX_REGIONS_AE);
+ assertKeyValueEquals(null, CameraCharacteristics.CONTROL_MAX_REGIONS_AWB);
+ assertKeyValueEquals(null, CameraCharacteristics.CONTROL_MAX_REGIONS_AF);
+
+ mMetadata.set(CameraCharacteristics.CONTROL_MAX_REGIONS,
+ new int[] { /*AE*/1, /*AWB*/2, /*AF*/3 });
+
+ // All keys are the expected value after doing a write
+ assertKeyValueEquals(1, CameraCharacteristics.CONTROL_MAX_REGIONS_AE);
+ assertKeyValueEquals(2, CameraCharacteristics.CONTROL_MAX_REGIONS_AWB);
+ assertKeyValueEquals(3, CameraCharacteristics.CONTROL_MAX_REGIONS_AF);
+ }
+
+ @SmallTest
+ public void testOverrideMaxNumOutputStreams() {
+ // All keys are null before doing any writes.
+ assertKeyValueEquals(null, CameraCharacteristics.REQUEST_MAX_NUM_OUTPUT_RAW);
+ assertKeyValueEquals(null, CameraCharacteristics.REQUEST_MAX_NUM_OUTPUT_PROC);
+ assertKeyValueEquals(null, CameraCharacteristics.REQUEST_MAX_NUM_OUTPUT_PROC_STALLING);
+
+ mMetadata.set(CameraCharacteristics.REQUEST_MAX_NUM_OUTPUT_STREAMS,
+ new int[] { /*AE*/1, /*AWB*/2, /*AF*/3 });
+
+ // All keys are the expected value after doing a write
+ assertKeyValueEquals(1, CameraCharacteristics.REQUEST_MAX_NUM_OUTPUT_RAW);
+ assertKeyValueEquals(2, CameraCharacteristics.REQUEST_MAX_NUM_OUTPUT_PROC);
+ assertKeyValueEquals(3, CameraCharacteristics.REQUEST_MAX_NUM_OUTPUT_PROC_STALLING);
+ }
+
@SmallTest
public void testCaptureResult() {
mMetadata.set(CaptureRequest.CONTROL_AE_MODE,