mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.2k stars 716 forks source link

AVIF/webp format? #955

Open strarsis opened 3 years ago

strarsis commented 3 years ago

Can Pannellum use AVIF or webp instead JPEG for the panorama images (multires and single)? The new formats compress more efficient and AVIF even supports HDR.

mpetroff commented 3 years ago

I have not personally tested either WebP or AVIF, but image support is handled by the browser, so both image formats should work with appropriate browser support.

The new formats compress more efficient[ly]

This is not necessarily true, especially for WebP. While WebP is more efficient at low bitrates, it does not present much, if any, improvement at higher bitrates, such as those often used for panoramas or other photographic content where the image is the main subject and high quality is desired. Personally, I'm mostly interested in JPEG XL, which, unlike WebP and AVIF, is a high-fidelity codec designed for still images instead of a low-fidelity video codec intra-frame kludged into an image format. I also think that JPEG XL's responsive design combined with HTTP range requests should allow for a more space- and bandwidth-efficient multiresolution format, which can be stored on disk as a single file.

AVIF even supports HDR

Supporting HDR will require changes at the WebGL level, so image format support for HDR is insufficient. To the best of my knowledge, HDR output from WebGL is not currently supported by browsers, although such support is planned. Without HDR output support, it would still be possible to take advantage of HDR images using an "auto-exposure" calculation for the current view (or a manual exposure control slider). I had experimented with encoding HDR images as a pair of low dynamic range images a few years ago, prior to browser support of HDR image formats, with the intent of eventually implementing such "auto-exposure" support in Pannellum. However, it was never a priority, and I never got around to adding it.

mirh commented 5 months ago

Personally, I'm mostly interested in JPEG XL, which, unlike WebP and AVIF, is a high-fidelity codec designed for still images instead of a low-fidelity video codec intra-frame kludged into an image format.

I'm also a fan of jxl, but the article does absolutely nothing to substantiate that claim. Like, you just have the last section mentioning it at all, and it's written so vaguely that I'm even struggling to grasp the grammar. Let alone talking about numbers (which are kinda the whole point, because otherwise even 1992 jpeg can be high-fidelity with a high enough quality setting).

To the best of my knowledge, HDR output from WebGL is not currently supported by browsers, although such support is planned.

I think this is probably more relevant?

I had experimented with encoding HDR images as a pair of low dynamic range images a few years ago

Very cool.. and I suppose that was kinda the idea of gain maps google used in their JPEG_R format?

mpetroff commented 5 months ago

I think this is probably more relevant?

That entry didn't exist when I wrote my previous comment. Now that it exists, it is more relevant, although it also depends on the previous entry (HDR depends on color management).

Very cool.. and I suppose that was kinda the idea of gain maps google used in their JPEG_R format?

It's a similar idea, although Google's Ultra HDR format more closely resembles the JPEG-HDR technique than the BoostHDR technique I based my implementation on. Unsurprisingly, you're more limited in what you can do if you want to maintain backward compatibility with standard JPEG decoders and SDR display, although there are certainly benefits in doing so.