Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'tmap' brand to files with gainmaps. Issue #2385 #2386

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maryla: Thank you for the fix in src/write.c and the test files. I assume you will also fix src/read.c (the subject of #2385)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that will be in another PR.

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
Loading