From f655b1c8762fe63bf141b244c8a5eae62a82defd Mon Sep 17 00:00:00 2001
From: Shuzhen Wang This list is also used as supported thumbnail sizes for HEIC image format capture. This key is available on all devices. The available HEIC (ISO/IEC 23008-12) stream
+ * configurations that this camera device supports
+ * (i.e. format, width, height, output/input stream). The configurations are listed as If the camera device supports HEIC image format, it will support identical set of stream
+ * combinations involving HEIC image format, compared to the combinations involving JPEG
+ * image format as required by the device's hardware level and capabilities. All the static, control, and dynamic metadata tags related to JPEG apply to HEIC formats.
+ * Configuring JPEG and HEIC streams at the same time is not supported. Optional - This value may be {@code null} on some devices. Limited capability -
+ * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
+ * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key This lists the minimum frame duration for each
+ * format/size combination for HEIC output formats. This should correspond to the frame duration when only that
+ * stream is active, with all processing (typically in android.*.mode)
+ * set to either OFF or FAST. When multiple streams are used in a request, the minimum frame
+ * duration will be max(individual stream min durations). See {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration} and
+ * android.scaler.availableStallDurations for more details about
+ * calculating the max frame rate. Units: (format, width, height, ns) x n Optional - This value may be {@code null} on some devices. Limited capability -
+ * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
+ * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key This lists the maximum stall duration for each
+ * output format/size combination for HEIC streams. A stall duration is how much extra time would get added
+ * to the normal minimum frame duration for a repeating request
+ * that has streams with non-zero stall. This functions similarly to
+ * android.scaler.availableStallDurations for HEIC
+ * streams. All HEIC output stream formats may have a nonzero stall
+ * duration. Units: (format, width, height, ns) x n Optional - This value may be {@code null} on some devices. Limited capability -
+ * Present on all camera devices that report being at least {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED HARDWARE_LEVEL_LIMITED} devices in the
+ * {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} key(0, 0) sizes will have non-zero widths and heights.
- * This key is available on all devices.(0, 0) sizes will have non-zero widths and heights.(format, width, height, input?) tuples.
*
MONOCHROME-capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES} - * includes {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME MONOCHROME}) devices - * supporting {@link android.graphics.ImageFormat#Y8 Y8} support substituting {@code YUV} - * streams with {@code Y8} in all guaranteed stream combinations for the device's hardware level - * and capabilities.
- * *FULL-level ({@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL}
* {@code == }{@link CameraMetadata#INFO_SUPPORTED_HARDWARE_LEVEL_FULL FULL}) devices
* support at least the following stream combinations in addition to those for
@@ -435,6 +429,18 @@ public abstract class CameraDevice implements AutoCloseable {
*
*
MONOCHROME-capability ({@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES} + * includes {@link CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME MONOCHROME}) devices + * supporting {@link android.graphics.ImageFormat#Y8 Y8} support substituting {@code YUV} + * streams with {@code Y8} in all guaranteed stream combinations for the device's hardware level + * and capabilities.
+ * + *Devices capable of outputting HEIC formats ({@link StreamConfigurationMap#getOutputFormats} + * contains {@link android.graphics.ImageFormat#HEIC}) will support substituting {@code JPEG} + * streams with {@code HEIC} in all guaranteed stream combinations for the device's hardware + * level and capabilities. Calling createCaptureSession with both JPEG and HEIC outputs is not + * supported.
+ * *Clients can access the above mandatory stream combination tables via * {@link android.hardware.camera2.params.MandatoryStreamCombination}.
* diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 3d3a916bae7a8..525070103c2c3 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -2126,6 +2126,7 @@ public final class CaptureRequest extends CameraMetadataSetting a location object in a request will include the GPS coordinates of the location * into any JPEG images captured based on the request. These coordinates can then be * viewed by anyone who receives the JPEG image.
+ *This tag is also used for HEIC image capture.
*This key is available on all devices.
*/ @PublicKey @@ -2136,6 +2137,7 @@ public final class CaptureRequest extends CameraMetadataGPS coordinates to include in output JPEG * EXIF.
+ *This tag is also used for HEIC image capture.
*Range of valid values:
* (-180 - 180], [-90,90], [-inf, inf]
This key is available on all devices.
@@ -2147,6 +2149,7 @@ public final class CaptureRequest extends CameraMetadata32 characters describing GPS algorithm to * include in EXIF.
+ *This tag is also used for HEIC image capture.
*This key is available on all devices.
* @hide */ @@ -2156,6 +2159,7 @@ public final class CaptureRequest extends CameraMetadataTime GPS fix was made to include in * EXIF.
+ *This tag is also used for HEIC image capture.
*Units: UTC in seconds since January 1, 1970
*This key is available on all devices.
* @hide @@ -2195,6 +2199,10 @@ public final class CaptureRequest extends CameraMetadataFor EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will * also be set to EXTERNAL. The above code is not relevant in such case.
+ *This tag is also used to describe the orientation of the HEIC image capture, in which + * case the rotation is reflected by + * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by + * rotating the image data itself.
*Units: Degrees in multiples of 90
*Range of valid values:
* 0, 90, 180, 270
Compression quality of the final JPEG * image.
- *85-95 is typical usage range.
+ *85-95 is typical usage range. This tag is also used to describe the quality + * of the HEIC image capture.
*Range of valid values:
* 1-100; larger is higher quality
This key is available on all devices.
@@ -2221,6 +2230,7 @@ public final class CaptureRequest extends CameraMetadataCompression quality of JPEG * thumbnail.
+ *This tag is also used to describe the quality of the HEIC image capture.
*Range of valid values:
* 1-100; larger is higher quality
This key is available on all devices.
@@ -2253,6 +2263,10 @@ public final class CaptureRequest extends CameraMetadataThe tag is also used as thumbnail size for HEIC image format capture, in which case the + * the thumbnail rotation is reflected by + * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by + * rotating the thumbnail data itself.
*Range of valid values:
* {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}
This key is available on all devices.
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index 8982b40be29b9..13ad092f6efd4 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2450,6 +2450,7 @@ public class CaptureResult extends CameraMetadataSetting a location object in a request will include the GPS coordinates of the location * into any JPEG images captured based on the request. These coordinates can then be * viewed by anyone who receives the JPEG image.
+ *This tag is also used for HEIC image capture.
*This key is available on all devices.
*/ @PublicKey @@ -2460,6 +2461,7 @@ public class CaptureResult extends CameraMetadataGPS coordinates to include in output JPEG * EXIF.
+ *This tag is also used for HEIC image capture.
*Range of valid values:
* (-180 - 180], [-90,90], [-inf, inf]
This key is available on all devices.
@@ -2471,6 +2473,7 @@ public class CaptureResult extends CameraMetadata32 characters describing GPS algorithm to * include in EXIF.
+ *This tag is also used for HEIC image capture.
*This key is available on all devices.
* @hide */ @@ -2480,6 +2483,7 @@ public class CaptureResult extends CameraMetadataTime GPS fix was made to include in * EXIF.
+ *This tag is also used for HEIC image capture.
*Units: UTC in seconds since January 1, 1970
*This key is available on all devices.
* @hide @@ -2519,6 +2523,10 @@ public class CaptureResult extends CameraMetadataFor EXTERNAL cameras the sensor orientation will always be set to 0 and the facing will * also be set to EXTERNAL. The above code is not relevant in such case.
+ *This tag is also used to describe the orientation of the HEIC image capture, in which + * case the rotation is reflected by + * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by + * rotating the image data itself.
*Units: Degrees in multiples of 90
*Range of valid values:
* 0, 90, 180, 270
Compression quality of the final JPEG * image.
- *85-95 is typical usage range.
+ *85-95 is typical usage range. This tag is also used to describe the quality + * of the HEIC image capture.
*Range of valid values:
* 1-100; larger is higher quality
This key is available on all devices.
@@ -2545,6 +2554,7 @@ public class CaptureResult extends CameraMetadataCompression quality of JPEG * thumbnail.
+ *This tag is also used to describe the quality of the HEIC image capture.
*Range of valid values:
* 1-100; larger is higher quality
This key is available on all devices.
@@ -2577,6 +2587,10 @@ public class CaptureResult extends CameraMetadataThe tag is also used as thumbnail size for HEIC image format capture, in which case the + * the thumbnail rotation is reflected by + * {@link android.media.ExifInterface#TAG_ORIENTATION EXIF orientation flag}, and not by + * rotating the thumbnail data itself.
*Range of valid values:
* {@link CameraCharacteristics#JPEG_AVAILABLE_THUMBNAIL_SIZES android.jpeg.availableThumbnailSizes}
This key is available on all devices.
diff --git a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java index 7877a4d51313c..65026b6feb9f2 100644 --- a/core/java/android/hardware/camera2/impl/CameraMetadataNative.java +++ b/core/java/android/hardware/camera2/impl/CameraMetadataNative.java @@ -1133,6 +1133,9 @@ public class CameraMetadataNative implements Parcelable { /*dynamicDepthConfigurations*/ null, /*dynamicDepthMinFrameDurations*/ null, /*dynamicDepthStallDurations*/ null, + /*heicconfiguration*/ null, + /*heicminduration*/ null, + /*heicstallduration*/ null, /*highspeedvideoconfigurations*/ null, /*inputoutputformatsmap*/ null, listHighResolution, supportsPrivate[i]); break; @@ -1144,6 +1147,9 @@ public class CameraMetadataNative implements Parcelable { /*dynamicDepthConfigurations*/ null, /*dynamicDepthMinFrameDurations*/ null, /*dynamicDepthStallDurations*/ null, + /*heicconfiguration*/ null, + /*heicminduration*/ null, + /*heicstallduration*/ null, highSpeedVideoConfigurations, /*inputoutputformatsmap*/ null, listHighResolution, supportsPrivate[i]); break; @@ -1155,6 +1161,9 @@ public class CameraMetadataNative implements Parcelable { /*dynamicDepthConfigurations*/ null, /*dynamicDepthMinFrameDurations*/ null, /*dynamicDepthStallDurations*/ null, + /*heicconfiguration*/ null, + /*heicminduration*/ null, + /*heicstallduration*/ null, /*highSpeedVideoConfigurations*/ null, inputOutputFormatsMap, listHighResolution, supportsPrivate[i]); break; @@ -1166,6 +1175,9 @@ public class CameraMetadataNative implements Parcelable { /*dynamicDepthConfigurations*/ null, /*dynamicDepthMinFrameDurations*/ null, /*dynamicDepthStallDurations*/ null, + /*heicconfiguration*/ null, + /*heicminduration*/ null, + /*heicstallduration*/ null, /*highSpeedVideoConfigurations*/ null, /*inputOutputFormatsMap*/ null, listHighResolution, supportsPrivate[i]); } @@ -1230,6 +1242,12 @@ public class CameraMetadataNative implements Parcelable { CameraCharacteristics.DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS); StreamConfigurationDuration[] dynamicDepthStallDurations = getBase( CameraCharacteristics.DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS); + StreamConfiguration[] heicConfigurations = getBase( + CameraCharacteristics.HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS); + StreamConfigurationDuration[] heicMinFrameDurations = getBase( + CameraCharacteristics.HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS); + StreamConfigurationDuration[] heicStallDurations = getBase( + CameraCharacteristics.HEIC_AVAILABLE_HEIC_STALL_DURATIONS); HighSpeedVideoConfiguration[] highSpeedVideoConfigurations = getBase( CameraCharacteristics.CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS); ReprocessFormatsMap inputOutputFormatsMap = getBase( @@ -1239,7 +1257,9 @@ public class CameraMetadataNative implements Parcelable { configurations, minFrameDurations, stallDurations, depthConfigurations, depthMinFrameDurations, depthStallDurations, dynamicDepthConfigurations, dynamicDepthMinFrameDurations, - dynamicDepthStallDurations, highSpeedVideoConfigurations, inputOutputFormatsMap, + dynamicDepthStallDurations, heicConfigurations, + heicMinFrameDurations, heicStallDurations, + highSpeedVideoConfigurations, inputOutputFormatsMap, listHighResolution); } diff --git a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java index a22e008a65fd9..996f9978a6128 100644 --- a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java +++ b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java @@ -79,6 +79,22 @@ public final class StreamConfigurationMap { * @param configurations a non-{@code null} array of {@link StreamConfiguration} * @param minFrameDurations a non-{@code null} array of {@link StreamConfigurationDuration} * @param stallDurations a non-{@code null} array of {@link StreamConfigurationDuration} + * @param depthConfigurations a non-{@code null} array of depth {@link StreamConfiguration} + * @param depthMinFrameDurations a non-{@code null} array of depth + * {@link StreamConfigurationDuration} + * @param depthStallDurations a non-{@code null} array of depth + * {@link StreamConfigurationDuration} + * @param dynamicDepthConfigurations a non-{@code null} array of dynamic depth + * {@link StreamConfiguration} + * @param dynamicDepthMinFrameDurations a non-{@code null} array of dynamic depth + * {@link StreamConfigurationDuration} + * @param dynamicDepthStallDurations a non-{@code null} array of dynamic depth + * {@link StreamConfigurationDuration} + * @param heicConfigurations a non-{@code null} array of heic {@link StreamConfiguration} + * @param heicMinFrameDurations a non-{@code null} array of heic + * {@link StreamConfigurationDuration} + * @param heicStallDurations a non-{@code null} array of heic + * {@link StreamConfigurationDuration} * @param highSpeedVideoConfigurations an array of {@link HighSpeedVideoConfiguration}, null if * camera device does not support high speed video recording * @param listHighResolution a flag indicating whether the device supports BURST_CAPTURE @@ -98,14 +114,19 @@ public final class StreamConfigurationMap { StreamConfiguration[] dynamicDepthConfigurations, StreamConfigurationDuration[] dynamicDepthMinFrameDurations, StreamConfigurationDuration[] dynamicDepthStallDurations, + StreamConfiguration[] heicConfigurations, + StreamConfigurationDuration[] heicMinFrameDurations, + StreamConfigurationDuration[] heicStallDurations, HighSpeedVideoConfiguration[] highSpeedVideoConfigurations, ReprocessFormatsMap inputOutputFormatsMap, boolean listHighResolution) { this(configurations, minFrameDurations, stallDurations, depthConfigurations, depthMinFrameDurations, depthStallDurations, dynamicDepthConfigurations, dynamicDepthMinFrameDurations, - dynamicDepthStallDurations, highSpeedVideoConfigurations, inputOutputFormatsMap, - listHighResolution, /*enforceImplementationDefined*/ true); + dynamicDepthStallDurations, + heicConfigurations, heicMinFrameDurations, heicStallDurations, + highSpeedVideoConfigurations, inputOutputFormatsMap, listHighResolution, + /*enforceImplementationDefined*/ true); } /** @@ -117,6 +138,22 @@ public final class StreamConfigurationMap { * @param configurations a non-{@code null} array of {@link StreamConfiguration} * @param minFrameDurations a non-{@code null} array of {@link StreamConfigurationDuration} * @param stallDurations a non-{@code null} array of {@link StreamConfigurationDuration} + * @param depthConfigurations a non-{@code null} array of depth {@link StreamConfiguration} + * @param depthMinFrameDurations a non-{@code null} array of depth + * {@link StreamConfigurationDuration} + * @param depthStallDurations a non-{@code null} array of depth + * {@link StreamConfigurationDuration} + * @param dynamicDepthConfigurations a non-{@code null} array of dynamic depth + * {@link StreamConfiguration} + * @param dynamicDepthMinFrameDurations a non-{@code null} array of dynamic depth + * {@link StreamConfigurationDuration} + * @param dynamicDepthStallDurations a non-{@code null} array of dynamic depth + * {@link StreamConfigurationDuration} + * @param heicConfigurations a non-{@code null} array of heic {@link StreamConfiguration} + * @param heicMinFrameDurations a non-{@code null} array of heic + * {@link StreamConfigurationDuration} + * @param heicStallDurations a non-{@code null} array of heic + * {@link StreamConfigurationDuration} * @param highSpeedVideoConfigurations an array of {@link HighSpeedVideoConfiguration}, null if * camera device does not support high speed video recording * @param listHighResolution a flag indicating whether the device supports BURST_CAPTURE @@ -138,14 +175,23 @@ public final class StreamConfigurationMap { StreamConfiguration[] dynamicDepthConfigurations, StreamConfigurationDuration[] dynamicDepthMinFrameDurations, StreamConfigurationDuration[] dynamicDepthStallDurations, + StreamConfiguration[] heicConfigurations, + StreamConfigurationDuration[] heicMinFrameDurations, + StreamConfigurationDuration[] heicStallDurations, HighSpeedVideoConfiguration[] highSpeedVideoConfigurations, ReprocessFormatsMap inputOutputFormatsMap, boolean listHighResolution, boolean enforceImplementationDefined) { + if (configurations == null && + depthConfigurations == null && + heicConfigurations == null) { + throw new NullPointerException("At least one of color/depth/heic configurations " + + "must not be null"); + } + if (configurations == null) { // If no color configurations exist, ensure depth ones do - checkArrayElementsNotNull(depthConfigurations, "depthConfigurations"); mConfigurations = new StreamConfiguration[0]; mMinFrameDurations = new StreamConfigurationDuration[0]; mStallDurations = new StreamConfigurationDuration[0]; @@ -183,6 +229,19 @@ public final class StreamConfigurationMap { "dynamicDepthStallDurations"); } + if (heicConfigurations == null) { + mHeicConfigurations = new StreamConfiguration[0]; + mHeicMinFrameDurations = new StreamConfigurationDuration[0]; + mHeicStallDurations = new StreamConfigurationDuration[0]; + } else { + mHeicConfigurations = checkArrayElementsNotNull(heicConfigurations, + "heicConfigurations"); + mHeicMinFrameDurations = checkArrayElementsNotNull(heicMinFrameDurations, + "heicMinFrameDurations"); + mHeicStallDurations = checkArrayElementsNotNull(heicStallDurations, + "heicStallDurations"); + } + if (highSpeedVideoConfigurations == null) { mHighSpeedVideoConfigurations = new HighSpeedVideoConfiguration[0]; } else { @@ -235,6 +294,17 @@ public final class StreamConfigurationMap { mDynamicDepthOutputFormats.get(config.getFormat()) + 1); } + // For each heic format, track how many sizes there are available to configure + for (StreamConfiguration config : mHeicConfigurations) { + if (!config.isOutput()) { + // Ignoring input depth configs + continue; + } + + mHeicOutputFormats.put(config.getFormat(), + mHeicOutputFormats.get(config.getFormat()) + 1); + } + if (configurations != null && enforceImplementationDefined && mOutputFormats.indexOfKey(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) < 0) { throw new AssertionError( @@ -302,7 +372,16 @@ public final class StreamConfigurationMap { if (mInputOutputFormatsMap == null) { return new int[0]; } - return mInputOutputFormatsMap.getOutputs(inputFormat); + + int[] outputs = mInputOutputFormatsMap.getOutputs(inputFormat); + if (mHeicOutputFormats.size() > 0) { + // All reprocessing formats map contain JPEG. + int[] outputsWithHeic = Arrays.copyOf(outputs, outputs.length+1); + outputsWithHeic[outputs.length] = ImageFormat.HEIC; + return outputsWithHeic; + } else { + return outputs; + } } /** @@ -366,6 +445,8 @@ public final class StreamConfigurationMap { return mDepthOutputFormats.indexOfKey(internalFormat) >= 0; } else if (dataspace == HAL_DATASPACE_DYNAMIC_DEPTH) { return mDynamicDepthOutputFormats.indexOfKey(internalFormat) >= 0; + } else if (dataspace == HAL_DATASPACE_HEIF) { + return mHeicOutputFormats.indexOfKey(internalFormat) >= 0; } else { return getFormatsMap(/*output*/true).indexOfKey(internalFormat) >= 0; } @@ -479,6 +560,7 @@ public final class StreamConfigurationMap { StreamConfiguration[] configs = surfaceDataspace == HAL_DATASPACE_DEPTH ? mDepthConfigurations : surfaceDataspace == HAL_DATASPACE_DYNAMIC_DEPTH ? mDynamicDepthConfigurations : + surfaceDataspace == HAL_DATASPACE_HEIF ? mHeicConfigurations : mConfigurations; for (StreamConfiguration config : configs) { if (config.getFormat() == surfaceFormat && config.isOutput()) { @@ -512,9 +594,10 @@ public final class StreamConfigurationMap { int dataspace = imageFormatToDataspace(format); StreamConfiguration[] configs = - dataspace == HAL_DATASPACE_DEPTH ? mDepthConfigurations : - dataspace == HAL_DATASPACE_DYNAMIC_DEPTH ? mDynamicDepthConfigurations : - mConfigurations; + dataspace == HAL_DATASPACE_DEPTH ? mDepthConfigurations : + dataspace == HAL_DATASPACE_DYNAMIC_DEPTH ? mDynamicDepthConfigurations : + dataspace == HAL_DATASPACE_HEIF ? mHeicConfigurations : + mConfigurations; for (StreamConfiguration config : configs) { if ((config.getFormat() == internalFormat) && config.isOutput() && config.getSize().equals(size)) { @@ -1033,6 +1116,9 @@ public final class StreamConfigurationMap { Arrays.equals(mDynamicDepthMinFrameDurations, other.mDynamicDepthMinFrameDurations) && Arrays.equals(mDynamicDepthStallDurations, other.mDynamicDepthStallDurations) && + Arrays.equals(mHeicConfigurations, other.mHeicConfigurations) && + Arrays.equals(mHeicMinFrameDurations, other.mHeicMinFrameDurations) && + Arrays.equals(mHeicStallDurations, other.mHeicStallDurations) && Arrays.equals(mHighSpeedVideoConfigurations, other.mHighSpeedVideoConfigurations); } @@ -1049,7 +1135,9 @@ public final class StreamConfigurationMap { mConfigurations, mMinFrameDurations, mStallDurations, mDepthConfigurations, mDepthMinFrameDurations, mDepthStallDurations, mDynamicDepthConfigurations, mDynamicDepthMinFrameDurations, - mDynamicDepthStallDurations, mHighSpeedVideoConfigurations); + mDynamicDepthStallDurations, mHeicConfigurations, + mHeicMinFrameDurations, mHeicStallDurations, + mHighSpeedVideoConfigurations); } // Check that the argument is supported by #getOutputFormats or #getInputFormats @@ -1068,6 +1156,10 @@ public final class StreamConfigurationMap { if (mDynamicDepthOutputFormats.indexOfKey(internalFormat) >= 0) { return format; } + } else if (internalDataspace == HAL_DATASPACE_HEIF) { + if (mHeicOutputFormats.indexOfKey(internalFormat) >= 0) { + return format; + } } else { if (mAllOutputFormats.indexOfKey(internalFormat) >= 0) { return format; @@ -1108,8 +1200,9 @@ public final class StreamConfigurationMap { case HAL_PIXEL_FORMAT_Y16: return format; case ImageFormat.JPEG: + case ImageFormat.HEIC: throw new IllegalArgumentException( - "ImageFormat.JPEG is an unknown internal format"); + "An unknown internal format: " + format); default: return checkArgumentFormat(format); } @@ -1267,6 +1360,8 @@ public final class StreamConfigurationMap { *This format defines the HEIC brand of High Efficiency Image File + * Format as described in ISO/IEC 23008-12.
+ */ + public static final int HEIC = 0x48454946; + /** * Use this function to retrieve the number of bits per pixel of an * ImageFormat. @@ -796,6 +804,7 @@ public class ImageFormat { case RAW_DEPTH: case Y8: case DEPTH_JPEG: + case HEIC: return true; } diff --git a/media/java/android/media/Image.java b/media/java/android/media/Image.java index 26b9b8cf85a77..70a343f4de014 100644 --- a/media/java/android/media/Image.java +++ b/media/java/android/media/Image.java @@ -155,6 +155,13 @@ public abstract class Image implements AutoCloseable { * UnSupportedOperationException being thrown. * * + *