21 #ifndef LIBHEIF_HEIF_CONTEXT_H
22 #define LIBHEIF_HEIF_CONTEXT_H
71 m_maximum_image_width_limit = maximum_size;
72 m_maximum_image_height_limit = maximum_size;
113 void add_thumbnail(std::shared_ptr<Image> img) { m_thumbnails.push_back(img); }
116 std::vector<std::shared_ptr<Image>>
get_thumbnails()
const {
return m_thumbnails; }
138 m_has_depth_representation_info =
true;
139 m_depth_representation_info = info;
143 return m_has_depth_representation_info;
147 return m_depth_representation_info;
154 m_metadata.push_back(metadata);
157 std::vector<std::shared_ptr<ImageMetadata>>
get_metadata()
const {
return m_metadata; }
171 void set_color_profile(std::shared_ptr<const color_profile> profile) { m_color_profile = profile; };
177 uint32_t m_width=0, m_height=0;
178 uint32_t m_ispe_width=0, m_ispe_height=0;
179 bool m_is_primary =
false;
181 bool m_is_thumbnail =
false;
184 std::vector<std::shared_ptr<Image>> m_thumbnails;
186 bool m_is_alpha_channel =
false;
188 std::shared_ptr<Image> m_alpha_channel;
190 bool m_is_depth_channel =
false;
192 std::shared_ptr<Image> m_depth_channel;
194 bool m_has_depth_representation_info =
false;
197 std::vector<std::shared_ptr<ImageMetadata>> m_metadata;
199 std::shared_ptr<const color_profile> m_color_profile;
227 std::shared_ptr<Image>& out_image);
236 std::shared_ptr<Image> thumbnail_image);
242 std::shared_ptr<Image>& out_image_handle);
249 const char* item_type,
const char* content_type);
256 std::set<const struct heif_decoder_plugin*> m_decoder_plugins;
258 std::map<heif_item_id, std::shared_ptr<Image>> m_all_images;
262 std::vector<std::shared_ptr<Image>> m_top_level_images;
264 std::shared_ptr<Image> m_primary_image;
266 std::shared_ptr<HeifFile> m_heif_file;
268 int m_max_decoding_threads = 4;
270 uint32_t m_maximum_image_width_limit;
271 uint32_t m_maximum_image_height_limit;
273 Error interpret_heif_file();
275 void remove_top_level_image(std::shared_ptr<Image> image);
278 std::shared_ptr<HeifPixelImage>& img,
279 const std::vector<uint8_t>& grid_data)
const;
282 std::shared_ptr<HeifPixelImage> out_image,
283 int x0,
int y0)
const;
286 std::shared_ptr<HeifPixelImage>& img)
const;
289 std::shared_ptr<HeifPixelImage>& img,
290 const std::vector<uint8_t>& overlay_data)
const;
Definition: heif_context.h:79
void set_primary(bool flag=true)
Definition: heif_context.h:87
int get_height() const
Definition: heif_context.h:94
bool is_alpha_channel() const
Definition: heif_context.h:124
void set_is_alpha_channel_of(heif_item_id id)
Definition: heif_context.h:121
int get_width() const
Definition: heif_context.h:93
int get_ispe_width() const
Definition: heif_context.h:96
heif_item_id get_id() const
Definition: heif_context.h:89
std::shared_ptr< const color_profile > get_color_profile() const
Definition: heif_context.h:169
bool is_depth_channel() const
Definition: heif_context.h:133
bool has_depth_representation_info() const
Definition: heif_context.h:142
void set_preencoded_hevc_image(const std::vector< uint8_t > &data)
bool is_primary() const
Definition: heif_context.h:102
void set_depth_channel(std::shared_ptr< Image > img)
Definition: heif_context.h:131
void add_metadata(std::shared_ptr< ImageMetadata > metadata)
Definition: heif_context.h:153
int get_chroma_bits_per_pixel() const
Image(HeifContext *file, heif_item_id id)
std::shared_ptr< Image > get_depth_channel() const
Definition: heif_context.h:134
bool is_thumbnail() const
Definition: heif_context.h:115
Error decode_image(std::shared_ptr< HeifPixelImage > &img, heif_colorspace colorspace=heif_colorspace_undefined, heif_chroma chroma=heif_chroma_undefined, const struct heif_decoding_options *options=nullptr) const
void set_is_depth_channel_of(heif_item_id id)
Definition: heif_context.h:130
std::vector< std::shared_ptr< ImageMetadata > > get_metadata() const
Definition: heif_context.h:157
std::vector< std::shared_ptr< Image > > get_thumbnails() const
Definition: heif_context.h:116
int get_luma_bits_per_pixel() const
void add_thumbnail(std::shared_ptr< Image > img)
Definition: heif_context.h:113
int get_ispe_height() const
Definition: heif_context.h:97
std::shared_ptr< Image > get_alpha_channel() const
Definition: heif_context.h:125
void set_is_thumbnail_of(heif_item_id id)
Definition: heif_context.h:112
void set_ispe_resolution(int w, int h)
Definition: heif_context.h:85
void set_resolution(int w, int h)
Definition: heif_context.h:84
void set_alpha_channel(std::shared_ptr< Image > img)
Definition: heif_context.h:122
void set_depth_representation_info(struct heif_depth_representation_info &info)
Definition: heif_context.h:137
void set_color_profile(std::shared_ptr< const color_profile > profile)
Definition: heif_context.h:171
Error encode_image_as_hevc(std::shared_ptr< HeifPixelImage > image, struct heif_encoder *encoder, const struct heif_encoding_options *options, enum heif_image_input_class input_class)
const struct heif_depth_representation_info & get_depth_representation_info() const
Definition: heif_context.h:146
Definition: heif_context.h:63
bool is_image(heif_item_id ID) const
std::string debug_dump_boxes() const
void write(StreamWriter &writer)
void set_primary_image(std::shared_ptr< Image > image)
Error set_primary_item(heif_item_id id)
bool is_primary_image_set() const
Definition: heif_context.h:233
Error add_XMP_metadata(std::shared_ptr< Image > master_image, const void *data, int size)
Error add_exif_metadata(std::shared_ptr< Image > master_image, const void *data, int size)
std::shared_ptr< Image > get_primary_image()
Definition: heif_context.h:204
Error read(std::shared_ptr< StreamReader > reader)
Error decode_image(heif_item_id ID, std::shared_ptr< HeifPixelImage > &img, const struct heif_decoding_options *options=nullptr) const
Error add_generic_metadata(std::shared_ptr< Image > master_image, const void *data, int size, const char *item_type, const char *content_type)
Error encode_image(std::shared_ptr< HeifPixelImage > image, struct heif_encoder *encoder, const struct heif_encoding_options *options, enum heif_image_input_class input_class, std::shared_ptr< Image > &out_image)
Error read_from_memory(const void *data, size_t size, bool copy)
Error read_from_file(const char *input_filename)
void set_maximum_image_size_limit(int maximum_size)
Definition: heif_context.h:70
void register_decoder(const heif_decoder_plugin *decoder_plugin)
Error assign_thumbnail(std::shared_ptr< Image > master_image, std::shared_ptr< Image > thumbnail_image)
void set_max_decoding_threads(int max_threads)
Definition: heif_context.h:68
Error encode_thumbnail(std::shared_ptr< HeifPixelImage > image, struct heif_encoder *encoder, const struct heif_encoding_options *options, int bbox_size, std::shared_ptr< Image > &out_image_handle)
std::vector< std::shared_ptr< Image > > get_top_level_images()
Definition: heif_context.h:202
void reset_to_empty_heif()
Definition: bitstream.h:256
heif_colorspace
Definition: heif.h:741
@ heif_colorspace_undefined
Definition: heif.h:742
heif_chroma
Definition: heif.h:722
@ heif_chroma_undefined
Definition: heif.h:723
heif_compression_format
Definition: heif.h:715
uint32_t heif_item_id
Definition: heif.h:276
heif_image_input_class
Definition: heif_plugin.h:111
Definition: bitstream.h:41
const struct heif_decoder_plugin * get_decoder(enum heif_compression_format type)
Definition: heif_plugin.h:51
Definition: heif_api_structs.h:51