Skip to content

[pull] master from strukturag:master#69

Open
pull[bot] wants to merge 3908 commits into
346design:masterfrom
strukturag:master
Open

[pull] master from strukturag:master#69
pull[bot] wants to merge 3908 commits into
346design:masterfrom
strukturag:master

Conversation

@pull

@pull pull Bot commented Oct 30, 2021

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull Bot added the ⤵️ pull label Oct 30, 2021
farindk added 29 commits May 2, 2026 17:14
Wrapper image items (tili, grid, iden, iovl) didn't populate their
m_components, so the handle reported 0 components and per-component
queries returned defaults. For tili-of-unci this caused viewers that
detect float monochrome via the handle to fall back to RGB decode and
render black tiles.

Each wrapper now copies descriptions from a representative child and
rescales per-component dims to its own ispe via a new shared helper
ImageItem::populate_descriptions_from_child(). Overlay is special-cased
to emit fixed RGB 8-bit since decode_overlay_image always composes in
that format. apply_descriptions_from now also clamps the published
description's width/height to the actual decoded plane dims, so tile
decodes report tile-sized components instead of full-image-sized.
Box_tilC encodes the tile offset table with offset and size fields whose
widths (32/40/48/64 and 0/24/32/64) are configured in the box flags.
writevec() blindly stored the low N bytes of a uint64_t, so an offset
past the configured field width was silently truncated, leaving the
written offset table pointing into nonsense in the iloc data. At decode
time the truncated offset would point at random bytes, which the
generic-compression decompressor (zlib/brotli) then reported as
"invalid stored block lengths" - reproducible by zooming to the highest
pyramid layer of a tili image larger than the offset field can address.

set_tild_tile_range now returns an Error when the value does not fit,
and write_offset_table re-checks each row as a defense-in-depth before
emitting the table. The existing add_image_tile call site propagates
the new error.

Existing files written with truncated offsets remain corrupt on disk;
this only prevents producing such files going forward.
DarthSim and others added 30 commits May 28, 2026 00:53
Covers the encoder-reuse abort (issue #1827) by encoding a 4x4 grid via
heif_context_encode_grid() with HEVC and AV1, and the extract_area /
extend_to_size_with_zero ComponentDescription sync by encoding the same
grid tile-by-tile via heif_context_add_grid_image() +
heif_context_add_image_tile() with YCbCr 4:2:0 planar tiles and the
uncompressed encoder.

The source is sized 451x461 so that cutting into 128x128 tiles produces
edge tiles (right column 67 wide, bottom row 77 tall) that go through
the extend_to_size_with_zero() padding path.
… channel size

heif_context_encode_grid() computed the grid output size from
tiles[0]->get_width(heif_channel_interleaved). For tiles that do not
have an interleaved channel (e.g. planar YCbCr), this returns 0 and
the produced grid has a 0x0 ispe, decoding as "Zero image width or
height". Use HeifPixelImage::get_width()/get_height() (the logical
image dims) which work for any channel layout.
add_new_grid_item() dereferenced encoding_options unconditionally
(set_tile_encoding_options copy + image_orientation read), so passing
a null encoding_options to the public API crashed. Match the behaviour
of heif_context_encode_grid() and allocate a default heif_encoding_options
struct when the caller passes nullptr.

The test's tile-by-tile YCbCr 4:2:0 case now passes nullptr to exercise
this path.
The bitstream write() function already serializes clli/mdcv/cclv/amve/ndwt
correctly, but the two conversions between Box_mini and HeifFile dropped them:

  - create_from_heif_file (write path) did not collect Box_clli/Box_mdcv/
    Box_cclv/Box_amve/Box_ndwt from the source item's properties and forced
    set_hdr_flag(false), so any HDR metadata was silently lost when emitting
    a mini box.

  - create_expanded_boxes (read path) parsed the mini bitstream's HDR block
    into m_clli/m_mdcv/m_cclv/m_amve/m_ndwt but never appended them to the
    expanded ipco/ipma, so the public has/get accessors on the primary item
    returned 0 even when the file actually carried the data.

Fix both directions for the primary item; the tmap/gainmap HDR metadata is
still TODO and the existing comments reflect that.
Add per-field comments to heif_content_light_level,
heif_mastering_display_colour_volume and heif_ambient_viewing_environment
explaining units, valid ranges and the corresponding H.265 SEI semantics
(ITU-T H.265 Annex D.3.35 / D.3.28 / D.3.39). Comment-only change.
The LIBHEIF_API export macro previously lived in heif_library.h, which
made heif_error.h non-self-contained: it uses LIBHEIF_API but cannot
include heif_library.h, because the two headers are mutually dependent
(heif_library.h needs the heif_error type).

Move the macro into a tiny, dependency-free heif_export.h and include it
from both headers. Every public header now compiles standalone as plain
C, so the heif_error.h prelude exception in check-c-headers.sh is removed.

Also fill in the API versions table in heif_library.h with the 1.21,
1.22, and 1.23 rows.
Reading the MP4 spec, I think it should be in the 2 highest bits, not the whole 8-bit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.