diff --git a/api/current.txt b/api/current.txt index f9ea1a7ad1a5b..3c681d21a6831 100644 --- a/api/current.txt +++ b/api/current.txt @@ -12887,7 +12887,11 @@ package android.hardware.camera2 { field public static final int SYNC_MAX_LATENCY_UNKNOWN = -1; // 0xffffffff field public static final int TONEMAP_MODE_CONTRAST_CURVE = 0; // 0x0 field public static final int TONEMAP_MODE_FAST = 1; // 0x1 + field public static final int TONEMAP_MODE_GAMMA_VALUE = 3; // 0x3 field public static final int TONEMAP_MODE_HIGH_QUALITY = 2; // 0x2 + field public static final int TONEMAP_MODE_PRESET_CURVE = 4; // 0x4 + field public static final int TONEMAP_PRESET_CURVE_REC709 = 1; // 0x1 + field public static final int TONEMAP_PRESET_CURVE_SRGB = 0; // 0x0 } public class CaptureFailure { @@ -12954,7 +12958,9 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureRequest.Key STATISTICS_HOT_PIXEL_MAP_MODE; field public static final android.hardware.camera2.CaptureRequest.Key STATISTICS_LENS_SHADING_MAP_MODE; field public static final android.hardware.camera2.CaptureRequest.Key TONEMAP_CURVE; + field public static final android.hardware.camera2.CaptureRequest.Key TONEMAP_GAMMA; field public static final android.hardware.camera2.CaptureRequest.Key TONEMAP_MODE; + field public static final android.hardware.camera2.CaptureRequest.Key TONEMAP_PRESET_CURVE; } public static final class CaptureRequest.Builder { @@ -13041,7 +13047,9 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureResult.Key STATISTICS_LENS_SHADING_MAP_MODE; field public static final android.hardware.camera2.CaptureResult.Key STATISTICS_SCENE_FLICKER; field public static final android.hardware.camera2.CaptureResult.Key TONEMAP_CURVE; + field public static final android.hardware.camera2.CaptureResult.Key TONEMAP_GAMMA; field public static final android.hardware.camera2.CaptureResult.Key TONEMAP_MODE; + field public static final android.hardware.camera2.CaptureResult.Key TONEMAP_PRESET_CURVE; } public static final class CaptureResult.Key { diff --git a/api/system-current.txt b/api/system-current.txt index a1b53c1441d00..290d81dcc88d6 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -13193,7 +13193,11 @@ package android.hardware.camera2 { field public static final int SYNC_MAX_LATENCY_UNKNOWN = -1; // 0xffffffff field public static final int TONEMAP_MODE_CONTRAST_CURVE = 0; // 0x0 field public static final int TONEMAP_MODE_FAST = 1; // 0x1 + field public static final int TONEMAP_MODE_GAMMA_VALUE = 3; // 0x3 field public static final int TONEMAP_MODE_HIGH_QUALITY = 2; // 0x2 + field public static final int TONEMAP_MODE_PRESET_CURVE = 4; // 0x4 + field public static final int TONEMAP_PRESET_CURVE_REC709 = 1; // 0x1 + field public static final int TONEMAP_PRESET_CURVE_SRGB = 0; // 0x0 } public class CaptureFailure { @@ -13260,7 +13264,9 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureRequest.Key STATISTICS_HOT_PIXEL_MAP_MODE; field public static final android.hardware.camera2.CaptureRequest.Key STATISTICS_LENS_SHADING_MAP_MODE; field public static final android.hardware.camera2.CaptureRequest.Key TONEMAP_CURVE; + field public static final android.hardware.camera2.CaptureRequest.Key TONEMAP_GAMMA; field public static final android.hardware.camera2.CaptureRequest.Key TONEMAP_MODE; + field public static final android.hardware.camera2.CaptureRequest.Key TONEMAP_PRESET_CURVE; } public static final class CaptureRequest.Builder { @@ -13347,7 +13353,9 @@ package android.hardware.camera2 { field public static final android.hardware.camera2.CaptureResult.Key STATISTICS_LENS_SHADING_MAP_MODE; field public static final android.hardware.camera2.CaptureResult.Key STATISTICS_SCENE_FLICKER; field public static final android.hardware.camera2.CaptureResult.Key TONEMAP_CURVE; + field public static final android.hardware.camera2.CaptureResult.Key TONEMAP_GAMMA; field public static final android.hardware.camera2.CaptureResult.Key TONEMAP_MODE; + field public static final android.hardware.camera2.CaptureResult.Key TONEMAP_PRESET_CURVE; } public static final class CaptureResult.Key { diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 7cf8fb00d05db..1e60627799113 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -2255,8 +2255,13 @@ public final class CameraCharacteristics extends CameraMetadataList of tonemapping modes for {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} that are supported by this camera * device.

- *

Camera devices that support the MANUAL_POST_PROCESSING capability will always list - * CONTRAST_CURVE and FAST. This includes all FULL level devices.

+ *

Camera devices that support the MANUAL_POST_PROCESSING capability will always contain + * at least one of below mode combinations:

+ *
    + *
  • CONTRAST_CURVE and FAST
  • + *
  • GAMMA_VALUE, PRESET_CURVE, and FAST
  • + *
+ *

This includes all FULL level devices.

*

Range of valid values:
* Any value listed in {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode}

*

Optional - This value may be {@code null} on some devices.

diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java index 1b108589ef46e..44e97306f6a21 100644 --- a/core/java/android/hardware/camera2/CameraMetadata.java +++ b/core/java/android/hardware/camera2/CameraMetadata.java @@ -367,13 +367,19 @@ public abstract class CameraMetadata { * The camera device supports basic manual control of the image post-processing * stages. This means the following controls are guaranteed to be supported:

*
    - *
  • Manual tonemap control
      + *
    • + *

      Manual tonemap control

      + *
        *
      • {@link CaptureRequest#TONEMAP_CURVE android.tonemap.curve}
      • *
      • {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode}
      • *
      • {@link CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS android.tonemap.maxCurvePoints}
      • + *
      • {@link CaptureRequest#TONEMAP_GAMMA android.tonemap.gamma}
      • + *
      • {@link CaptureRequest#TONEMAP_PRESET_CURVE android.tonemap.presetCurve}
      • *
      *
    • - *
    • Manual white balance control
        + *
      • + *

        Manual white balance control

        + *
          *
        • {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
        • *
        • {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains}
        • *
        @@ -403,8 +409,10 @@ public abstract class CameraMetadata { * @see CaptureRequest#SHADING_MODE * @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE * @see CaptureRequest#TONEMAP_CURVE + * @see CaptureRequest#TONEMAP_GAMMA * @see CameraCharacteristics#TONEMAP_MAX_CURVE_POINTS * @see CaptureRequest#TONEMAP_MODE + * @see CaptureRequest#TONEMAP_PRESET_CURVE * @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES */ public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = 2; @@ -2026,6 +2034,47 @@ public abstract class CameraMetadata { */ public static final int TONEMAP_MODE_HIGH_QUALITY = 2; + /** + *

        Use the gamma value specified in {@link CaptureRequest#TONEMAP_GAMMA android.tonemap.gamma} to peform + * tonemapping.

        + *

        All color enhancement and tonemapping must be disabled, except + * for applying the tonemapping curve specified by {@link CaptureRequest#TONEMAP_GAMMA android.tonemap.gamma}.

        + *

        Must not slow down frame rate relative to raw sensor output.

        + * + * @see CaptureRequest#TONEMAP_GAMMA + * @see CaptureRequest#TONEMAP_MODE + */ + public static final int TONEMAP_MODE_GAMMA_VALUE = 3; + + /** + *

        Use the preset tonemapping curve specified in + * {@link CaptureRequest#TONEMAP_PRESET_CURVE android.tonemap.presetCurve} to peform tonemapping.

        + *

        All color enhancement and tonemapping must be disabled, except + * for applying the tonemapping curve specified by + * {@link CaptureRequest#TONEMAP_PRESET_CURVE android.tonemap.presetCurve}.

        + *

        Must not slow down frame rate relative to raw sensor output.

        + * + * @see CaptureRequest#TONEMAP_PRESET_CURVE + * @see CaptureRequest#TONEMAP_MODE + */ + public static final int TONEMAP_MODE_PRESET_CURVE = 4; + + // + // Enumeration values for CaptureRequest#TONEMAP_PRESET_CURVE + // + + /** + *

        Tonemapping curve is defined by sRGB

        + * @see CaptureRequest#TONEMAP_PRESET_CURVE + */ + public static final int TONEMAP_PRESET_CURVE_SRGB = 0; + + /** + *

        Tonemapping curve is defined by ITU-R BT.709

        + * @see CaptureRequest#TONEMAP_PRESET_CURVE + */ + public static final int TONEMAP_PRESET_CURVE_REC709 = 1; + // // Enumeration values for CaptureResult#CONTROL_AE_STATE // diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index b4174965dedd9..3499966cafde0 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -2340,6 +2340,8 @@ public final class CaptureRequest extends CameraMetadata> *
      • {@link #TONEMAP_MODE_CONTRAST_CURVE CONTRAST_CURVE}
      • *
      • {@link #TONEMAP_MODE_FAST FAST}
      • *
      • {@link #TONEMAP_MODE_HIGH_QUALITY HIGH_QUALITY}
      • + *
      • {@link #TONEMAP_MODE_GAMMA_VALUE GAMMA_VALUE}
      • + *
      • {@link #TONEMAP_MODE_PRESET_CURVE PRESET_CURVE}
      • *

      *

      Available values for this device:
      * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}

      @@ -2355,11 +2357,59 @@ public final class CaptureRequest extends CameraMetadata> * @see #TONEMAP_MODE_CONTRAST_CURVE * @see #TONEMAP_MODE_FAST * @see #TONEMAP_MODE_HIGH_QUALITY + * @see #TONEMAP_MODE_GAMMA_VALUE + * @see #TONEMAP_MODE_PRESET_CURVE */ @PublicKey public static final Key TONEMAP_MODE = new Key("android.tonemap.mode", int.class); + /** + *

      Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is + * GAMMA_VALUE

      + *

      The tonemap curve will be defined the following formula: + * * OUT = pow(IN, 1.0 / gamma) + * where IN and OUT is the input pixel value scaled to range [0.0, 1.0], + * pow is the power function and gamma is the gamma value specified by this + * key.

      + *

      The same curve will be applied to all color channels. The camera device + * may clip the input gamma value to its supported range. The actual applied + * value will be returned in capture result.

      + *

      The valid range of gamma value varies on different devices, but values + * within [1.0, 5.0] are guaranteed not to be clipped.

      + *

      Optional - This value may be {@code null} on some devices.

      + * + * @see CaptureRequest#TONEMAP_MODE + */ + @PublicKey + public static final Key TONEMAP_GAMMA = + new Key("android.tonemap.gamma", float.class); + + /** + *

      Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is + * PRESET_CURVE

      + *

      The tonemap curve will be defined by specified standard.

      + *

      sRGB (approximated by 16 control points):

      + *

      sRGB tonemapping curve

      + *

      Rec. 709 (approximated by 16 control points):

      + *

      Rec. 709 tonemapping curve

      + *

      Note that above figures show a 16 control points approximation of preset + * curves. Camera devices may apply a different approximation to the curve.

      + *

      Possible values: + *

        + *
      • {@link #TONEMAP_PRESET_CURVE_SRGB SRGB}
      • + *
      • {@link #TONEMAP_PRESET_CURVE_REC709 REC709}
      • + *

      + *

      Optional - This value may be {@code null} on some devices.

      + * + * @see CaptureRequest#TONEMAP_MODE + * @see #TONEMAP_PRESET_CURVE_SRGB + * @see #TONEMAP_PRESET_CURVE_REC709 + */ + @PublicKey + public static final Key TONEMAP_PRESET_CURVE = + new Key("android.tonemap.presetCurve", int.class); + /** *

      This LED is nominally used to indicate to the user * that the camera is powered on and may be streaming images back to the diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index f17100d29eb0b..0c5ba9765d6f4 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -3531,6 +3531,8 @@ public class CaptureResult extends CameraMetadata> { *

    • {@link #TONEMAP_MODE_CONTRAST_CURVE CONTRAST_CURVE}
    • *
    • {@link #TONEMAP_MODE_FAST FAST}
    • *
    • {@link #TONEMAP_MODE_HIGH_QUALITY HIGH_QUALITY}
    • + *
    • {@link #TONEMAP_MODE_GAMMA_VALUE GAMMA_VALUE}
    • + *
    • {@link #TONEMAP_MODE_PRESET_CURVE PRESET_CURVE}
    • *

    *

    Available values for this device:
    * {@link CameraCharacteristics#TONEMAP_AVAILABLE_TONE_MAP_MODES android.tonemap.availableToneMapModes}

    @@ -3546,11 +3548,59 @@ public class CaptureResult extends CameraMetadata> { * @see #TONEMAP_MODE_CONTRAST_CURVE * @see #TONEMAP_MODE_FAST * @see #TONEMAP_MODE_HIGH_QUALITY + * @see #TONEMAP_MODE_GAMMA_VALUE + * @see #TONEMAP_MODE_PRESET_CURVE */ @PublicKey public static final Key TONEMAP_MODE = new Key("android.tonemap.mode", int.class); + /** + *

    Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is + * GAMMA_VALUE

    + *

    The tonemap curve will be defined the following formula: + * * OUT = pow(IN, 1.0 / gamma) + * where IN and OUT is the input pixel value scaled to range [0.0, 1.0], + * pow is the power function and gamma is the gamma value specified by this + * key.

    + *

    The same curve will be applied to all color channels. The camera device + * may clip the input gamma value to its supported range. The actual applied + * value will be returned in capture result.

    + *

    The valid range of gamma value varies on different devices, but values + * within [1.0, 5.0] are guaranteed not to be clipped.

    + *

    Optional - This value may be {@code null} on some devices.

    + * + * @see CaptureRequest#TONEMAP_MODE + */ + @PublicKey + public static final Key TONEMAP_GAMMA = + new Key("android.tonemap.gamma", float.class); + + /** + *

    Tonemapping curve to use when {@link CaptureRequest#TONEMAP_MODE android.tonemap.mode} is + * PRESET_CURVE

    + *

    The tonemap curve will be defined by specified standard.

    + *

    sRGB (approximated by 16 control points):

    + *

    sRGB tonemapping curve

    + *

    Rec. 709 (approximated by 16 control points):

    + *

    Rec. 709 tonemapping curve

    + *

    Note that above figures show a 16 control points approximation of preset + * curves. Camera devices may apply a different approximation to the curve.

    + *

    Possible values: + *

      + *
    • {@link #TONEMAP_PRESET_CURVE_SRGB SRGB}
    • + *
    • {@link #TONEMAP_PRESET_CURVE_REC709 REC709}
    • + *

    + *

    Optional - This value may be {@code null} on some devices.

    + * + * @see CaptureRequest#TONEMAP_MODE + * @see #TONEMAP_PRESET_CURVE_SRGB + * @see #TONEMAP_PRESET_CURVE_REC709 + */ + @PublicKey + public static final Key TONEMAP_PRESET_CURVE = + new Key("android.tonemap.presetCurve", int.class); + /** *

    This LED is nominally used to indicate to the user * that the camera is powered on and may be streaming images back to the diff --git a/docs/html/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png b/docs/html/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png index ec89e37ec2b9e..a02fd893b286c 100644 Binary files a/docs/html/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png and b/docs/html/images/camera2/metadata/android.tonemap.curveRed/gamma_tonemap.png differ diff --git a/docs/html/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png b/docs/html/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png index cf0c63ddda425..c309ac5ea887e 100644 Binary files a/docs/html/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png and b/docs/html/images/camera2/metadata/android.tonemap.curveRed/inverse_tonemap.png differ diff --git a/docs/html/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png b/docs/html/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png index f226a548633e9..414fad49a919e 100644 Binary files a/docs/html/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png and b/docs/html/images/camera2/metadata/android.tonemap.curveRed/linear_tonemap.png differ diff --git a/docs/html/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png b/docs/html/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png new file mode 100644 index 0000000000000..c147a8729f171 Binary files /dev/null and b/docs/html/images/camera2/metadata/android.tonemap.curveRed/rec709_tonemap.png differ diff --git a/docs/html/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png b/docs/html/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png index ded0645a48cab..4ce2125f3c911 100644 Binary files a/docs/html/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png and b/docs/html/images/camera2/metadata/android.tonemap.curveRed/srgb_tonemap.png differ