Merge pull request #1023 from vigneshvg/cl_i400
Guard I400 libyuv conversions with correct version
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e8d67d5..8e07e67 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,7 +31,7 @@
with:
version: 2.15.05
- uses: seanmiddleditch/gha-setup-ninja@v3
- if: steps.cache-ext.outputs.cache-hit != 'true'
+ #if: steps.cache-ext.outputs.cache-hit != 'true'
- run: pip install meson
if: steps.cache-ext.outputs.cache-hit != 'true'
- name: Build aom
@@ -65,20 +65,22 @@
run: bash googletest.cmd
- name: Prepare libavif (cmake)
- run: |
+ run: >
mkdir build && cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF \
- -DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON \
- -DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON \
- -DAVIF_CODEC_RAV1E=ON -DAVIF_LOCAL_RAV1E=ON \
- -DAVIF_CODEC_SVT=ON -DAVIF_LOCAL_SVT=ON \
- -DAVIF_CODEC_LIBGAV1=ON -DAVIF_LOCAL_LIBGAV1=ON \
- -DAVIF_LOCAL_LIBYUV=ON \
- -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON \
- -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
- - name: Build libavif (make)
+
+ cmake .. -G Ninja
+ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
+ -DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON
+ -DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON
+ -DAVIF_CODEC_RAV1E=ON -DAVIF_LOCAL_RAV1E=ON
+ -DAVIF_CODEC_SVT=ON -DAVIF_LOCAL_SVT=ON
+ -DAVIF_CODEC_LIBGAV1=ON -DAVIF_LOCAL_LIBGAV1=ON
+ -DAVIF_LOCAL_LIBYUV=ON
+ -DAVIF_BUILD_EXAMPLES=ON -DAVIF_BUILD_APPS=ON
+ -DAVIF_BUILD_TESTS=ON -DAVIF_ENABLE_GTEST=ON -DAVIF_LOCAL_GTEST=ON
+ - name: Build libavif (ninja)
working-directory: ./build
- run: make -j $(($(nproc) + 1))
+ run: ninja
- name: Run AVIF Tests (on Linux)
if: runner.os == 'Linux'
working-directory: ./build
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8648e95..e3ffb6e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,8 @@
### Changed
* Update aom.cmd: v3.4.0
* Update svt.cmd/svt.sh: v1.1.0
+* Update libgav1.cmd: v0.18.0
+* Update libyuv.cmd: d53f1be (version 1837)
* avifImageCopy() and avifImageAllocatePlanes() now return avifResult instead of
void to report invalid parameters or memory allocation failures.
* avifImageRGBToYUV() now uses libyuv fast paths by default. It may slightly
diff --git a/apps/shared/avifpng.c b/apps/shared/avifpng.c
index b824b57..5bc1b3e 100644
--- a/apps/shared/avifpng.c
+++ b/apps/shared/avifpng.c
@@ -190,6 +190,11 @@
avifRGBImageSetDefaults(&rgb, avif);
rgb.depth = rgbDepth;
+ int colorType = PNG_COLOR_TYPE_RGBA;
+ if (!avif->alphaPlane) {
+ colorType = PNG_COLOR_TYPE_RGB;
+ rgb.format = AVIF_RGB_FORMAT_RGB;
+ }
rgb.chromaUpsampling = chromaUpsampling;
avifRGBImageAllocatePixels(&rgb);
if (avifImageYUVToRGB(avif, &rgb) != AVIF_RESULT_OK) {
@@ -231,7 +236,7 @@
png_set_compression_level(png, compressionLevel);
}
- png_set_IHDR(png, info, avif->width, avif->height, rgb.depth, PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+ png_set_IHDR(png, info, avif->width, avif->height, rgb.depth, colorType, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
if (avif->icc.data && (avif->icc.size > 0)) {
png_set_iCCP(png, info, "libavif", 0, (png_iccp_datap)avif->icc.data, (png_uint_32)avif->icc.size);
}
diff --git a/appveyor.yml b/appveyor.yml
index 5e44a29..84b278d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -24,12 +24,13 @@
- dav1d.cmd
- libjpeg.cmd
- zlibpng.cmd
+ - libyuv.cmd
- cd ..
# Configure with CMake
- mkdir build
- cd build
- cmake --version
- - cmake .. -DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON -DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON -DBUILD_SHARED_LIBS=OFF -DAVIF_LOCAL_JPEG=ON -DAVIF_LOCAL_ZLIBPNG=ON -DAVIF_BUILD_APPS=ON
+ - cmake .. -DAVIF_CODEC_AOM=ON -DAVIF_LOCAL_AOM=ON -DAVIF_CODEC_DAV1D=ON -DAVIF_LOCAL_DAV1D=ON -DBUILD_SHARED_LIBS=OFF -DAVIF_LOCAL_JPEG=ON -DAVIF_LOCAL_ZLIBPNG=ON -DAVIF_LOCAL_LIBYUV=ON -DAVIF_BUILD_APPS=ON
build:
project: build/libavif.sln
diff --git a/ext/googletest.cmd b/ext/googletest.cmd
index 2e2587b..f080a0f 100755
--- a/ext/googletest.cmd
+++ b/ext/googletest.cmd
@@ -11,5 +11,5 @@
cd googletest
mkdir build
cd build
-cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_GMOCK=OFF
+cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_GMOCK=OFF ..
cmake --build .
diff --git a/ext/libgav1.cmd b/ext/libgav1.cmd
index a039736..284d0de 100755
--- a/ext/libgav1.cmd
+++ b/ext/libgav1.cmd
@@ -9,13 +9,12 @@
: # "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
# When updating the libgav1 version, make the same change to libgav1_android.sh.
-git clone -b v0.17.0 --depth 1 https://chromium.googlesource.com/codecs/libgav1
+git clone -b v0.18.0 --depth 1 https://chromium.googlesource.com/codecs/libgav1
cd libgav1
-git clone -b lts_2021_03_24 --depth 1 https://github.com/abseil/abseil-cpp.git third_party/abseil-cpp
mkdir build
cd build
-cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLIBGAV1_THREADPOOL_USE_STD_MUTEX=1 ..
+cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLIBGAV1_THREADPOOL_USE_STD_MUTEX=1 -DLIBGAV1_ENABLE_EXAMPLES=0 -DLIBGAV1_ENABLE_TESTS=0 ..
ninja
cd ../..
diff --git a/ext/libgav1_android.sh b/ext/libgav1_android.sh
index 97fae0e..ba4d387 100755
--- a/ext/libgav1_android.sh
+++ b/ext/libgav1_android.sh
@@ -14,10 +14,9 @@
exit 1
fi
# When updating the libgav1 version, make the same change to libgav1.cmd.
-git clone -b v0.17.0 --depth 1 https://chromium.googlesource.com/codecs/libgav1
+git clone -b v0.18.0 --depth 1 https://chromium.googlesource.com/codecs/libgav1
cd libgav1
-git clone -b lts_2021_03_24 --depth 1 https://github.com/abseil/abseil-cpp.git third_party/abseil-cpp
mkdir build
cd build
@@ -31,6 +30,8 @@
-DCMAKE_BUILD_TYPE=Release \
-DLIBGAV1_ANDROID_NDK_PATH=${1} \
-DLIBGAV1_THREADPOOL_USE_STD_MUTEX=1 \
+ -DLIBGAV1_ENABLE_EXAMPLES=0 \
+ -DLIBGAV1_ENABLE_TESTS=0 \
-DANDROID_ABI=${abi}
ninja
cd ..
diff --git a/ext/libyuv.cmd b/ext/libyuv.cmd
index 010e925..8485a58 100755
--- a/ext/libyuv.cmd
+++ b/ext/libyuv.cmd
@@ -10,7 +10,7 @@
git clone --single-branch https://chromium.googlesource.com/libyuv/libyuv
cd libyuv
-git checkout 3aebf69
+git checkout d53f1be
mkdir build
cd build
diff --git a/src/reformat_libyuv.c b/src/reformat_libyuv.c
index efd0f4d..63f1bf6 100644
--- a/src/reformat_libyuv.c
+++ b/src/reformat_libyuv.c
@@ -112,42 +112,48 @@
// libyuv only handles BT.601 for RGB to YUV, and not all range/order/subsampling combinations.
// BT.470BG has the same coefficients as BT.601.
if ((image->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_BT470BG) || (image->matrixCoefficients == AVIF_MATRIX_COEFFICIENTS_BT601)) {
- if (image->yuvRange == AVIF_RANGE_LIMITED) {
- if (rgb->format == AVIF_RGB_FORMAT_RGBA) {
- if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
- RGBtoYUV = ABGRToI420;
- }
- } else if (rgb->format == AVIF_RGB_FORMAT_ARGB) {
- if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
- RGBtoYUV = BGRAToI420;
- }
- } else if (rgb->format == AVIF_RGB_FORMAT_BGR) {
- if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
- RGBtoYUV = RGB24ToI420;
- }
- } else if (rgb->format == AVIF_RGB_FORMAT_BGRA) {
- if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV444) {
- RGBtoYUV = ARGBToI444;
- } else if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV422) {
- RGBtoYUV = ARGBToI422;
- } else if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
+ if (rgb->format == AVIF_RGB_FORMAT_BGRA) {
+ if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
+ if (image->yuvRange == AVIF_RANGE_FULL) {
+ RGBtoYUV = ARGBToJ420;
+ } else {
RGBtoYUV = ARGBToI420;
}
- } else if (rgb->format == AVIF_RGB_FORMAT_ABGR) {
- if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
- RGBtoYUV = RGBAToI420;
+ } else if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV422) {
+ if (image->yuvRange == AVIF_RANGE_FULL) {
+ RGBtoYUV = ARGBToJ422;
+ } else {
+ RGBtoYUV = ARGBToI422;
+ }
+ } else if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV444) {
+ if (image->yuvRange == AVIF_RANGE_LIMITED) {
+ RGBtoYUV = ARGBToI444;
}
}
- } else { // image->yuvRange == AVIF_RANGE_FULL
- if (rgb->format == AVIF_RGB_FORMAT_BGR) {
- if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
+ } else if (rgb->format == AVIF_RGB_FORMAT_BGR) {
+ if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
+ if (image->yuvRange == AVIF_RANGE_FULL) {
RGBtoYUV = RGB24ToJ420;
+ } else {
+ RGBtoYUV = RGB24ToI420;
}
- } else if (rgb->format == AVIF_RGB_FORMAT_BGRA) {
- if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV422) {
- RGBtoYUV = ARGBToJ422;
- } else if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
- RGBtoYUV = ARGBToJ420;
+ }
+ } else if (rgb->format == AVIF_RGB_FORMAT_RGBA) {
+ if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
+ if (image->yuvRange == AVIF_RANGE_LIMITED) {
+ RGBtoYUV = ABGRToI420;
+ }
+ }
+ } else if (rgb->format == AVIF_RGB_FORMAT_ARGB) {
+ if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
+ if (image->yuvRange == AVIF_RANGE_LIMITED) {
+ RGBtoYUV = BGRAToI420;
+ }
+ }
+ } else if (rgb->format == AVIF_RGB_FORMAT_ABGR) {
+ if (image->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) {
+ if (image->yuvRange == AVIF_RANGE_LIMITED) {
+ RGBtoYUV = RGBAToI420;
}
}
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 869db35..2c8bbdb 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -52,8 +52,8 @@
if(AVIF_ENABLE_GTEST)
if(AVIF_LOCAL_GTEST)
set(GTEST_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/ext/googletest/googletest/include)
- set(GTEST_LIBRARIES ${CMAKE_SOURCE_DIR}/ext/googletest/build/lib/libgtest${CMAKE_STATIC_LIBRARY_SUFFIX})
- set(GTEST_MAIN_LIBRARIES ${CMAKE_SOURCE_DIR}/ext/googletest/build/lib/libgtest_main${CMAKE_STATIC_LIBRARY_SUFFIX})
+ set(GTEST_LIBRARIES ${CMAKE_SOURCE_DIR}/ext/googletest/build/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX})
+ set(GTEST_MAIN_LIBRARIES ${CMAKE_SOURCE_DIR}/ext/googletest/build/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX})
set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
if(NOT EXISTS ${GTEST_INCLUDE_DIRS}/gtest/gtest.h)
message(FATAL_ERROR "googletest(AVIF_LOCAL_GTEST): ${GTEST_INCLUDE_DIRS}/gtest/gtest.h is missing, bailing out")
diff --git a/tests/docker/build.sh b/tests/docker/build.sh
index 255c4b9..2533baf 100644
--- a/tests/docker/build.sh
+++ b/tests/docker/build.sh
@@ -54,12 +54,11 @@
# libgav1
cd
-git clone -b v0.17.0 --depth 1 https://chromium.googlesource.com/codecs/libgav1
+git clone -b v0.18.0 --depth 1 https://chromium.googlesource.com/codecs/libgav1
cd libgav1
-git clone -b lts_2021_03_24 --depth 1 https://github.com/abseil/abseil-cpp.git third_party/abseil-cpp
mkdir build
cd build
-cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DLIBGAV1_THREADPOOL_USE_STD_MUTEX=1 ..
+cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DLIBGAV1_THREADPOOL_USE_STD_MUTEX=1 -DLIBGAV1_ENABLE_EXAMPLES=0 -DLIBGAV1_ENABLE_TESTS=0 ..
ninja install
# rav1e
diff --git a/tests/gtest/avifallocationtest.cc b/tests/gtest/avifallocationtest.cc
index e5224d0..2b4315f 100644
--- a/tests/gtest/avifallocationtest.cc
+++ b/tests/gtest/avifallocationtest.cc
@@ -58,40 +58,38 @@
TestAllocation(1, 1, 8, AVIF_RESULT_OK);
}
-TEST(AllocationTest, MaximumValidDimensions) {
- // On 32-bit builds, malloc() will fail with fairly low sizes.
- // Adapt the tests to take that into account.
- constexpr bool kIsPlatform64b = sizeof(void*) > 4;
- constexpr uint32_t kMaxAllocatableDimension =
- kIsPlatform64b ? std::numeric_limits<typeof(avifImage::width)>::max()
- : 134217728; // Up to 1 GB total for YUVA
-
- // 8 bits
- TestAllocation(kMaxAllocatableDimension, 1, 8, AVIF_RESULT_OK);
- TestAllocation(1, kMaxAllocatableDimension, 8, AVIF_RESULT_OK);
- // 12 bits (impacts the width because avifImage stride is stored as uint32_t)
- TestAllocation(kMaxAllocatableDimension / 2, 1, 12, AVIF_RESULT_OK);
- TestAllocation(1, kMaxAllocatableDimension, 12, AVIF_RESULT_OK);
- // Some high number of bytes that malloc() accepts to allocate.
- TestAllocation(1024 * 16, 1024 * 8, 12, AVIF_RESULT_OK); // Up to 1 GB total
+// Up to SIZE_MAX can be passed as the input argument to avifAlloc(). Testing
+// this value is unrealistic so allocate 1 GB: that should pass on all platforms
+// and environments.
+TEST(AllocationTest, Allocate1GB) {
+ // 8 bits, so one byte per pixel per channel, up to 4 channels
+ TestAllocation((1 << 30) / 4, 1, 8, AVIF_RESULT_OK);
+ TestAllocation(1, (1 << 30) / 4, 8, AVIF_RESULT_OK);
+ // 12 bits, so two bytes per pixel per channel, up to 4 channels
+ TestAllocation((1 << 30) / 2 / 4, 1, 12, AVIF_RESULT_OK);
+ TestAllocation(1, (1 << 30) / 2 / 4, 12, AVIF_RESULT_OK);
+ TestAllocation(1 << 15, (1 << 15) / 2 / 4, 12, AVIF_RESULT_OK);
}
TEST(AllocationTest, MinimumInvalidDimensions) {
- TestAllocation(std::numeric_limits<typeof(avifImage::width)>::max(), 1, 12,
+ TestAllocation(std::numeric_limits<decltype(avifImage::width)>::max(), 1, 12,
AVIF_RESULT_INVALID_ARGUMENT);
}
TEST(AllocationTest, MaximumInvalidDimensions) {
- TestAllocation(std::numeric_limits<typeof(avifImage::width)>::max(),
- std::numeric_limits<typeof(avifImage::height)>::max(), 12,
+ TestAllocation(std::numeric_limits<decltype(avifImage::width)>::max(),
+ std::numeric_limits<decltype(avifImage::height)>::max(), 12,
AVIF_RESULT_INVALID_ARGUMENT);
}
-// This is valid in theory but malloc() should refuse to allocate so much and
-// avifAlloc() aborts on malloc() failure.
TEST(DISABLED_AllocationTest, OutOfMemory) {
- TestAllocation(std::numeric_limits<typeof(avifImage::width)>::max() / 2,
- std::numeric_limits<typeof(avifImage::height)>::max(), 12,
+ // This should pass on 64-bit but may fail on 32-bit or other setups.
+ TestAllocation(std::numeric_limits<decltype(avifImage::width)>::max(), 1, 8,
+ AVIF_RESULT_OK);
+ // This is valid in theory: malloc() should always refuse to allocate so much,
+ // but avifAlloc() aborts on malloc() failure instead of returning.
+ TestAllocation(std::numeric_limits<decltype(avifImage::width)>::max() / 2,
+ std::numeric_limits<decltype(avifImage::height)>::max(), 12,
AVIF_RESULT_OUT_OF_MEMORY);
}
@@ -149,12 +147,21 @@
TestAllocation(1, 1, 8, AVIF_RESULT_OK);
}
-TEST(EncodingTest, MaximumValidDimensions) {
- // 65536 is the maximum AV1 frame dimension allowed by the AV1 specification.
- // See the section 5.5.1. General sequence header OBU syntax.
- // Old versions of libaom are capped to 65535 (http://crbug.com/aomedia/3304).
- TestEncoding(65535, 1, 12, AVIF_RESULT_OK);
- TestEncoding(1, 65535, 12, AVIF_RESULT_OK);
+TEST(EncodingTest, ReasonableValidDimensions) {
+ TestEncoding(16384, 1, 12, AVIF_RESULT_OK);
+ TestEncoding(1, 16384, 12, AVIF_RESULT_OK);
+}
+
+// 65536 is the maximum AV1 frame dimension allowed by the AV1 specification.
+// See the section 5.5.1. General sequence header OBU syntax.
+// However, this test is disabled because:
+// - Old versions of libaom are capped to 65535 (http://crbug.com/aomedia/3304).
+// - libaom may be compiled with CONFIG_SIZE_LIMIT defined, limiting the
+// internal allocation to DECODE_WIDTH_LIMIT and DECODE_HEIGHT_LIMIT during
+// encoding in aom_realloc_frame_buffer().
+TEST(DISABLED_EncodingTest, MaximumValidDimensions) {
+ TestEncoding(65536, 1, 12, AVIF_RESULT_OK);
+ TestEncoding(1, 65536, 12, AVIF_RESULT_OK);
// TestEncoding(65536, 65536, 12, AVIF_RESULT_OK); // Too slow.
}
@@ -168,14 +175,14 @@
}
TEST(EncodingTest, MaximumInvalidDimensions) {
- TestEncoding(std::numeric_limits<typeof(avifImage::width)>::max(), 1, 8,
+ TestEncoding(std::numeric_limits<decltype(avifImage::width)>::max(), 1, 8,
AVIF_RESULT_ENCODE_COLOR_FAILED);
- TestEncoding(1, std::numeric_limits<typeof(avifImage::height)>::max(), 8,
+ TestEncoding(1, std::numeric_limits<decltype(avifImage::height)>::max(), 8,
AVIF_RESULT_ENCODE_COLOR_FAILED);
- TestEncoding(std::numeric_limits<typeof(avifImage::width)>::max(),
- std::numeric_limits<typeof(avifImage::height)>::max(), 12,
+ TestEncoding(std::numeric_limits<decltype(avifImage::width)>::max(),
+ std::numeric_limits<decltype(avifImage::height)>::max(), 12,
AVIF_RESULT_ENCODE_COLOR_FAILED);
- TestEncoding(1, 1, std::numeric_limits<typeof(avifImage::depth)>::max(),
+ TestEncoding(1, 1, std::numeric_limits<decltype(avifImage::depth)>::max(),
AVIF_RESULT_UNSUPPORTED_DEPTH);
}
diff --git a/tests/oss-fuzz/avif_decode_fuzzer.cc b/tests/oss-fuzz/avif_decode_fuzzer.cc
index bcab665..173040f 100644
--- a/tests/oss-fuzz/avif_decode_fuzzer.cc
+++ b/tests/oss-fuzz/avif_decode_fuzzer.cc
@@ -32,7 +32,8 @@
if (result == AVIF_RESULT_OK) {
for (int loop = 0; loop < 2; ++loop) {
while (avifDecoderNextImage(decoder) == AVIF_RESULT_OK) {
- if ((loop != 0) || (decoder->imageIndex != 0)) {
+ if (((decoder->image->width * decoder->image->height) > (47 * 1024 * 1024)) || (loop != 0) ||
+ (decoder->imageIndex != 0)) {
// Skip the YUV<->RGB conversion tests, which are time-consuming for large
// images. It suffices to run these tests only for loop == 0 and only for the
// first image of an image sequence.