Non-blocky progressive loading demo

It is possible to load progressive JPEGs faster and nicer. The decoder knows how many coefficients it has received already, and from this information it's possible to calculate optimal resolution which perfectly hides the distortions.

The above animaiton (on the right) is only a rough approximation in JS. A real decoder could do it more in sync with the image.

It's also faster, because JPEG can be decoded at 1/nth of its resolution with less CPU usage (libjpeg-turbo has optimized DCT routines for scaled outputs, and 1/8th res is a trivial case that does not even need a transform).

For example, the first ~13% of a JPEG file is usually enough to decode the image at 1/8th of its resolution. It requires only 1/10th of CPU time, 1/64th of memory, and when it's nicely upsampled/blurred, it alredy looks the same as if you blurred the complete high-res file.

Decoding of the first couple of scans at lower resolution can make progressive loading look much more elegant, and also obsolete a few hacks on medium.com.