Best image compression algorithms

Started by
6 comments, last by Hacksaw2201 16 years, 2 months ago
Hi, I am looking for an efficient way to compress images on disk/memory. Ideally, i am looking for a compression: - which has a fairly good ratio especially with two 16bits channels format, - which can be "streamed" (meaning I can decompress regions and not the full image at once) - and which can be used in realtime (meaning I don't want decompression to require a loading screen since I expect to decompress chunks per x frames). I have looked around and the PNG compression doesn't seem to pack things tighly enough in memory, I also read some things about a JPG2000 library but it seems to only support 16bits grayscale images and not 2 channels of 16 bits. Does anyone have a clue about my other options? Or any recommendations? Thanks in advance. -damsku [Edited by - damsku on February 22, 2008 2:39:17 AM]
Advertisement
Lossy or lossless?
When you say 2 16bit channels, are they 16bit RGB? If so, which bit arrangement? (As there's no standard 16bit format.)
And, can it be a proprietary format, or are you interested in making your own?
Thank you for your answer.
I don't have a requirement about whether it is a lossy or lossless compression.
I think I won't really know if I need a lossless compression before I see the result using a lossy one in the measure it has a much better compression ratio.
And 2 channels of 16bits, I mean if I were to store a R16G16 texture format to disk. I currently use 16bits GrayAlpha PNG to store those.
And it can be a prioprietary format, if you mean by proprietary an existing one, unless it is a commercial one, then I guess I'll have to see about that.
PNG seems to be a good choice for your kind of application, but you can also take a look at PGF instead of JPEG2000: http://www.libpgf.org/

Generally its very hard to recommend any compression unless we know more about images you are going to store and what is acceptable loss of quality.

What are you really trying to do?

Quote:- which has a fairly good ratio especially with two 16bits channels format,


There is no fairly. You mention real-time, what is your target bitrate?

Quote:- which can be "streamed" (meaning I can decompress regions and not the full image at once)


Anything can be streamed. Streaming Bitmaps allows you to display scanlines as you receive them.

Quote:- and which can be used in realtime (meaning I don't want decompression to require a loading screen since I expect to decompress chunks per x frames).


What target architecture? On 8086, such compressors will be vastly different. On modern computers, one can play 264 codec at full resolution with some 30-90% CPU load.

Quote:I have looked around and the PNG compression doesn't seem to pack things tighly enough in memory


This doesn't make much sense. In memory, you need raw data if you want to display them.


If this is for movies, the only way to achieve what you want will require lossy temporal compression.

Why 2 channel 16 bits? What are the images? Why not just use 32bpp RGBA stream and using one of codecs designed specifically for video streaming?

What are the image dimensions? Why do you need 16 bits per channel, you cannot display that.

In general, when choosing things like this, define the following:
- Target fidelity - what are allowed target parameters (resolution, bandwidth, depth). 16-bits likely cannot be displayed, so sending such channels is redundant. Or, you're using some specialized hardware.

- We're talking about streaming. What is your bits-per-pixel requirement? What is your bandwidth? JPG achieves arbitrarily low bpp, somewhere at 0.1 bits-per-pixel. How much network do you have at disposal? Gigabit LAN? Stream raw frames. Modem connection? You're stuck with very lossy algorithm and very low resolution.

- Why do you need to decompress regions? For interactive display? Why can't you display image at a time? If this is streaming, then you'll be receiving 5+ images per second - no need to display results partially.

- Hardware requirements. What is your target architecture? Target OS?

There is approximately thousands of video and image codecs out there. Name your usage requirements, and one will be suitable.
Quote:JPG2000 library but it seems to only support 16bits grayscale images
I assure you, JPEG2000 can handle full colour images.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
You might want to take a look at Microsoft's HD Photo / WM Photo: http://www.microsoft.com/windows/windowsmedia/forpros/wmphoto/default.aspx. It should meet the requirements you list, though whether decompression is fast enough for your specific requirements is hard to say, it has competitive performance with other image codecs.

Game Programming Blog: www.mattnewport.com/blog

TGA Targa Truevision format.

This topic is closed to new replies.

Advertisement