Mercurial > projects > dwt-mac
comparison dwt/internal/image/JPEGQuantizationTable.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 1a8b3cb347e0 |
children | 5123b17c98ef |
comparison
equal
deleted
inserted
replaced
6:b903c16b6f48 | 7:e831403a80a9 |
---|---|
11 module dwt.internal.image; | 11 module dwt.internal.image; |
12 | 12 |
13 | 13 |
14 final class JPEGQuantizationTable : JPEGVariableSizeSegment { | 14 final class JPEGQuantizationTable : JPEGVariableSizeSegment { |
15 public static byte[] DefaultLuminanceQTable = { | 15 public static byte[] DefaultLuminanceQTable = { |
16 (byte)255, (byte)219, 0, 67, 0, | 16 cast(byte)255, cast(byte)219, 0, 67, 0, |
17 16, 11, 10, 16, 24, 40, 51, 61, | 17 16, 11, 10, 16, 24, 40, 51, 61, |
18 12, 12, 14, 19, 26, 58, 60, 55, | 18 12, 12, 14, 19, 26, 58, 60, 55, |
19 14, 13, 16, 24, 40, 57, 69, 56, | 19 14, 13, 16, 24, 40, 57, 69, 56, |
20 14, 17, 22, 29, 51, 87, 80, 62, | 20 14, 17, 22, 29, 51, 87, 80, 62, |
21 18, 22, 37, 56, 68, 109, 103, 77, | 21 18, 22, 37, 56, 68, 109, 103, 77, |
22 24, 35, 55, 64, 81, 104, 113, 92, | 22 24, 35, 55, 64, 81, 104, 113, 92, |
23 49, 64, 78, 87, 103, 121, 120, 101, | 23 49, 64, 78, 87, 103, 121, 120, 101, |
24 72, 92, 95, 98, 112, 100, 103, 99 | 24 72, 92, 95, 98, 112, 100, 103, 99 |
25 }; | 25 }; |
26 public static byte[] DefaultChrominanceQTable = { | 26 public static byte[] DefaultChrominanceQTable = { |
27 (byte)255, (byte)219, 0, 67, 1, | 27 cast(byte)255, cast(byte)219, 0, 67, 1, |
28 17, 18, 24, 47, 99, 99, 99, 99, | 28 17, 18, 24, 47, 99, 99, 99, 99, |
29 18, 21, 26, 66, 99, 99, 99, 99, | 29 18, 21, 26, 66, 99, 99, 99, 99, |
30 24, 26, 56, 99, 99, 99, 99, 99, | 30 24, 26, 56, 99, 99, 99, 99, 99, |
31 47, 66, 99, 99, 99, 99, 99, 99, | 31 47, 66, 99, 99, 99, 99, 99, 99, |
32 99, 99, 99, 99, 99, 99, 99, 99, | 32 99, 99, 99, 99, 99, 99, 99, 99, |
139 if (pq is 0) { | 139 if (pq is 0) { |
140 for (int i = ofs + 1; i <= ofs + 64; i++) { | 140 for (int i = ofs + 1; i <= ofs + 64; i++) { |
141 int temp = ((reference[i] & 0xFF) * qFactor + 50) / 100; | 141 int temp = ((reference[i] & 0xFF) * qFactor + 50) / 100; |
142 if (temp <= 0) temp = 1; | 142 if (temp <= 0) temp = 1; |
143 if (temp > 255) temp = 255; | 143 if (temp > 255) temp = 255; |
144 reference[i] = (byte)temp; | 144 reference[i] = cast(byte)temp; |
145 } | 145 } |
146 ofs += 65; | 146 ofs += 65; |
147 totalLength -= 65; | 147 totalLength -= 65; |
148 } else { | 148 } else { |
149 for (int i = ofs + 1; i <= ofs + 128; i += 2) { | 149 for (int i = ofs + 1; i <= ofs + 128; i += 2) { |
150 int temp = (((reference[i] & 0xFF) * 256 + (reference[i + 1] & 0xFF)) * qFactor + 50) / 100; | 150 int temp = (((reference[i] & 0xFF) * 256 + (reference[i + 1] & 0xFF)) * qFactor + 50) / 100; |
151 if (temp <= 0) temp = 1; | 151 if (temp <= 0) temp = 1; |
152 if (temp > 32767) temp = 32767; | 152 if (temp > 32767) temp = 32767; |
153 reference[i] = (byte)(temp >> 8); | 153 reference[i] = cast(byte)(temp >> 8); |
154 reference[i + 1] = (byte)(temp & 0xFF); | 154 reference[i + 1] = cast(byte)(temp & 0xFF); |
155 } | 155 } |
156 ofs += 129; | 156 ofs += 129; |
157 totalLength -= 129; | 157 totalLength -= 129; |
158 } | 158 } |
159 } | 159 } |