Skip to content

Commit

Permalink
add tilC properties to ImageItem during encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Nov 5, 2024
1 parent 4e774b0 commit 9021567
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 7 additions & 0 deletions libheif/image-items/image_item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ std::shared_ptr<HeifFile> ImageItem::get_file() const
}


heif_property_id ImageItem::add_property(std::shared_ptr<Box> property, bool essential)
{
m_properties.push_back(property);
return get_file()->add_property(get_id(), property, essential);
}


Error ImageItem::init_decoder_from_item(heif_item_id id)
{
m_id = id;
Expand Down
2 changes: 2 additions & 0 deletions libheif/image-items/image_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class ImageItem : public ErrorBuffer
return nullptr;
}

heif_property_id add_property(std::shared_ptr<Box> property, bool essential);

void set_resolution(uint32_t w, uint32_t h)
{
m_width = w;
Expand Down
10 changes: 5 additions & 5 deletions libheif/image-items/tiled.cc
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ ImageItem_Tiled::add_new_tiled_item(HeifContext* ctx, const heif_tiled_image_par
auto tilC_box = std::make_shared<Box_tilC>();
tilC_box->set_parameters(*parameters);
tilC_box->set_compression_format(encoder->plugin->compression_format);
ctx->get_heif_file()->add_property(tild_id, tilC_box, true);
tild_image->add_property(tilC_box, true);

// Create header + offset table

Expand All @@ -617,10 +617,10 @@ ImageItem_Tiled::add_new_tiled_item(HeifContext* ctx, const heif_tiled_image_par
}

// Add ISPE property
file->add_ispe_property(tild_id,
static_cast<uint32_t>(parameters->image_width),
static_cast<uint32_t>(parameters->image_height),
true);
auto ispe = std::make_shared<Box_ispe>();
ispe->set_size(static_cast<uint32_t>(parameters->image_width),
static_cast<uint32_t>(parameters->image_height));
tild_image->add_property(ispe, true);

#if 0
// TODO
Expand Down

0 comments on commit 9021567

Please sign in to comment.