-
Notifications
You must be signed in to change notification settings - Fork 7
/
scan script doc.txt
62 lines (52 loc) · 2.28 KB
/
scan script doc.txt
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
Each scan definition contains one to four component indexes, optionally
followed by a colon (':') and the four progressive-JPEG parameters. The
component indexes denote which color component(s) are to be transmitted in
the scan. Components are numbered in the order in which they appear in the
JPEG SOF marker, with the first component being numbered 0. (Note that these
indexes are not the "component ID" codes assigned to the components, just
positional indexes.)
The progression parameters for each scan are (after the colon):
Ss Zigzag index of first coefficient included in scan
Se Zigzag index of last coefficient included in scan
Ah Zero for first scan of a coefficient, else Al of prior scan
Al Successive approximation low bit position for scan
Default 10-scan progressive:
# Initial DC scan for Y,Cb,Cr (lowest bit not sent)
0,1,2: 0-0, 0, 1 ;
# First AC scan: send first 5 Y AC coefficients, minus 2 lowest bits:
0: 1-5, 0, 2 ;
# Send all Cr,Cb AC coefficients, minus lowest bit:
# (chroma data is usually too small to be worth subdividing further;
# but note we send Cr first since eye is least sensitive to Cb)
2: 1-63, 0, 1 ;
1: 1-63, 0, 1 ;
# Send remaining Y AC coefficients, minus 2 lowest bits:
0: 6-63, 0, 2 ;
# Send next-to-lowest bit of all Y AC coefficients:
0: 1-63, 2, 1 ;
# At this point we've sent all but the lowest bit of all coefficients.
# Send lowest bit of DC coefficients
0,1,2: 0-0, 1, 0 ;
# Send lowest bit of AC coefficients
2: 1-63, 1, 0 ;
1: 1-63, 1, 0 ;
# Y AC lowest bit scan is last; it's usually the largest scan
0: 1-63, 1, 0 ;
Here is an example of a progressive scan script using only spectral selection
(no successive approximation):
# Interleaved DC scan for Y,Cb,Cr:
0,1,2: 0-0, 0, 0 ;
# AC scans:
0: 1-2, 0, 0 ; # First two Y AC coefficients
0: 3-5, 0, 0 ; # Three more
1: 1-63, 0, 0 ; # All AC coefficients for Cb
2: 1-63, 0, 0 ; # All AC coefficients for Cr
0: 6-9, 0, 0 ; # More Y coefficients
0: 10-63, 0, 0 ; # Remaining Y coefficients
Here is an example of a scan script that generates a partially interleaved
sequential JPEG file:
0; # Y only in first scan
1 2; # Cb and Cr in second scan
the following two scan definitions are equivalent:
0 1 2: 0 63 0 0;
0,1,2 : 0-63, 0,0 ;