From e8d4dd48ed3ad2e226259d8944afd139e86520f8 Mon Sep 17 00:00:00 2001 From: xiaobjy Date: Sat, 13 Apr 2024 15:49:59 +0800 Subject: [PATCH] add hdr ndk api Signed-off-by: xiaobjy Change-Id: Ib7d668308244b0c47dddfe00c575f78a520ed974 --- .../include/image/image_packer_native.h | 38 +++++++++++++ .../include/image/image_source_native.h | 55 +++++++++++++++++++ .../include/image/pixelmap_native.h | 11 ++++ 3 files changed, 104 insertions(+) diff --git a/multimedia/image_framework/include/image/image_packer_native.h b/multimedia/image_framework/include/image/image_packer_native.h index 32ffdff8d..623fdb5e5 100644 --- a/multimedia/image_framework/include/image/image_packer_native.h +++ b/multimedia/image_framework/include/image/image_packer_native.h @@ -58,6 +58,22 @@ typedef struct OH_ImagePackerNative OH_ImagePackerNative; struct OH_PackingOptions; typedef struct OH_PackingOptions OH_PackingOptions; +/** + * @brief Enumerates packing dynamic range. + * + * @since 12 + */ +typedef enum { + /* + * Packing according to the content of the image. + */ + IMAGE_PACKER_DYNAMIC_RANGE_AUTO = 0, + /* + * Packing to standard dynamic range. + */ + IMAGE_PACKER_DYNAMIC_RANGE_SDR = 1, +} IMAGE_PACKER_DYNAMIC_RANGE; + /** * @brief Create a pointer for PackingOptions struct. * @@ -112,6 +128,28 @@ Image_ErrorCode OH_PackingOptions_GetQuality(OH_PackingOptions *options, Image_ErrorCode OH_PackingOptions_SetQuality(OH_PackingOptions *options, uint32_t quality); +/** + * @brief Get desiredDynamicRange for PackingOptions struct. + * + * @param options The PackingOptions pointer will be operated. Pointer connot be null. + * @param desiredDynamicRange The number of dynamic range {@link IMAGE_PACKER_DYNAMIC_RANGE}. Pointer connot be null. + * @return Returns {@link Image_ErrorCode} IMAGE_SUCCESS - The operation is successful. + * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed. + * @since 12 + */ +Image_ErrorCode OH_PackingOptions_GetDesiredDynamicRange(OH_PackingOptions *options, int32_t* desiredDynamicRange); + +/** + * @brief Set desiredDynamicRange number for PackingOptions struct. + * + * @param options The PackingOptions pointer will be operated. Pointer connot be null. + * @param desiredDynamicRange The number of dynamic range {@link IMAGE_PACKER_DYNAMIC_RANGE}. + * @return Returns {@link Image_ErrorCode} IMAGE_SUCCESS - The operation is successful. + * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed. + * @since 12 + */ +Image_ErrorCode OH_PackingOptions_SetDesiredDynamicRange(OH_PackingOptions *options, int32_t desiredDynamicRange); + /** * @brief delete OH_PackingOptions pointer. * diff --git a/multimedia/image_framework/include/image/image_source_native.h b/multimedia/image_framework/include/image/image_source_native.h index c172388ee..65e412195 100644 --- a/multimedia/image_framework/include/image/image_source_native.h +++ b/multimedia/image_framework/include/image/image_source_native.h @@ -60,6 +60,26 @@ typedef struct OH_ImageSourceNative OH_ImageSourceNative; struct OH_ImageSource_Info; typedef struct OH_ImageSource_Info OH_ImageSource_Info; +/** + * @brief Enumerates decoding dynamic range.. + * + * @since 12 + */ +typedef enum { + /* + * Dynamic range depends on the image. + */ + IMAGE_DYNAMIC_RANGE_AUTO = 0, + /* + * Standard dynamic range. + */ + IMAGE_DYNAMIC_RANGE_SDR = 1, + /* + * High dynamic range. + */ + IMAGE_DYNAMIC_RANGE_HDR = 2, +} IMAGE_DYNAMIC_RANGE; + /** * @brief Create a pointer for OH_ImageSource_Info struct. * @@ -89,6 +109,17 @@ Image_ErrorCode OH_ImageSourceInfo_GetWidth(OH_ImageSource_Info *info, uint32_t */ Image_ErrorCode OH_ImageSourceInfo_GetHeight(OH_ImageSource_Info *info, uint32_t *height); +/** + * @brief Get isHdr for OH_ImageSource_Info struct. + * + * @param info The OH_ImageSource_Info pointer will be operated. Pointer connot be null. + * @param isHdr Whether the image has a high dynamic range. + * @return Returns {@link Image_ErrorCode} IMAGE_SUCCESS - The operation is successful. + * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed. + * @since 12 + */ +Image_ErrorCode OH_ImageSourceInfo_GetDynamicRange(OH_ImageSource_Info *info, bool *isHdr); + /** * @brief delete OH_ImageSource_Info pointer. * @@ -222,6 +253,30 @@ Image_ErrorCode OH_DecodingOptions_GetDesiredRegion(OH_DecodingOptions *options, Image_ErrorCode OH_DecodingOptions_SetDesiredRegion(OH_DecodingOptions *options, Image_Region *desiredRegion); +/** + * @brief Set desiredDynamicRange number for OH_DecodingOptions struct. + * + * @param options The OH_DecodingOptions pointer will be operated. Pointer connot be null. + * @param desiredDynamicRange the number of desired dynamic range {@link IMAGE_DYNAMIC_RANGE}. Pointer connot be null. + * @return Returns {@link Image_ErrorCode} IMAGE_SUCCESS - The operation is successful. + * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed. + * @since 12 + */ +Image_ErrorCode OH_DecodingOptions_GetDesiredDynamicRange(OH_DecodingOptions *options, + int32_t *desiredDynamicRange); + +/** + * @brief Set desiredDynamicRange number for OH_DecodingOptions struct. + * + * @param options The OH_DecodingOptions pointer will be operated. Pointer connot be null. + * @param desiredDynamicRange the number of desired dynamic range {@link IMAGE_DYNAMIC_RANGE}. + * @return Returns {@link Image_ErrorCode} IMAGE_SUCCESS - The operation is successful. + * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed. + * @since 12 + */ +Image_ErrorCode OH_DecodingOptions_SetDesiredDynamicRange(OH_DecodingOptions *options, + int32_t desiredDynamicRange); + /** * @brief delete OH_DecodingOptions pointer. * diff --git a/multimedia/image_framework/include/image/pixelmap_native.h b/multimedia/image_framework/include/image/pixelmap_native.h index 5f176d821..507e3f643 100644 --- a/multimedia/image_framework/include/image/pixelmap_native.h +++ b/multimedia/image_framework/include/image/pixelmap_native.h @@ -289,6 +289,17 @@ Image_ErrorCode OH_PixelmapImageInfo_GetPixelFormat(OH_Pixelmap_ImageInfo *info, */ Image_ErrorCode OH_PixelmapImageInfo_GetAlphaType(OH_Pixelmap_ImageInfo *info, int32_t *alphaType); +/** + * @brief Get isHdr boolean for imageinfo struct. + * + * @param info The imageinfo pointer will be operated. Pointer connot be null. + * @param isHdr Whether the image has a high dynamic range. + * @return Returns {@link Image_ErrorCode} IMAGE_SUCCESS - The operation is successful. + * returns {@link Image_ErrorCode} IMAGE_BAD_PARAMETER - Parameter error.Possible causes:Parameter verification failed. + * @since 12 + */ +Image_ErrorCode OH_PixelmapImageInfo_GetDynamicRange(OH_Pixelmap_ImageInfo *info, bool *isHdr); + /** * @brief Delete imageinfo struct pointer. * -- Gitee