1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! JPEG marker byte constants (ITU T.81 Annex B).
//!
//! Each marker is a two-byte sequence `0xFF, 0x??`. Only the second byte
//! is declared here. The first byte is always `0xFF`; a run of `0xFF`
//! bytes before the payload byte is legal as fill.
/// Start of Image.
pub const SOI: u8 = 0xD8;
/// End of Image.
pub const EOI: u8 = 0xD9;
/// Start of Scan.
pub const SOS: u8 = 0xDA;
/// Define Quantization Table(s).
pub const DQT: u8 = 0xDB;
/// Define Huffman Table(s).
pub const DHT: u8 = 0xC4;
/// Define Arithmetic Coding conditioning table(s) — used by SOF9..SOF15
/// arithmetic JPEGs to override the default `(L=0, U=1, Kx=5)` parameters.
pub const DAC: u8 = 0xCC;
/// Define Restart Interval.
pub const DRI: u8 = 0xDD;
/// Define Number of Lines (T.81 §B.2.5). Carries the frame's `NL`
/// (number of lines) when the SOF `Y` field was coded as 0; the segment
/// appears immediately after the first scan's entropy-coded data and is
/// mandatory in that case.
pub const DNL: u8 = 0xDC;
/// COMment segment.
pub const COM: u8 = 0xFE;
/// Baseline DCT sequential.
pub const SOF0: u8 = 0xC0;
/// Extended sequential DCT (same scan structure as SOF0 for 8-bit).
pub const SOF1: u8 = 0xC1;
/// Progressive DCT.
pub const SOF2: u8 = 0xC2;
/// Lossless sequential, Huffman-coded (T.81 Annex H — predictor-based, no DCT).
pub const SOF3: u8 = 0xC3;
/// Extended sequential DCT, arithmetic-coded (T.81 §F.1.4).
pub const SOF9: u8 = 0xC9;
/// Progressive DCT, arithmetic-coded (T.81 §G.1.3 — the SOF2 scan
/// structure entropy-coded by the Annex D Q-coder).
pub const SOF10: u8 = 0xCA;
/// Lossless sequential, arithmetic-coded (T.81 §H.1.2.3 two-dimensional
/// statistical model over the Annex D Q-coder).
pub const SOF11: u8 = 0xCB;
/// Application-specific markers APP0..APP15 (0xE0..0xEF).
pub const APP0: u8 = 0xE0;
/// APP2 — conventionally carries the embedded ICC colour profile.
/// Payload begins with the 12-byte ASCII identifier `"ICC_PROFILE\0"`
/// followed by a one-byte chunk-sequence number, a one-byte total-chunk
/// count, and then the next slice of the ICC profile bytes (T.872 / Annex
/// L of T.871 — see docs/image/jpeg/jpeg-fixtures-and-traces.md §3.11).
pub const APP2: u8 = 0xE2;
/// APP14 — conventionally carries the Adobe colour-transform tag.
pub const APP14: u8 = 0xEE;
pub const APP15: u8 = 0xEF;
/// Restart markers RST0..RST7 (0xD0..0xD7).
pub const RST0: u8 = 0xD0;
pub const RST7: u8 = 0xD7;
/// Returns true if `b` is an `APPn` marker byte.
/// Returns true if `b` is a restart (RSTn) marker byte.
/// Returns true if `b` is any SOFn (Start Of Frame) marker.
/// Excludes DHT (0xC4) and JPG (0xC8).