Data formats in jpeglib

转载 2007年09月20日 12:41:00
Data formats

Before diving into procedural details, it is helpful to understand the
image data format that the JPEG library expects or returns.

The standard input image format is a rectangular array of pixels, with each
pixel having the same number of "component" or "sample" values (color
channels). You must specify how many components there are and the colorspace
interpretation of the components. Most applications will use RGB data
(three components per pixel) or grayscale data (one component per pixel).
A remarkable number of people manage to miss this, only to find that their
programs don't work with grayscale JPEG files.

There is no provision for colormapped input. JPEG files are always full-color
or full grayscale (or sometimes another colorspace such as CMYK). You can
feed in a colormapped image by expanding it to full-color format. However
JPEG often doesn't work very well with source data that has been colormapped,
because of dithering noise. This is discussed in more detail in the JPEG FAQ
and the other references mentioned in the README file.

Pixels are stored by scanlines, with each scanline running from left to
right. The component values for each pixel are adjacent in the row; for
example, R,G,B,R,G,B,R,G,B,... for 24-bit RGB color. Each scanline is an
array of data type JSAMPLE --- which is typically "unsigned char", unless
you've changed jmorecfg.h. (You can also change the RGB pixel layout, say
to B,G,R order, by modifying jmorecfg.h. But see the restrictions listed in
that file before doing so.)

A 2-D array of pixels is formed by making a list of pointers to the starts of
scanlines; so the scanlines need not be physically adjacent in memory. Even
if you process just one scanline at a time, you must make a one-element
pointer array to conform to this structure. Pointers to JSAMPLE rows are of
type JSAMPROW, and the pointer to the pointer array is of type JSAMPARRAY.

The library accepts or supplies one or more complete scanlines per call.
It is not possible to process part of a row at a time. Scanlines are always
processed top-to-bottom. You can process an entire image in one call if you
have it all in memory, but usually it's simplest to process one scanline at
a time.

For best results, source data values should have the precision specified by
BITS_IN_JSAMPLE (normally 8 bits). For instance, if you choose to compress
data that's only 6 bits/channel, you should left-justify each value in a
byte before passing it to the compressor. If you need to compress data
that has more than 8 bits/channel, compile with BITS_IN_JSAMPLE = 12.
(See "Library compile-time options", later.)

The data format returned by the decompressor is the same in all details,
except that colormapped output is supported. (Again, a JPEG file is never
colormapped. But you can ask the decompressor to perform on-the-fly color
quantization to deliver colormapped output.) If you request colormapped
output then the returned data array contains a single JSAMPLE per pixel;
its value is an index into a color map. The color map is represented as
a 2-D JSAMPARRAY in which each row holds the values of one color component,
that is, colormap[i][j] is the value of the i'th color component for pixel
value (map index) j. Note that since the colormap indexes are stored in
JSAMPLEs, the maximum number of colors is limited by the size of JSAMPLE
(ie, at most 256 colors for an 8-bit JPEG library).

Apache POI Data Formats

Apache POI 的dataFormat 顾名思义就是支持数据个格式化.
  • hehexiaoyou
  • hehexiaoyou
  • 2014年07月16日 10:30
  • 978

Introducing Payload Data Formats

This section covers three alternative, standardized formats for sending and receiving structured dat...
  • chuanyituoku
  • chuanyituoku
  • 2014年02月19日 17:26
  • 419

Understanding YUV data formats

SUMMARY: This article explains the basics of YUV image data structure and transmission. ...
  • caibaihui
  • caibaihui
  • 2013年04月20日 17:23
  • 913


介绍HCI提供了统一的访问蓝牙能力的方法。HCI Link命令提供Host具有控制其他蓝牙设备链路层链接的能力。这些命令通常涉及Link Manager(LM)层来与远程蓝牙设备交换LMP命令。HCI...
  • lihenair
  • lihenair
  • 2010年01月13日 10:42
  • 631

MRPT data formats and serialization

MRPT data file formats: .gridmap (or  compressed  version  .gridmap.gz).   A  2D  occupancygrid ma...
  • feiskyer
  • feiskyer
  • 2012年09月29日 09:53
  • 516

Comparing Formats(Comparing with other data formats)学习笔记

v/:* {behavior:url(#default#VML);}o/:* {behavior:url(#default#VML);}w/:* {behavior:url(#default#VML)...
  • taurenshaman
  • taurenshaman
  • 2008年10月06日 15:48
  • 331

Jpeglib使用指南, 各种压缩包的压缩和解压方法, 开源社区分裂史

Jpeglib使用指南 各种压缩包的压缩和解压方法 开源社区分裂史
  • antkillerfarm
  • antkillerfarm
  • 2016年05月24日 10:40
  • 1195

data formats相关

今天,自己用as3写了一些tga解码程序,直接解成:as3 BitmapData对象; 多谢下面的一些参考信息: 1、强大的:paulbourke(保罗)的网站: http://paul...
  • linjf520
  • linjf520
  • 2012年11月22日 20:15
  • 346

2D Data Matrix Barcode Formats

2D Data Matrix Barcode Formats IDAutomation 2D Data Matrix ECC 200 barcode products support all for...
  • liuruxin
  • liuruxin
  • 2013年11月29日 15:47
  • 673


最近给实验室做一个项目,中间用到了对jpeg图片的处理,因为使用嵌入式开发板(beaglebone black),所以需要给交叉编译环境安装jpeglib。     环境介绍:     开发板:bea...
  • buynow123
  • buynow123
  • 2015年02月03日 17:02
  • 1510
您举报文章:Data formats in jpeglib