AVIF Still-Image Codec: Potential Enhancements Fueling Future Adoption
Vikas K Prasad (General Manager, IMT)
Ranjit Kumar Tulabandu (Senior Principal Engineer, SMTS, IMT)
Sanampudi Venkata Rao (Lead Engineer, IMT)
“A picture is worth a thousand words” is one of the most commonly used phrases. This is a primary reason for sharing information on the webpages using images. However, images constitute the bulk of webpage size and poor compression efficiency, often leading to increased page loading time and subsequently, rendering poor user experience. Several image compression standards such as PNG, GIF, JPEG 2000, WebP and HEIF have successfully emerged to address this issue in their own ways. Recent addition to this list is AV1 Image Format (AVIF) providing not only superior compression efficiency but also a wider feature support when compared to other formats.
AVIF defines the storage of a subset of AV1 bit-stream (intra-coded) in a HEIF file  and was standardized by Alliance for Open Media (AOM). AVIF achieves ~50% savings in file size over JPEG . These savings can help in faster download of webpages and also reduce the streaming bandwidth requirements. The superior compression performance of AVIF can enable content providers to reduce storage and bandwidth requirements of image catalog hosted on CDN. The catalog typically caters to a variety of end devices such as smart TVs and phones – supporting quick browsing and thereby serving the recommendations . Other potential applications of AVIF include reducing the storage space required for photos/images in cloud storage, image archives and medical applications. However, the improvements in the compression performance come at the expense of higher processing requirements for encoder/decoder. Hence, it is important to improve the speed of an encoder for ubiquitous deployment. Similarly, improvements to the speed of the decoder can aid faster display of images while browsing webpages / image catalogue. In this blog, we will take a closer look at the enhancements to AVIF codec (for still-image coding) over the last several months with the perspective for potential future improvements.
The ‘libavif’ library is an implementation of AVIF. It supports encoding using libaom, rav1e and SVT-AV1 encoders and decoding using libaom, dav1d and libgav1 decoders. The libaom encoder for still-picture encoding has undergone significant optimizations to reduce the heap memory requirements by ~5x and encode time by ~6.5x . The optimizations were achieved via code restructuring to avoid redundant allocations, speed-up through algorithmic modifications and SIMD intrinsic coding. The multi-thread optimization of different stages in libaom AV1 encoder such as bit stream preparation too contributed to improved performance of AVIF encoder. Faster AVIF encoding with reduced memory bandwidth requirements aided the adoption of AVIF format in different browsers.
Though AVIF codec has grown faster, there is still a lot of scope for improvement to aid better adoption of AVIF. AVIF codec has already been successfully adopted by browsers such as Chrome, Firefox and Opera. Further improvements to AVIF codec will not only enhance the user experience in existing browsers but also hasten the new deployments .
AVIF encoder supports multiple speed presets – 0 to 10. These presets are aimed at wide applications covering ahead-of-time encode to on-the-fly encode. In the rest of the blog, we will present various analyses performed on libavif codec aimed at above applications and also provide an overview of potential improvements.
AVIF encoder supports multi-threading for better performance. This is mainly achieved through multi-threading of different stages (in libaom AV1 encoder) including encoding and bit-stream preparation. Table 1 summarizes MT scaling of AVIF encoder for different resolutions with 4 threads. It can be seen that MT scaling of AVIF encoder is better at higher resolution as compared to lower resolution.
The chart in the Figure 1 presents the percentage distribution of time across stages in AVIF encoder. Given the distribution of time across stages, MT efficiency can be potentially improved by optimizing ‘EncodeStage’ and ‘PrepareEncode’ stages of the encoder.
AV1 standard has multiple coding tools to achieve superior compression efficiency for image/intra encode. These coding tools improve quality of the encoder at the cost of increased complexity/processing requirements for the encoder/decoder. Table 2 captures a few key coding tools/algorithms in AVIF encoder that can be potentially tuned for performance improvements without significantly impacting quality.
Though AVIF encoder has undergone significant heap memory optimizations , the heap memory requirements are still relatively higher. AVIF encoder uses superior algorithms for better compression performance and the memory requirements are expected to be more than that of WebP encoder, if not same or less. Table 3 summarizes the heap memory consumption of AVIF encoder as compared to that of WebP encoder for different resolutions. It is observed that AVIF encoder consumes 2 to 6 times more heap memory than WebP encoder depending on the resolution. Given that memory consumption is a key care-about for most applications, any improvement to reduce the memory requirements can help in faster adoption of a newer generation codec. Based on the analysis, the heap memory requirements of AVIF encoder can be reduced through suitable on-the-fly allocations.
Dav1d  is commonly used for AVIF decode due to its superior performance. It supports multi-threading through tile parallel decode (parsing + reconstruction) along with in-loop filtering of decoded rows in parallel. Table 4 summarizes the MT performance of AVIF decoder using the files generated from AVIF encoder, speed=6. It can be seen that MT efficiency of AVIF decoder is better at higher resolution/higher number of tiles as compared to lower resolution/lower number of tiles. Introducing row-parallel decode of tile-superblock rows can significantly improve the efficiency for lower number of tiles.
Though AVIF codec has undergone significant improvements recently, there is further potential to reduce heap memory consumption and improve performance through optimizations specific to single/multi-thread encode/decode. AVIF is expected to see widespread deployment in web browsers and online video services due to its compression efficiency and support for rich features such as transparency and HDR. These rich features along with improved performance and royalty-free nature of the format, can potentially make the adoption of AVIF much easier. At Ittiam, we continue to explore improvements to AVIF codec targeted at different applications to facilitate faster adoption of AVIF.