← Back to context

Comment by nneonneo

2 months ago

Worth noting that this progressive AVIF, when viewed in Chrome, has only two states: a "base layer" which pops in around 8KB, and the full image which appears 270KB later. The comparison JXL continues to refine during most of the download, so it winds up looking substantially better than the AVIF at around 95KB loaded, and looks pretty good (almost as good as the full 280KB AVIF) by 175KB. I suspect that there are a lot of knobs to turn for both progressive modes, but this particular case could definitely be cherry-picked to favour either codec.

Progressive AVIF is very flexible: it supports up to four passes, at configurable quality and dimension scaling levels. You can have any given pass reference up to two previous ones for refinement (thanks to AV1's strong inter-encoding capabilities), and you add filters to non-final passes (like blurring) to achieve a desired loading aesthetic.

That JXL page happens to use two passes, but the knobs are there to customize the experience to fit the use case.

  • I find it misleading to call AVIF's "up to four passes" "very flexible".

    It seems quite limited compared to the JPEG XL ability to truncate the bitstream anywhere, or send the progressive updates for salient regions first [1].

    [1]: https://opensource.googleblog.com/2021/09/using-saliency-in-...

    • > I find it misleading to call AVIF's "up to four passes" "very flexible".

      Wow, what a way to misquote me. Let me repeat what I actually said:

      > Progressive AVIF is very flexible: it supports up to four passes, at configurable quality and dimension scaling levels. You can have any given pass reference up to two previous ones for refinement (thanks to AV1's strong inter-encoding capabilities), and you add filters to non-final passes (like blurring) to achieve a desired loading aesthetic.

      So, I re-iterate progressive AVIF is flexible, because:

      - Intermediate passes in AVIF can look as sharp or blurry as desired -- you don't have that kind of control with JXL

      - Intermediate passes in AVIF can semantically be different from the final pass -- very useful if you want to add a "loading" mark to the non-final passes to inform the user the image is still loading

      - The four pass limit is A GOOD THING, as you want an image format to have a reasonable worst-case upper bound on energy consumption due to sum of partial decoding + display refresh updates -- there's such a thing as having "too many passes", and uncapping the limit would be irresponsible

      - You can absolutely do saliency encoding in AVIF, as AV1's inter-frame encoding naturally allows for it efficiently

      4 replies →

I believe wholeheartedly that AVIF's approach is significantly better UX.

  • why? in jpeg xl i get an image quicker and i can see it getting better, so i know it's still loading while the avif one looks stuck for the majority of the time, which makes it look already done loading and just low quality to me.

  • What exactly is AVIF doing in this case that I can't do with two <img> tags at a smaller size? I can easily create a thumbnail that beats the AVIF quality in less than the 5KB delta between the static and progressive version in Squoosh.

    • The quick answer is: you can have up to four passes. With progressive AVIF, you let the browser avoid rendering previous passes if a subsequent one has already been downloaded. It's more efficient and saves battery.

Perhaps it's just a bad example. I suppose avif can support multiple "scans" of progressive encoding as well.