/src/libheif/libheif/image/image_description.h
Line | Count | Source |
1 | | /* |
2 | | * HEIF codec. |
3 | | * Copyright (c) 2026 Dirk Farin <dirk.farin@gmail.com> |
4 | | * |
5 | | * This file is part of libheif. |
6 | | * |
7 | | * libheif is free software: you can redistribute it and/or modify |
8 | | * it under the terms of the GNU Lesser General Public License as |
9 | | * published by the Free Software Foundation, either version 3 of |
10 | | * the License, or (at your option) any later version. |
11 | | * |
12 | | * libheif is distributed in the hope that it will be useful, |
13 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | | * GNU Lesser General Public License for more details. |
16 | | * |
17 | | * You should have received a copy of the GNU Lesser General Public License |
18 | | * along with libheif. If not, see <http://www.gnu.org/licenses/>. |
19 | | */ |
20 | | |
21 | | #ifndef LIBHEIF_IMAGE_DESCRIPTION_H |
22 | | #define LIBHEIF_IMAGE_DESCRIPTION_H |
23 | | |
24 | | #include "error.h" |
25 | | #include "nclx.h" |
26 | | #include <libheif/heif_experimental.h> |
27 | | #include <libheif/heif_uncompressed.h> |
28 | | #include "omaf_boxes.h" |
29 | | |
30 | | #include <cassert> |
31 | | #include <map> |
32 | | #include <memory> |
33 | | #include <optional> |
34 | | #include <string> |
35 | | #include <vector> |
36 | | #include <algorithm> |
37 | | #include <utility> |
38 | | |
39 | | |
40 | | // === === Bayer pattern |
41 | | |
42 | | // --- Bayer pattern expressed as ISO 23001-17 cmpd component indices |
43 | | |
44 | | struct BayerPatternPixelCmpd |
45 | | { |
46 | | uint32_t cmpd_index; |
47 | | float component_gain; |
48 | | }; |
49 | | |
50 | | struct BayerPatternCmpd |
51 | | { |
52 | | uint16_t pattern_width = 0; |
53 | | uint16_t pattern_height = 0; |
54 | | std::vector<BayerPatternPixelCmpd> pixels; |
55 | | }; |
56 | | |
57 | | // --- Bayer pattern expressed as libheif components IDs |
58 | | |
59 | | struct BayerPattern |
60 | | { |
61 | | uint16_t pattern_width = 0; |
62 | | uint16_t pattern_height = 0; |
63 | | std::vector<heif_bayer_pattern_pixel> pixels; |
64 | | |
65 | | [[nodiscard]] BayerPatternCmpd resolve_to_cmpd(std::map<uint32_t, uint32_t> comp_id_to_cmpd) const; |
66 | | }; |
67 | | |
68 | | |
69 | | // === Polarization pattern (ISO 23001-17) |
70 | | |
71 | | struct PolarizationPattern |
72 | | { |
73 | | std::vector<uint32_t> component_ids; // empty = applies to all components. Either cmpd-index or component-id, depending on context. |
74 | | uint16_t pattern_width = 0; |
75 | | uint16_t pattern_height = 0; |
76 | | std::vector<float> polarization_angles; // pattern_width * pattern_height entries |
77 | | // 0xFFFFFFFF bit-pattern (NaN) = no polarization filter |
78 | | }; |
79 | | |
80 | | |
81 | | // === Sensor bad pixels map (ISO 23001-17) |
82 | | |
83 | | struct SensorBadPixelsMap |
84 | | { |
85 | | struct BadPixelCoordinate |
86 | | { |
87 | | uint32_t row, column; |
88 | | }; |
89 | | |
90 | | std::vector<uint32_t> component_ids; // empty = applies to all components. Either cmpd-index or component-id, depending on context. |
91 | | bool correction_applied = false; |
92 | | std::vector<uint32_t> bad_rows; |
93 | | std::vector<uint32_t> bad_columns; |
94 | | std::vector<BadPixelCoordinate> bad_pixels; |
95 | | }; |
96 | | |
97 | | |
98 | | // === Sensor non-uniformity correction (ISO 23001-17) |
99 | | |
100 | | struct SensorNonUniformityCorrection |
101 | | { |
102 | | std::vector<uint32_t> component_ids; // empty = applies to all components. Either cmpd-index or component-id, depending on context. |
103 | | bool nuc_is_applied = false; |
104 | | uint32_t image_width = 0; |
105 | | uint32_t image_height = 0; |
106 | | std::vector<float> nuc_gains; // image_width * image_height entries |
107 | | std::vector<float> nuc_offsets; // image_width * image_height entries |
108 | | }; |
109 | | |
110 | | |
111 | | |
112 | | // === Image components |
113 | | |
114 | | // Given a list of libheif component IDs, map them to a list of cmpd IDs through the given map. |
115 | | // The output does not contain duplicates and is in no particular order. |
116 | | std::vector<uint32_t> map_component_ids_to_cmpd(const std::vector<uint32_t>& component_ids, const std::map<uint32_t, uint32_t>& comp_id_to_cmpd); |
117 | | |
118 | | // Map a list of unci component indices to libheif components. |
119 | | // Use to find the libheif components for a metadata box that assigns it through cmpd indices. |
120 | | // The output does not contain duplicates and is in no particular order. |
121 | | std::vector<uint32_t> map_cmpd_to_component_ids(const std::vector<uint32_t>& cmpd_indices, const std::vector<std::vector<uint32_t>>& cmpd_to_comp_ids); |
122 | | |
123 | | // Find the closest matching heif_channel for an ISO 23001-17 component type. |
124 | | // Returns heif_channel_unknown if no good mapping exists. |
125 | | heif_channel map_uncompressed_component_to_channel(uint16_t component_type); |
126 | | |
127 | | |
128 | | // Per-component description, independent of pixel data. |
129 | | // Lives on ImageDescription so both ImageItem (handle side, before decoding) |
130 | | // and HeifPixelImage (decoded side) can carry the same structural view. |
131 | | struct ComponentDescription |
132 | | { |
133 | | uint32_t component_id = 0; // stable id, matches HeifPixelImage::m_storage ids |
134 | | |
135 | | heif_channel channel = heif_channel_unknown; |
136 | | uint16_t component_type = 0; // heif_cmpd_component_type_* |
137 | | |
138 | | // The numeric values of heif_component_datatype are aligned with the |
139 | | // ISO 23001-17 Table 2 component_format byte (from the uncC box), so on |
140 | | // the unci read path this field directly holds the file byte and on the |
141 | | // write path it is emitted as the file byte. For non-unci codecs |
142 | | // (HEVC/AVIF/JPEG/...) the codec sets this to the appropriate value |
143 | | // (typically heif_component_datatype_unsigned_integer). |
144 | | heif_component_datatype datatype = heif_component_datatype_undefined; |
145 | | |
146 | | uint16_t bit_depth = 0; // logical bit depth (1..256) |
147 | | uint32_t width = 0; |
148 | | uint32_t height = 0; |
149 | | bool has_data_plane = true; // false for cpat reference colors |
150 | | |
151 | | // Empty string means "no content id assigned". |
152 | | std::string gimi_content_id; |
153 | | }; |
154 | | |
155 | | |
156 | | // TODO: the colorspace and the chroma format of the image should be part of this class, |
157 | | // together with a function that compares two descriptions for having the same format. |
158 | | // See the notes at ImageItem_Grid::TileFormat (image-items/grid.h). |
159 | | class ImageDescription |
160 | | { |
161 | | public: |
162 | 603k | virtual ~ImageDescription() = default; |
163 | | |
164 | | // TODO: Decide who is responsible for writing the colr boxes. |
165 | | // Currently it is distributed over various places. |
166 | | // Either here, in image_item.cc or in grid.cc. |
167 | | std::vector<std::shared_ptr<Box>> generate_property_boxes(bool generate_colr_boxes) const; |
168 | | |
169 | | |
170 | | // --- color profile |
171 | | |
172 | | bool has_nclx_color_profile() const; |
173 | | |
174 | 277k | void set_color_profile_nclx(const nclx_profile& profile) { m_color_profile_nclx = profile; } |
175 | | |
176 | 333k | nclx_profile get_color_profile_nclx() const { return m_color_profile_nclx; } |
177 | | |
178 | | // get the stored nclx fallback or return the default nclx if none is stored |
179 | | nclx_profile get_color_profile_nclx_with_fallback() const; |
180 | | |
181 | 93.4k | void set_color_profile_icc(const std::shared_ptr<const color_profile_raw>& profile) { m_color_profile_icc = profile; } |
182 | | |
183 | 37.6k | bool has_icc_color_profile() const { return m_color_profile_icc != nullptr; } |
184 | | |
185 | 78.5k | const std::shared_ptr<const color_profile_raw>& get_color_profile_icc() const { return m_color_profile_icc; } |
186 | | |
187 | | // These setters only store profile metadata. Encoding an ImageItem must add |
188 | | // a 'colr' property explicitly through ImageItem::add_color_profile_property(). |
189 | | void set_color_profile(const std::shared_ptr<const color_profile>& profile) |
190 | 130k | { |
191 | 130k | auto icc = std::dynamic_pointer_cast<const color_profile_raw>(profile); |
192 | 130k | if (icc) { |
193 | 87.4k | set_color_profile_icc(icc); |
194 | 87.4k | } |
195 | | |
196 | 130k | auto nclx = std::dynamic_pointer_cast<const color_profile_nclx>(profile); |
197 | 130k | if (nclx) { |
198 | 42.8k | set_color_profile_nclx(nclx->get_nclx_color_profile()); |
199 | 42.8k | } |
200 | 130k | } |
201 | | |
202 | | |
203 | | // --- premultiplied alpha |
204 | | |
205 | 0 | bool is_premultiplied_alpha() const { return m_premultiplied_alpha; } |
206 | | |
207 | 0 | virtual void set_premultiplied_alpha(bool flag) { m_premultiplied_alpha = flag; } |
208 | | |
209 | | |
210 | | // --- pixel aspect ratio |
211 | | |
212 | 42.2k | bool has_nonsquare_pixel_ratio() const { return m_PixelAspectRatio_h != m_PixelAspectRatio_v; } |
213 | | |
214 | | void get_pixel_ratio(uint32_t* h, uint32_t* v) const |
215 | 2.46k | { |
216 | 2.46k | *h = m_PixelAspectRatio_h; |
217 | 2.46k | *v = m_PixelAspectRatio_v; |
218 | 2.46k | } |
219 | | |
220 | | virtual void set_pixel_ratio(uint32_t h, uint32_t v) |
221 | 511 | { |
222 | 511 | m_PixelAspectRatio_h = h; |
223 | 511 | m_PixelAspectRatio_v = v; |
224 | 511 | } |
225 | | |
226 | | // --- clli |
227 | | |
228 | 42.2k | bool has_clli() const { return m_clli.max_content_light_level != 0 || m_clli.max_pic_average_light_level != 0; } |
229 | | |
230 | 12 | heif_content_light_level get_clli() const { return m_clli; } |
231 | | |
232 | 246 | virtual void set_clli(const heif_content_light_level& clli) { m_clli = clli; } |
233 | | |
234 | | // --- mdcv |
235 | | |
236 | 42.2k | bool has_mdcv() const { return m_mdcv.has_value(); } |
237 | | |
238 | 1 | heif_mastering_display_colour_volume get_mdcv() const { return *m_mdcv; } |
239 | | |
240 | | virtual void set_mdcv(const heif_mastering_display_colour_volume& mdcv) |
241 | 10 | { |
242 | 10 | m_mdcv = mdcv; |
243 | 10 | } |
244 | | |
245 | 0 | void unset_mdcv() { m_mdcv.reset(); } |
246 | | |
247 | | // --- amve (ambient viewing environment) |
248 | | |
249 | 42.2k | bool has_amve() const { return m_amve.has_value(); } |
250 | | |
251 | 1 | heif_ambient_viewing_environment get_amve() const { return *m_amve; } |
252 | | |
253 | | virtual void set_amve(const heif_ambient_viewing_environment& amve) |
254 | 286 | { |
255 | 286 | m_amve = amve; |
256 | 286 | } |
257 | | |
258 | 0 | void unset_amve() { m_amve.reset(); } |
259 | | |
260 | | // --- ndwt (nominal diffuse white) |
261 | | |
262 | | // Note: a luminance of 0 is a valid value (it selects the ISO/TS 22028-5 |
263 | | // default), so presence is tracked separately from the value via std::optional. |
264 | | |
265 | 42.2k | bool has_nominal_diffuse_white() const { return m_nominal_diffuse_white_luminance.has_value(); } |
266 | | |
267 | | // Nominal diffuse white luminance in units of 0.0001 cd/m^2. |
268 | 3 | uint32_t get_nominal_diffuse_white_luminance() const { return m_nominal_diffuse_white_luminance.value_or(0); } |
269 | | |
270 | | virtual void set_nominal_diffuse_white_luminance(uint32_t luminance) |
271 | 225 | { |
272 | 225 | m_nominal_diffuse_white_luminance = luminance; |
273 | 225 | } |
274 | | |
275 | 0 | void unset_nominal_diffuse_white() { m_nominal_diffuse_white_luminance.reset(); } |
276 | | |
277 | 0 | virtual Error set_tai_timestamp(const heif_tai_timestamp_packet* tai) { |
278 | | // Version-aware copy into a freshly initialized packet, mirroring |
279 | | // heif_tai_timestamp_packet_alloc() + heif_tai_timestamp_packet_copy(). |
280 | 0 | heif_tai_timestamp_packet packet{}; |
281 | 0 | packet.version = 1; |
282 | 0 | heif_tai_timestamp_packet_copy(&packet, tai); |
283 | 0 | m_tai_timestamp = packet; |
284 | 0 | return Error::Ok; |
285 | 0 | } |
286 | | |
287 | 4.55k | [[nodiscard]] const heif_tai_timestamp_packet* get_tai_timestamp() const { |
288 | 4.55k | return m_tai_timestamp ? &*m_tai_timestamp : nullptr; |
289 | 4.55k | } |
290 | | |
291 | | // --- GIMI content ID |
292 | | |
293 | 106 | virtual void set_gimi_sample_content_id(std::string id) { m_gimi_sample_content_id = std::move(id); } |
294 | | |
295 | 4.55k | [[nodiscard]] bool has_gimi_sample_content_id() const { return !m_gimi_sample_content_id.empty(); } |
296 | | |
297 | 0 | [[nodiscard]] const std::string& get_gimi_sample_content_id() const { return m_gimi_sample_content_id; } |
298 | | |
299 | | |
300 | | [[nodiscard]] bool has_component_content_ids() const |
301 | 4.55k | { |
302 | 4.55k | return std::any_of(m_components.begin(), m_components.end(), |
303 | 13.6k | [](const ComponentDescription& c) { return !c.gimi_content_id.empty(); }); |
304 | 4.55k | } |
305 | | |
306 | | // Returns a positional vector: entry i is m_components[i].gimi_content_id |
307 | | // (empty string if unset). Returned by value because it is reconstructed. |
308 | | [[nodiscard]] std::vector<std::string> get_component_content_ids() const |
309 | 0 | { |
310 | 0 | std::vector<std::string> ids; |
311 | 0 | ids.reserve(m_components.size()); |
312 | 0 | for (const auto& c : m_components) { |
313 | 0 | ids.push_back(c.gimi_content_id); |
314 | 0 | } |
315 | 0 | return ids; |
316 | 0 | } |
317 | | |
318 | | |
319 | | // --- per-component descriptions (id-based) |
320 | | // These describe each component independent of pixel storage. Both ImageItem |
321 | | // (before decoding) and HeifPixelImage (after decoding) carry the same list. |
322 | | |
323 | 1.04M | [[nodiscard]] const std::vector<ComponentDescription>& get_component_descriptions() const { return m_components; } |
324 | | |
325 | | // Append a ComponentDescription. The caller is expected to have set |
326 | | // component_id, either from a fresh mint_component_id() call or by |
327 | | // matching an id already used by a parallel structure (e.g. |
328 | | // HeifPixelImage::ComponentStorage::m_component_ids). |
329 | | void add_component_description(ComponentDescription desc) |
330 | 1.14M | { |
331 | 1.14M | m_components.push_back(std::move(desc)); |
332 | 1.14M | } |
333 | | |
334 | | // Bulk-replace the component descriptions and sync the next-id allocator. |
335 | | // Used by clone/apply paths that rebuild the whole list at once. |
336 | | void set_component_descriptions(std::vector<ComponentDescription> components, uint32_t next_id) |
337 | 55.2k | { |
338 | 55.2k | m_components = std::move(components); |
339 | 55.2k | m_next_component_id = next_id; |
340 | 55.2k | } |
341 | | |
342 | | // Erase the description matching this component_id. Returns true if one was |
343 | | // removed. |
344 | | bool remove_component_description(uint32_t component_id) |
345 | 378 | { |
346 | 378 | auto it = std::find_if(m_components.begin(), m_components.end(), |
347 | 378 | [component_id](const ComponentDescription& c) { |
348 | 378 | return c.component_id == component_id; |
349 | 378 | }); |
350 | 378 | if (it == m_components.end()) return false; |
351 | 378 | m_components.erase(it); |
352 | 378 | return true; |
353 | 378 | } |
354 | | |
355 | | // Mint a fresh component id (monotonically increasing, starting at 1). |
356 | 1.14M | [[nodiscard]] uint32_t mint_component_id() { return m_next_component_id++; } |
357 | | |
358 | | // Read-only view of the next id that mint_component_id() would return. |
359 | | // Used by HeifPixelImage::clone_component_descriptions_from() to keep the |
360 | | // counter aligned across an item-to-image clone. |
361 | 55.2k | [[nodiscard]] uint32_t peek_next_component_id() const { return m_next_component_id; } |
362 | | |
363 | | [[nodiscard]] ComponentDescription* find_component_description(uint32_t component_id) |
364 | 323k | { |
365 | 704k | for (auto& c : m_components) { |
366 | 704k | if (c.component_id == component_id) return &c; |
367 | 704k | } |
368 | 0 | return nullptr; |
369 | 323k | } |
370 | | |
371 | | [[nodiscard]] const ComponentDescription* find_component_description(uint32_t component_id) const |
372 | 712 | { |
373 | 1.42k | for (const auto& c : m_components) { |
374 | 1.42k | if (c.component_id == component_id) return &c; |
375 | 1.42k | } |
376 | 0 | return nullptr; |
377 | 712 | } |
378 | | |
379 | | |
380 | | // --- bayer pattern |
381 | | |
382 | 0 | bool has_bayer_pattern(uint32_t component_id) const { return m_bayer_pattern.has_value(); } |
383 | | |
384 | 306 | bool has_any_bayer_pattern() const { return m_bayer_pattern.has_value(); } |
385 | | |
386 | 0 | const BayerPattern& get_bayer_pattern(uint32_t component_id) const { assert(has_bayer_pattern(component_id)); return *m_bayer_pattern; } |
387 | | |
388 | 0 | const BayerPattern& get_any_bayer_pattern() const { assert(has_any_bayer_pattern()); return *m_bayer_pattern; } |
389 | | |
390 | 0 | virtual void set_bayer_pattern(const BayerPattern& pattern) { m_bayer_pattern = pattern; } |
391 | | |
392 | | |
393 | | // --- polarization pattern |
394 | | |
395 | 17 | bool has_polarization_patterns() const { return !m_polarization_patterns.empty(); } |
396 | | |
397 | 0 | const std::vector<PolarizationPattern>& get_polarization_patterns() const { return m_polarization_patterns; } |
398 | | |
399 | 0 | virtual void set_polarization_patterns(const std::vector<PolarizationPattern>& p) { m_polarization_patterns = p; } |
400 | | |
401 | 2 | virtual void add_polarization_pattern(const PolarizationPattern& p) { m_polarization_patterns.push_back(p); } |
402 | | |
403 | | |
404 | | // --- sensor bad pixels map |
405 | | |
406 | 17 | bool has_sensor_bad_pixels_maps() const { return !m_sensor_bad_pixels_maps.empty(); } |
407 | | |
408 | 0 | const std::vector<SensorBadPixelsMap>& get_sensor_bad_pixels_maps() const { return m_sensor_bad_pixels_maps; } |
409 | | |
410 | 0 | virtual void set_sensor_bad_pixels_maps(const std::vector<SensorBadPixelsMap>& m) { m_sensor_bad_pixels_maps = m; } |
411 | | |
412 | 0 | virtual void add_sensor_bad_pixels_map(const SensorBadPixelsMap& m) { m_sensor_bad_pixels_maps.push_back(m); } |
413 | | |
414 | | |
415 | | // --- sensor non-uniformity correction |
416 | | |
417 | 17 | bool has_sensor_nuc() const { return !m_sensor_nuc.empty(); } |
418 | | |
419 | 0 | const std::vector<SensorNonUniformityCorrection>& get_sensor_nuc() const { return m_sensor_nuc; } |
420 | | |
421 | 0 | virtual void set_sensor_nuc(const std::vector<SensorNonUniformityCorrection>& n) { m_sensor_nuc = n; } |
422 | | |
423 | 0 | virtual void add_sensor_nuc(const SensorNonUniformityCorrection& n) { m_sensor_nuc.push_back(n); } |
424 | | |
425 | | |
426 | | // --- chroma sample location (ISO 23001-17, Section 6.1.4) |
427 | | |
428 | 17 | bool has_chroma_location() const { return m_chroma_location.has_value(); } |
429 | | |
430 | 0 | uint8_t get_chroma_location() const { return m_chroma_location.value_or(0); } |
431 | | |
432 | 1 | virtual void set_chroma_location(uint8_t loc) { m_chroma_location = loc; } |
433 | | |
434 | | |
435 | | // --- sample duration (for images that are frames in a sequence) |
436 | | // 0 means "no duration assigned" (the default for still images). |
437 | | |
438 | 37.6k | void set_sample_duration(uint32_t d) { m_sample_duration = d; } |
439 | | |
440 | 0 | uint32_t get_sample_duration() const { return m_sample_duration; } |
441 | | |
442 | | |
443 | 4.55k | bool has_omaf_image_projection() const { |
444 | 4.55k | return (m_omaf_image_projection != heif_omaf_image_projection_flat); |
445 | 4.55k | } |
446 | | |
447 | 0 | const heif_omaf_image_projection get_omaf_image_projection() const { |
448 | 0 | return m_omaf_image_projection; |
449 | 0 | } |
450 | | |
451 | 256 | virtual void set_omaf_image_projection(const heif_omaf_image_projection projection) { |
452 | 256 | m_omaf_image_projection = projection; |
453 | 256 | } |
454 | | |
455 | | // Copies all per-image metadata from `other` (color profiles, premultiplied |
456 | | // alpha, pixel aspect ratio, clli, mdcv, tai timestamp, gimi sample content |
457 | | // id, bayer pattern, polarization patterns, sensor maps, sensor nuc, chroma |
458 | | // location, omaf projection). Per-component descriptions |
459 | | // (m_components / m_next_component_id) are intentionally not copied; those |
460 | | // are managed separately by callers (via add_channel / add_component, or |
461 | | // set_component_descriptions on the destination). |
462 | | // |
463 | | // Bayer / polarization / sensor-map metadata refers to image geometry; |
464 | | // transforms that change orientation or position copy them verbatim and |
465 | | // would need separate geometry adjustment to remain semantically correct. |
466 | | void copy_metadata_from(const ImageDescription& other); |
467 | | |
468 | | private: |
469 | | bool m_premultiplied_alpha = false; |
470 | | nclx_profile m_color_profile_nclx = nclx_profile::undefined(); |
471 | | std::shared_ptr<const color_profile_raw> m_color_profile_icc; |
472 | | |
473 | | uint32_t m_PixelAspectRatio_h = 1; |
474 | | uint32_t m_PixelAspectRatio_v = 1; |
475 | | heif_content_light_level m_clli{}; |
476 | | std::optional<heif_mastering_display_colour_volume> m_mdcv; |
477 | | std::optional<heif_ambient_viewing_environment> m_amve; |
478 | | std::optional<uint32_t> m_nominal_diffuse_white_luminance; |
479 | | |
480 | | // Stored by value so that the compiler-generated copy/move operations |
481 | | // duplicate it correctly (GHSA-qwpf-5wf7-r996). std::nullopt == "no timestamp". |
482 | | std::optional<heif_tai_timestamp_packet> m_tai_timestamp; |
483 | | |
484 | | // Empty string means "no content id assigned". |
485 | | std::string m_gimi_sample_content_id; |
486 | | |
487 | | // Per-component description vector. Single source of truth for per-component |
488 | | // metadata (id, channel, type, format, datatype, bit depth, dims, content ID). |
489 | | std::vector<ComponentDescription> m_components; |
490 | | |
491 | | // ID allocator for the per-component descriptions above. Used both by |
492 | | // HeifPixelImage (decoded side) and ImageItem (handle side) via the |
493 | | // mint_component_id() / peek_next_component_id() accessors. |
494 | | uint32_t m_next_component_id = 1; |
495 | | |
496 | | std::optional<BayerPattern> m_bayer_pattern; |
497 | | |
498 | | std::vector<PolarizationPattern> m_polarization_patterns; |
499 | | |
500 | | std::vector<SensorBadPixelsMap> m_sensor_bad_pixels_maps; |
501 | | |
502 | | std::vector<SensorNonUniformityCorrection> m_sensor_nuc; |
503 | | |
504 | | std::optional<uint8_t> m_chroma_location; |
505 | | |
506 | | uint32_t m_sample_duration = 0; // duration of a sequence frame, 0 for stills |
507 | | |
508 | | heif_omaf_image_projection m_omaf_image_projection = heif_omaf_image_projection::heif_omaf_image_projection_flat; |
509 | | |
510 | | protected: |
511 | | std::shared_ptr<Box_clli> create_clli_box() const; |
512 | | |
513 | | std::shared_ptr<Box_mdcv> create_mdcv_box() const; |
514 | | |
515 | | std::shared_ptr<Box_amve> create_amve_box() const; |
516 | | |
517 | | std::shared_ptr<Box_ndwt> create_ndwt_box() const; |
518 | | |
519 | | std::shared_ptr<Box_pasp> create_pasp_box() const; |
520 | | |
521 | | std::shared_ptr<Box_colr> create_colr_box_nclx() const; |
522 | | |
523 | | std::shared_ptr<Box_colr> create_colr_box_icc() const; |
524 | | |
525 | | std::shared_ptr<Box_prfr> create_prfr_box() const; |
526 | | }; |
527 | | |
528 | | #endif |