From a166f50ac5f5393236685418ce45509212f706bd Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Mon, 23 Feb 2015 15:51:58 -0800 Subject: [PATCH] Camera2: Add max depth point count and stream configuration tags - Add system-level android.depth.maxDepthSamples to indicate maximum size of a point cloud buffer - Add hidden android.depth.availableDepthStreamConfigurations, android.depth.availableDepthMinFrameDurations, and android.depth.availableDepthStallDurations - Add DEPTH tag that covers the above. Change-Id: I639f9cdfbcfdea871479f3b886db83dd88b8994f --- camera/docs/docs.html | 315 +++++++++++++++++++++++++++ camera/docs/metadata_properties.xml | 108 +++++++++ camera/include/system/camera_metadata_tags.h | 17 ++ camera/src/camera_metadata_tag_info.c | 43 ++++ 4 files changed, 483 insertions(+) diff --git a/camera/docs/docs.html b/camera/docs/docs.html index d6a870fe..4ad5d985 100644 --- a/camera/docs/docs.html +++ b/camera/docs/docs.html @@ -1081,6 +1081,24 @@ +
  • + depth + +
  • @@ -24517,6 +24535,293 @@ Similarly, for edge enhancement reprocessing, it is only effective w + depth + + + static + + + + Property Name + Type + Description + Units + Range + Tags + + + + + + + + + + + + + + + + + android.depth.maxDepthSamples + + + int32 + + [system] + + + [limited] + + + + + + + +

    Maximum number of points that a depth point cloud may contain.

    + + + + + + + + + + + + + + + Details + + + +

    If a camera device supports outputting depth range data in the form of a depth +point cloud (ImageFormat#DEPTH_POINT_CLOUD), this is the maximum number of points +an output buffer may contain.

    +

    Any given buffer may contain between 0 and maxDepthSamples points, inclusive. +If output in the depth point cloud format is not supported, this entry will +not be defined.

    + + + + + + + + + + + android.depth.availableDepthStreamConfigurations + + + int32 + x + + + n x 4 + + [hidden as streamConfiguration] + + + [limited] + + + + + + + + +

    The available depth dataspace stream +configurations that this camera device supports +(i.e. format, width, height, output/input stream).

    + + + + + + + + + + + + + + + Details + + + +

    These are output stream configurations for use with +dataSpace HAL_DATASPACE_DEPTH. The configurations are +listed as (format, width, height, input?) tuples.

    +

    Only devices that support depth output for at least +the HAL_PIXEL_FORMAT_Y16 dense depth map may include +this entry.

    +

    A device that also supports the HAL_PIXEL_FORMAT_BLOB +sparse depth point cloud must report a single entry for +the format in this list as (HAL_PIXEL_FORMAT_BLOB, +android.depth.maxDepthSamples, 1, OUTPUT) in addition to +the entries for HAL_PIXEL_FORMAT_Y16.

    + + + + + + + + + + + android.depth.availableDepthMinFrameDurations + + + int64 + x + + + 4 x n + + [hidden as streamConfigurationDuration] + + + [limited] + + + + + + + +

    This lists the minimum frame duration for each +format/size combination for depth output formats.

    + + + + (format, width, height, ns) x n + + + + + + + + + + + + Details + + + +

    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).

    +

    The minimum frame duration of a stream (of a particular format, size) +is the same regardless of whether the stream is input or output.

    +

    See android.sensor.frameDuration and +android.scaler.availableStallDurations for more details about +calculating the max frame rate.

    +

    (Keep in sync with +StreamConfigurationMap#getOutputMinFrameDuration)

    + + + + + + + + + + + android.depth.availableDepthStallDurations + + + int64 + x + + + 4 x n + + [hidden as streamConfigurationDuration] + + + [limited] + + + + + + + +

    This lists the maximum stall duration for each +format/size combination for depth streams.

    + + + + (format, width, height, ns) x n + + + + + + + + + + + + Details + + + +

    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 depth +streams.

    +

    All depth output stream formats may have a nonzero stall +duration.

    + + + + + + + + + + + + + @@ -24698,6 +25003,16 @@ Similarly, for edge enhancement reprocessing, it is only effective w
  • android.sensor.maxAnalogSensitivity (static)
  • +
  • DEPTH - + Entry is required for the depth capability. + + +
  • FUTURE - Entry is under-specified and is not required for now. This is for book-keeping purpose, do not implement or use it, it may be revised for future. diff --git a/camera/docs/metadata_properties.xml b/camera/docs/metadata_properties.xml index b5a96626..1ac1b42c 100644 --- a/camera/docs/metadata_properties.xml +++ b/camera/docs/metadata_properties.xml @@ -33,6 +33,9 @@ xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata Entry is required for full hardware level devices, and optional for other hardware levels + + Entry is required for the depth capability. + Entry is under-specified and is not required for now. This is for book-keeping purpose, do not implement or use it, it may be revised for future. @@ -7676,5 +7679,110 @@ xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata +
    + + + Maximum number of points that a depth point cloud may contain. + +
    + If a camera device supports outputting depth range data in the form of a depth + point cloud (ImageFormat#DEPTH_POINT_CLOUD), this is the maximum number of points + an output buffer may contain. + + Any given buffer may contain between 0 and maxDepthSamples points, inclusive. + If output in the depth point cloud format is not supported, this entry will + not be defined. +
    + +
    + + + n + 4 + + + OUTPUT + INPUT + + The available depth dataspace stream + configurations that this camera device supports + (i.e. format, width, height, output/input stream). + +
    + These are output stream configurations for use with + dataSpace HAL_DATASPACE_DEPTH. The configurations are + listed as `(format, width, height, input?)` tuples. + + Only devices that support depth output for at least + the HAL_PIXEL_FORMAT_Y16 dense depth map may include + this entry. + + A device that also supports the HAL_PIXEL_FORMAT_BLOB + sparse depth point cloud must report a single entry for + the format in this list as `(HAL_PIXEL_FORMAT_BLOB, + android.depth.maxDepthSamples, 1, OUTPUT)` in addition to + the entries for HAL_PIXEL_FORMAT_Y16. +
    + +
    + + + 4 + n + + This lists the minimum frame duration for each + format/size combination for depth output formats. + + (format, width, height, ns) x n +
    + 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). + + The minimum frame duration of a stream (of a particular format, size) + is the same regardless of whether the stream is input or output. + + See android.sensor.frameDuration and + android.scaler.availableStallDurations for more details about + calculating the max frame rate. + + (Keep in sync with + StreamConfigurationMap#getOutputMinFrameDuration) +
    + +
    + + + 4 + n + + This lists the maximum stall duration for each + format/size combination for depth streams. + + (format, width, height, ns) x n +
    + 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 depth + streams. + + All depth output stream formats may have a nonzero stall + duration. +
    + +
    +
    +
    diff --git a/camera/include/system/camera_metadata_tags.h b/camera/include/system/camera_metadata_tags.h index aa1e4830..b5bd3229 100644 --- a/camera/include/system/camera_metadata_tags.h +++ b/camera/include/system/camera_metadata_tags.h @@ -60,6 +60,7 @@ typedef enum camera_metadata_section { ANDROID_BLACK_LEVEL, ANDROID_SYNC, ANDROID_REPROCESS, + ANDROID_DEPTH, ANDROID_SECTION_COUNT, VENDOR_SECTION = 0x8000 @@ -95,6 +96,7 @@ typedef enum camera_metadata_section_start { ANDROID_BLACK_LEVEL_START = ANDROID_BLACK_LEVEL << 16, ANDROID_SYNC_START = ANDROID_SYNC << 16, ANDROID_REPROCESS_START = ANDROID_REPROCESS << 16, + ANDROID_DEPTH_START = ANDROID_DEPTH << 16, VENDOR_SECTION_START = VENDOR_SECTION << 16 } camera_metadata_section_start_t; @@ -391,6 +393,14 @@ typedef enum camera_metadata_tag { ANDROID_REPROCESS_START, ANDROID_REPROCESS_END, + ANDROID_DEPTH_MAX_DEPTH_SAMPLES = // int32 | system + ANDROID_DEPTH_START, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, + // enum[] | hidden + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS,// int64[] | hidden + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS, // int64[] | hidden + ANDROID_DEPTH_END, + } camera_metadata_tag_t; /** @@ -883,3 +893,10 @@ typedef enum camera_metadata_enum_android_sync_max_latency { +// ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS +typedef enum camera_metadata_enum_android_depth_available_depth_stream_configurations { + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT, +} camera_metadata_enum_android_depth_available_depth_stream_configurations_t; + + diff --git a/camera/src/camera_metadata_tag_info.c b/camera/src/camera_metadata_tag_info.c index 329fe20b..212a1db3 100644 --- a/camera/src/camera_metadata_tag_info.c +++ b/camera/src/camera_metadata_tag_info.c @@ -56,6 +56,7 @@ const char *camera_metadata_section_names[ANDROID_SECTION_COUNT] = { [ANDROID_BLACK_LEVEL] = "android.blackLevel", [ANDROID_SYNC] = "android.sync", [ANDROID_REPROCESS] = "android.reprocess", + [ANDROID_DEPTH] = "android.depth", }; unsigned int camera_metadata_section_bounds[ANDROID_SECTION_COUNT][2] = { @@ -109,6 +110,8 @@ unsigned int camera_metadata_section_bounds[ANDROID_SECTION_COUNT][2] = { ANDROID_SYNC_END }, [ANDROID_REPROCESS] = { ANDROID_REPROCESS_START, ANDROID_REPROCESS_END }, + [ANDROID_DEPTH] = { ANDROID_DEPTH_START, + ANDROID_DEPTH_END }, }; static tag_info_t android_color_correction[ANDROID_COLOR_CORRECTION_END - @@ -634,6 +637,20 @@ static tag_info_t android_reprocess[ANDROID_REPROCESS_END - { "effectiveExposureFactor", TYPE_FLOAT }, }; +static tag_info_t android_depth[ANDROID_DEPTH_END - + ANDROID_DEPTH_START] = { + [ ANDROID_DEPTH_MAX_DEPTH_SAMPLES - ANDROID_DEPTH_START ] = + { "maxDepthSamples", TYPE_INT32 }, + [ ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS - ANDROID_DEPTH_START ] = + { "availableDepthStreamConfigurations", + TYPE_INT32 }, + [ ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS - ANDROID_DEPTH_START ] = + { "availableDepthMinFrameDurations", + TYPE_INT64 }, + [ ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS - ANDROID_DEPTH_START ] = + { "availableDepthStallDurations", TYPE_INT64 }, +}; + tag_info_t *tag_info[ANDROID_SECTION_COUNT] = { android_color_correction, @@ -661,6 +678,7 @@ tag_info_t *tag_info[ANDROID_SECTION_COUNT] = { android_black_level, android_sync, android_reprocess, + android_depth, }; int camera_metadata_enum_snprint(uint32_t tag, @@ -2456,6 +2474,31 @@ int camera_metadata_enum_snprint(uint32_t tag, break; } + case ANDROID_DEPTH_MAX_DEPTH_SAMPLES: { + break; + } + case ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS: { + switch (value) { + case ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT: + msg = "OUTPUT"; + ret = 0; + break; + case ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT: + msg = "INPUT"; + ret = 0; + break; + default: + msg = "error: enum value out of range"; + } + break; + } + case ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS: { + break; + } + case ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS: { + break; + } + } strncpy(dst, msg, size - 1); -- 2.11.0