From 0220116b39399a404f129b3cbc662a8efbd65cbe Mon Sep 17 00:00:00 2001 From: xiaobjy Date: Mon, 15 Jul 2024 11:46:56 +0800 Subject: [PATCH] add hdr metadata Signed-off-by: xiaobjy Change-Id: I908d127a563ddb9b49b3788dfce737176ef2c647 --- .../include/image/pixelmap_native.h | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) diff --git a/multimedia/image_framework/include/image/pixelmap_native.h b/multimedia/image_framework/include/image/pixelmap_native.h index 7114cbee2f4..f25a1e4d237 100644 --- a/multimedia/image_framework/include/image/pixelmap_native.h +++ b/multimedia/image_framework/include/image/pixelmap_native.h @@ -137,6 +137,186 @@ typedef enum { OH_PixelmapNative_AntiAliasing_HIGH = 3, } OH_PixelmapNative_AntiAliasingLevel; +/** + * @brief Enumerates the HDR metadata types that need to be stored in Pixelmap. + * + * @since 12 + */ +typedef enum { + /** + * Indicate the types of metadata that image needs to use. + */ + HDR_METADATA_TYPE = 0, + /** + * Static metadata key. + */ + HDR_STATIC_METADATA = 1, + /** + * Dynamic metadata key. + */ + HDR_DYNAMIC_METADATA = 2, + /** + * Gainmap metadata key. + */ + HDR_GAINMAP_METADATA = 3, +} OH_Pixelmap_HdrMetadataKey; + +/** + * @brief Value for HDR_METADATA_TYPE. + * + * @since 12 + */ +typedef enum { + /** + * No metadata. + */ + NONE = 0, + /** + * Indicates that metadata will be used for the base image. + */ + BASE = 1, + /** + * Indicates that metadata will be used for the gainmap image. + */ + GAINMAP = 2, + /** + * Indicates that metadata will be used for the alternate image. + */ + ALTERNATE = 3, +} OH_Pixelmap_HdrMetadataType; + +/** + * @brief Value for HDR_STATIC_METADATA. + * + * @since 12 + */ +typedef struct OH_Pixelmap_HdrStaticMetadata { + /** + * The X-coordinate of the primary colors. The length of the array is three. Store in the order of r, g, b. + */ + float displayPrimariesX[3]; + /** + * The Y-coordinate of the primary colors. The length of the array is three. Store in the order of r, g, b. + */ + float displayPrimariesY[3]; + /** + * The X-coordinate of the white point value. + */ + float whitePointX; + /** + * The Y-coordinate of the white point value. + */ + float whitePointY; + /** + * Max luminance. + */ + float maxLuminance; + /** + * Min luminance. + */ + float minLuminance; + /** + * Maximum brightness of displayed content. + */ + float maxContentLightLevel; + /** + * Maximum average brightness of displayed content. + */ + float maxFrameAverageLightLevel; +} OH_Pixelmap_HdrStaticMetadata; + +/** + * @brief Value for HDR_DYNAMIC_METADATA. + * + * @since 12 + */ +typedef struct OH_Pixelmap_HdrDynamicMetadata { + /** + * The value of dynamic metadata. + */ + uint8_t* data; + /** + * The length of dynamic metadata. + */ + uint32_t length; +} OH_Pixelmap_HdrDynamicMetadata; + +/** + * @brief Value for HDR_GAINMAP_METADATA. + * + * @since 12 + */ +typedef struct OH_Pixelmap_HdrGainmapMetadata { + /** + * The version used by the writer. + */ + uint16_t writerVersion; + /** + * The minimum version a parser needs to understand. + */ + uint16_t miniVersion; + /** + * The number of gain map channels, with a value of 1 or 3. + */ + uint8_t gainmapChannelNum; + /** + * Indicate whether to use the color space of the base image. + */ + bool useBaseColorFlag; + /** + * The baseline hdr headroom. + */ + float baseHeadroom; + /** + * The alternate hdr headroom. + */ + float alternateHeadroom; + /** + * The per-component max gain map values. + */ + float gainmapMax[3]; + /** + * The per-component min gain map values. + */ + float gainmapMin[3]; + /** + * The per-component gamma values. + */ + float gamma[3]; + /** + * The per-component baseline offset. + */ + float baselineOffset[3]; + /** + * The per-component alternate offset. + */ + float alternateOffset[3]; +} OH_Pixelmap_HdrGainmapMetadata; + +/** + * @brief Value for HDR_METADATA_KEY. Corresponding relationship with HDR_METADATA_KEY. + * + * @since 12 + */ +typedef struct OH_Pixelmap_HdrMetadataValue { + /** + * The value corresponding to the HDR_METADATA_TYPE key + */ + OH_Pixelmap_HdrMetadataType type; + /** + * The value corresponding to the HDR_STATIC_METADATA key + */ + OH_Pixelmap_HdrStaticMetadata staticMetadata; + /** + * The value corresponding to the HDR_DYNAMIC_METADATA key + */ + OH_Pixelmap_HdrDynamicMetadata dynamicMetadata; + /** + * The value corresponding to the HDR_GAINMAP_METADATA key + */ + OH_Pixelmap_HdrGainmapMetadata gainmapMetadata; +} OH_Pixelmap_HdrMetadataValue; + /** * @brief Defines the options used for creating a pixel map. * -- Gitee