comparison s3tc.c @ 6306:23c0704067f6 libavcodec

use AV_RL* instead of le2me_*
author aurel
date Fri, 01 Feb 2008 23:49:56 +0000
parents 470601203f44
children 2acf0ae7b041
comparison
equal deleted inserted replaced
6305:4bc09f4a0885 6306:23c0704067f6
29 uint64_t alpha) { 29 uint64_t alpha) {
30 unsigned int x, y, c0, c1, a = (!flag * 255) << 24; 30 unsigned int x, y, c0, c1, a = (!flag * 255) << 24;
31 unsigned int rb0, rb1, rb2, rb3, g0, g1, g2, g3; 31 unsigned int rb0, rb1, rb2, rb3, g0, g1, g2, g3;
32 uint32_t colors[4], pixels; 32 uint32_t colors[4], pixels;
33 33
34 c0 = le2me_16(*(uint16_t *)(s)); 34 c0 = AV_RL16(s);
35 c1 = le2me_16(*(uint16_t *)(s+2)); 35 c1 = AV_RL16(s+2);
36 36
37 rb0 = (c0<<3 | c0<<8) & 0xf800f8; 37 rb0 = (c0<<3 | c0<<8) & 0xf800f8;
38 rb1 = (c1<<3 | c1<<8) & 0xf800f8; 38 rb1 = (c1<<3 | c1<<8) & 0xf800f8;
39 rb0 += (rb0>>5) & 0x070007; 39 rb0 += (rb0>>5) & 0x070007;
40 rb1 += (rb1>>5) & 0x070007; 40 rb1 += (rb1>>5) & 0x070007;
58 colors[3] = 0; 58 colors[3] = 0;
59 } 59 }
60 60
61 colors[2] = rb2 + g2 + a; 61 colors[2] = rb2 + g2 + a;
62 62
63 pixels = le2me_32(*(uint32_t *)(s+4)); 63 pixels = AV_RL32(s+4);
64 for (y=0; y<4; y++) { 64 for (y=0; y<4; y++) {
65 for (x=0; x<4; x++) { 65 for (x=0; x<4; x++) {
66 a = (alpha & 0x0f) << 28; 66 a = (alpha & 0x0f) << 28;
67 a += a >> 4; 67 a += a >> 4;
68 d[x] = a + colors[pixels&3]; 68 d[x] = a + colors[pixels&3];