Skip to content

Commit e0e2e9a

Browse files
morssssscmb69
authored andcommitted
Disable strict pixi requirement for libavif >= 0.9.1
Some AVIF image generators didn't include the PixelInformationProperty (pixi), even though strictly speaking they should. In v0.9.2, libavif began requiring this. Let's disable it so we can read those images too. We also remove xfail from test on FreeBSD. Closes GH-7253.
1 parent 2bf316f commit e0e2e9a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ext/gd/libgd/gd_avif.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,15 @@ gdImagePtr gdImageCreateFromAvifCtx (gdIOCtx *ctx)
347347

348348
decoder = avifDecoderCreate();
349349

350+
// Check if libavif version is >= 0.9.1
351+
// If so, allow the PixelInformationProperty ('pixi') to be missing in AV1 image
352+
// items. libheif v1.11.0 or older does not add the 'pixi' item property to
353+
// AV1 image items. (This issue has been corrected in libheif v1.12.0.)
354+
355+
#if AVIF_VERSION >= 90100
356+
decoder->strictFlags &= ~AVIF_STRICT_PIXI_REQUIRED;
357+
#endif
358+
350359
io = createAvifIOFromCtx(ctx);
351360
if (!io) {
352361
gd_error("avif error - Could not allocate memory");

ext/gd/tests/imagecreatefromstring_avif.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ gd
77
if (!(imagetypes() & IMG_AVIF)) {
88
die('skip AVIF support required');
99
}
10-
if (str_contains(PHP_OS, "FreeBSD")) {
11-
die("xfail Currently failing on FreeBSD CI");
12-
}
1310
?>
1411
--FILE--
1512
<?php

0 commit comments

Comments
 (0)