Skip to content

Commit

Permalink
Add 'tmap' brand to files with gainmaps. Issue #2385 (#2386)
Browse files Browse the repository at this point in the history
  • Loading branch information
maryla-uc authored Aug 12, 2024
1 parent d142df6 commit 10b7232
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -3073,6 +3073,18 @@ avifResult avifEncoderFinish(avifEncoder * encoder, avifRWData * output)
AVIF_CHECKRES(avifRWStreamWriteChars(&s, "MA1A", 4)); // ... compatible_brands[]
}
}
#if defined(AVIF_ENABLE_EXPERIMENTAL_GAIN_MAP)
for (uint32_t itemIndex = 0; itemIndex < encoder->data->items.count; ++itemIndex) {
if (!memcmp(encoder->data->items.item[itemIndex].type, "tmap", 4)) {
// ISO/IEC 23008-12:2024/AMD 1:2024(E)
// This brand enables file players to identify and decode HEIF files containing tone-map derived image
// items. When present, this brand shall be among the brands included in the compatible_brands
// array of the FileTypeBox.
AVIF_CHECKRES(avifRWStreamWriteChars(&s, "tmap", 4)); // ... compatible_brands[]
break;
}
}
#endif
avifRWStreamFinishBox(&s, ftyp);

// -----------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<ISOBaseMediaFileTrace>
<!--MP4Box dump trace-->
<IsoMediaFile xmlns="urn:mpeg:isobmff:schema:file:2016" Name="paris_exif_xmp_gainmap_bigendian.jpg.avif">
<FileTypeBox Size="32" Type="ftyp" Specification="p12" Container="file otyp" MajorBrand="avif" MinorVersion="0">
<FileTypeBox Size="36" Type="ftyp" Specification="p12" Container="file otyp" MajorBrand="avif" MinorVersion="0">
<BrandEntry AlternateBrand="avif"/>
<BrandEntry AlternateBrand="mif1"/>
<BrandEntry AlternateBrand="miaf"/>
<BrandEntry AlternateBrand="MA1B"/>
<BrandEntry AlternateBrand="tmap"/>
</FileTypeBox>
<MetaBox Size="606" Type="meta" Version="0" Flags="0" Specification="p12" Container="file moov trak moof traf udta" >
<HandlerBox Size="40" Type="hdlr" Version="0" Flags="0" Specification="p12" Container="mdia meta minf" hdlrType="pict" Name="libavif" reserved1="0" reserved2="data:application/octet-string,000000000000000000000000">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<ISOBaseMediaFileTrace>
<!--MP4Box dump trace-->
<IsoMediaFile xmlns="urn:mpeg:isobmff:schema:file:2016" Name="paris_exif_xmp_gainmap_littleendian.jpg.avif">
<FileTypeBox Size="32" Type="ftyp" Specification="p12" Container="file otyp" MajorBrand="avif" MinorVersion="0">
<FileTypeBox Size="36" Type="ftyp" Specification="p12" Container="file otyp" MajorBrand="avif" MinorVersion="0">
<BrandEntry AlternateBrand="avif"/>
<BrandEntry AlternateBrand="mif1"/>
<BrandEntry AlternateBrand="miaf"/>
<BrandEntry AlternateBrand="MA1B"/>
<BrandEntry AlternateBrand="tmap"/>
</FileTypeBox>
<MetaBox Size="606" Type="meta" Version="0" Flags="0" Specification="p12" Container="file moov trak moof traf udta" >
<HandlerBox Size="40" Type="hdlr" Version="0" Flags="0" Specification="p12" Container="mdia meta minf" hdlrType="pict" Name="libavif" reserved1="0" reserved2="data:application/octet-string,000000000000000000000000">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
<ISOBaseMediaFileTrace>
<!--MP4Box dump trace-->
<IsoMediaFile xmlns="urn:mpeg:isobmff:schema:file:2016" Name="paris_exif_xmp_icc_gainmap_bigendian.jpg.avif">
<FileTypeBox Size="32" Type="ftyp" Specification="p12" Container="file otyp" MajorBrand="avif" MinorVersion="0">
<FileTypeBox Size="36" Type="ftyp" Specification="p12" Container="file otyp" MajorBrand="avif" MinorVersion="0">
<BrandEntry AlternateBrand="avif"/>
<BrandEntry AlternateBrand="mif1"/>
<BrandEntry AlternateBrand="miaf"/>
<BrandEntry AlternateBrand="MA1B"/>
<BrandEntry AlternateBrand="tmap"/>
</FileTypeBox>
<MetaBox Size="1121" Type="meta" Version="0" Flags="0" Specification="p12" Container="file moov trak moof traf udta" >
<HandlerBox Size="40" Type="hdlr" Version="0" Flags="0" Specification="p12" Container="mdia meta minf" hdlrType="pict" Name="libavif" reserved1="0" reserved2="data:application/octet-string,000000000000000000000000">
Expand Down

0 comments on commit 10b7232

Please sign in to comment.