• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_HEIF_PARSER_HEIF_TYPE_H
17 #define PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_HEIF_PARSER_HEIF_TYPE_H
18 
19 #include <vector>
20 #include "heif_utils.h"
21 
22 namespace OHOS {
23 namespace ImagePlugin {
24 static const uint32_t BOX_TYPE_FTYP = fourcc_to_code("ftyp");
25 static const uint32_t BOX_TYPE_META = fourcc_to_code("meta");
26 static const uint32_t BOX_TYPE_HDLR = fourcc_to_code("hdlr");
27 static const uint32_t BOX_TYPE_ILOC = fourcc_to_code("iloc");
28 static const uint32_t BOX_TYPE_PITM = fourcc_to_code("pitm");
29 static const uint32_t BOX_TYPE_INFE = fourcc_to_code("infe");
30 static const uint32_t BOX_TYPE_IINF = fourcc_to_code("iinf");
31 static const uint32_t BOX_TYPE_PTIM = fourcc_to_code("ptim");
32 static const uint32_t BOX_TYPE_IPRP = fourcc_to_code("iprp");
33 static const uint32_t BOX_TYPE_AUXC = fourcc_to_code("auxC");
34 static const uint32_t BOX_TYPE_AUXL = fourcc_to_code("auxl");
35 static const uint32_t BOX_TYPE_IPCO = fourcc_to_code("ipco");
36 static const uint32_t BOX_TYPE_IPMA = fourcc_to_code("ipma");
37 static const uint32_t BOX_TYPE_ISPE = fourcc_to_code("ispe");
38 static const uint32_t BOX_TYPE_PIXI = fourcc_to_code("pixi");
39 static const uint32_t BOX_TYPE_COLR = fourcc_to_code("colr");
40 static const uint32_t BOX_TYPE_NCLX = fourcc_to_code("nclx");
41 static const uint32_t BOX_TYPE_HVCC = fourcc_to_code("hvcC");
42 static const uint32_t BOX_TYPE_IROT = fourcc_to_code("irot");
43 static const uint32_t BOX_TYPE_IMIR = fourcc_to_code("imir");
44 static const uint32_t BOX_TYPE_IREF = fourcc_to_code("iref");
45 static const uint32_t BOX_TYPE_IDAT = fourcc_to_code("idat");
46 static const uint32_t BOX_TYPE_MDAT = fourcc_to_code("mdat");
47 static const uint32_t BOX_TYPE_UUID = fourcc_to_code("uuid");
48 static const uint32_t BOX_TYPE_THMB = fourcc_to_code("thmb");
49 static const uint32_t BOX_TYPE_DIMG = fourcc_to_code("dimg");
50 static const uint32_t BOX_TYPE_CDSC = fourcc_to_code("cdsc");
51 
52 static const uint32_t BOX_TYPE_CLLI = fourcc_to_code("clli");
53 static const uint32_t BOX_TYPE_MDCV = fourcc_to_code("mdcv");
54 static const uint32_t BOX_TYPE_IT35 = fourcc_to_code("it35");
55 
56 static const uint32_t BOX_TYPE_RLOC = fourcc_to_code("rloc");
57 static const uint32_t BOX_TYPE_GRPL = fourcc_to_code("grpl");
58 
59 static const uint32_t HANDLER_TYPE_PICT = fourcc_to_code("pict");
60 
61 static const uint32_t ITEM_TYPE_MIME = fourcc_to_code("mime");
62 static const uint32_t ITEM_TYPE_URI = fourcc_to_code("uri ");
63 
64 static const uint32_t COLOR_TYPE_PROF = fourcc_to_code("prof");
65 static const uint32_t COLOR_TYPE_RICC = fourcc_to_code("rICC");
66 
67 typedef uint32_t heif_item_id;
68 
69 typedef uint32_t heif_brand;
70 
71 enum HeifBoxVersion {
72     HEIF_BOX_VERSION_ZERO = 0,
73     HEIF_BOX_VERSION_ONE = 1,
74     HEIF_BOX_VERSION_TWO = 2,
75     HEIF_BOX_VERSION_THREE = 3,
76 };
77 
78 enum class HeifColorFormat {
79     UNDEDEFINED = 255,
80     YCBCR = 0,
81     RGB = 1,
82     MONOCHROME = 2
83 };
84 
85 enum class HeifPixelFormat {
86     UNDEFINED = 255,
87     MONOCHROME = 0,
88     YUV420 = 1,
89     YUV422 = 2,
90     YUV444 = 3,
91 };
92 
93 enum class HeifTransformMirrorDirection : uint8_t {
94     VERTICAL = 0,
95     HORIZONTAL = 1,
96     INVALID = 2,
97 };
98 
99 typedef uint32_t heif_property_id;
100 
101 struct HeifMetadata {
102     heif_item_id itemId;
103     std::string itemType;
104     std::string contentType;
105     std::string itemUriType;
106     std::vector<uint8_t> mData;
107 };
108 
109 struct HeifFragmentMetadata {
110     uint32_t width = 0;
111     uint32_t height = 0;
112     uint32_t horizontalOffset = 0;
113     uint32_t verticalOffset = 0;
114 };
115 } // namespace ImagePlugin
116 } // namespace OHOS
117 
118 #endif // PLUGINS_COMMON_LIBS_IMAGE_LIBEXTPLUGIN_INCLUDE_HEIF_PARSER_HEIF_TYPE_H
119