|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "lookuptable.h" |
|
17 |
|
18 /** |
|
19 @internalComponent |
|
20 */ |
|
21 // Lookup table low word for converting from 16bpp to 32bpp display modes |
|
22 const TUint16 KBlt16to32Low[256] = |
|
23 { |
|
24 0x0000, |
|
25 0x0008, |
|
26 0x0010, |
|
27 0x0018, |
|
28 0x0021, |
|
29 0x0029, |
|
30 0x0031, |
|
31 0x0039, |
|
32 0x0042, |
|
33 0x004a, |
|
34 0x0052, |
|
35 0x005a, |
|
36 0x0063, |
|
37 0x006b, |
|
38 0x0073, |
|
39 0x007b, |
|
40 0x0084, |
|
41 0x008c, |
|
42 0x0094, |
|
43 0x009c, |
|
44 0x00a5, |
|
45 0x00ad, |
|
46 0x00b5, |
|
47 0x00bd, |
|
48 0x00c6, |
|
49 0x00ce, |
|
50 0x00d6, |
|
51 0x00de, |
|
52 0x00e7, |
|
53 0x00ef, |
|
54 0x00f7, |
|
55 0x00ff, |
|
56 0x0400, |
|
57 0x0408, |
|
58 0x0410, |
|
59 0x0418, |
|
60 0x0421, |
|
61 0x0429, |
|
62 0x0431, |
|
63 0x0439, |
|
64 0x0442, |
|
65 0x044a, |
|
66 0x0452, |
|
67 0x045a, |
|
68 0x0463, |
|
69 0x046b, |
|
70 0x0473, |
|
71 0x047b, |
|
72 0x0484, |
|
73 0x048c, |
|
74 0x0494, |
|
75 0x049c, |
|
76 0x04a5, |
|
77 0x04ad, |
|
78 0x04b5, |
|
79 0x04bd, |
|
80 0x04c6, |
|
81 0x04ce, |
|
82 0x04d6, |
|
83 0x04de, |
|
84 0x04e7, |
|
85 0x04ef, |
|
86 0x04f7, |
|
87 0x04ff, |
|
88 0x0800, |
|
89 0x0808, |
|
90 0x0810, |
|
91 0x0818, |
|
92 0x0821, |
|
93 0x0829, |
|
94 0x0831, |
|
95 0x0839, |
|
96 0x0842, |
|
97 0x084a, |
|
98 0x0852, |
|
99 0x085a, |
|
100 0x0863, |
|
101 0x086b, |
|
102 0x0873, |
|
103 0x087b, |
|
104 0x0884, |
|
105 0x088c, |
|
106 0x0894, |
|
107 0x089c, |
|
108 0x08a5, |
|
109 0x08ad, |
|
110 0x08b5, |
|
111 0x08bd, |
|
112 0x08c6, |
|
113 0x08ce, |
|
114 0x08d6, |
|
115 0x08de, |
|
116 0x08e7, |
|
117 0x08ef, |
|
118 0x08f7, |
|
119 0x08ff, |
|
120 0x0c00, |
|
121 0x0c08, |
|
122 0x0c10, |
|
123 0x0c18, |
|
124 0x0c21, |
|
125 0x0c29, |
|
126 0x0c31, |
|
127 0x0c39, |
|
128 0x0c42, |
|
129 0x0c4a, |
|
130 0x0c52, |
|
131 0x0c5a, |
|
132 0x0c63, |
|
133 0x0c6b, |
|
134 0x0c73, |
|
135 0x0c7b, |
|
136 0x0c84, |
|
137 0x0c8c, |
|
138 0x0c94, |
|
139 0x0c9c, |
|
140 0x0ca5, |
|
141 0x0cad, |
|
142 0x0cb5, |
|
143 0x0cbd, |
|
144 0x0cc6, |
|
145 0x0cce, |
|
146 0x0cd6, |
|
147 0x0cde, |
|
148 0x0ce7, |
|
149 0x0cef, |
|
150 0x0cf7, |
|
151 0x0cff, |
|
152 0x1000, |
|
153 0x1008, |
|
154 0x1010, |
|
155 0x1018, |
|
156 0x1021, |
|
157 0x1029, |
|
158 0x1031, |
|
159 0x1039, |
|
160 0x1042, |
|
161 0x104a, |
|
162 0x1052, |
|
163 0x105a, |
|
164 0x1063, |
|
165 0x106b, |
|
166 0x1073, |
|
167 0x107b, |
|
168 0x1084, |
|
169 0x108c, |
|
170 0x1094, |
|
171 0x109c, |
|
172 0x10a5, |
|
173 0x10ad, |
|
174 0x10b5, |
|
175 0x10bd, |
|
176 0x10c6, |
|
177 0x10ce, |
|
178 0x10d6, |
|
179 0x10de, |
|
180 0x10e7, |
|
181 0x10ef, |
|
182 0x10f7, |
|
183 0x10ff, |
|
184 0x1400, |
|
185 0x1408, |
|
186 0x1410, |
|
187 0x1418, |
|
188 0x1421, |
|
189 0x1429, |
|
190 0x1431, |
|
191 0x1439, |
|
192 0x1442, |
|
193 0x144a, |
|
194 0x1452, |
|
195 0x145a, |
|
196 0x1463, |
|
197 0x146b, |
|
198 0x1473, |
|
199 0x147b, |
|
200 0x1484, |
|
201 0x148c, |
|
202 0x1494, |
|
203 0x149c, |
|
204 0x14a5, |
|
205 0x14ad, |
|
206 0x14b5, |
|
207 0x14bd, |
|
208 0x14c6, |
|
209 0x14ce, |
|
210 0x14d6, |
|
211 0x14de, |
|
212 0x14e7, |
|
213 0x14ef, |
|
214 0x14f7, |
|
215 0x14ff, |
|
216 0x1800, |
|
217 0x1808, |
|
218 0x1810, |
|
219 0x1818, |
|
220 0x1821, |
|
221 0x1829, |
|
222 0x1831, |
|
223 0x1839, |
|
224 0x1842, |
|
225 0x184a, |
|
226 0x1852, |
|
227 0x185a, |
|
228 0x1863, |
|
229 0x186b, |
|
230 0x1873, |
|
231 0x187b, |
|
232 0x1884, |
|
233 0x188c, |
|
234 0x1894, |
|
235 0x189c, |
|
236 0x18a5, |
|
237 0x18ad, |
|
238 0x18b5, |
|
239 0x18bd, |
|
240 0x18c6, |
|
241 0x18ce, |
|
242 0x18d6, |
|
243 0x18de, |
|
244 0x18e7, |
|
245 0x18ef, |
|
246 0x18f7, |
|
247 0x18ff, |
|
248 0x1c00, |
|
249 0x1c08, |
|
250 0x1c10, |
|
251 0x1c18, |
|
252 0x1c21, |
|
253 0x1c29, |
|
254 0x1c31, |
|
255 0x1c39, |
|
256 0x1c42, |
|
257 0x1c4a, |
|
258 0x1c52, |
|
259 0x1c5a, |
|
260 0x1c63, |
|
261 0x1c6b, |
|
262 0x1c73, |
|
263 0x1c7b, |
|
264 0x1c84, |
|
265 0x1c8c, |
|
266 0x1c94, |
|
267 0x1c9c, |
|
268 0x1ca5, |
|
269 0x1cad, |
|
270 0x1cb5, |
|
271 0x1cbd, |
|
272 0x1cc6, |
|
273 0x1cce, |
|
274 0x1cd6, |
|
275 0x1cde, |
|
276 0x1ce7, |
|
277 0x1cef, |
|
278 0x1cf7, |
|
279 0x1cff |
|
280 }; |
|
281 |
|
282 /** |
|
283 @internalComponent |
|
284 */ |
|
285 // Lookup table high long word for converting from 16bpp to 32bpp display modes |
|
286 const TUint32 KBlt16to32High[256] = |
|
287 { |
|
288 0xff000000, |
|
289 0xff002000, |
|
290 0xff004100, |
|
291 0xff006100, |
|
292 0xff008200, |
|
293 0xff00a200, |
|
294 0xff00c300, |
|
295 0xff00e300, |
|
296 0xff080000, |
|
297 0xff082000, |
|
298 0xff084100, |
|
299 0xff086100, |
|
300 0xff088200, |
|
301 0xff08a200, |
|
302 0xff08c300, |
|
303 0xff08e300, |
|
304 0xff100000, |
|
305 0xff102000, |
|
306 0xff104100, |
|
307 0xff106100, |
|
308 0xff108200, |
|
309 0xff10a200, |
|
310 0xff10c300, |
|
311 0xff10e300, |
|
312 0xff180000, |
|
313 0xff182000, |
|
314 0xff184100, |
|
315 0xff186100, |
|
316 0xff188200, |
|
317 0xff18a200, |
|
318 0xff18c300, |
|
319 0xff18e300, |
|
320 0xff210000, |
|
321 0xff212000, |
|
322 0xff214100, |
|
323 0xff216100, |
|
324 0xff218200, |
|
325 0xff21a200, |
|
326 0xff21c300, |
|
327 0xff21e300, |
|
328 0xff290000, |
|
329 0xff292000, |
|
330 0xff294100, |
|
331 0xff296100, |
|
332 0xff298200, |
|
333 0xff29a200, |
|
334 0xff29c300, |
|
335 0xff29e300, |
|
336 0xff310000, |
|
337 0xff312000, |
|
338 0xff314100, |
|
339 0xff316100, |
|
340 0xff318200, |
|
341 0xff31a200, |
|
342 0xff31c300, |
|
343 0xff31e300, |
|
344 0xff390000, |
|
345 0xff392000, |
|
346 0xff394100, |
|
347 0xff396100, |
|
348 0xff398200, |
|
349 0xff39a200, |
|
350 0xff39c300, |
|
351 0xff39e300, |
|
352 0xff420000, |
|
353 0xff422000, |
|
354 0xff424100, |
|
355 0xff426100, |
|
356 0xff428200, |
|
357 0xff42a200, |
|
358 0xff42c300, |
|
359 0xff42e300, |
|
360 0xff4a0000, |
|
361 0xff4a2000, |
|
362 0xff4a4100, |
|
363 0xff4a6100, |
|
364 0xff4a8200, |
|
365 0xff4aa200, |
|
366 0xff4ac300, |
|
367 0xff4ae300, |
|
368 0xff520000, |
|
369 0xff522000, |
|
370 0xff524100, |
|
371 0xff526100, |
|
372 0xff528200, |
|
373 0xff52a200, |
|
374 0xff52c300, |
|
375 0xff52e300, |
|
376 0xff5a0000, |
|
377 0xff5a2000, |
|
378 0xff5a4100, |
|
379 0xff5a6100, |
|
380 0xff5a8200, |
|
381 0xff5aa200, |
|
382 0xff5ac300, |
|
383 0xff5ae300, |
|
384 0xff630000, |
|
385 0xff632000, |
|
386 0xff634100, |
|
387 0xff636100, |
|
388 0xff638200, |
|
389 0xff63a200, |
|
390 0xff63c300, |
|
391 0xff63e300, |
|
392 0xff6b0000, |
|
393 0xff6b2000, |
|
394 0xff6b4100, |
|
395 0xff6b6100, |
|
396 0xff6b8200, |
|
397 0xff6ba200, |
|
398 0xff6bc300, |
|
399 0xff6be300, |
|
400 0xff730000, |
|
401 0xff732000, |
|
402 0xff734100, |
|
403 0xff736100, |
|
404 0xff738200, |
|
405 0xff73a200, |
|
406 0xff73c300, |
|
407 0xff73e300, |
|
408 0xff7b0000, |
|
409 0xff7b2000, |
|
410 0xff7b4100, |
|
411 0xff7b6100, |
|
412 0xff7b8200, |
|
413 0xff7ba200, |
|
414 0xff7bc300, |
|
415 0xff7be300, |
|
416 0xff840000, |
|
417 0xff842000, |
|
418 0xff844100, |
|
419 0xff846100, |
|
420 0xff848200, |
|
421 0xff84a200, |
|
422 0xff84c300, |
|
423 0xff84e300, |
|
424 0xff8c0000, |
|
425 0xff8c2000, |
|
426 0xff8c4100, |
|
427 0xff8c6100, |
|
428 0xff8c8200, |
|
429 0xff8ca200, |
|
430 0xff8cc300, |
|
431 0xff8ce300, |
|
432 0xff940000, |
|
433 0xff942000, |
|
434 0xff944100, |
|
435 0xff946100, |
|
436 0xff948200, |
|
437 0xff94a200, |
|
438 0xff94c300, |
|
439 0xff94e300, |
|
440 0xff9c0000, |
|
441 0xff9c2000, |
|
442 0xff9c4100, |
|
443 0xff9c6100, |
|
444 0xff9c8200, |
|
445 0xff9ca200, |
|
446 0xff9cc300, |
|
447 0xff9ce300, |
|
448 0xffa50000, |
|
449 0xffa52000, |
|
450 0xffa54100, |
|
451 0xffa56100, |
|
452 0xffa58200, |
|
453 0xffa5a200, |
|
454 0xffa5c300, |
|
455 0xffa5e300, |
|
456 0xffad0000, |
|
457 0xffad2000, |
|
458 0xffad4100, |
|
459 0xffad6100, |
|
460 0xffad8200, |
|
461 0xffada200, |
|
462 0xffadc300, |
|
463 0xffade300, |
|
464 0xffb50000, |
|
465 0xffb52000, |
|
466 0xffb54100, |
|
467 0xffb56100, |
|
468 0xffb58200, |
|
469 0xffb5a200, |
|
470 0xffb5c300, |
|
471 0xffb5e300, |
|
472 0xffbd0000, |
|
473 0xffbd2000, |
|
474 0xffbd4100, |
|
475 0xffbd6100, |
|
476 0xffbd8200, |
|
477 0xffbda200, |
|
478 0xffbdc300, |
|
479 0xffbde300, |
|
480 0xffc60000, |
|
481 0xffc62000, |
|
482 0xffc64100, |
|
483 0xffc66100, |
|
484 0xffc68200, |
|
485 0xffc6a200, |
|
486 0xffc6c300, |
|
487 0xffc6e300, |
|
488 0xffce0000, |
|
489 0xffce2000, |
|
490 0xffce4100, |
|
491 0xffce6100, |
|
492 0xffce8200, |
|
493 0xffcea200, |
|
494 0xffcec300, |
|
495 0xffcee300, |
|
496 0xffd60000, |
|
497 0xffd62000, |
|
498 0xffd64100, |
|
499 0xffd66100, |
|
500 0xffd68200, |
|
501 0xffd6a200, |
|
502 0xffd6c300, |
|
503 0xffd6e300, |
|
504 0xffde0000, |
|
505 0xffde2000, |
|
506 0xffde4100, |
|
507 0xffde6100, |
|
508 0xffde8200, |
|
509 0xffdea200, |
|
510 0xffdec300, |
|
511 0xffdee300, |
|
512 0xffe70000, |
|
513 0xffe72000, |
|
514 0xffe74100, |
|
515 0xffe76100, |
|
516 0xffe78200, |
|
517 0xffe7a200, |
|
518 0xffe7c300, |
|
519 0xffe7e300, |
|
520 0xffef0000, |
|
521 0xffef2000, |
|
522 0xffef4100, |
|
523 0xffef6100, |
|
524 0xffef8200, |
|
525 0xffefa200, |
|
526 0xffefc300, |
|
527 0xffefe300, |
|
528 0xfff70000, |
|
529 0xfff72000, |
|
530 0xfff74100, |
|
531 0xfff76100, |
|
532 0xfff78200, |
|
533 0xfff7a200, |
|
534 0xfff7c300, |
|
535 0xfff7e300, |
|
536 0xffff0000, |
|
537 0xffff2000, |
|
538 0xffff4100, |
|
539 0xffff6100, |
|
540 0xffff8200, |
|
541 0xffffa200, |
|
542 0xffffc300, |
|
543 0xffffe300 |
|
544 }; |
|
545 |
|
546 |
|
547 const TUint16 NormalisationTable16Bit[256] = { |
|
548 0,65280,32640,21760,16320,13056,10880,9326,8160,7254,6528, |
|
549 5935,5440,5022,4663,4352,4080,3840,3627,3436,3264, |
|
550 3109,2968,2839,2720,2612,2511,2418,2332,2252,2176, |
|
551 2106,2040,1979,1920,1866,1814,1765,1718,1674,1632, |
|
552 1593,1555,1519,1484,1451,1420,1389,1360,1333,1306, |
|
553 1280,1256,1232,1209,1187,1166,1146,1126,1107,1088, |
|
554 1071,1053,1037,1020,1005,990,975,960,947,933, |
|
555 920,907,895,883,871,859,848,837,827,816, |
|
556 806,797,787,778,768,760,751,742,734,726, |
|
557 718,710,702,695,688,680,673,667,660,653, |
|
558 647,640,634,628,622,616,611,605,599,594, |
|
559 589,583,578,573,568,563,558,554,549,544, |
|
560 540,536,531,527,523,519,515,510,507,503, |
|
561 499,495,491,488,484,480,477,474,470,467, |
|
562 463,460,457,454,451,448,445,442,439,436, |
|
563 433,430,427,424,422,419,416,414,411,408, |
|
564 406,403,401,399,396,394,391,389,387,384, |
|
565 382,380,378,376,374,371,369,367,365,363, |
|
566 361,359,357,355,353,351,350,348,346,344, |
|
567 342,340,339,337,335,334,332,330,329,327, |
|
568 325,324,322,320,319,317,316,314,313,311, |
|
569 310,308,307,306,304,303,301,300,299,297, |
|
570 296,295,293,292,291,289,288,287,286,284, |
|
571 283,282,281,279,278,277,276,275,274,272, |
|
572 271,270,269,268,267,266,265,264,263,262, |
|
573 261,260,259,258,256, |
|
574 }; |
|
575 |
|
576 |
|
577 /** |
|
578 This function will return value of converted 16bpp to 32bpp display modes. This lookup table is |
|
579 used to improve performance. |
|
580 @internalComponent |
|
581 */ |
|
582 |
|
583 EXPORT_C const TUint16* Convert16to32bppLow() |
|
584 { |
|
585 return KBlt16to32Low; |
|
586 } |
|
587 |
|
588 EXPORT_C const TUint32* Convert16to32bppHigh() |
|
589 { |
|
590 return KBlt16to32High; |
|
591 } |
|
592 |
|
593 /** |
|
594 Returns the pointer to the table of 16-bit normalisation table. |
|
595 The table is currently used for performing un-multiplying Premultiplied Alpha color channels. |
|
596 This lookup table for normalised alpha is compluted using this equation: Table[index] = (255*256) / index (where index is an 8 bit value) |
|
597 Use: Let x be c * a/255, and y = c, then y = (x/a)*255, where a is in 0-255 range. |
|
598 To use this table, use y = (x * Table[a])>>8. i.e, the inaccurate division is converted |
|
599 to more accurate multiplication and shift. |
|
600 |
|
601 @return pointer to the normalisation table. |
|
602 @internalTechnology |
|
603 */ |
|
604 EXPORT_C const TUint16* PtrTo16BitNormalisationTable() |
|
605 { |
|
606 return &NormalisationTable16Bit[0]; |
|
607 } |
|
608 |