tinyjpeg_src_ver100
所属分类:图形图象
开发工具:C/C++
文件大小:163KB
下载次数:11
上传日期:2009-12-03 12:01:30
上 传 者:
vitah86
说明: Tiny JPEG decoder ! !
文件列表:
JpegEncoder (0, 2006-07-29)
JpegEncoder\Debug (0, 2006-07-29)
JpegEncoder\JpegEncoder (0, 2006-08-23)
JpegEncoder\JpegEncoder\JpegEncoder.dsp (5308, 2006-08-27)
JpegEncoder\JpegEncoder\JpegEncoder.plg (2913, 2006-08-30)
JpegEncoder\JpegEncoder.dsp (5330, 2006-12-27)
JpegEncoder\JpegEncoder.plg (4318, 2006-12-27)
JpegEncoder\Release (0, 2006-07-30)
歜erLame_src (0, 2006-08-28)
歜erLame_src\DCT.cpp (22971, 2006-12-27)
歜erLame_src\DCT.h (8168, 2006-12-27)
歜erLame_src\Huffman.h (28102, 2006-12-27)
歜erLame_src\Jpeg.cpp (92197, 2006-10-12)
歜erLame_src\Jpeg.h (12681, 2006-12-27)
歜erLame_src\JpegEnc.cpp (96040, 2006-12-27)
歜erLame_src\JpegEnc.h (15130, 2006-12-27)
歜erLame_src\Tga.cpp (15411, 2006-07-31)
歜erLame_src\Tga.h (1020, 2006-07-31)
歜erLame_src\Timer.cpp (2404, 2006-08-23)
歜erLame_src\Timer.h (977, 2006-08-23)
EncMain.cpp (10571, 2006-12-27)
JpegDecoder.dsp (5257, 2006-12-27)
JpegDecoder.plg (3608, 2006-12-27)
Main.cpp (8655, 2006-12-27)
Makefile (1492, 2006-12-27)
TinyJpeg.dsw (758, 2006-08-23)
TinyJpeg.ncb (320512, 2006-12-27)
TinyJpeg.opt (60928, 2006-12-27)
TinyJpeg distribution v1.0
Motivation
* wanted fast & tiny minimal jpeg decoder (baseline gray / RGB) for tiny programs like games / intros
* wanted to see how jpeg lossless compression performs (in the end it's not so much worse than png
on photographs, it can be even better if you reduce sample precission a bit. it doesn't do very well
with line drawing, etc. (jpeg was meant for continous tone images) which is fixed by additional
(non std! - i'm not keen on broadening wild formats, but i found no program to support lossless mode
jpegs so i favor better compression ratio) RLE compression)
* wanted jpeg encoder that would handle more formats and lossless compression (not meant to be part of
product distribution, rather part of tools used to create distribution datafiles)
Why use it?
* it's written in C++
* it's tiny (decoder is slightly over 4kB, encoder is under 7kB; for comparison - jpeglib is about 30kB)
* code is quite clean (if you don't look at frequent #ifdef's) and short (2x ~2000 lines with comments),
there is option to print verbose information on encoding / decoding process (educational purposes or
jpeg files analysis)
* it's cross-platform - it can be compiled under MSVC/windows and g++/linux (and certainly under more
OSes and compillers; contains msvc project and a simple makefile for encoder and decoder demo app)
* decoder is considerably fast and can decode grayscale, RG, RGB, YCCK and CMYK images in lossy mode
(it can decode any number of channels, but i wrote converting functions for just those four ones)
(in lossless mode any colorspace conversion is useless, it can simply decode up to four-channel images)
* encoder can encode in grayscale, RG, RGB and CMYK / YCCK modes (source is always RGB, but it can be
easily changed)
* encoder uses adaptive huffman coding as default (which means smaller resulting images)
* support for lossless jpegs and non-standard extended lossles jpegs (something jpeglib doesn't have)
* preparing support for runtime sample-width selection (8 / 12 for lossy, 8 - 12 for lossless; jpeglib
neither has this feature)
* it's not widely used and it's not gdi++ which means there's very low propability of viri attack via
data execution
* it comes with nice TGA reader class and multi-platform timer class (not to mention nice & fast
1D and 2D DCT classes)
* it's completely for free (completely means free of any warranty of usability, harmlessness
or purpose accomplishment)
Why don't use it?
* it's written by me
* encoder is a bit slow
* doesn't handle progressive images (and i don't plan to support them, this lib is supposed to stay tiny,
not to mention i don't need progressive images for my purposes at all)
* it doesn't have as rich interface as jpeglib (hey, it's tiny!)
* it's not tiny at all (right, it's small, but it could have been even smaller if i didn't use templates,
operator overloading and inheritance ... if i sticked to C-like C++, i could sure have saved a few kB)
Todo
* better image data structure, something like:
struct TImage {
int n_width, n_height;
int n_sample_bit_num; // 2 - 12 for jpeg
int n_pixel_align; // 1, 2, 4 or 8 - number of bytes to contain a single pixel. aligned towards LSB
enum {
color_R, // single-component lossless
color_Gray, // single-component lossy
color_RG,
color_RGB,
color_RGBA,
color_CMYK // possible to select in decoder to either keep CMYK if present or convert to RGB
} n_format;
unsigned char *p_buffer;
};
with such a format, it's possible to call OpenGL TexImage* or DrawPixels without wasting memory by
expanding data with small bpp to 8 bpp and without loss of precission by clipping data with large
bpp to 8 bpp.
there will be function to explicitly select desired data format and color conversion in decoder,
in encoder it will be possible to select target colorspace and sample precission
* maybe a few MMX optimizations
-tHE SWINe-
PS - if anyone knew about any software that can create and view lossless jpeg images, let me know
- if anyone found a bug or suggestion for improvement, any feedback is welcome
mail: luki.sach@atlas.cz
icq: 200339454
近期下载者:
相关文件:
收藏者: