/src/libheif/libheif/image-items/iden.h
Line | Count | Source |
1 | | /* |
2 | | * HEIF codec. |
3 | | * Copyright (c) 2024 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_IDEN_H |
22 | | #define LIBHEIF_IDEN_H |
23 | | |
24 | | #include "image_item.h" |
25 | | #include <vector> |
26 | | #include <string> |
27 | | #include <memory> |
28 | | #include <set> |
29 | | |
30 | | |
31 | | class ImageItem_iden : public ImageItem |
32 | | { |
33 | | public: |
34 | | ImageItem_iden(HeifContext* ctx, heif_item_id id); |
35 | | |
36 | | ImageItem_iden(HeifContext* ctx); |
37 | | |
38 | 47 | uint32_t get_infe_type() const override { return fourcc("iden"); } |
39 | | |
40 | | // TODO: nclx depends on contained format |
41 | | // const heif_color_profile_nclx* get_forced_output_nclx() const override { return nullptr; } |
42 | | |
43 | | // heif_compression_format get_compression_format() const override { return heif_compression_HEVC; } |
44 | | |
45 | | //Error on_load_file() override; |
46 | | |
47 | | Error get_coded_image_colorspace(heif_colorspace* out_colorspace, heif_chroma* out_chroma) const override; |
48 | | |
49 | | // Delegates to the referenced image's component descriptions, rescaled to |
50 | | // this iden's ispe. Without this override the base populate would bail |
51 | | // (iden has no get_decoder()) and the handle would report 0 components. |
52 | | void populate_component_descriptions() override; |
53 | | |
54 | | int get_luma_bits_per_pixel() const override; |
55 | | |
56 | | int get_chroma_bits_per_pixel() const override; |
57 | | |
58 | | Result<Encoder::CodedImageData> encode(const std::shared_ptr<HeifPixelImage>& image, |
59 | | heif_encoder* encoder, |
60 | | const heif_encoding_options& options, |
61 | | heif_image_input_class input_class) override |
62 | 0 | { |
63 | 0 | return Error{heif_error_Unsupported_feature, |
64 | 0 | heif_suberror_Unspecified, "Cannot encode image to 'iden'"}; |
65 | 0 | } |
66 | | |
67 | | Result<std::shared_ptr<HeifPixelImage>> decode_compressed_image(const heif_decoding_options& options, |
68 | | bool decode_tile_only, uint32_t tile_x0, uint32_t tile_y0, |
69 | | std::set<heif_item_id> processed_ids) const override; |
70 | | |
71 | | // iden forwards decoding to the referenced item, which validates its own decoded |
72 | | // size. Re-checking here against this iden's (possibly absent) 'ispe' would be wrong. |
73 | | Error check_decoded_image_size(const HeifPixelImage&, bool, uint32_t, uint32_t) const override |
74 | 0 | { |
75 | 0 | return Error::Ok; |
76 | 0 | } |
77 | | |
78 | | heif_brand2 get_compatible_brand() const override; |
79 | | |
80 | | private: |
81 | | }; |
82 | | |
83 | | |
84 | | #endif //LIBHEIF_IDEN_H |