7 ms·
> we could have solved that entire problem simply by adding an attribute to <img> telling the client which HTTP byte ranges it needs to request for various size
by saurik 11y ago
> we could have solved that entire problem simply by adding an attribute to <img> telling the client which HTTP byte ranges it needs to request for various sizes
You would never have a range start anywhere but the top of the file, as the whole point is that the later octaves are refinements of earlier ones. What makes JPEG2000 so amazing for this use case is precisely that you don't need to care about "ranges" (if you needed ranges, we might as well just have multiple files..). Instead, browsers just keep downloading the file until they either achieve the level of quality they need to render at the scale they currently care about (being able to continue later, if required) or run out of file. At worst, only as a "hint", I could see a benefit to having a table of sizes, but I feel like the cool solution for at would be to have an encoded version of the octave offsets, sort of like a zindex but for JPEG.
- acdha 11y ago> You would never have a range start anywhere but the top of the file, as the whole point is that the later octaves are refinements of earlier ones. Correct, but also arguing against a claim I never made. 1-10 and 1-1000 are both range requests. > What makes JPEG2000 so amazing for this use case is precisely that you don't need to care about "ranges" (if you needed ranges, we might as well just have multiple files..). The difference is simply performance: separate files lower cache hit ratios. Smart HTTP caches, including some CDNs, cache a given resource only once so e.g. a laptop user can get an edge hit for the first n bytes which an iPhone user just read and the image can start displaying immediately while the finer detail streams in. Similarly, streaming the download and canceling after you've read enough for your target output resolution means that you're likely to wasting time transferring more bytes than you actually needed. That's particularly nice on a high-latency wireless network where a significant amount of data can be in-flight and those unneeded bytes will consume battery power to transfer and will likely delay transferring other resources which are actually needed.