29 unsigned int w,
unsigned int h,
30 unsigned int qstride,
unsigned int flag,
32 unsigned int x,
y, c0,
c1,
a = (!flag * 255
u) << 24;
33 unsigned int rb0, rb1, rb2, rb3, g0, g1, g2, g3;
34 uint32_t colors[4],
pixels;
36 c0 = bytestream2_get_le16(gb);
37 c1 = bytestream2_get_le16(gb);
39 rb0 = (c0<<3 | c0<<8) & 0xf800f8;
40 rb1 = (c1<<3 | c1<<8) & 0xf800f8;
41 rb0 += (rb0>>5) & 0x070007;
42 rb1 += (rb1>>5) & 0x070007;
43 g0 = (c0 <<5) & 0x00fc00;
44 g1 = (c1 <<5) & 0x00fc00;
45 g0 += (g0 >>6) & 0x000300;
46 g1 += (g1 >>6) & 0x000300;
48 colors[0] = rb0 + g0 +
a;
49 colors[1] = rb1 + g1 +
a;
51 if (c0 > c1 || flag) {
52 rb2 = (((2*rb0+rb1) * 21) >> 6) & 0xff00ff;
53 rb3 = (((2*rb1+rb0) * 21) >> 6) & 0xff00ff;
54 g2 = (((2*g0 +g1 ) * 21) >> 6) & 0x00ff00;
55 g3 = (((2*g1 +g0 ) * 21) >> 6) & 0x00ff00;
56 colors[3] = rb3 + g3 +
a;
58 rb2 = ((rb0+rb1) >> 1) & 0xff00ff;
59 g2 = ((g0 +g1 ) >> 1) & 0x00ff00;
63 colors[2] = rb2 + g2 +
a;
65 pixels = bytestream2_get_le32(gb);
68 a = (alpha & 0x0f) << 28;
70 d[x] = a + colors[pixels&3];
83 const unsigned int w,
const unsigned int h,
84 const unsigned int stride) {
85 unsigned int x,
y, qstride = stride/4;
86 uint32_t *d = (uint32_t *) dst;
88 for (y=0; y <
h; y += 4, d += stride-w)
89 for (x = 0; x < w; d +=
FFMIN(4, w-x), x += 4)
94 const unsigned int w,
const unsigned int h,
95 const unsigned int stride) {
96 unsigned int x,
y, qstride = stride/4;
97 uint32_t *d = (uint32_t *) dst;
99 for (y=0; y <
h; y += 4, d += stride-w)
100 for (x = 0; x < w; d +=
FFMIN(4, w-x), x += 4)
void ff_decode_dxt3(GetByteContext *gb, uint8_t *dst, const unsigned int w, const unsigned int h, const unsigned int stride)
Decode DXT3 encoded data to RGB32.
static void dxt1_decode_pixels(GetByteContext *gb, uint32_t *d, unsigned int w, unsigned int h, unsigned int qstride, unsigned int flag, uint64_t alpha)
static double alpha(void *priv, double x, double y)
Libavcodec external API header.
void ff_decode_dxt1(GetByteContext *gb, uint8_t *dst, const unsigned int w, const unsigned int h, const unsigned int stride)
Decode DXT1 encoded data to RGB32.
GLint GLenum GLboolean GLsizei stride