Live data from Hacker News

Visualizing and Understanding JPEG Format

github.com

41–47 of 47 posts

Re: Visualizing and Understanding JPEG Format

#41

Hexfiend (open source hex editor for mac) [0] and synalize it [1] (closed source hex editor for mac) both support a similar feature (hexfiend only in the newest github release) that shows the structure of known file formats similar to what wireshark [2] does for network packages. Thought about writing an hex editor or adding the hex fiend functionality to other hex editors based on the templates of hex fiend. [0] htt…

I love Hexfiend, so I was checking wireshark.org to see what you meant, since I don't use it nearly as much. First, Cloudshare is evaluating my browser to see if it's genuine access. Why? Second, scrolling the site uses 97% of my CPU. WTF is it doing? Some parallax effect on the shark, that could easily be done with a few lines of CSS? Lost interest at the spot. What have we turned the web into.

Can't reproduce the problem on the site, but here

> Wireshark is the world’s foremost and widely-used network protocol analyzer. It lets you see what’s happening on your network at a microscopic level and is the de facto (and often de jure) standard across many commercial and non-profit enterprises, government agencies, and educational institutions.

From the website. Btw wireshark is is one of the most useful tools for system administrators (especially in combination with tcpdump and ssh) and giving up on a project, because your browser bugs out is kind of bad form. You should at least take a look at it. Anyway hope you change your mind and have fun ;) some of my most interesting nights I have spent with wireshark

Re: Visualizing and Understanding JPEG Format

#42

Earlier quoted context omitted.

I love Hexfiend, so I was checking wireshark.org to see what you meant, since I don't use it nearly as much. First, Cloudshare is evaluating my browser to see if it's genuine access. Why? Second, scrolling the site uses 97% of my CPU. WTF is it doing? Some parallax effect on the shark, that could easily be done with a few lines of CSS? Lost interest at the spot. What have we turned the web into.

Can't reproduce the problem on the site, but here > Wireshark is the world’s foremost and widely-used network protocol analyzer. It lets you see what’s happening on your network at a microscopic level and is the de facto (and often de jure) standard across many commercial and non-profit enterprises, government agencies, and educational institutions. From the website. Btw wireshark is is one of the most useful tools f…

Thanks. I know how awesome Wireshark is from the brief interactions I've had in the past. But their website experience the terrible.

It's much more a critique of the state of the web than of the project itself.

BTW, both behaviors (insane CPU usage while scrolling and Cloudflare checking) are reproducible in Safari, Chrome and Firefox, so it's not the browser that's bugging out, but the website scroll highjacking that's poorly written.

Re: Visualizing and Understanding JPEG Format

#43

Earlier quoted context omitted.

I would add that the "reference implementation" of jpeg encoding and decoding is very easy to compile and to use, reasonably efficient, and completely free software. There has never been a corresponding jpeg2000 implementation, for example, leading to the fast demise of the arguably superior format.

JPEG2000 is not actually much better and I always found the artifacts to be kind of unpleasant. Wavelets are not very good psychovisually because they make the image blurry; they're also more complicated to decode and cost more memory. It's not a good idea to enable too many file formats in a browser because of the new security issues, so it really needs to be a huge improvement. I also think WebP was a mistake for t…

Actually, JPEG 2000 seems pretty badass. I believe Apple is the only major vendor that supports JPEG 2000 out of the box.

From "JPEG 2000: The Better Alternative to JPEG That Never Made it Big": https://petapixel.com/2015/09/12/jpeg-2000-the-better-altern...

JPEG 2000 is a much better image solution than the original JPEG file format. Using a sophisticated encoding method, JPEG 2000 files can compress files with less loss of, what we might consider, visual performance. In addition, the file format is less likely to be affected by ‘bit errors’ and other file system errors due to its more efficient coding structure.

Those who choose to save their files in the JPEG 2000 standard can also choose between utilizing compression or saving the file as lossless to retain original detail. A higher dynamic range is also supported by the format with no limit of an image’s bit depth. Together, these abilities created a much better alternative than the original JPEG solution.

Re: Visualizing and Understanding JPEG Format

#44
post #40

If you're looking for a fun project that can be completed in a weekend or less, one of the things I recommend is to write a (baseline) JPEG decoder. The official spec (linked from the article near the top) is quite readable as far as standards go, and even contains helpful flowcharts for basically the whole process. When I did it, it took less than 1kLoC of C, including some minor optimisations like array-based Huffm…

Where do you get the spec for video? That really something that can be done in a weekend?

https://www.itu.int/rec/T-REC-H.261-199303-I/en

Re: Visualizing and Understanding JPEG Format

#45
post #40

Earlier quoted context omitted.

Where do you get the spec for video? That really something that can be done in a weekend?

https://www.itu.int/rec/T-REC-H.261-199303-I/en

If you can write a JPEG decoder in a weekend, H.261 should be doable. It's much simpler in many ways --- hardcoded Huffman tables and dimensions. The spec is much shorter too.

Re: Visualizing and Understanding JPEG Format

#46

Earlier quoted context omitted.

JPEG2000 is not actually much better and I always found the artifacts to be kind of unpleasant. Wavelets are not very good psychovisually because they make the image blurry; they're also more complicated to decode and cost more memory. It's not a good idea to enable too many file formats in a browser because of the new security issues, so it really needs to be a huge improvement. I also think WebP was a mistake for t…

Actually, JPEG 2000 seems pretty badass. I believe Apple is the only major vendor that supports JPEG 2000 out of the box. From "JPEG 2000: The Better Alternative to JPEG That Never Made it Big": https://petapixel.com/2015/09/12/jpeg-2000-the-better-altern... JPEG 2000 is a much better image solution than the original JPEG file format. Using a sophisticated encoding method, JPEG 2000 files can compress files with less…

> In addition, the file format is less likely to be affected by ‘bit errors’ and other file system errors due to its more efficient coding structure.

This is confusing. I think they mean that a file is less likely to be corrupt if it's smaller, which is debatable. But I wouldn't use a newer codec just to make smaller files, I'd make them higher quality at the same size. In that case you need redundancy, which is the opposite of compression efficiency.

> A higher dynamic range is also supported by the format with no limit of an image’s bit depth.

JPEG supports this, but most decoders don't because pixel depth is not something you can just abstract away. Do JPEG2K decoders actually support 10/12-bit? HEIF does.

Re: Visualizing and Understanding JPEG Format

#47

Earlier quoted context omitted.

Actually, JPEG 2000 seems pretty badass. I believe Apple is the only major vendor that supports JPEG 2000 out of the box. From "JPEG 2000: The Better Alternative to JPEG That Never Made it Big": https://petapixel.com/2015/09/12/jpeg-2000-the-better-altern... JPEG 2000 is a much better image solution than the original JPEG file format. Using a sophisticated encoding method, JPEG 2000 files can compress files with less…

> In addition, the file format is less likely to be affected by ‘bit errors’ and other file system errors due to its more efficient coding structure. This is confusing. I think they mean that a file is less likely to be corrupt if it's smaller, which is debatable. But I wouldn't use a newer codec just to make smaller files, I'd make them higher quality at the same size. In that case you need redundancy, which is the…

A file format can be notably more or less resilient to bit errors. It can be the difference between getting a slightly different output, a garbled one or an oops, sorry.

BTW compression efficiency is orthogonal not opposite of structured redundancy that you would want. As a thought experiment, imagine as a last step of coding, encrypting the data with a publicly known key. Theoretical redundancy remains the same, but good luck¹ getting your data back, if you get a bit error.

¹ Imagine a variable length single block cypher was used, multi round CBC or something.

Post reply on HN