JPEG file in VC Data Structure

Source: Internet
Author: User

I 'd better take a look at my blog <Simple Analysis of JPEG file formats> Article

JPEG files are divided into two parts: tag and compressed data.

The code stream formats are: soi, app0info, dqtinfo, driinfo, sofinfo, dhtinfo, sosinfo, and EOI. The specific structure is as follows:

# Define byte unsigned char
# Define word unsigned short int

# Define SOI 0xffd8 // start of Image
# Define EOI 0xffd9 // end of Image

Static struct app0info {
Word marker; // 0xffe0
Word Length; // 16 for usual JPEG
Byte j1_signature [5]; // = "jfif", '/0' = 0x4a, 0x49,0x00
Word version; // 0x0101,0x0102
Byte xyunits; // 0 for default
Word xdensity;
Word ydensity;
Byte num_of_x;
Byte num_of_y;
// Rgb0 --- rgbn ??
} App0info;

Static struct dqtinfo {// define quantization table
Word marker; // 0 xffdb
Word Length; // 132 for usual case
Byte qtyinfo; // PQ () =: 8bit or 16bit precision; TQ () =,: ID of QT table
Byte ytable [64]; // may be word size according to PQ, zigzag arrange
Byte qtcbcrinfo;
Byte cbcrtable [64];
} Dqtinfo;

Static struct driinfo {// define start Interval
Word marker; // 0 xffdd
Word length;
Word Ri;
} Driinfo;

Static struct sofinfo {// start of Frame
Word marker; // 0xffc0
Word Length; // = 17 for a true color YCbCr
Byte precision; // For basemode: 0x08, 8bit/sample
Word height;
Word width;
Byte num_of_component; // 0x01 for Grayscale, 0x03 for ycrcb
Byte idy;
Byte y_sfactor;
Byte qty;
Byte idcb;
Byte cb_sfactor;
Byte qtcb;
Byte idcr;
Byte cr_sfactor;
Byte qctl;
} Sofinfo;

Static struct dhtinfo {// define Huffman table
Word marker; // 0xffc4
Word Length; // = 0x01a2
Byte ht_ydc_info; // Tc (): 0 for DC and 1 for AC, th (): For base mode, it can be
Byte ydc_index [16];
Byte ydc_values [12];
Byte ht_yac_info; // 0x10
Byte yac_index [16];
Byte yac_value [162];
Byte ht_cbcrdc_info;
Byte cbcrdc_index [16];
Byte cbcrdc_value [12];
Byte ht_cbcrac_info; // 0x11
Byte cbcrac_index [16];
Byte cbcrac_values [162];
} Dhtinfo;

Static struct sosinfo {
Word marker; // 0 xffda
Word Length; // = 12
Byte num_scan_component; // for base Mode 1, 3
Byte idy;
Byte hty;
Byte idcb;
Byte htcb;
Byte idcr;
Byte hTCR;
Byte SS, Se, BF; // 0x00, 0x3f, 0x00
} Sosinfo;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.