summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Morss <morss@google.com>2021-08-03 23:07:48 -0400
committerGitHub <noreply@github.com>2021-08-03 23:07:48 -0400
commitf9c995b55c8d3794130a98e7be12fb0eba97d7a6 (patch)
treedb54ff1f305e807b884c06e858bc47e08dd6aa6d /src
parent8accfa98a75c1be74786f321e1a8c77f6869384a (diff)
downloadlibgd-f9c995b55c8d3794130a98e7be12fb0eba97d7a6.tar.gz
Disable strict pixi requirement for libavif >= 0.9.1 (#723)
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.
Diffstat (limited to 'src')
-rw-r--r--src/gd_avif.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gd_avif.c b/src/gd_avif.c
index 90733b9..b1e377f 100644
--- a/src/gd_avif.c
+++ b/src/gd_avif.c
@@ -356,6 +356,15 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromAvifCtx (gdIOCtx *ctx)
decoder = avifDecoderCreate();
+ // Check if libavif version is >= 0.9.1.
+ // If so, allow the PixelInformationProperty ('pixi') to be missing in AV1 image
+ // items. libheif v1.11.0 or older does not add the 'pixi' item property to
+ // AV1 image items. (This issue has been corrected in libheif v1.12.0.)
+
+#if AVIF_VERSION >= 90100
+ decoder->strictFlags &= ~AVIF_STRICT_PIXI_REQUIRED;
+#endif
+
io = createAvifIOFromCtx(ctx);
if (!io) {
gd_error("avif error - Could not allocate memory");