Add RAW_DEPTH10 image format

Add support for 10bit opaque and private RAW_DEPTH10 image format
which is similar to RAW_DEPTH.

Bug: 167250258
Test: Manual using camera application.
Change-Id: Ib2ee11570429d7a9a53e9dd6bc2042a1f5eaa760
This commit is contained in:
Emilian Peev
2020-08-31 17:23:50 -07:00
parent e2a264d0e9
commit 0173af0189
3 changed files with 26 additions and 0 deletions

View File

@@ -1320,6 +1320,8 @@ public final class StreamConfigurationMap {
return ImageFormat.DEPTH16;
case HAL_PIXEL_FORMAT_RAW16:
return ImageFormat.RAW_DEPTH;
case HAL_PIXEL_FORMAT_RAW10:
return ImageFormat.RAW_DEPTH10;
case ImageFormat.JPEG:
throw new IllegalArgumentException(
"ImageFormat.JPEG is an unknown internal format");
@@ -1393,6 +1395,8 @@ public final class StreamConfigurationMap {
return HAL_PIXEL_FORMAT_Y16;
case ImageFormat.RAW_DEPTH:
return HAL_PIXEL_FORMAT_RAW16;
case ImageFormat.RAW_DEPTH10:
return HAL_PIXEL_FORMAT_RAW10;
default:
return format;
}
@@ -1437,6 +1441,7 @@ public final class StreamConfigurationMap {
case ImageFormat.DEPTH_POINT_CLOUD:
case ImageFormat.DEPTH16:
case ImageFormat.RAW_DEPTH:
case ImageFormat.RAW_DEPTH10:
return HAL_DATASPACE_DEPTH;
case ImageFormat.DEPTH_JPEG:
return HAL_DATASPACE_DYNAMIC_DEPTH;
@@ -1878,6 +1883,8 @@ public final class StreamConfigurationMap {
return "DEPTH_JPEG";
case ImageFormat.RAW_DEPTH:
return "RAW_DEPTH";
case ImageFormat.RAW_DEPTH10:
return "RAW_DEPTH10";
case ImageFormat.PRIVATE:
return "PRIVATE";
case ImageFormat.HEIC:

View File

@@ -47,6 +47,7 @@ public class ImageFormat {
DEPTH16,
DEPTH_POINT_CLOUD,
RAW_DEPTH,
RAW_DEPTH10,
PRIVATE,
HEIC
})
@@ -724,6 +725,15 @@ public class ImageFormat {
*/
public static final int RAW_DEPTH = 0x1002;
/**
* Unprocessed implementation-dependent raw
* depth measurements, opaque with 10 bit
* samples and device specific bit layout.
*
* @hide
*/
public static final int RAW_DEPTH10 = 0x1003;
/**
* Android private opaque image format.
* <p>
@@ -797,6 +807,7 @@ public class ImageFormat {
case RAW_DEPTH:
case RAW_SENSOR:
return 16;
case RAW_DEPTH10:
case RAW10:
return 10;
case RAW12:
@@ -838,6 +849,7 @@ public class ImageFormat {
case DEPTH_POINT_CLOUD:
case PRIVATE:
case RAW_DEPTH:
case RAW_DEPTH10:
case Y8:
case DEPTH_JPEG:
case HEIC:

View File

@@ -63,6 +63,7 @@ class ImageUtils {
case ImageFormat.DEPTH16:
case ImageFormat.DEPTH_POINT_CLOUD:
case ImageFormat.RAW_DEPTH:
case ImageFormat.RAW_DEPTH10:
case ImageFormat.DEPTH_JPEG:
case ImageFormat.HEIC:
return 1;
@@ -110,6 +111,10 @@ class ImageUtils {
throw new IllegalArgumentException(
"Copy of RAW_DEPTH format has not been implemented");
}
if (src.getFormat() == ImageFormat.RAW_DEPTH10) {
throw new IllegalArgumentException(
"Copy of RAW_DEPTH10 format has not been implemented");
}
if (!(dst.getOwner() instanceof ImageWriter)) {
throw new IllegalArgumentException("Destination image is not from ImageWriter. Only"
+ " the images from ImageWriter are writable");
@@ -202,6 +207,7 @@ class ImageUtils {
estimatedBytePerPixel = 1.0;
break;
case ImageFormat.RAW10:
case ImageFormat.RAW_DEPTH10:
estimatedBytePerPixel = 1.25;
break;
case ImageFormat.YV12:
@@ -264,6 +270,7 @@ class ImageUtils {
case ImageFormat.RAW10:
case ImageFormat.RAW12:
case ImageFormat.RAW_DEPTH:
case ImageFormat.RAW_DEPTH10:
case ImageFormat.HEIC:
return new Size(image.getWidth(), image.getHeight());
case ImageFormat.PRIVATE: