Support for progressive AVIFs and operating point selection
* Support for parsing boxes: a1op, a1lx, lsel * Added operating point and "skip" support to avifCodec impls for layer selection support * Reworked avifdec decoding to support nth image decoding and minor optimization * New avifProgressiveState enum to expose info about progressive AVIFs to users of libavif * New avifdec args: --progressive, --index
Add automatic tile scaling to the item's ispe or track's dims
(rough draft, scale.c needs more work)
Disable JSON-based tests for now, the metrics are inconsistent/unreli…
…able
Add diagnostic messages for AV1 decode failures
Add diagnostic messages for all AVIF_RESULT_DECODE_ALPHA_FAILED or AVIF_RESULT_DECODE_COLOR_FAILED errors.
Make avifDecoderItemMaxExtent progressive-aware (#683)
* Make avifDecoderItemMaxExtent progressive-aware
Re-map libavif-libaom speed settings (#682)
Make libavif speed setting to map 1-to-1 to libaom speed setting. Adjust usage for speed >= 7 according to AOM_USAGE_ALL_INTRA availability and sequence coding.
Fix avifDecoderItemMaxExtent() - compensate for sample->offset correc…
…tly (#687) * Fix avifDecoderItemMaxExtent() - compensate for sample->offset correctly
Bump of version in CMakeLists.txt was forgotten
Ideally should use this line and PROJECT_VERSION_* variables to generate include/avif/avif.h version info to keep things nicely in sync
Clarify the comment for avifDecodeSample.spatialID
Clarify the comment for the spatialID member of the avifDecodeSample struct. Avoid the ambiguous word "otherwise". Fix #697.
Move an assertion next to the dependent statement
In avifCodecDecodeInputFillFromDecoderItem(), the assertion
assert(lselProp->u.lsel.layerID < MAX_AV1_LAYER_COUNT);
is apparently intended to ensure that the following uint8_t cast is
safe:
sample->spatialID = (uint8_t)lselProp->u.lsel.layerID;
So move the assertion next to that statement.Call avifDecoderNextImage in while loop condition
Call avifDecoderNextImage() in an assignment statement in the while loop's conditional expression. This allows us to have only one avifDecoderNextImage() call.
Better message for unsupported file extension
Improve the error message for an unsupported output file extension. If we reach here, we recognize the file extension (currently only .avif), but the file cannot be the output from avifdec. So the error message "Unrecognized file extension" is a little confusing.
Remove unneeded null check for decoder
Remove the unneeded null check for 'decoder' under the 'cleanup' label.
The 'decoder' variable is initialized as follows:
avifDecoder * decoder = avifDecoderCreate();
decoder->maxThreads = jobs;
decoder->codecChoice = codecChoice;
...
so it cannot possibly be a null pointer.Compare partialByteCount with item->size - offset
Compare partialByteCount with item->size - offset rather than item->size, because the read should start from 'offset'.
Remove a change from the 0.9.2 section
The change "Don't need to disable MSVC warnings 5031 and 5032 (#681)" is a change to commit 5a98790 (the "-j all" option of avifenc and avifdec), which was added during the 0.9.2 development cycle. So this change is not a change to older releases and does not need to be documented as a change in 0.9.2.
Do not copy input image when encoding with libaom
Avoid the heap allocation of aomImage plane buffers and copying of input image in aomCodecEncodeImage(). This requires manually setting up the aom_image_t struct 'aomImage'. Fix #694.
Assert the presence of the alpha plane (if necessary) in avifImageYUV…
…AnyToRGBAnySlow()
Fix the comment for AVIF_STRICT_PIXI_REQUIRED
The old comment describes the behavior when this bit is disabled. The comment should describe the behavior when this bit is enabled.
Update libavif.pc.cmake (#692)
Use full paths and move configure w/install
Update a comment with libaom v3.1.2
Also fix a comment typo (libaom, not libavif).
In 32-bit builds set frame_size_limit to 8192*8192
This avoids the following dav1d_log() message in 32-bit builds:
Frame size limit reduced from 268435456 to 67108864.Copy input image data if width or height is 1
Commit ea3e97e eliminated the unnecessary copying of input image data into the aom_image_t struct, but it exposed a libaom bug (https://crbug.com/aomedia/3113). Work around the libaom bug by resurrecting the original code that copies input image data and using it when the image width or height is equal to 1.
Skip YUV/RGB conversion tests except first image
Skip the YUV<->RGB conversion tests except for the first loop iteration (loop == 0) and the first image of an image sequence. The YUV<->RGB conversion tests are time-consuming for large images, so we should try to avoid duplicate tests.
Make image size limit configurable, expose to avifdec
Adapted from Joe Drago's pull request #527, with the limitation that decoder->imageSizeLimit must be less than or equal to the default value and must not be set to 0 (reserved for future use). This way we don't need to audit our code for integer overflows due to a large image width or height. Set decoder->imageSizeLimit to 11 * 1024 * 10 * 1024 in avif_decode_fuzzer.cc to keep its memory consumption under 2560 MB. #263
Test avifImageRGBToYUV() with upsamplingsIndex=0
Since avifImageRGBToYUV() ignores rgb.chromaUpsampling, we only need to test avifImageRGBToYUV() with a single upsamplingsIndex.
Add diagnostic messages if imageSizeLimit exceeded
Add custom diagnostic messages if item size, track size, or grid dimensions exceed imageSizeLimit. Related to #263.
Check for scale values that cause overflow (#735)
* Check for scale values that cause overflow This addresses #734
When creating the read buffer in avifDecoderItemRead(), always make t…
…he buffer the item's full size This avoids progressive image partial item reads causing reallocs of this buffer, which can cause dangling pointers in the underlying AV1 decoders (use-after-free). As the natural pattern of this type of usage is to ultimately decode the final image, those additional reallocations are also typically unnecessary overhead, as we'll eventually be using this sized buffer anyway. This should address Chromium issue 1239472.
Allocate alpha alongside YUV (if necessary) during y4m decode to avoi…
…d incorrect alphaRowBytes math
Change avif_decode_fuzzer to be more like Chrome
Allow progressive decoding and use a non-persistent avifIO object. This allows avif_decode_fuzzer to reproduce the AddressSanitizer heap-use-after-free error in https://crbug.com/1239472.
NON-STANDARD: Allow alpha subimage items to not have an ispe property…
…, infer ispe from color item See: https://crbug.com/1245673
Revert "NON-STANDARD: Allow alpha subimage items to not have an ispe …
…property, infer ispe from color item" This reverts commit efed118. That commit is intended for Chrome 93 only.
Update codec_dav1d.c for the new threading model
See https://code.videolan.org/videolan/dav1d/-/commit/753eef833b: Merge the 3 threading models into a single one by Victorien Le Couviour--Tuffet <victorien@videolan.org>
Compute maxFixedValueWidth in 64-bit operation
Improve the check added in #735. Compute maxFixedValueWidth and maxFixedValueHeight in 64-bit multiplication by casting the first operand to int64_t. Otherwise, the first operand is an int and the second operand is a uint32_t, so the multiplication is 32-bit. Replace 0x7fffffff with the symbolic constant INT_MAX because the product will be stored in an int variable.