Hacker News new | ask | show | jobs
by Varriount 880 days ago
From a technical perspective, what are the differences between the two?
2 comments

The original lossy WebP format is more or less an intra-coded frame format from VP8. This "I-frame-as-image" approach was considered good enough for some time, for example AVIF largely follows the same structure.

The WebP lossless format (internally "VP8L") is the second codec supported by libwebp but otherwise independent. This format can be thought as an optimized PNG; it uses the main PNG algorithm but then tweaks various bits for better compression. For this reason it is very rare to see PNG files smaller than losslessly compressed WebP files when efficiently done.

JPEG XL is very different from both. There are some technical resemblances, as the author of lossless WebP also worked on JPEG XL (and Brotli), but the overall architecture is completely revamped. The lossy portion of JPEG XL is a (much larger) superset of JPEG 1, while the lossless portion is based on a learnable context modelling respresented as a binary decision tree. And then everything got sandwiched between yet another set of components.

It would be more correct to say that PNG uses the GIF algorithm than that WebP uses the PNG algorithm.

WebP's select predictor and some other predictors are used in JPEG XL. The same for 2d locality map in backward references.

Both are able to use delta palettes. JPEG XL goes further by having a mixed mode where some entries are deltas for smooth gradients while others are usual palette entries.

the main difference is webp is a last gen video format (vp9) adapted to support images, while jpeg-xl is an image format first. This may not sound important, but actually matters a lot because videos and images are viewed very differently and therefore have different constraints to optimize for.

1. A frame of video only is viewed for 1/30th to 1/60th of a second. Quality standards are lower than for an image which will often be looked at for several seconds. One example tradeof is webp always has chroma sub-sampling which is a fairly major quality tradeoff.

2. image sizes vary a lot more. Images sizes range from 32x32 pixels to enormous. Videos are pretty much always between 360p and 4k (webp supports 16k by 16k vs 1 billion by 1 billion for jpeg-xl)

3. videos don't care about progressive loading, but it makes sense for images (especially for users with slow connections)

4. video formats care about encode time because a videos are massive. Image formats are fine with 100x slower encode if it makes the file smaller and decode is faster 3.