1 /* 2 * Copyright (C) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FRAMEWORKS_INNERKITSIMPL_UTILS_INCLUDE_HDR_TYPE_H 17 #define FRAMEWORKS_INNERKITSIMPL_UTILS_INCLUDE_HDR_TYPE_H 18 #include <vector> 19 namespace OHOS { 20 namespace Media { 21 enum class ImageHdrType : int32_t { 22 UNKNOWN = 0, 23 SDR, 24 HDR_ISO_DUAL, 25 HDR_CUVA, 26 HDR_VIVID_DUAL, 27 HDR_VIVID_SINGLE, 28 HDR_ISO_SINGLE, 29 }; 30 31 typedef struct ISOMetadata { 32 unsigned short writeVersion; 33 unsigned short miniVersion; 34 unsigned char gainmapChannelNum; 35 unsigned char useBaseColorFlag; 36 float baseHeadroom; 37 float alternateHeadroom; 38 float enhanceClippedThreholdMaxGainmap[3]; 39 float enhanceClippedThreholdMinGainmap[3]; 40 float enhanceMappingGamma[3]; 41 float enhanceMappingBaselineOffset[3]; 42 float enhanceMappingAlternateOffset[3]; 43 } ISOMetadata; 44 45 typedef struct GainmapColorMetadata { 46 unsigned char enhanceDataColorPrimary; 47 unsigned char enhanceDataTransFunction; 48 unsigned char enhanceDataColorModel; 49 50 unsigned char combineColorPrimary; 51 unsigned char combineTransFunction; 52 unsigned char combineColorModel; 53 54 unsigned char alternateColorPrimary; 55 unsigned char alternateTransFunction; 56 unsigned char alternateColorModel; 57 58 unsigned short enhanceICCSize; 59 std::vector<unsigned char> enhanceICC; 60 61 unsigned char combineMappingFlag; 62 unsigned short combineMappingSize; 63 unsigned char combineMappingMatrix[9]; 64 std::vector<unsigned char> combineMapping; 65 } GainmapColorMetadata; 66 67 typedef struct BaseColorMetadata { 68 unsigned char baseColorPrimary; 69 unsigned char baseTransFunction; 70 unsigned char baseColorModel; 71 72 unsigned short baseIccSize; 73 std::vector<unsigned char> baseICC; 74 75 unsigned char baseMappingFlag; 76 unsigned short baseMappingSize; 77 unsigned char baseMappingMatrix[9]; 78 std::vector<unsigned char> baseMapping; 79 } BaseColorMetadata; 80 81 typedef struct HDRVividExtendMetadata { 82 ISOMetadata metaISO; 83 GainmapColorMetadata gainmapColorMeta; 84 BaseColorMetadata baseColorMeta; 85 } HDRVividExtendMetadata; 86 87 struct HdrMetadata { 88 std::vector<uint8_t> staticMetadata; 89 std::vector<uint8_t> dynamicMetadata; 90 bool extendMetaFlag = false; 91 HDRVividExtendMetadata extendMeta; 92 int32_t hdrMetadataType; 93 }; 94 } // namespace Media 95 } // namespace OHOS 96 97 #endif // FRAMEWORKS_INNERKITSIMPL_UTILS_INCLUDE_HDR_TYPE_H