BPG Image Comparison
xooyoozoo.github.io
xooyoozoo.github.io
edit
Why am I being downvoted for saying this? Do the people downvoting me realize that BPG is using HEVC which is patented by many entities?
You may hear a lot about trolls and grossly invalid obvious patents making millions in licensing and extortion by legal fees and I agree those things are bad. They are very bad. But the real problem is the apparently valid patents.
Monopolizing a programming technique is a long-term barrier to invention that provides little or no incentive to create anything new compared to all the invention it prohibits. It's the same in any field where experimentation doesn't require billion dollar research teams and each new idea is built on thousands of others. No new work you do in video, audio, or image processing or encoding will be legal without a mountain of licensing agreements. Anything beyond common established software applications will be unlicensable and effectively outlawed. Google had to fight for years with a giant legal team to get permission to release WebM and you don't have that kind of power.
So how little money do you believe has been spent creating MPEG, H.264, H.265, and all the other codecs? Do you think these were created by a handful of people in a garage over a weekend?
Meetings for these codecs were more than 300 people and those were just representatives of larger groups. This is research that does require billions of dollars and thousands of experts working for years. That's not going to happen as a charity or by weekend hackers. Linus isn't going to get frustrated at the size of video files and take a week off to come up with a better codec.
Software patents created these video codecs by funding the research and development, and patents aren't long-term barriers as many of the early formats have expired or are expiring now. You want to use MPEG-1? Go ahead. Or if you want to leverage hundreds of thousands of man-hours experts put into improving on it for the next generation then for a few more years you'll need to pay for it to cover those costs. That's exactly how patents are supposed to work.
To be honest that's exactly what happened with Vorbis (1 FOSS guy) and Opus (2 FOSS guys, 1 Skype guy).
The MPEG process is full off politics and massive overheads.
> Intensive development began following a September 1998 letter from the Fraunhofer Society announcing plans to charge licensing fees for the MP3 audio format.
Who says patents don't promote innovation? :-)
(I'm only half-joking - invention forced by working around patents has long been a post-facto justification of patents.)
Also, nit, it wasn't all done by just "1 FOSS guy". From the same wikipedia link:
> Chris Montgomery began work on the project and was assisted by a growing number of other developers.
That's easy to do when your goal is to have as many different people and patents involved as possible, rather than simply develop an efficient codec using an efficient process.
And according to my math, I should be able to use MPEG-2 (publication date 1996), AC3 (1995) or MP3 (1992) already, with MPEG-4 ASP (1999) getting there soon.
No, making a novel and non-obvious contribution to the arts gives you the right to apply for a patent on your invention, which then gives you the right to prevent others from using that specific invention. Spending big money and organizing meetings may or may not be involved.
Nothing prevents others from inventing their own codecs.
Now commercializing those codecs may be another matter entirely, probably requiring resolving licensing issues depending on how much they rely on other patented methods. Ostensibly, pools like MPEG-LA exist to make this easier.
That would be fine. However, confusing the issue, claiming infringement by these new codecs in general, without providing any proof and otherwise trying to destroy the adoption of these new codecs is not OK. MPEG-LA and other right-holders conspiring to damage the alternative codecs uptake did cross this line.
That's kind of what he did with Git.
[1] http://www.mpegla.com/main/programs/HEVC/Documents/HEVCweb.p... - page 7, HEVC License Terms
If I own a patented 3d printer, would you be worried that those patents could restrict my ability to distribute the objects printed by it?
The javascript decoder would certainly be covered by the patents as much as any other decoder, so it doesn't solve the patent-related barriers to adoption even if it takes care of the practical issues with using the format.
If you stick that poly-fill on your website they can also sue you for distributing the decoder to everyone that downloaded the javascript file.
Otherwise JS would become a universal patent loophole, which I'm pretty sure a judge would find fault with.
(IANAL also.)
The patent courts and ITC have looked very unfavorably on First Amendment claims and on defenses based on lack of infringement within the USA and technologies with alternative non-infringing uses not being liable.
The Supreme Court is less extremist than patent courts on insisting that patents pre-empt the Constitution, but the Supreme Court takes very few cases and you'd already have spent millions to get there and -- most importantly -- the patent courts largely don't consider Supreme Court cases to be necessarily binding precedent next time around.
Some of the HEVC algorithms may be protected by patents in some countries (read the FFmpeg Patent Mini-FAQ [https://www.ffmpeg.org/legal.html] for more information). Most devices already include or will include hardware HEVC support, so we suggest to use it if patents are an issue.
The mini-FAQ contains some relevant information.
Bellard is possibly the best example I'm aware of the 100x programmer.
[1] http://blog.smartbear.com/careers/fabrice-bellard-portrait-o...
[2] A subset of things he started: LZEXE, FFMpeg, QEMU. He's also held the record for the calculation of the largest known prime and the most digits of Pi, wrote the first x86 emulator in JS that could boot Linux, won the International Obfuscated C Contest, etc etc.
Oh. Wait...
How many companies can point to software as impactful as FFMpeg and QEMU? (Don't forget that most Linux based non-VMWare virtualization solutions use QEMU at least in part).
Microsoft, Apple, Google, Amazon, Facebook, etc...
> How many individuals can point to software as impactful as FFMpeg and QEMU?
Tougher question.
I almost put this in myself, but I assumed that people would fill in the blank themselves and realize that they are comparing the output of one person to that of AN ENTIRE FORTUNE 500 COMPANY. Judging by the downvotes I guess I should have spelt it out. Mea Culpa.
"Newton is the best example of the 100x scientist."
"Christopher Lee is the best example of the 100x actor."
"John Paul II is the best example of the 100x pope."
"Van Gogh is the best example of the 100x painter."
Saying 100x assumes an expected production. All those people didn't do what was expected of them, they did what they loved.
You, reader, can be a Bellard. There's nothing "special" about what Bellard has done, in the sense of it being beyond your abilities. You just have to believe in yourself, along with having a willingness to work hard most days. But working hard is easy when you find an interesting problem.
Bellard is able to do so much because knowledge is like compound interest: The more you know, the more you can learn. Bellard has been saving up for a long time.
Competition is sometimes motivational, and if you insist on looking at it like a competition, then realize that every day Bellard devotes to relaxation is a day you can catch up to where he's at. Competition is what motivated me, when I first started. And once you realize there's nothing magical about what they know, you realize you can sprint very hard towards where they're at, which is exciting.
But once you start down that path, competitive spirit tends to transcend into something else entirely. You stop comparing yourself to others. You focus on putting one foot in front of the other, taking the next logical step towards your goal. Repeat for N days, and suddenly people are highlighting the projects you've done.
But what's your goal? Well, that's up to you.
So pursue your interests! You can do it.
It's a vicious cycle of desire and fatigue.
What ultimately worked for me was to capture a question. Find a question that fascinates you.
The ability to do that, for me, came down to resisting the urge to come home and zone out in front of Netflix. It's tempting after an 8-10 hour day.
Drained, or scared?
Even if your point was logical, it would be debatable.
Many people are unwilling, or can't or look for excuses to not take the first step because fear[1][2] might be (secretly) hindering them.
I was offered a great job and I was afraid/unwilling to take the job because of the responsibility in involved (even though, I would've loved the job) and was afraid I wouldn't be up to the task or my own expectations (now I realise I would've been more than capable).
Although, my issue was a consequence of a much bigger emotional problem, I wouldn't have ever resolved it, if it wasn't for a tactless and stubborn friend who forced me into helping myself.
Just my two cents.
--
[1]:Atychiphobia
[2]: or Jonah's complex
This is far from universally accepted.
"blank slate fallacy" ... Steven Pinker probably has to pay a marketing person a quarter every time someone says that. I should construct a straw man, position myself as a iconoclast against that straw man, and then rake in the TED/book deal $$$ instead of working hard like a chump.
In the sense that you, reader, can write ffmpeg, that's not really true.
In the sense that you, reader, can achieve your maximum potential in any given field if you commit yourself wholeheartedly to doing so, then yes, it is.
Of course you can write ffmpeg. What's so special about ffmpeg? Research how it works, then write it yourself.
Maybe it seems pointless to do that since ffmpeg is already written, but it's not. You'll learn an amazing amount from the experience.
Putting "mythical 100x programmers" onto a pedestal is mistaken.
But one thing is certain, if you train hard at basketball, you will get better at it.
[0] http://www.cs.virginia.edu/~robins/YouAndYourResearch.html
I really like the results!
Image encoders must allocate the bitrate among the channels, luma (Y), and chroma (Cb, Cr). Most of the time it is better to allocate most of the bitrate to the luma, because that's what the eye is most sensitive to. However it can create artifacts like this.
Any new "image compression format" isn't going to gain widespread traction unless is can displace JPEG in terms of hardware support and ubiquity in cameras.
I was part of the JPEG-2000 support. The company I was with at the time had technology around how blocks were encoded (it gave up block independence at the benefit of 20+% encoding efficiency -- downside would be an intermediary step to reconstruct the JPEG steam).
None of those solutions took off.
Explain to me how beyond a hobbyist market BPG will make a splash?
I can imagine Safari and IE building support for this format entirely as a counter to Google’s WebP, since they already need support for HEVC as a matter of course.
Many current websites send very heavily compressed JPEG images to save bandwidth, and just live with the big hit to image quality. If they had a similar-filesize alternative that they could use for some or all clients that didn’t degrade image quality, and still was guaranteed to work smoothly, it’s plausible they might adopt it.
I don't think a format requiring JS to decode and negating the whole parallel download/decode thing has a chance regardless of the elegance.
It's not an imaging format discussion I this case.
As far as I can tell, this new format already has a better client compatibility story than JPEG 2000 right off the bat, as well as better quality for the same file sizes.
I believe part of the point of BPG is that it's an HEVC subset. If cameras can shoot HVEC, they have BGP hardware support.
However if you look at the history of JPEG and MP3, which were also encumbered with patents, the public domain basically won due to the sheer number of violations being too large to take down or even force licensing.
It will be interesting to see if any product (ie browser) actually puts any of these algorithms in their codebase.
I would love to be able to use this today.
It penalizes "loss of detail" like that, biasing towards (inaccurate) noise over (accurate on average) absolute pixel values (PSNR).
However, to my eye, Large is the only acceptable quality level on these examples, and at Large the difference between JPEG and BPG looks almost imperceptible. Considering the cost of polyfilling, I would stick with JPEG.
I feel we must be looking at different examples, or must have very different definitions of “imperceptible”. I find that there is a very substantial difference in high frequency detail between mozjpeg and BPG in nearly all of these examples at the 'large' size, as well as many images where mozjpeg produces highly objectionable artifacts even at the 'large' size and BPG does not.
Speaking for myself, I would prefer to use a higher quality setting than any of the ones demonstrated even with BPG for most of my personal purposes. For my typical use cases, the 'large' BPG versions of most of these images are at the edge of acceptable quality, and every one of the other compressed versions falls far short of acceptable.†
Many other people have use cases where precise image replication isn’t as important though, and at every size BPG seems like a dramatic step up over the competition.
One thing I hope gets worked out before this goes mainstream is color management / color profile support. In Safari on my Mac there are several images where the rendered BPG image is obviously not correctly applying the image’s color profile.
† Kakadu’s JPEG2000 encoder and WebP at that 'large' size also seem noticeably better than mozjpeg, but they still seem to wipe more high frequency detail and produce more artifacts – especially edge artifacts – than BPG. On some images packed with very high contrast fine detail (e.g. Vallée de Colca), WebP performance and BPG performance seems pretty similar and a bit better than Kakadu; in general compression is hard in these cases so the “large” size ends up being pretty large.
Also, saying "Large is the only acceptable quality level," means that you are only considering only a very narrow use-case
All the other image formats work fine.
Any idea why? Windows Chrome 41.0.2243.0 dev-m (64-bit)
Someone filed a bug today: https://code.google.com/p/chromium/issues/detail?id=442599
Fixed in Canary 5 days ago: https://code.google.com/p/chromium/issues/detail?id=439743
[0] http://xooyoozoo.github.io/yolo-octo-bugfixes/#production&bp...
BPG context: https://news.ycombinator.com/item?id=8704629
If you're reading, Bellard, hi!
I do think some people can only relate to the argument when you propose to replace Lena with a seductively pretty half-naked (gay?) man, though.
I don't see the problem with using either one and think the controversy is ridiculous.
The reflexive hate for anything "role-confirming" is sexist in denying legitimacy to any man/woman in that role.
Fine change it to a half-naked guy. I don't know why if he's gay it'd make a difference, but sure.
Well first of all it's very nice of her approving the use of image and Playboy too for not going after their rights. But I think it's far fetched to see her approval as a positive message. There are women out there contributing to the objectification of women too, for whatever reason they have. (One weird side of this is people think women are shielded from criticism of their own objectification, but it's a delicate matter to say the least. One has the right to objectify themselves so it's hard to say something without getting in the way of their right to self express.) There are more than one side to this issue; but it's not about her consent, it's about how it might be contributing to boys club image of tech.
It's easy to see that we have a problem of the lack of women in tech. I find this very depressing since they're able as much as men are and it looks wasteful to dismiss half the population. I think we're getting better each day, but it does not happen magically. People fight for it and will keep fighting until there's no discrimination based on sex. I accept that Lena image is one of the minor issues, but I still see this as one of the factors that drives women away. This boys club image of tech gives the implicit message that women are not wanted here.
I know there's no nudity in the image and one needs to research to find its origins in Playboy so it seems unlikely to come across it. But the real reason here is if we're willing to combat sexism, it will give women comfort that we're willing to change tradition to be more welcoming. I believe actions speak louder than words, and if the reason to keep the tradition is not all that important, we should do it.
(I also don't think it's fair to compare it to an image of a naked guy, since it's unlikely to drive boys away from tech. It's not just naked guy vs. naked girl, the context and the message makes a world of difference.)
Although there is a lot more going on in the original that justifies its use as a test image; varying levels of subtlety of detail (the two parts of the top of the hat, DoF, and especially the feathers or whatever you call it) as well as the human in it.
original being referenced: http://bellard.org/bpg/lena.html
--
Speaking of image formats, it might be nice to have a new format where the container is designed to only allow a minimum of features. Something like a file with only [MagicNum, xsize, ysize, xdpi, ydpi, gamma, <compressed pixels>, CRC32].
The idea is that it should NOT support "metadata" like comments or EXIF. As we've seen, there is a problem with getting most people to understand that they should probably strip EXIF/etc before uploading, and having a format where we could say "only upload .foo pictures" instead of "run $tool to strip EXIF". A browser plugin could even auto-convert every image while uploading.
Unfortunately, it would face the same problem as any new image format: nobody wants to use a new format until it is already popular.
wget http://xooyoozoo.github.io/yolo-octo-bugfixes/comparisonfiles/Original/Ricardo_Quaresma-L-,_Pablo_Zabaleta-R-Portugal_vs._Argentina,_9th_February_2011.png -O src.png
convert src.png -quality 100 -sampling-factor 1x1 full.jpg
jpegoptim -s full.jpg -S85 --stdout > s85.jpg
jpegoptim -s full.jpg -S50 --stdout > s50.jpg
jpegoptim -s full.jpg -S30 --stdout > s30.jpg
jpegoptim -s full.jpg -S18 --stdout > s18.jpg[16/12/2014 06:25:05] JavaScript - http://xooyoozoo.github.io/yolo-octo-bugfixes/ Inline script thread
Uncaught exception: TypeError: Cannot convert 'file' to object
Error thrown at line 5, column 4 in <anonymous function>() in http://xooyoozoo.github.io/yolo-octo-bugfixes/js/splitimage2...:
for (i = 0; i < file.length; i++)
called from line 1, column 0 in http://xooyoozoo.github.io/yolo-octo-bugfixes/js/splitimage2...: (function() {I think the results depend a little on the kind of input, but some of the pictures where rather convincing. WebP seems to do better than jpeg.
Considering that the page says it's based on a Daala comparison page, it would be interesting to stick a Daala snapshot in the mix for comparison using the same images (reencoding to PNG like it does for WebP, I'm not suggesting porting Daala to emscripten). A quick browse of the original page shows Daala sometimes beating x265, sometimes losing to it, but I guess both x265 and the Daala {encoder, codec} may have been improved in the last six months.
- http://www.digibis.com/digibib-demo/i18n/catalogo_imagenes/g...
- http://www.digibis.com/digibib-demo/cartografia/es/catalogo_...
I'm interested in seeing the result of using 4:4:4 with BPG. If you have the originals to compress, of course (meaning, the original is not chroma subsampled).
As far as intra-prediction goes, x265 should be better than the HM by at least a few percents MSE-wise and around 10% SSIM-wise[0].
[0] https://github.com/strukturag/libde265/wiki/Intra-Prediction...