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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
BMC format ̎dl
BMC ́ABMP format̉摜f[^AȒPȕϊɂ舳k̂łB
dviout for Windows łPostScript摜̒ԃt@CƂėp邽߁A
k╜̍ƗeՂɎႪuĂB
Ƃ̉摜f[^́A<width> byte ̃f[^ <height>gAɕł
ƂiƂAtJ[(24bit)BMPt@C̏ꍇA<width> ́A摜
PIXELPʂł̕3{4̔{ɂȂ悤ɐグ̂łjB
ȉ 1. 2. 3. ƕϊ̂ABMCɂ摜f[^łB
1. ̉摜f[^
unsigned char image[<height>*<width>];
XOR ̉Zɂ
unsigned char trans[<height>*<width>];
ɕϊB
trans[i] = image[i] if i == 0
= image[i] ^ image[i-1] if 0 < i < <width>
= image[i] ^ image[i - <width>] if <width> <= i < <height>*<width>
trans[] ɂ́A0 Ƃf[^܂܂ĂƊ҂B
2. trans[] ̊e byte ̏ 4 bit (0 15)̕pxׁA1 15
̂ŁAƂpx̏Ȃ K 肷iȒP̂߁AK=5
ǂƂ炩ߌ߂Ă܂Ă悢jB
3. trans[] Af[^ byte AƂŃf[^B
<M N> AL byte ƂBAM, N 0 15 ܂ł̐ŁA
1 byte(unsigned char) \̏4bit M, 4bit N ɑΉ
̂ƂB
ȂAL >= 0x100000000 ̂Ƃ́A0xffffffffi 42.9Gjȉ̃ubN
ɕ邱ƂɂAL < 0x100000000 ƂB
3.1. L == 1 ̂Ƃ
M != K Ȃ <M N>
M == K Ȃ <K 0><0 N>
3.2. L == 2 ̂Ƃ
<M N> == 0 Ȃ <K 1>
M != K <M N> != 0 Ȃ <M N><M N>
M == K Ȃ <K 0><0 N><K 0><0 N>
3.3. L > 2 ̂Ƃ
<M N> == 0 Ȃ <K L-1> if L-1 < 0x10
<K 0><L-1> if 0x10 <= L-1 <= 0xe0
<K 0><0xff>S(L-1,2) if 0xe0 < L-1 < 0x10000
<K 0><0xfe>S(L-1,3) if 0x10000 <= L-1 < 0x1000000
<K 0><0xfd>S(L-1,4) if 0x1000000 <= L-1
<M N> != 0 Ȃ
M != K ǂɉāA<M N> ܂ <K 0><0 N> ̌(cf. 3.1)
<K 0><0xde + L> if L < 0x1b
<K 0><0xfc>S(L-1,1) if 0x19 <= L-2 < 0x100
<K 0><0xfb>S(L-1,2) if 0x100 <= L-2 < 0x10000
<K 0><0xfa>S(L-1,3) if 0x10000 <= L-2 < 0x1000000
<K 0><0xf9>S(L-1,4) if 0x1000000 <= L-2
AS(X,K) ́AX K byte ̐ŕ\̂ŁAʃoCg ->
ʃoCg̏B
BMC f[^̑Ŝ́A擪
id[2]; // 'B', 'C' ID for BMC
flag[1]; // flag & 1: Not compressed?
key[1]; // <K 0>
bmc_head_size[4]; // address of bmp_head[0] "BM..."
bmp_head_size[4]; // size of BMP header
byte_width[4]; // <width>
height[4]; // <height>
bit_width[4]; // width by bit
bmc_data_size[4]; // size after "BM..."
f_mode[1]; // used by dviout
bmp_rev[1]; // used by dviout
bmp_on[1]; // used by dviout
bmp_off[1]; // used by dviout
-- The following top is 0x20 byte from the head --
name[]; // original filename (zero terminated)
bmp_head[]; // original BITMAPFILEHEADEF + BITMAPINFOHEADER
bmc_data[]; // compressed or original image data
ƂȂB
f_mode[1] & 0xf = 2: 1 PIXEL = 1 bit
3: 4 bit
4: 8 bit
5: 24 bit
6: 16 bit
7: 32 bit
f_mode[1] & 0x10 : Use only Black & White (not gray, no color)
f_mode[1] & 0x20 : Only Black & White but the number of pallets > 2
f_mode[1] & 0x40 : the number of pallets <= 0x10 ? in 256 color mode
bmp_rev[1] 0: 0 is white for 2 color mode
1: 1 is white for 2 color mode
bmp_on[1] : pallet index of white for B & W
bmp_off[1] : pallet index of black for B & W
--------------------------- t ----------------------------------
epsfdoc(1) : the first page of epsfdoc.dvi A4 size 600dpi B/W
epsfdoc(16) : the first page A4 epsfdoc.dvi size 600dpi/6 gray scale(16 colors)
\includegraphics*[height=10cm]{golfer} in 300dpi
\includegraphics*[height=6cm]{tiger} in 300dpi
golfer(256) : 16 colors
tiger(256) : 16 colors
golfer(full) : full colors(24 bit)
tiger(full) : full colors(24 bit)
Size of image data files
BMP BMP+LZH BMP+GZIP BMC BMC+LZH PNG PNG+LZH GIF GIF+LZH
epsfdoc(1) 4378046 189330 190107 204831 148307 204643 197189 291454 291454
epsfdoc(16) 486838 46648 46976 57062 48486 48208 47451 52497 52407
golfer(256) 1144286 15458 15294 23932 12369 21401 21294 22643 22643
tiger(256) 485350 25447 25249 46858 25807 29415 29160 31884 31884
golfer(full) 3429678 23054 22028 40337 16038 28167 27432
tiger(full) 1447206 30958 31766 95170 31639 44921 44628
Ratio of compression (%)
BMP BMP+LZH BMP+GZIP BMC BMC+LZH PNG PNG+LZH GIF GIF+LZH
epsfdoc(1) 100.00 4.378 4.325 4.679 3.388 4.674 4.504 6.657 6.657
epsfdoc(16) 100.00 9.582 9.649 11.720 9.960 9.902 9.747 10.783 10.765
golfer(256) 100.00 1.351 1.337 2.091 1.081 1.870 1.861 1.979 1.979
tiger(256) 100.00 5.243 5.202 9.654 5.317 6.061 6.008 6.569 6.569
golfer(full) 100.00 0.672 0.642 1.176 0.468 0.858 0.771
tiger(full) 100.00 2.139 2.196 6.576 2.186 3.104 3.084
|