Slashdot Mirror


Breakthrough In JPEG Compression

Kris_J writes "The makers of the (classic) compression package Stuffit have written a program that can compress JPGs by roughly 30%. This isn't the raw image to JPG compression, this is lossless compression applied to the JPG file. Typical compression rates for JPGs are 2% to -1%. If you read the whitepaper (PDF), they are even proposing a new image format; StuffIt Image Format (SIF). Now I just need someone to write a SIF compressor for my old Kodak DC260."

30 of 648 comments (clear)

  1. Fractal image format by nmg196 · · Score: 5, Interesting

    I would have thought that rather than 'zipping' an existing image format to create a new one just to save 30%, they'd be better off improving the original image compression algorithm or coming up with a new one.

    Quite a while ago (years!) I had a program which could compress images into a fractal image format. It was amazing - the files were much smaller than JPEGs but looked a lot better. The only drawback was that it took ages to compress the images. But with the extra CPU horsepower we have today I'm surprised fractal image compression hasn't become more prevailant. It would still probably be useless for digital cameras though as it would probably be impossible to implement the compression in hardware/firmware such that it could compress a 6+ megapixel image within the requisit 1-2 seconds.

    Does anyone know what happened to fractal image format files (.fif) and why they never took off?

    1. Re:Fractal image format by mcbevin · · Score: 5, Informative

      Maybe, but StuffIt is an archival program. If I have 10gb of existing jpgs and want to archive them, then this is whats wanted. Reencoding them as you suggest would be equivalent to converting say an mp3 to ogg format - a surefire way to lose quality with little gain.

      Re fractal compression, people have been hyping it up for years but as far as I know it never really delivered. I'm dubious about any claims to some mysterious program which compresses anything amazingly well without strong evidence.

      Wavelet compression however is used in jpeg2000 which is a bit better than jpeg but even that isn't supported by any digital cameras.

      If StuffIt really does compress jpegs 25-30% that is a massive leap forward over the previous state-of-the-art compressors which reached I think around 3-4% - http://www.maximumcompression.com/data/jpg.php . Heres hoping their claims pan out, and that they release at least some details regarding the methods they used.

    2. Re:Fractal image format by Goodbyte · · Score: 4, Informative

      For those mathematically interested fractal compression tries to find a matrix transform (A) so the serie x_n = A * x_{n - 1} converges where x is an image matrix and x_{\infty}=image to compress is a fixed point.

    3. Re:Fractal image format by ID10T5 · · Score: 5, Funny
      I'm not sure how practical 100% reduction is, but if anyone is interested I have an extremely fast algorithm for doing it.

      The results can be seen by the /. logo I have reduced here:

    4. Re:Fractal image format by happyhippy · · Score: 5, Insightful
      I did my final year project in Fractal Image Compression about 5 years ago.

      I concluded that it isnt practical for general use, it took too much time to compress an image (alright it was five years ago and so today it probably wouldnt matter), but most importantly there is no easy general compression solution for all images (for instance one that compresses tree pics well wont do faces well and vice versa).

      For a general dip into fractal image compression try to get and read 'Fractal Image Compression By Yuval Fisher'. Damn good read.

    5. Re:Fractal image format by plumby · · Score: 4, Funny

      100% compression of a file is easy. It's the decompression of that file into the original that's the tricky bit.

    6. Re:Fractal image format by dalyraptor · · Score: 4, Insightful

      30%(even close to) is a very good reduction in filesize, when considering this is lossless, you cannot turn your nose up at this. People with alot of jpegs will want to use it. Creating a better jpeg compression algorithm with 50% (100% is impossible) filezize reduction, seems impossible. I would make the assumption that since jpeg is over 18years old, compression algroithms are at their limit for this image format.

    7. Re:Fractal image format by mukund · · Score: 4, Insightful

      nmg196:

      Fractal image compression is generally useless for high-quality output. It's useful for low-bitrate applications. You can read about this in the Mark Nelson book.

      The main reason fractal image compression was not picked up is the same reason algorithms such as IDEA are not very popular --- software patents. IIRC The company which holds the patents for fractal image compression made it clear that it was ready to defend its IP back in the 90s.

      You can read about software patents too in the Mark Nelson book (the ones which apply to data compression).

      Even the IJG JPEG software (not the standard) which we use today so commonly avoids arithmetic coding and uses baseline huffman compression for compressing the quantized output.

      --
      Banu
    8. Re:Fractal image format by harrkev · · Score: 4, Informative

      It certainly seems possible, except for patent issues.

      The heart of JPG is the DCT transform, performed on an 8x8 block basis. This is not being changed, since they claim that the original JPG can be reconstructed bit-for-bit exact. Hence their algorithm must be "lossless." Othewise, if you apply lossy compression to lossy compression, you get even more loss.

      Here is the JPEG algorithm in a nutshell...
      1) Convert RGB into Brightness, Color, and Saturation (three separate monochrome images).
      2) Down-sample the Color and Saturation images. (This reduces the image size by 1/2; VERY lossy but you don't notice it)
      3) Break each image into 8x8 blocks.
      4) Perform a 2D DCT (discrete cosine transform) on each 8x8 block separately.
      5) Quantize the DCT data using the special JPEG quantizaion matrix (this is where most of the loss happens)
      6) Convert each 8x8 block of DCT data into a 64-number stream using the zig-zag scan (this just shuffles the order of the data, nothing more).
      7) Apply a specialiazed huffman code to compress the data (lossless compression).
      8) Write the header information, and dump encoded data to the file

      I could be waaaay off-base on this, but I suspect that they have found a better replacement for the zig-zag scan and huffman coding steps. Optimizing another step would still be lossy, and could not re-create the original JPEG byte-for-byte.

      But I must admit that I am completely baffled how they could take a huffman code optimized for JPEG and find something 30% better. Such a thing seems to be impossible, given what I know of coding theory (which, I admit, is a but rusty).

      --
      "-1 Troll" is the apparently the same as "-1 I disagree with you."
  2. What's the point? by CliffSpradlin · · Score: 5, Interesting

    The linked page shows average decompression times of 6-8 seconds for 600-800 KB files, rising with the size of the file. Who would benefit from this? It's obviously too slow to speed up web pages, and would be far too CPU intensive for consumer cameras. Professional photographers would have no use for this since they would use RAW images.

    I mean, it's cool and all to be able to compress JPGs by that much more, but the size gains are negated by the time it takes to decompress them. This seems just like those super high compression algorithms that have rather amazing compression rates, but take -forever- to compress or decompress, making them unusable. The difference is those are obviously and labeled as simply for scientific research into compression, but Aladdin seems to be trying to market this product for public consumption. The listed uses ( http://www.stuffit.com/imagecompression/ ) seem trivial at best.

    Who's gonna be buying this?

    -Cliff Spradlin

    1. Re:What's the point? by Zhe+Mappel · · Score: 4, Funny
      The listed uses ( http://www.stuffit.com/imagecompression/ ) seem trivial at best.

      You're right. I read the list, reproduced below. Who'd want to:

      * Send more photos via email
      * Fit more on CDs, DVDs, and other backup media
      * Save time when sending pictures over the internet or across the network
      * Reduce bandwidth costs

      After all, electronic storage media is infinite, and bandwidth is free!
  3. Roughly 25%, but who's counting? by Dancin_Santa · · Score: 4

    I just installed an 800Gb hard disk in my system. I have a gigabyte worth of webmail space (more than that, if you consider that I can send myself gmail invitations). Storage is, as they say in the vernacular, very inexpensive.

    Even in cameras where storage is tight, the bounds of memory is expanding all the time. Whereas a couple years ago the average storage card size was a measly 64Mb, today we are talking about gigabytes of storage memory inside our *cameras*!

    So let's say we can squeeze another 30% of pictures onto a card. Does that really help us? Not really, if you consider that the compression itself rides atop JPEG compression and that computing time needs to be accounted for.

    Currently, the fastest continuous shooting digital camera (the Nikon D2X) can only take 4 shots in a row before its memory buffers get full and the whole camera becomes useless. Compare that with the 9 shots per second F5 and you can see that the speed of shooting isn't going to cut it for digital cameras.

    We need a compression method that is lossless, not one that creates compact files. Space is cheap, CPU cycles aren't.

    1. Re:Roughly 25%, but who's counting? by NMerriam · · Score: 4, Informative

      Currently, the fastest continuous shooting digital camera (the Nikon D2X) can only take 4 shots in a row before its memory buffers get full and the whole camera becomes useless

      I beg your pardon? Just about every digital SLR on the market is able to handle more than 4 images in buffer at a time. My year and a half old 10D can buffer 9 RAW images, and the D70 processes JPEGs before they hit the buffer, so it can buffer JPEGs in the dozens.

      I doubt this is intended for any use other than archiving of images, where it will kick ass. It's clearly processor-intensive from the timing results, but for long-term storage that makes little difference.

      I've got a few TB of images in storage and I'd love to be able to save 20-30% of that space, regardless of how cheap it is. That means a little longer between burning DVDs, and having more stuff on mounted drives for reference.

      --
      Recursive: Adj. See Recursive.
    2. Re:Roughly 25%, but who's counting? by Motherfucking+Shit · · Score: 4, Funny
      Dancin_Santa says:
      I just installed an 800Gb hard disk in my system.
      I always wondered how much space it took to keep track of who's been naughty and who's been nice...
      --
      "BSD: Free as in speech. Linux: Free as in beer. Windows 10: Free as in herpes." --Man On Pink Corner in #52607549.
  4. Questions by RAMMS+EIN · · Score: 4, Interesting

    The linked page did not answer some of my questions:

    1. Does this only work for JPEG, or also for other (compressed or plain) files?

    2a. If it only works for JPEG, why?

    2b. If it works for others, how well?

    Anybody who can answer these?

    --
    Please correct me if I got my facts wrong.
    1. Re:Questions by ottffssent · · Score: 4, Interesting

      The whitepaper suggests they're tearing out the run-length encoding that's the final step in jpeg and replacing it with something more space-efficient.

      In a nutshell, JPEG works like:

      Original image data -> frequency domain -> high frequencies truncated (via division matrix) -> RLE

      RLE is fast, but not terribly compact. Replacing it with something better improves compression. However, RLE generates not-very-compressable output, which is why traditional compression software does poorly. I imagine if you took a jpeg, undid the RLE, and zip compressed the result, you'd get something close to what the stuffit folk are claiming. If someone wants to try that, I'd be interested in the results.

    2. Re:Questions by azuretongue · · Score: 5, Informative

      JPEG does not use Run-length encoding as its last compression step. Quote from the faq:"The JPEG spec defines two different "back end" modules for the final output of compressed data: either Huffman coding or arithmetic coding is allowed." http://www.faqs.org/faqs/jpeg-faq/part1/section-18 .html It goes on to say that arithmetic coding is ~10% smaller, but is patented, so don't use it. So what they are doing is removing the known chubby huffman coding and replacing it.

  5. Didn't we just get rid of patented image files? by putaro · · Score: 4, Insightful

    If you read the whitepaper you will see that their algorithm is patent pending. The patent will almost certainly be granted, and, since no one else has done additional jpg compression before, it may even be deserved.

    However, do we want to subject ourselves to a new tax on images? If they make it, we don't have to go! Just say NO to patented file formats!

  6. Wow, that IS a breakthrough! by wcitechnologies · · Score: 5, Interesting

    I have a friend who's father is a professional photographer. He has gigabytes and gigabytes of images stored for his customers, should they want to order re-prints. They're thinking about setting up raid terabyte file server. I can certainyl say that this is good news for them!

    --
    Electrons are free; it is moving them that becomes expensive.
  7. Re:Only lossyless by lougarou · · Score: 4, Interesting

    JPEG is (roughly) a discrete cosine transform, followed by a filter on high frequencies, followed by Huffmann encoding (which is lossless). This is probably the Huffmann encoding that they did remove and replace with one of the more efficient compression algorithms, and something that could indeed be much more efficient than simple huffmann encoding. So they still take advantage of all the strengths of JPEG related to the human perception model, but they still gain in compression. Huffmann is great to compress oft-appearing sequences, and is a great general-purpose lossless encoding, but there are other that do a better job of it.

    In other words, you did not understand what they did.

  8. Bandwidth is the point by The+Rizz · · Score: 4, Insightful

    The linked page shows average decompression times of 6-8 seconds for 600-800 KB files, rising with the size of the file. Who would benefit from this?

    Any websites with the primary purpose of hosting images would benefit greatly from this - such as art & photography sites. (Yes, and porn sites, too.)

    Why? Because 99% of the traffic they generate is for their images. Of those images, 99% of them are in JPEG format. So this compression would give a good savings in bandwidth on all those pictures.

    At large sites, a 30% cut in required bandwidth could mean a very large savings. Now, if they can take a large cut off their operating expenses, and all they need to do that is to make the users wait a few extra seconds for their pictures, I think we know what they'll do.

    As for the decompression time, one thing to remember is that with how slow internet connections are (even broadband), you're much more likely to be waiting for one of these images to transfer than you are to be waiting for it to decompress (so long as it allows you to start the decompression without waiting for the end of the file, of course).

    --The Rizz

    "Man will never be free until the last king is strangled with the entrails of the last priest." -Denis Diderot

  9. Patents? by arvindn · · Score: 4, Insightful

    If they've really achieved 25-30% over jpg, and it looks like they have, then its a truly amazing invention considering that jpeg has been around for so long. It would save at least about ten dollars worth of space on every digital camera. If you look at the humongous image archives that NASA and other research projects generate and the cost of tape to store them all, we're talking tens of billions of dollars of savings here.

    So, a question to slashdotters: do you think this kind of invention deserves to be protected by a patent? The standard response "software is already protected by copyright, patents are unnecessary" doesn't work, because anyone can study the code (even the binary will do), describe the algorithm to someone else, who can then reimplement it. Standard cleanroom process; takes only a couple of days for a competent team.

    If you're RMS, you probably believe that no one has the right to own anything and all inventions and ideas belong to the public, but the majority of us will agree that that's a tad extreme. So whaddya'll think? Myself, I'm totally undecided.

    1. Re:Patents? by bit01 · · Score: 4, Informative

      If you're RMS, you probably believe that no one has the right to own anything and all inventions and ideas belong to the public,

      Nonsense, RMS has never said that. Please read a more widely before making such malicious accusations again. Don't buy into M$ marketing smear and FUD campaign.

      ---

      It's wrong that an intellectual property creator should not be rewarded for their work.
      It's equally wrong that an IP creator should be rewarded too many times for the one piece of work, for exactly the same reasons.
      Reform IP law and stop the M$/RIAA abuse.

  10. Re:Only lossyless by mcbevin · · Score: 4, Insightful

    This is not in competition with JPEG - more with LZW compressed TIFF.

    You're misreading the whitepaper. What they're explaining here is different and actually quite clever.

    Jpeg compression can be seen as consisting of two main steps. In the first, information in the image deemed unimportant is removed from the image. In the second, the remaining information is compressed losslessly.

    It was already known that the second step is not the most efficient possible. Also, the jpeg standard supports both huffman and arithmetic-coding, however due to patent reasons I think arithmetic-coding (which is more efficient) is often not used. So what they're doing is just improving the efficiency of this second step. This works much better than attempting to encode the jpg binary itself, as anything performed following entropy coding will struggle to achieve much compression, as the data has been hugely complicated by the process and it is thus much harder to find any compressible patterns etc.

    They've also improved the compression by a very impressive margin. Typically in the lossless compression world, gains are in the .x% range, yet they've apparently improved by a factor of around 6x what the previous best programs were able to achieve. I should note that I developed the audio codec with the currently highest lossless audio compression - http://lossless-audio.com/ - so have some idea of what I'm talking about here.

    Anyway, the end effect is the same regardless how the compression is achieved - they're taking a lossily-compressed jpg, and reducing its size. This obviously makes little sense to be say integrated into digital cameras, for which the jpeg2000 format is available anyway and features better gains and is much faster (yet is still awaiting mainstream adoption), however from the archival and theoretical-lossless-compression perspectives what they've allegedly achieved is pretty damn interesting.

  11. Possibly just a rehuff? by tangent3 · · Score: 4, Interesting

    The quantised DCT coefficients of a JPEG image are compressed using a JPEG standard huffman table. From what I've seen, this table is far from optimized even for "the average of the majority" of images out there.

    Ogg Vorbis stores its own huffman table in its own stream. The default encoder uses a table optimized for the general audio you can find out there. There is a utility called "rehuff" (goggle it yourself please) that will calculate and build a huffman table optimized for a particular stream and it seems that on average it reduces an Ogg Vorbis filesize by about 5-10%.

    Building an optimized huffman table for individual JPEGs will probably yield such improved compression rates too. If the original JPEG tables are less optimized than the Ogg Vorbis ones, the reduction will be even higher. But 30% seems a little... optimistic.

  12. And when will we learn about the patent? by gotan · · Score: 4, Insightful

    To be honest i don't care about the 30% compression if there's the slightest danger that anyone might start a patent-war over the image-format or the compression algorithm.

    I've really seen enough of that (gif, mp3, jpeg) and i prefer spending the additional storage/bandwith capacity to another uppity "IP-shop" coming out to "0wn0rz" the internet with lawyering (maybe after a management-change).

    Let's have another look at that compression algorithm in 20 years or so.

    --
    "By the way if anyone here is in advertising or marketing... kill yourself." -- Bill Hicks
  13. Patents. by xtal · · Score: 4, Interesting

    I worked in this field for awhile, and the liscencing and other issues sent the company I was with running in the other direction. JPEG was good enough, everyone was using it, so JPEG it was.

    Fractal compression is cool.. but encumbered by IP issues. Too bad.

    --
    ..don't panic
  14. Benefits far outweighed by costs. by jbn-o · · Score: 4, Insightful

    Given that the software is likely to be proprietary and the algorithm will be patented, it becomes completely useless to me and it is completely unsuitable for archiving anything (smart people don't play nickel and dime games with archives and backups).

    Maybe if computers were a lot faster and the compression worked on any array of pixels, not just those that have undergone the lossy transformation of JPEG compression. But even then, it would have to do better than what PNG can do in terms of all the other things PNG does and no patented format will beat PNG at its game.

    In theory what you say sounds nice, but in practice I genuinely can't recall a situation where a little more compression would have allowed me to send all the photos I wanted to via e-mail. But the reasons I mentioned at the top of this post are more important reasons why this should be rejected out of hand.

    What meager benefits this affords are far outweighed by the costs. I don't see this going anywhere, and for very good reason.

  15. Here's why it works by Richard+Kirk · · Score: 4, Informative
    These are the old JPEG images. I worked on DCT compression systems before JPEG, and had a tiny contribution to the freeware DCT code. When I saw the posting I immediatly suspected that the JPEG compression had been pushed up too high.

    The original JPEG compression algorithm had Huffmann coding for the DCT variables, but it also had some fixed-length codes for the beginning and end of blocks. If you set your compression at about 10x then you can hardly see the difference with real images. bring it up to 15x and the changes are still modest. However, yank it much over about 22x, and the image will go to hell. The reason is the block handling codes meant that a JPEG image with no data at all - a flat tint - would only compress at about 64x, so at 22x compression these block handling codes are about 1/3 of your overall code. The fractional bit wastage you get with using Huffmannn coding instead of arithmetic coding mops up some of the rest as you are usig shorter Huffmann codes. The codes are also very regular, as about 1/3 of the code is not particularly random. The 1/3 figure also matches the 30% compression figures too, which isn't surprising.

    Why didn't the original JPEG developers make a better job of this? Well, doing an experimental DCT compression used to take me hours or days when I was developing on a shared PDP-11, and there was always the worry that a dropped bit would lose your place in the code, and scramble the rest of the image. A little regular overhead was also useful for things like progressive JPEG control. I guess we all knew it was not as tight as things could have been, but it got the job done. We knew if you want to get 40x compression, then reducing your image to half size, and the compressing that by x10 will look better. Unfortunately, people who just drag a slider to get more compression don't always know that.

    The right solution would be to use JPEG2000 which has a much smaller block overhead, and so fails much more gracefully at higher compressions.