OSDN Git Service

Camera2: Legacy: fix legacy device CTS failures
authorYin-Chia Yeh <yinchiayeh@google.com>
Sat, 30 Jan 2016 00:09:49 +0000 (16:09 -0800)
committerYin-Chia Yeh <yinchiayeh@google.com>
Sat, 30 Jan 2016 00:11:09 +0000 (16:11 -0800)
Bug: 26626933
Change-Id: I4fa91e5213e67e3b8c2a4208c82600d5426c0786

core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java
core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java
core/java/android/hardware/camera2/legacy/LegacyResultMapper.java

index 8bdd42a..bb0a042 100644 (file)
@@ -175,7 +175,8 @@ public class LegacyMetadataMapper {
          * colorCorrection.*
          */
         m.set(COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES,
-                new int[] { COLOR_CORRECTION_ABERRATION_MODE_FAST });
+                new int[] { COLOR_CORRECTION_ABERRATION_MODE_FAST,
+                            COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY });
         /*
          * control.ae*
          */
@@ -210,7 +211,8 @@ public class LegacyMetadataMapper {
          * noiseReduction.*
          */
         m.set(NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES,
-                new int[] { NOISE_REDUCTION_MODE_FAST });
+                new int[] { NOISE_REDUCTION_MODE_FAST,
+                            NOISE_REDUCTION_MODE_HIGH_QUALITY});
 
         /*
          * scaler.*
@@ -1389,7 +1391,22 @@ public class LegacyMetadataMapper {
         /*
          * noiseReduction.*
          */
-        m.set(CaptureRequest.NOISE_REDUCTION_MODE, NOISE_REDUCTION_MODE_FAST);
+        if (templateId == CameraDevice.TEMPLATE_STILL_CAPTURE) {
+            m.set(CaptureRequest.NOISE_REDUCTION_MODE, NOISE_REDUCTION_MODE_HIGH_QUALITY);
+        } else {
+            m.set(CaptureRequest.NOISE_REDUCTION_MODE, NOISE_REDUCTION_MODE_FAST);
+        }
+
+        /*
+        * colorCorrection.*
+        */
+        if (templateId == CameraDevice.TEMPLATE_STILL_CAPTURE) {
+            m.set(CaptureRequest.COLOR_CORRECTION_ABERRATION_MODE,
+                    COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY);
+        } else {
+            m.set(CaptureRequest.COLOR_CORRECTION_ABERRATION_MODE,
+                    COLOR_CORRECTION_ABERRATION_MODE_FAST);
+        }
 
         /*
          * lens.*
index 6a44ac5..2e06d5f 100644 (file)
@@ -89,7 +89,8 @@ public class LegacyRequestMapper {
                     COLOR_CORRECTION_ABERRATION_MODE,
                     /*defaultValue*/COLOR_CORRECTION_ABERRATION_MODE_FAST);
 
-            if (aberrationMode != COLOR_CORRECTION_ABERRATION_MODE_FAST) {
+            if (aberrationMode != COLOR_CORRECTION_ABERRATION_MODE_FAST &&
+                    aberrationMode != COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY) {
                 Log.w(TAG, "convertRequestToMetadata - Ignoring unsupported " +
                         "colorCorrection.aberrationMode = " + aberrationMode);
             }
@@ -446,7 +447,8 @@ public class LegacyRequestMapper {
                     NOISE_REDUCTION_MODE,
                     /*defaultValue*/NOISE_REDUCTION_MODE_FAST);
 
-            if (mode != NOISE_REDUCTION_MODE_FAST) {
+            if (mode != NOISE_REDUCTION_MODE_FAST &&
+                    mode != NOISE_REDUCTION_MODE_HIGH_QUALITY) {
                 Log.w(TAG, "convertRequestToMetadata - Ignoring unsupported " +
                         "noiseReduction.mode = " + mode);
             }
index ce85005..dc5823d 100644 (file)
@@ -67,7 +67,9 @@ public class LegacyResultMapper {
         /*
          * Attempt to look up the result from the cache if the parameters haven't changed
          */
-        if (mCachedRequest != null && legacyRequest.parameters.same(mCachedRequest.parameters)) {
+        if (mCachedRequest != null &&
+                legacyRequest.parameters.same(mCachedRequest.parameters) &&
+                legacyRequest.captureRequest.equals(mCachedRequest.captureRequest)) {
             result = new CameraMetadataNative(mCachedResult);
             cached = true;
         } else {
@@ -124,8 +126,8 @@ public class LegacyResultMapper {
          */
         // colorCorrection.aberrationMode
         {
-            // Always hardcoded to FAST
-            result.set(COLOR_CORRECTION_ABERRATION_MODE, COLOR_CORRECTION_ABERRATION_MODE_FAST);
+            result.set(COLOR_CORRECTION_ABERRATION_MODE,
+                    request.get(CaptureRequest.COLOR_CORRECTION_ABERRATION_MODE));
         }
 
         /*
@@ -282,7 +284,7 @@ public class LegacyResultMapper {
          * noiseReduction.*
          */
         // noiseReduction.mode
-        result.set(NOISE_REDUCTION_MODE, NOISE_REDUCTION_MODE_FAST);
+        result.set(NOISE_REDUCTION_MODE, request.get(CaptureRequest.NOISE_REDUCTION_MODE));
 
         return result;
     }