ReactOS 0.4.16-dev-1007-g2e85425
ddsformat.c
Go to the documentation of this file.
1/*
2 * Copyright 2020 Ziqing Hui
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include <stdarg.h>
20
21#define COBJMACROS
22
23#include "windef.h"
24#include "wincodec.h"
25#include "wine/test.h"
26
27#ifdef __REACTOS__
28#define debugstr_guid wine_dbgstr_guid
29#endif
30
31#define GET_RGB565_R(color) ((BYTE)(((color) >> 11) & 0x1F))
32#define GET_RGB565_G(color) ((BYTE)(((color) >> 5) & 0x3F))
33#define GET_RGB565_B(color) ((BYTE)(((color) >> 0) & 0x1F))
34#define MAKE_RGB565(r, g, b) ((WORD)(((BYTE)(r) << 11) | ((BYTE)(g) << 5) | (BYTE)(b)))
35#define MAKE_ARGB(a, r, g, b) (((DWORD)(a) << 24) | ((DWORD)(r) << 16) | ((DWORD)(g) << 8) | (DWORD)(b))
36
37#define BLOCK_WIDTH 4
38#define BLOCK_HEIGHT 4
39
40/* 1x1 uncompressed(Alpha) DDS image */
41static BYTE test_dds_alpha[] = {
42 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,
43 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
47 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
49 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50 0xFF
51};
52
53/* 1x1 uncompressed(Luminance) DDS image */
55 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,
56 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
60 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63 0x82
64};
65
66/* 4x4 uncompressed(16bpp RGB565) DDS image */
68 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00,
69 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
73 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00,
74 0xE0, 0x07, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
75 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76 0xF5, 0xA7, 0x08, 0x69, 0x4C, 0x7B, 0x08, 0x69, 0xF5, 0xA7, 0xF5, 0xA7, 0xF5, 0xA7, 0x4C, 0x7B,
77 0x4C, 0x7B, 0x4C, 0x7B, 0x4C, 0x7B, 0xB1, 0x95, 0x4C, 0x7B, 0x08, 0x69, 0x08, 0x69, 0x4C, 0x7B
78};
79
80/* 1x1 uncompressed(24bpp RGB) DDS image */
81static BYTE test_dds_24bpp[] = {
82 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,
83 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
87 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
88 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
89 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90 0x70, 0x81, 0x83
91};
92
93/* 1x1 uncompressed(32bpp XRGB) DDS image */
95 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,
96 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
99 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
100 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
101 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
102 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
103 0x70, 0x81, 0x83, 0x00
104};
105
106/* 1x1 uncompressed(32bpp ARGB) DDS image */
108 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,
109 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
111 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
112 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
113 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
114 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x10, 0x00, 0x00,
115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
116 0x70, 0x81, 0x83, 0xFF
117};
118
119/* 1x1 uncompressed(64bpp ABGR) DDS image */
121 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x0F, 0x10, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,
122 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
123 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
126 0x04, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
129 0x83, 0x83, 0x81, 0x81, 0x70, 0x70, 0xFF, 0xFF
130};
131
132/* 1x1 uncompressed(96bpp ABGR float) DDS image */
134 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x0F, 0x10, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,
135 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
139 0x04, 0x00, 0x00, 0x00, 'D', 'X', '1', '0', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
143 0x00, 0x00, 0x00, 0x00, 0x84, 0x83, 0x03, 0x3F, 0x82, 0x81, 0x01, 0x3F, 0xE2, 0xE0, 0xE0, 0x3E
144};
145
146/* 1x1 uncompressed(128bpp ABGR float) DDS image */
148 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x0F, 0x10, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,
149 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
151 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
152 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
153 0x04, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
154 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
155 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
156 0x84, 0x83, 0x03, 0x3F, 0x82, 0x81, 0x01, 0x3F, 0xE2, 0xE0, 0xE0, 0x3E, 0x00, 0x00, 0x80, 0x3F
157};
158
159/* 4x4 compressed(DXT1) cube map, mipMapCount = 3 */
160static BYTE test_dds_cube[] = {
161 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0A, 0x00, 0x04, 0x00, 0x00, 0x00,
162 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
166 0x04, 0x00, 0x00, 0x00, 'D', 'X', 'T', '1', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
167 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
168 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
169 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55,
170 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7,
171 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00,
172 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55,
173 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7,
174 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00,
175 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55,
176 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7,
177 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00
178};
179
180/* 4x4 compressed(DXT1) cube map with extended header, mipMapCount=3 */
182 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0A, 0x00, 0x04, 0x00, 0x00, 0x00,
183 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
184 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
187 0x04, 0x00, 0x00, 0x00, 'D', 'X', '1', '0', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
188 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
189 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
190 0x47, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
191 0x03, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B,
192 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69,
193 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84,
194 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B,
195 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69,
196 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84,
197 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B,
198 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69,
199 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84,
200 0x00, 0x00, 0x00, 0x00
201};
202
203/* 4x4 compressed(DXT1) DDS image with mip maps, mipMapCount=3 */
205 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0A, 0x00, 0x04, 0x00, 0x00, 0x00,
206 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
207 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
208 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
210 0x04, 0x00, 0x00, 0x00, 'D', 'X', 'T', '1', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
211 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
212 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7, 0xB1, 0x95, 0x6D, 0x7B, 0xFC, 0x55, 0x5D, 0x5D,
214 0x2E, 0x8C, 0x4E, 0x7C, 0xAA, 0xAB, 0xAB, 0xAB
215};
216
217/* 4x4 compressed(DXT1) volume texture, depth=4, mipMapCount=3 */
219 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x8A, 0x00, 0x04, 0x00, 0x00, 0x00,
220 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
221 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
224 0x04, 0x00, 0x00, 0x00, 'D', 'X', 'T', '1', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
225 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
226 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
227 0xD5, 0xA7, 0x2C, 0x7B, 0xE0, 0x00, 0x55, 0x55, 0xD5, 0xA7, 0x49, 0x69, 0x57, 0x00, 0xFF, 0x55,
228 0xD5, 0xA7, 0x48, 0x69, 0xFD, 0x80, 0xFF, 0x55, 0x30, 0x8D, 0x89, 0x71, 0x55, 0xA8, 0x00, 0xFF,
229 0x32, 0x96, 0x6D, 0x83, 0xA8, 0x55, 0x5D, 0x5D, 0x0E, 0x84, 0x6D, 0x7B, 0xA8, 0xA9, 0xAD, 0xAD,
230 0x2E, 0x8C, 0x2E, 0x7C, 0xAA, 0xAB, 0xAB, 0xAB
231};
232
233/* 4x4 compressed(DXT1) texture array, arraySize=3, mipMapCount=3 */
235 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0A, 0x00, 0x04, 0x00, 0x00, 0x00,
236 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
240 0x04, 0x00, 0x00, 0x00, 'D', 'X', '1', '0', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
241 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
242 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
243 0x47, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
244 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B,
245 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69,
246 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B, 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84,
247 0x00, 0x00, 0x00, 0x00, 0xF5, 0xA7, 0x08, 0x69, 0x74, 0xC0, 0xBF, 0xD7, 0x32, 0x96, 0x0B, 0x7B,
248 0xCC, 0x55, 0xCC, 0x55, 0x0E, 0x84, 0x0E, 0x84, 0x00, 0x00, 0x00, 0x00
249};
250
251/* 4x4 compressed(DXT1c) DDS image */
253 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00,
254 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
255 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
258 0x04, 0x00, 0x00, 0x00, 'D', 'X', 'T', '1', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
259 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
261 0x9A, 0xE6, 0x2B, 0x39, 0x37, 0xB7, 0x7F, 0x7F
262};
263
264/* 4x4 compressed(DXT1a) DDS image */
266 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00,
267 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
271 0x04, 0x00, 0x00, 0x00, 'D', 'X', 'T', '1', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
274 0x2A, 0x31, 0xF5, 0xBC, 0xE3, 0x6E, 0x2A, 0x3A
275};
276
277/* 4x4 compressed(DXT2) DDS image, mipMapCount=3 */
278static BYTE test_dds_dxt2[] = {
279 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00,
280 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
282 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
283 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
284 0x04, 0x00, 0x00, 0x00, 'D', 'X', 'T', '2', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
285 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
287 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFD, 0xDE, 0xC4, 0x10, 0x2F, 0xBF, 0xFF, 0x7B,
288 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x53, 0x00, 0x00, 0x52, 0x52, 0x55, 0x55,
289 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0x59, 0x00, 0x00, 0x54, 0x55, 0x55, 0x55
290};
291
292/* 1x3 compressed(DXT3) DDS image, mipMapCount=2 */
293static BYTE test_dds_dxt3[] = {
294 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0A, 0x00, 0x03, 0x00, 0x00, 0x00,
295 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
296 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
299 0x04, 0x00, 0x00, 0x00, 'D', 'X', 'T', '3', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
302 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C, 0x92, 0x38, 0x84, 0x00, 0xFF, 0x55, 0xFF,
303 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x53, 0x8B, 0x53, 0x8B, 0x00, 0x00, 0x00, 0x00
304};
305
306/* 4x4 compressed(DXT4) DDS image, mipMapCount=3 */
307static BYTE test_dds_dxt4[] = {
308 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00,
309 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
310 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
313 0x04, 0x00, 0x00, 0x00, 'D', 'X', 'T', '4', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFD, 0xDE, 0xC4, 0x10, 0x2F, 0xBF, 0xFF, 0x7B,
317 0xFF, 0x00, 0x40, 0x02, 0x24, 0x49, 0x92, 0x24, 0x57, 0x53, 0x00, 0x00, 0x52, 0x52, 0x55, 0x55,
318 0xFF, 0x00, 0x48, 0x92, 0x24, 0x49, 0x92, 0x24, 0xCE, 0x59, 0x00, 0x00, 0x54, 0x55, 0x55, 0x55
319};
320
321/* 6x6 compressed(DXT5) image, mipMapCount=3 */
322static BYTE test_dds_dxt5[] = {
323 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0A, 0x00, 0x06, 0x00, 0x00, 0x00,
324 0x06, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
328 0x04, 0x00, 0x00, 0x00, 0x44, 0x58, 0x54, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
331 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x73, 0x8E, 0x51, 0x97, 0x97, 0xBF, 0xAF,
332 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9D, 0xC6, 0xCF, 0x52, 0x22, 0x22, 0xBB, 0x55,
333 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xA2, 0xB8, 0x5B, 0xF8, 0xF8, 0xF8, 0xF8,
334 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x3A, 0x05, 0x19, 0xCC, 0x66, 0xCC, 0x66,
335 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9D, 0x0A, 0x39, 0xCF, 0xEF, 0x9B, 0xEF,
336 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x6A, 0xF0, 0x6A, 0x00, 0x00, 0x00, 0x00
337};
338
339/* 12x12 compressed(DXT3) texture array, arraySize=2, mipMapCount=4 */
341 'D', 'D', 'S', ' ', 0x7C, 0x00, 0x00, 0x00, 0x07, 0x10, 0x0A, 0x00, 0x0C, 0x00, 0x00, 0x00,
342 0x0C, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
345 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
346 0x04, 0x00, 0x00, 0x00, 'D', 'X', '1', '0', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
347 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x40, 0x00,
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349 0x4A, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
350 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB5, 0xA7, 0xAD, 0x83,
351 0x60, 0x60, 0xE0, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x12, 0x96, 0x6B, 0x72,
352 0xD5, 0xD5, 0xAF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x30, 0x8D, 0x89, 0x69,
353 0x57, 0x5F, 0x5E, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB4, 0xA7, 0xAD, 0x83,
354 0x00, 0xAA, 0xFF, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF3, 0x9E, 0x6D, 0x83,
355 0x00, 0x00, 0xAA, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x12, 0x96, 0xCD, 0x83,
356 0x5C, 0xF8, 0xAA, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0x7A, 0xC9, 0x71,
357 0x80, 0x60, 0x60, 0x60, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4A, 0x72, 0xA8, 0x68,
358 0x28, 0xBE, 0xD7, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0x8C, 0xEA, 0x71,
359 0x0B, 0xAB, 0xAD, 0xBD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x54, 0x9F, 0xCC, 0x7A,
360 0x5C, 0xA8, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x50, 0x8D, 0x49, 0x69,
361 0x77, 0xEE, 0x88, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C, 0x7B, 0x08, 0x69,
362 0xF8, 0x58, 0xF8, 0x58, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4E, 0x84, 0x6B, 0x72,
363 0x33, 0x99, 0x33, 0x99, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x14, 0x9F, 0x0A, 0x72,
364 0xDC, 0xAA, 0x75, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x84, 0x0E, 0x84,
365 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB5, 0xA7, 0xAD, 0x83,
366 0x60, 0x60, 0xE0, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x12, 0x96, 0x6B, 0x72,
367 0xD5, 0xD5, 0xAF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x30, 0x8D, 0x89, 0x69,
368 0x57, 0x5F, 0x5E, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB4, 0xA7, 0xAD, 0x83,
369 0x00, 0xAA, 0xFF, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF3, 0x9E, 0x6D, 0x83,
370 0x00, 0x00, 0xAA, 0x55, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x12, 0x96, 0xCD, 0x83,
371 0x5C, 0xF8, 0xAA, 0xAF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0x7A, 0xC9, 0x71,
372 0x80, 0x60, 0x60, 0x60, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4A, 0x72, 0xA8, 0x68,
373 0x28, 0xBE, 0xD7, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xAF, 0x8C, 0xEA, 0x71,
374 0x0B, 0xAB, 0xAD, 0xBD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x54, 0x9F, 0xCC, 0x7A,
375 0x5C, 0xA8, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x50, 0x8D, 0x49, 0x69,
376 0x77, 0xEE, 0x88, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C, 0x7B, 0x08, 0x69,
377 0xF8, 0x58, 0xF8, 0x58, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4E, 0x84, 0x6B, 0x72,
378 0x33, 0x99, 0x33, 0x99, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x14, 0x9F, 0x0A, 0x72,
379 0xDC, 0xAA, 0x75, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x84, 0x0E, 0x84,
380 0x00, 0x00, 0x00, 0x00
381};
382
385static BYTE test_byte[1] = { 0 };
386static BYTE test_word[2] = { 0 };
387static BYTE test_dword[4] = { 0 };
388static BYTE test_qword_a[8] = { 0 };
389static BYTE test_qword_b[8] = "DDS ";
390
391static struct test_data {
401} test_data[] = {
402 { test_dds_alpha, sizeof(test_dds_alpha), WINCODEC_ERR_BADHEADER, 1, 1, 8, &GUID_WICPixelFormat8bppAlpha,
404 { test_dds_luminance, sizeof(test_dds_luminance), WINCODEC_ERR_BADHEADER, 1, 1, 8, &GUID_WICPixelFormat8bppGray,
406 { test_dds_rgb565, sizeof(test_dds_rgb565), WINCODEC_ERR_BADHEADER, 1, 2, 16, &GUID_WICPixelFormat16bppBGR565,
408 { test_dds_24bpp, sizeof(test_dds_24bpp), WINCODEC_ERR_BADHEADER, 1, 3, 24, &GUID_WICPixelFormat24bppBGR,
410 { test_dds_32bpp_xrgb, sizeof(test_dds_32bpp_xrgb), WINCODEC_ERR_BADHEADER, 1, 4, 32, &GUID_WICPixelFormat32bppBGR,
412 { test_dds_32bpp_argb, sizeof(test_dds_32bpp_argb), WINCODEC_ERR_BADHEADER, 1, 4, 32, &GUID_WICPixelFormat32bppBGRA,
414 { test_dds_64bpp, sizeof(test_dds_64bpp), WINCODEC_ERR_BADHEADER, 1, 8, 64, &GUID_WICPixelFormat64bppRGBA,
416 { test_dds_96bpp, sizeof(test_dds_96bpp), WINCODEC_ERR_BADHEADER, 1, 12, 96, &GUID_WICPixelFormat96bppRGBFloat,
418 { test_dds_128bpp, sizeof(test_dds_128bpp), WINCODEC_ERR_BADHEADER, 1, 16, 128, &GUID_WICPixelFormat128bppRGBAFloat,
420 { test_dds_cube, sizeof(test_dds_cube), WINCODEC_ERR_BADHEADER, 18, 8, 32, &GUID_WICPixelFormat32bppPBGRA,
422 { test_dds_cube_dx10, sizeof(test_dds_cube_dx10), WINCODEC_ERR_BADHEADER, 18, 8, 32, &GUID_WICPixelFormat32bppBGRA,
424 { test_dds_mipmaps, sizeof(test_dds_mipmaps), S_OK, 3, 8, 32, &GUID_WICPixelFormat32bppPBGRA,
426 { test_dds_volume, sizeof(test_dds_volume), S_OK, 7, 8, 32, &GUID_WICPixelFormat32bppPBGRA,
428 { test_dds_array, sizeof(test_dds_array), S_OK, 9, 8, 32, &GUID_WICPixelFormat32bppBGRA,
430 { test_dds_dxt1c, sizeof(test_dds_dxt1c), S_OK, 1, 8, 32, &GUID_WICPixelFormat32bppPBGRA,
432 { test_dds_dxt1a, sizeof(test_dds_dxt1a), S_OK, 1, 8, 32, &GUID_WICPixelFormat32bppPBGRA,
434 { test_dds_dxt2, sizeof(test_dds_dxt2), S_OK, 3, 16, 32, &GUID_WICPixelFormat32bppPBGRA,
436 { test_dds_dxt3, sizeof(test_dds_dxt3), S_OK, 2, 16, 32, &GUID_WICPixelFormat32bppBGRA,
438 { test_dds_dxt4, sizeof(test_dds_dxt4), S_OK, 3, 16, 32, &GUID_WICPixelFormat32bppPBGRA,
440 { test_dds_dxt5, sizeof(test_dds_dxt5), S_OK, 3, 16, 32, &GUID_WICPixelFormat32bppBGRA,
442 { test_dds_12x12, sizeof(test_dds_12x12), S_OK, 8, 16, 32, &GUID_WICPixelFormat32bppBGRA,
452
461};
462
464
465static IWICStream *create_stream(const void *image_data, UINT image_size)
466{
467 HRESULT hr;
469
470 hr = IWICImagingFactory_CreateStream(factory, &stream);
471 ok(hr == S_OK, "CreateStream failed, hr %#lx\n", hr);
472 if (hr != S_OK) goto fail;
473
474 hr = IWICStream_InitializeFromMemory(stream, (BYTE *)image_data, image_size);
475 ok(hr == S_OK, "InitializeFromMemory failed, hr %#lx\n", hr);
476 if (hr != S_OK) goto fail;
477
478 return stream;
479
480fail:
481 if (stream) IWICStream_Release(stream);
482 return NULL;
483}
484
486{
487 HRESULT hr;
489 GUID guidresult;
490
491 hr = CoCreateInstance(&CLSID_WICDdsDecoder, NULL, CLSCTX_INPROC_SERVER,
492 &IID_IWICBitmapDecoder, (void **)&decoder);
493 if (hr != S_OK) {
494 win_skip("Dds decoder is not supported\n");
495 return NULL;
496 }
497
498 memset(&guidresult, 0, sizeof(guidresult));
499 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
500 ok(hr == S_OK, "GetContainerFormat failed, hr %#lx\n", hr);
501 ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatDds),
502 "Got unexpected container format %s\n", debugstr_guid(&guidresult));
503
504 return decoder;
505}
506
508{
510 GUID guidresult;
511 HRESULT hr;
512
513 hr = CoCreateInstance(&CLSID_WICDdsEncoder, NULL, CLSCTX_INPROC_SERVER,
514 &IID_IWICBitmapEncoder, (void **)&encoder);
515 if (hr != S_OK)
516 {
517 win_skip("DDS encoder is not supported\n");
518 return NULL;
519 }
520
521 memset(&guidresult, 0, sizeof(guidresult));
522
523 hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guidresult);
524 ok(hr == S_OK, "GetContainerFormat failed, hr %#lx\n", hr);
525
526 ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatDds),
527 "Got unexpected container format %s\n", debugstr_guid(&guidresult));
528
529 return encoder;
530}
531
533{
534 HRESULT hr;
535 IWICWineDecoder *wine_decoder;
536
537 hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand);
538 ok(hr == expected, "Expected hr %#lx, got %#lx\n", expected, hr);
539
540 if (hr != S_OK && wine_init) {
541 hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICWineDecoder, (void **)&wine_decoder);
542 ok(hr == S_OK || broken(hr != S_OK), "QueryInterface failed, hr %#lx\n", hr);
543
544 if (hr == S_OK) {
545 hr = IWICWineDecoder_Initialize(wine_decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand);
546 ok(hr == S_OK, "Initialize failed, hr %#lx\n", hr);
547 }
548 }
549
550 return hr;
551}
552
554{
555 if (dds_encoder) IWICDdsEncoder_Release(dds_encoder);
556 if (stream) IWICStream_Release(stream);
557 if (encoder) IWICBitmapEncoder_Release(encoder);
558}
559
562{
563 IWICDdsEncoder *dds = NULL;
564 HRESULT hr;
565
567 if (!*encoder) goto fail;
568
570 if (!*stream) goto fail;
571
572 hr = IWICBitmapEncoder_Initialize(*encoder, (IStream *)*stream, WICBitmapEncoderNoCache);
573 ok(hr == S_OK, "Initialize failed, hr %#lx\n", hr);
574 if (hr != S_OK) goto fail;
575
576 hr = IWICBitmapEncoder_QueryInterface(*encoder, &IID_IWICDdsEncoder, (void **)&dds);
577 ok(hr == S_OK, "QueryInterface failed, hr %#lx\n", hr);
578 if (hr != S_OK) goto fail;
579
580 if (params)
581 {
582 hr = IWICDdsEncoder_SetParameters(dds, params);
583 ok(hr == S_OK, "SetParameters failed, hr %#lx\n", hr);
584 if (hr != S_OK) goto fail;
585 }
586
587 if (dds_encoder)
588 {
589 *dds_encoder = dds;
590 }
591 else
592 {
593 IWICDdsEncoder_Release(dds);
594 dds = NULL;
595 }
596
597 return S_OK;
598
599fail:
601 return E_FAIL;
602}
603
605{
606 UINT i;
607 for (i = 0; i < ARRAY_SIZE(compressed_formats); i++)
608 {
609 if (format == compressed_formats[i]) return TRUE;
610 }
611 return FALSE;
612}
613
615{
616 return data[84] == 'D' && data[85] == 'X' && data[86] == '1' && data[87] == '0';
617}
618
620{
621 return MAKE_ARGB(alpha, (GET_RGB565_R(color) * 0xFF + 0x0F) / 0x1F,
622 (GET_RGB565_G(color) * 0xFF + 0x1F) / 0x3F,
623 (GET_RGB565_B(color) * 0xFF + 0x0F) / 0x1F);
624}
625
626static void decode_block(const BYTE *block_data, UINT block_count, DXGI_FORMAT format,
628{
629 const BYTE *block, *color_indices, *alpha_indices, *alpha_table;
630 int i, j, x, y, block_x, block_y, color_index, alpha_index;
631 int block_size, color_offset, color_indices_offset;
632 WORD color[4], color_value = 0;
633 BYTE alpha[8], alpha_value = 0;
634
636 block_size = 8;
637 color_offset = 0;
638 color_indices_offset = 4;
639 } else {
640 block_size = 16;
641 color_offset = 8;
642 color_indices_offset = 12;
643 }
644 block_x = 0;
645 block_y = 0;
646
647 for (i = 0; i < block_count; i++)
648 {
649 block = block_data + i * block_size;
650
651 color[0] = *((WORD *)(block + color_offset));
652 color[1] = *((WORD *)(block + color_offset + 2));
653 color[2] = MAKE_RGB565(((GET_RGB565_R(color[0]) * 2 + GET_RGB565_R(color[1]) + 1) / 3),
654 ((GET_RGB565_G(color[0]) * 2 + GET_RGB565_G(color[1]) + 1) / 3),
655 ((GET_RGB565_B(color[0]) * 2 + GET_RGB565_B(color[1]) + 1) / 3));
656 color[3] = MAKE_RGB565(((GET_RGB565_R(color[0]) + GET_RGB565_R(color[1]) * 2 + 1) / 3),
657 ((GET_RGB565_G(color[0]) + GET_RGB565_G(color[1]) * 2 + 1) / 3),
658 ((GET_RGB565_B(color[0]) + GET_RGB565_B(color[1]) * 2 + 1) / 3));
659
660 switch (format)
661 {
663 if (color[0] <= color[1]) {
664 color[2] = MAKE_RGB565(((GET_RGB565_R(color[0]) + GET_RGB565_R(color[1]) + 1) / 2),
665 ((GET_RGB565_G(color[0]) + GET_RGB565_G(color[1]) + 1) / 2),
666 ((GET_RGB565_B(color[0]) + GET_RGB565_B(color[1]) + 1) / 2));
667 color[3] = 0;
668 }
669 break;
671 alpha_table = block;
672 break;
674 alpha[0] = *block;
675 alpha[1] = *(block + 1);
676 if (alpha[0] > alpha[1]) {
677 for (j = 2; j < 8; j++)
678 {
679 alpha[j] = (BYTE)((alpha[0] * (8 - j) + alpha[1] * (j - 1) + 3) / 7);
680 }
681 } else {
682 for (j = 2; j < 6; j++)
683 {
684 alpha[j] = (BYTE)((alpha[0] * (6 - j) + alpha[1] * (j - 1) + 2) / 5);
685 }
686 alpha[6] = 0;
687 alpha[7] = 0xFF;
688 }
689 alpha_indices = block + 2;
690 break;
691 default:
692 break;
693 }
694
695 color_indices = block + color_indices_offset;
696 for (j = 0; j < 16; j++)
697 {
698 x = block_x + j % 4;
699 y = block_y + j / 4;
700 if (x >= width || y >= height) continue;
701
702 color_index = (color_indices[j / 4] >> ((j % 4) * 2)) & 0x3;
703 color_value = color[color_index];
704
705 switch (format)
706 {
708 if ((color[0] <= color[1]) && !color_value) {
709 color_value = 0;
710 alpha_value = 0;
711 } else {
712 alpha_value = 0xFF;
713 }
714 break;
716 alpha_value = (alpha_table[j / 2] >> (j % 2) * 4) & 0xF;
717 alpha_value = (BYTE)((alpha_value * 0xFF + 0x7)/ 0xF);
718 break;
720 alpha_index = (*((DWORD *)(alpha_indices + (j / 8) * 3)) >> ((j % 8) * 3)) & 0x7;
721 alpha_value = alpha[alpha_index];
722 break;
723 default:
724 break;
725 }
726 buffer[x + y * width] = rgb565_to_argb(color_value, alpha_value);
727 }
728
729 block_x += BLOCK_WIDTH;
730 if (block_x >= width) {
731 block_x = 0;
732 block_y += BLOCK_HEIGHT;
733 }
734 }
735}
736
737static BOOL color_match(DWORD color_a, DWORD color_b)
738{
739 static const int tolerance = 8;
740
741 const int da = abs((int)((color_a & 0xFF000000) >> 24) - (int)((color_b & 0xFF000000) >> 24));
742 const int dr = abs((int)((color_a & 0x00FF0000) >> 16) - (int)((color_b & 0x00FF0000) >> 16));
743 const int dg = abs((int)((color_a & 0x0000FF00) >> 8) - (int)((color_b & 0x0000FF00) >> 8));
744 const int db = abs((int)((color_a & 0x000000FF) >> 0) - (int)((color_b & 0x000000FF) >> 0));
745
746 return (da <= tolerance && dr <= tolerance && dg <= tolerance && db <= tolerance);
747}
748
749static BOOL color_buffer_match(DWORD *color_buffer_a, DWORD *color_buffer_b, UINT color_count)
750{
751 UINT i;
752
753 for (i = 0; i < color_count; i++)
754 {
755 if (!color_match(color_buffer_a[i], color_buffer_b[i])) return FALSE;
756 }
757
758 return TRUE;
759}
760
761static void copy_pixels(void *src_buffer, UINT src_stride, void *dst_buffer, UINT dst_stride, UINT size)
762{
763 char *src = src_buffer, *dst = dst_buffer;
764 UINT i;
765
766 for (i = 0; i < size; i++)
767 {
768 *dst = src[i];
769 if (i % src_stride == src_stride - 1) dst += dst_stride - src_stride;
770 dst ++;
771 }
772}
773
775{
776 int i;
777
780 test_dds_bad_magic[0] = 0;
781 test_dds_bad_header[4] = 0;
782
783 for (i = 0; i < ARRAY_SIZE(test_data); i++)
784 {
787
788 winetest_push_context("Test %u", i);
789
791 if (!stream) goto next;
792
794 if (!decoder) goto next;
795
797
798 next:
799 if (decoder) IWICBitmapDecoder_Release(decoder);
800 if (stream) IWICStream_Release(stream);
802 }
803}
804
806{
807 HRESULT hr;
809 IWICMetadataQueryReader *metadata_reader = NULL;
810 IWICBitmapSource *preview = NULL, *thumnail = NULL;
811 IWICColorContext *color_context = NULL;
812 UINT count;
813
814 hr = IWICImagingFactory_CreatePalette(factory, &palette);
815 ok(hr == S_OK, "CreatePalette failed, hr %#lx\n", hr);
816 if (hr == S_OK) {
817 hr = IWICBitmapDecoder_CopyPalette(decoder, palette);
818 ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette got unexpected hr %#lx\n", hr);
819 hr = IWICBitmapDecoder_CopyPalette(decoder, NULL);
820 ok(hr == WINCODEC_ERR_PALETTEUNAVAILABLE, "CopyPalette got unexpected hr %#lx\n", hr);
821 }
822
823 hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, &metadata_reader);
824 todo_wine ok (hr == S_OK, "GetMetadataQueryReader got unexpected hr %#lx\n", hr);
825 hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, NULL);
826 ok(hr == E_INVALIDARG, "GetMetadataQueryReader got unexpected hr %#lx\n", hr);
827
828 hr = IWICBitmapDecoder_GetPreview(decoder, &preview);
829 ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetPreview got unexpected hr %#lx\n", hr);
830 hr = IWICBitmapDecoder_GetPreview(decoder, NULL);
831 ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetPreview got unexpected hr %#lx\n", hr);
832
833 hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, &color_context, &count);
834 ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts got unexpected hr %#lx\n", hr);
835 hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, NULL, NULL);
836 ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts got unexpected hr %#lx\n", hr);
837
838 hr = IWICBitmapDecoder_GetThumbnail(decoder, &thumnail);
839 ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "GetThumbnail got unexpected hr %#lx\n", hr);
840 hr = IWICBitmapDecoder_GetThumbnail(decoder, NULL);
841 ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "GetThumbnail got unexpected hr %#lx\n", hr);
842
843 if (palette) IWICPalette_Release(palette);
844 if (metadata_reader) IWICMetadataQueryReader_Release(metadata_reader);
845 if (preview) IWICBitmapSource_Release(preview);
846 if (color_context) IWICColorContext_Release(color_context);
847 if (thumnail) IWICBitmapSource_Release(thumnail);
848}
849
851{
852 int i;
853 HRESULT hr;
854 WICDdsParameters parameters;
855
856 for (i = 0; i < ARRAY_SIZE(test_data); i++)
857 {
858 UINT frame_count;
861 IWICDdsDecoder *dds_decoder = NULL;
862
863 winetest_push_context("Test %u", i);
864
866 if (!stream) goto next;
867
869 if (!decoder) goto next;
870
871 hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICDdsDecoder, (void **)&dds_decoder);
872 ok(hr == S_OK, "QueryInterface failed, hr %#lx\n", hr);
873 if (hr != S_OK) goto next;
874
875 hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
876 ok(hr == WINCODEC_ERR_WRONGSTATE, "GetFrameCount got unexpected hr %#lx\n", hr);
877 hr = IWICBitmapDecoder_GetFrameCount(decoder, NULL);
878 ok(hr == E_INVALIDARG, "GetFrameCount got unexpected hr %#lx\n", hr);
879
880 hr = IWICDdsDecoder_GetParameters(dds_decoder, &parameters);
881 ok(hr == WINCODEC_ERR_WRONGSTATE, "GetParameters got unexpected hr %#lx\n", hr);
882 hr = IWICDdsDecoder_GetParameters(dds_decoder, NULL);
883 ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#lx\n", hr);
884
885 if (test_data[i].init_hr != S_OK && !test_data[i].wine_init) goto next;
886
888 if (hr != S_OK) {
889 if (test_data[i].expected_parameters.Dimension == WICDdsTextureCube) {
890 win_skip("Cube map is not supported\n");
891 } else {
892 win_skip("Uncompressed DDS image is not supported\n");
893 }
894 goto next;
895 }
896
897 hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
898 ok(hr == S_OK, "GetFrameCount failed, hr %#lx\n", hr);
899 if (hr == S_OK) {
900 ok(frame_count == test_data[i].expected_frame_count, "Expected frame count %u, got %u\n",
901 test_data[i].expected_frame_count, frame_count);
902 }
903 hr = IWICBitmapDecoder_GetFrameCount(decoder, NULL);
904 ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#lx\n", hr);
905
906 hr = IWICDdsDecoder_GetParameters(dds_decoder, &parameters);
907 ok(hr == S_OK, "GetParameters failed, hr %#lx\n", hr);
908 if (hr == S_OK) {
910 "Expected Width %u, got %u\n", test_data[i].expected_parameters.Width, parameters.Width);
912 "Expected Height %u, got %u\n", test_data[i].expected_parameters.Height, parameters.Height);
914 "Expected Depth %u, got %u\n", test_data[i].expected_parameters.Depth, parameters.Depth);
916 "Expected MipLevels %u, got %u\n", test_data[i].expected_parameters.MipLevels, parameters.MipLevels);
918 "Expected ArraySize %u, got %u\n", test_data[i].expected_parameters.ArraySize, parameters.ArraySize);
920 "Expected DxgiFormat %#x, got %#x\n", test_data[i].expected_parameters.DxgiFormat, parameters.DxgiFormat);
922 "Expected Dimension %#x, got %#x\n", test_data[i].expected_parameters.Dimension, parameters.Dimension);
924 "Expected AlphaMode %#x, got %#x\n", test_data[i].expected_parameters.AlphaMode, parameters.AlphaMode);
925 }
926 hr = IWICDdsDecoder_GetParameters(dds_decoder, NULL);
927 ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#lx\n", hr);
928
929 next:
930 if (decoder) IWICBitmapDecoder_Release(decoder);
931 if (stream) IWICStream_Release(stream);
932 if (dds_decoder) IWICDdsDecoder_Release(dds_decoder);
934 }
935}
936
938 UINT frame_count, WICDdsParameters *params, struct test_data *test, UINT frame_index)
939{
940 HRESULT hr;
941 UINT width, height ,expected_width, expected_height, slice_index, depth;
942 UINT width_in_blocks, height_in_blocks, expected_width_in_blocks, expected_height_in_blocks;
943 UINT expected_block_width, expected_block_height;
946
947 /* frame size tests */
948
949 hr = IWICBitmapFrameDecode_GetSize(frame_decode, NULL, NULL);
950 ok(hr == E_INVALIDARG, "GetSize got unexpected hr %#lx\n", hr);
951 hr = IWICBitmapFrameDecode_GetSize(frame_decode, NULL, &height);
952 ok(hr == E_INVALIDARG, "GetSize got unexpected hr %#lx\n", hr);
953 hr = IWICBitmapFrameDecode_GetSize(frame_decode, &width, NULL);
954 ok(hr == E_INVALIDARG, "GetSize got unexpected hr %#lx\n", hr);
955 hr = IWICBitmapFrameDecode_GetSize(frame_decode, &width, &height);
956 ok(hr == S_OK, "GetSize failed, hr %#lx\n", hr);
957 if (hr != S_OK) return;
958
959 depth = params->Depth;
960 expected_width = params->Width;
961 expected_height = params->Height;
962 slice_index = frame_index % (frame_count / params->ArraySize);
963 while (slice_index >= depth)
964 {
965 if (expected_width > 1) expected_width /= 2;
966 if (expected_height > 1) expected_height /= 2;
967 slice_index -= depth;
968 if (depth > 1) depth /= 2;
969 }
970 ok(width == expected_width, "Expected width %u, got %u\n", expected_width, width);
971 ok(height == expected_height, "Expected height %u, got %u\n", expected_height, height);
972
973 /* frame format information tests */
974
975 if (is_compressed(test->expected_parameters.DxgiFormat)) {
976 expected_block_width = BLOCK_WIDTH;
977 expected_block_height = BLOCK_HEIGHT;
978 } else {
979 expected_block_width = 1;
980 expected_block_height = 1;
981 }
982
983 hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, NULL);
984 ok(hr == E_INVALIDARG, "GetFormatInfo got unexpected hr %#lx\n", hr);
985 hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, &format_info);
986 ok(hr == S_OK, "GetFormatInfo failed, hr %#lx\n", hr);
987 if (hr != S_OK) return;
988
989 ok(format_info.DxgiFormat == test->expected_parameters.DxgiFormat,
990 "Expected DXGI format %#x, got %#x\n",
991 test->expected_parameters.DxgiFormat, format_info.DxgiFormat);
992 ok(format_info.BytesPerBlock == test->expected_bytes_per_block,
993 "Expected bytes per block %u, got %u\n",
994 test->expected_bytes_per_block, format_info.BytesPerBlock);
995 ok(format_info.BlockWidth == expected_block_width,
996 "Expected block width %u, got %u\n",
997 expected_block_width, format_info.BlockWidth);
998 ok(format_info.BlockHeight == expected_block_height,
999 "Expected block height %u, got %u\n",
1000 expected_block_height, format_info.BlockHeight);
1001
1002
1003 /* size in blocks tests */
1004
1005 hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, NULL);
1006 ok(hr == E_INVALIDARG, "GetSizeInBlocks got unexpected hr %#lx\n", hr);
1007 hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, NULL, &height_in_blocks);
1008 ok(hr == E_INVALIDARG, "GetSizeInBlocks got unexpected hr %#lx\n", hr);
1009 hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, NULL);
1010 ok(hr == E_INVALIDARG, "GetSizeInBlocks got unexpected hr %#lx\n", hr);
1011 hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, &height_in_blocks);
1012 ok(hr == S_OK, "GetSizeInBlocks failed, hr %#lx\n", hr);
1013 if (hr != S_OK) return;
1014
1015 expected_width_in_blocks = (expected_width + expected_block_width - 1) / expected_block_width;
1016 expected_height_in_blocks = (expected_height + expected_block_height - 1) / expected_block_height;
1017 ok(width_in_blocks == expected_width_in_blocks,
1018 "Expected width in blocks %u, got %u\n", expected_width_in_blocks, width_in_blocks);
1019 ok(height_in_blocks == expected_height_in_blocks,
1020 "Expected height in blocks %u, got %u\n", expected_height_in_blocks, height_in_blocks);
1021
1022 /* pixel format tests */
1023
1024 hr = IWICBitmapFrameDecode_GetPixelFormat(frame_decode, NULL);
1025 ok(hr == E_INVALIDARG, "GetPixelFormat got unexpected hr %#lx\n", hr);
1026 hr = IWICBitmapFrameDecode_GetPixelFormat(frame_decode, &pixel_format);
1027 ok(hr == S_OK, "GetPixelFormat failed, hr %#lx\n", hr);
1028 if (hr != S_OK) return;
1029 ok(IsEqualGUID(&pixel_format, test->expected_pixel_format),
1030 "Expected pixel format %s, got %s\n",
1031 debugstr_guid(test->expected_pixel_format), debugstr_guid(&pixel_format));
1032}
1033
1036{
1037 HRESULT hr;
1040 WICRect rect = { 0, 0, 1, 1 }, rect_test_a = { 0, 0, 0, 0 }, rect_test_b = { 0, 0, 0xdeadbeaf, 0xdeadbeaf };
1041 WICRect rect_test_c = { -0xdeadbeaf, -0xdeadbeaf, 1, 1 }, rect_test_d = { 0xdeadbeaf, 0xdeadbeaf, 1, 1 };
1042 BYTE buffer[2048], pixels[2048];
1043 UINT stride, frame_stride, frame_size, frame_width, frame_height, width_in_blocks, height_in_blocks, bpp;
1044 UINT width, height, depth, array_index;
1045 UINT block_offset;
1046 int slice_index;
1047
1048 hr = IWICBitmapFrameDecode_GetPixelFormat(frame, &pixel_format);
1049 ok(hr == S_OK, "GetPixelFormat failed, hr %#lx\n", hr);
1050 if (hr != S_OK) return;
1051 hr = IWICBitmapFrameDecode_GetSize(frame, &frame_width, &frame_height);
1052 ok(hr == S_OK, "GetSize failed, hr %#lx\n", hr);
1053 if (hr != S_OK) return;
1054 hr = IWICDdsFrameDecode_GetFormatInfo(dds_frame, &format_info);
1055 ok(hr == S_OK, "GetFormatInfo failed, hr %#lx\n", hr);
1056 if (hr != S_OK) return;
1057 hr = IWICDdsFrameDecode_GetSizeInBlocks(dds_frame, &width_in_blocks, &height_in_blocks);
1058 ok(hr == S_OK, "GetSizeInBlocks failed, hr %#lx\n", hr);
1059 if (hr != S_OK) return;
1060 stride = rect.Width * format_info.BytesPerBlock;
1061 frame_stride = width_in_blocks * format_info.BytesPerBlock;
1062 frame_size = frame_stride * height_in_blocks;
1063
1064 /* CopyBlocks tests */
1065
1066 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, 0, 0, NULL);
1067 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1068
1069 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_a, stride, sizeof(buffer), buffer);
1070 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1071 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_b, stride, sizeof(buffer), buffer);
1072 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1073 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_c, stride, sizeof(buffer), buffer);
1074 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1075 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect_test_d, stride, sizeof(buffer), buffer);
1076 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1077
1078 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride - 1, sizeof(buffer), buffer);
1079 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1080 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride * 2, sizeof(buffer), buffer);
1081 ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
1082 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, sizeof(buffer), buffer);
1083 ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
1084 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, frame_stride * height_in_blocks - 1, buffer);
1085 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1086 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, frame_stride * height_in_blocks, buffer);
1087 ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
1088
1089 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, 0, sizeof(buffer), buffer);
1090 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1091 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride - 1, sizeof(buffer), buffer);
1092 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1093 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride * 2, sizeof(buffer), buffer);
1094 ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
1095
1096 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, 0, buffer);
1097 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1098 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, 1, buffer);
1099 ok(hr == E_INVALIDARG || (hr == S_OK && test->expected_bytes_per_block == 1),
1100 "CopyBlocks got unexpected hr %#lx\n", hr);
1101 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, stride * rect.Height - 1, buffer);
1102 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1103 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, stride * rect.Height, buffer);
1104 ok(hr == S_OK, "CopyBlocks got unexpected hr %#lx\n", hr);
1105
1106 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, sizeof(buffer), NULL);
1107 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1108
1109 block_offset = 128; /* DDS magic and header */
1110 if (has_extended_header(test->data)) block_offset += 20; /* DDS extended header */
1111 width = params->Width;
1112 height = params->Height;
1113 depth = params->Depth;
1114 slice_index = frame_index % (frame_count / params->ArraySize);
1115 array_index = frame_index / (frame_count / params->ArraySize);
1116 block_offset += (test->size - block_offset) / params->ArraySize * array_index;
1117 while (slice_index >= 0)
1118 {
1119 width_in_blocks = (width + format_info.BlockWidth - 1) / format_info.BlockWidth;
1120 height_in_blocks = (width + format_info.BlockWidth - 1) / format_info.BlockWidth;
1121 block_offset += (slice_index >= depth) ?
1122 (width_in_blocks * height_in_blocks * format_info.BytesPerBlock * depth) :
1123 (width_in_blocks * height_in_blocks * format_info.BytesPerBlock * slice_index);
1124 if (width > 1) width /= 2;
1125 if (height > 1) height /= 2;
1126 slice_index -= depth;
1127 if (depth > 1) depth /= 2;
1128 }
1129
1130 memset(buffer, 0, sizeof(buffer));
1131 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, &rect, stride, sizeof(buffer), buffer);
1132 ok(hr == S_OK, "CopyBlocks failed, hr %#lx\n", hr);
1133 if (hr != S_OK) return;
1134 ok(!memcmp(test->data + block_offset, buffer, format_info.BytesPerBlock),
1135 "Block data mismatch\n");
1136
1137 memset(buffer, 0, sizeof(buffer));
1138 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride, sizeof(buffer), buffer);
1139 ok(hr == S_OK, "CopyBlocks failed, hr %#lx\n", hr);
1140 if (hr != S_OK) return;
1141 ok(!memcmp(test->data + block_offset, buffer, frame_size),
1142 "Block data mismatch\n");
1143
1144 memset(buffer, 0, sizeof(buffer));
1145 memset(pixels, 0, sizeof(pixels));
1146 copy_pixels(test->data + block_offset, frame_stride, pixels, frame_stride * 2, frame_size);
1147 hr = IWICDdsFrameDecode_CopyBlocks(dds_frame, NULL, frame_stride * 2, sizeof(buffer), buffer);
1148 ok(hr == S_OK, "CopyBlocks failed, hr %#lx\n", hr);
1149 if (hr != S_OK) return;
1150 ok(!memcmp(pixels, buffer, frame_size),
1151 "Block data mismatch\n");
1152
1153 /* CopyPixels tests */
1154
1155 bpp = test->pixel_format_bpp;
1156 stride = rect.Width * bpp / 8;
1157 frame_stride = frame_width * bpp / 8;
1158 frame_size = frame_stride * frame_height;
1159
1160 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, 0, 0, NULL);
1161 ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
1162
1163 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect_test_a, stride, sizeof(buffer), buffer);
1164 ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
1165 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect_test_b, stride, sizeof(buffer), buffer);
1166 ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
1167 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect_test_c, stride, sizeof(buffer), buffer);
1168 ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
1169 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect_test_d, stride, sizeof(buffer), buffer);
1170 ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
1171
1172 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride - 1, sizeof(buffer), buffer);
1173 ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
1174 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride * 2, sizeof(buffer), buffer);
1175 ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
1176 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride, sizeof(buffer), buffer);
1177 ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
1178 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride, frame_stride * frame_height - 1, buffer);
1179 ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "CopyPixels got unexpected hr %#lx\n", hr);
1180 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride, frame_stride * frame_height, buffer);
1181 ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
1182
1183 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, 0, sizeof(buffer), buffer);
1184 ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
1185 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride - 1, sizeof(buffer), buffer);
1186 ok(hr == E_INVALIDARG, "CopyPixels got unexpected hr %#lx\n", hr);
1187 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride * 2, sizeof(buffer), buffer);
1188 ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
1189
1190 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, 0, buffer);
1191 ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "CopyPixels got unexpected hr %#lx\n", hr);
1192 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, 1, buffer);
1193 ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER || (hr == S_OK && test->expected_bytes_per_block == 1),
1194 "CopyPixels got unexpected hr %#lx\n", hr);
1195 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, stride * rect.Height - 1, buffer);
1196 ok(hr == WINCODEC_ERR_INSUFFICIENTBUFFER, "CopyPixels got unexpected hr %#lx\n", hr);
1197 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, stride * rect.Height, buffer);
1198 ok(hr == S_OK, "CopyPixels got unexpected hr %#lx\n", hr);
1199
1200 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, sizeof(buffer), NULL);
1201 ok(hr == E_INVALIDARG, "CopyBlocks got unexpected hr %#lx\n", hr);
1202
1203 memset(buffer, 0, sizeof(pixels));
1204 if (is_compressed(format_info.DxgiFormat)) {
1205 decode_block(test->data + block_offset, width_in_blocks * height_in_blocks,
1206 format_info.DxgiFormat, frame_width, frame_height, (DWORD *)pixels);
1207 } else {
1208 memcpy(pixels, test->data + block_offset, frame_size);
1209 }
1210
1211 memset(buffer, 0, sizeof(buffer));
1212 hr = IWICBitmapFrameDecode_CopyPixels(frame, &rect, stride, sizeof(buffer), buffer);
1213 ok(hr == S_OK, "CopyPixels failed, hr %#lx\n", hr);
1214 if (hr == S_OK) {
1215 if (is_compressed(format_info.DxgiFormat)) {
1216 ok(color_buffer_match((DWORD *)pixels, (DWORD *)buffer, 1), "Pixels mismatch\n");
1217 } else {
1218 ok(!memcmp(pixels, buffer, bpp / 8), "Pixels mismatch\n");
1219 }
1220 }
1221
1222 memset(buffer, 0, sizeof(buffer));
1223 hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, frame_stride, sizeof(buffer), buffer);
1224 ok(hr == S_OK, "CopyPixels failed, hr %#lx\n", hr);
1225 if (hr == S_OK) {
1226 if (is_compressed(format_info.DxgiFormat)) {
1227 ok(color_buffer_match((DWORD *)pixels, (DWORD *)buffer, frame_size / (bpp / 8)), "Pixels mismatch\n");
1228 } else {
1229 ok(!memcmp(pixels, buffer, frame_size), "Pixels mismatch\n");
1230 };
1231 }
1232}
1233
1235{
1236 HRESULT hr;
1237 IWICDdsDecoder *dds_decoder = NULL;
1238 UINT frame_count, j;
1240
1241 hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
1242 ok(hr == S_OK, "GetFrameCount failed, hr %#lx\n", hr);
1243 if (hr != S_OK) return;
1244 hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICDdsDecoder, (void **)&dds_decoder);
1245 ok(hr == S_OK, "QueryInterface failed, hr %#lx\n", hr);
1246 if (hr != S_OK) goto end;
1247 hr = IWICDdsDecoder_GetParameters(dds_decoder, &params);
1248 ok(hr == S_OK, "GetParameters failed, hr %#lx\n", hr);
1249 if (hr != S_OK) goto end;
1250
1251 if (test->expected_parameters.Dimension == WICDdsTextureCube) params.ArraySize *= 6;
1252
1253 for (j = 0; j < frame_count; j++)
1254 {
1255 IWICBitmapFrameDecode *frame_decode = NULL;
1256 IWICDdsFrameDecode *dds_frame = NULL;
1257
1258 winetest_push_context("Frame %u", j);
1259
1260 hr = IWICBitmapDecoder_GetFrame(decoder, j, &frame_decode);
1261 ok(hr == S_OK, "GetFrame failed, hr %#lx\n", hr);
1262 if (hr != S_OK) goto next;
1263 hr = IWICBitmapFrameDecode_QueryInterface(frame_decode, &IID_IWICDdsFrameDecode, (void **)&dds_frame);
1264 ok(hr == S_OK, "QueryInterface failed, hr %#lx\n", hr);
1265 if (hr != S_OK) goto next;
1266
1267 test_dds_decoder_frame_properties(frame_decode, dds_frame, frame_count, &params, test, j);
1268 test_dds_decoder_frame_data(frame_decode, dds_frame, frame_count, &params, test, j);
1269
1270 next:
1271 if (frame_decode) IWICBitmapFrameDecode_Release(frame_decode);
1272 if (dds_frame) IWICDdsFrameDecode_Release(dds_frame);
1274 }
1275
1276end:
1277 if (dds_decoder) IWICDdsDecoder_Release(dds_decoder);
1278}
1279
1280static void test_dds_decoder(void)
1281{
1282 int i;
1283 HRESULT hr;
1284
1287
1288 for (i = 0; i < ARRAY_SIZE(test_data); i++)
1289 {
1292
1293 if (test_data[i].init_hr != S_OK && !test_data[i].wine_init) continue;
1294
1295 winetest_push_context("Test %u", i);
1296
1298 if (!stream) goto next;
1300 if (!decoder) goto next;
1302 if (hr != S_OK) {
1303 if (test_data[i].expected_parameters.Dimension == WICDdsTextureCube) {
1304 win_skip("Cube map is not supported\n");
1305 } else {
1306 win_skip("Uncompressed DDS image is not supported\n");
1307 }
1308 goto next;
1309 }
1310
1313
1314 next:
1315 if (decoder) IWICBitmapDecoder_Release(decoder);
1316 if (stream) IWICStream_Release(stream);
1318 }
1319}
1320
1322{
1325 BYTE buffer[1];
1326 HRESULT hr;
1327
1329 if (!encoder) goto end;
1330
1331 stream = create_stream(buffer, sizeof(buffer));
1332 if (!stream) goto end;
1333
1334 /* initialize with invalid cache option */
1335
1336 hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, 0xdeadbeef);
1337 todo_wine
1338 ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "Initialize got unexpected hr %#lx\n", hr);
1339
1340 hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
1341 todo_wine
1342 ok(hr == E_INVALIDARG, "Initialize got unexpected hr %#lx\n", hr);
1343
1344 IWICBitmapEncoder_Release(encoder);
1345
1346 /* initialize with null stream */
1347
1349 if (!encoder) goto end;
1350
1351 hr = IWICBitmapEncoder_Initialize(encoder, NULL, WICBitmapEncoderNoCache);
1352 ok(hr == E_INVALIDARG, "Initialize got unexpected hr %#lx\n", hr);
1353
1354 hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
1355 ok(hr == S_OK, "Initialize failed, hr %#lx\n", hr);
1356
1357 IWICBitmapEncoder_Release(encoder);
1358
1359 /* regularly initialize */
1360
1362 if (!encoder) goto end;
1363
1364 hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
1365 ok(hr == S_OK, "Initialize failed, hr %#lx\n", hr);
1366
1367 hr = IWICBitmapEncoder_Initialize(encoder, (IStream *)stream, WICBitmapEncoderNoCache);
1368 ok(hr == WINCODEC_ERR_WRONGSTATE, "Initialize got unexpected hr %#lx\n", hr);
1369
1370end:
1371 if (stream) IWICStream_Release(stream);
1372 if (encoder) IWICBitmapEncoder_Release(encoder);
1373}
1374
1376{
1377 WICDdsParameters params, params_set = { 4, 4, 4, 3, 1, DXGI_FORMAT_BC1_UNORM,
1379 IWICDdsEncoder *dds_encoder = NULL;
1382 BYTE buffer[1024];
1383 HRESULT hr;
1384 UINT i;
1385
1386 hr = create_and_init_encoder(buffer, sizeof(buffer), NULL, &encoder, &dds_encoder, &stream);
1387 if (hr != S_OK) goto end;
1388
1389 hr = IWICDdsEncoder_GetParameters(dds_encoder, NULL);
1390 ok(hr == E_INVALIDARG, "GetParameters got unexpected hr %#lx\n", hr);
1391
1392 hr = IWICDdsEncoder_GetParameters(dds_encoder, &params);
1393 ok(hr == S_OK, "GetParameters failed, hr %#lx\n", hr);
1394 if (hr != S_OK) goto end;
1395
1396 /* default DDS parameters for encoder */
1397 ok(params.Width == 1, "Got unexpected Width %u\n", params.Width);
1398 ok(params.Height == 1, "Got unexpected Height %u\n", params.Height);
1399 ok(params.Depth == 1, "Got unexpected Depth %u\n", params.Depth);
1400 ok(params.MipLevels == 1, "Got unexpected MipLevels %u\n", params.MipLevels);
1401 ok(params.ArraySize == 1, "Got unexpected ArraySize %u\n", params.ArraySize);
1402 ok(params.DxgiFormat == DXGI_FORMAT_BC3_UNORM, "Got unexpected DxgiFormat %#x\n", params.DxgiFormat);
1403 ok(params.Dimension == WICDdsTexture2D, "Got unexpected Dimension %#x\n", params.Dimension);
1404 ok(params.AlphaMode == WICDdsAlphaModeUnknown, "Got unexpected AlphaMode %#x\n", params.AlphaMode);
1405
1406 hr = IWICDdsEncoder_SetParameters(dds_encoder, NULL);
1407 ok(hr == E_INVALIDARG, "SetParameters got unexpected hr %#lx\n", hr);
1408
1409 hr = IWICDdsEncoder_SetParameters(dds_encoder, &params_set);
1410 ok(hr == S_OK, "SetParameters failed, hr %#lx\n", hr);
1411 if (hr != S_OK) goto end;
1412
1413 IWICDdsEncoder_GetParameters(dds_encoder, &params);
1414
1415 ok(params.Width == params_set.Width,
1416 "Expected Width %u, got %u\n", params_set.Width, params.Width);
1417 ok(params.Height == params_set.Height,
1418 "Expected Height %u, got %u\n", params_set.Height, params.Height);
1419 ok(params.Depth == params_set.Depth,
1420 "Expected Depth %u, got %u\n", params_set.Depth, params.Depth);
1421 ok(params.MipLevels == params_set.MipLevels,
1422 "Expected MipLevels %u, got %u\n", params_set.MipLevels, params.MipLevels);
1423 ok(params.ArraySize == params_set.ArraySize,
1424 "Expected ArraySize %u, got %u\n", params_set.ArraySize, params.ArraySize);
1425 ok(params.DxgiFormat == params_set.DxgiFormat,
1426 "Expected DxgiFormat %u, got %#x\n", params_set.DxgiFormat, params.DxgiFormat);
1427 ok(params.Dimension == params_set.Dimension,
1428 "Expected Dimension %u, got %#x\n", params_set.Dimension, params.Dimension);
1429 ok(params.AlphaMode == params_set.AlphaMode,
1430 "Expected AlphaMode %u, got %#x\n", params_set.AlphaMode, params.AlphaMode);
1431
1432 for (i = 0; i < ARRAY_SIZE(test_data); ++i)
1433 {
1434 hr = IWICDdsEncoder_SetParameters(dds_encoder, &test_data[i].expected_parameters);
1435 todo_wine_if(test_data[i].init_hr != S_OK)
1436 ok((hr == S_OK && test_data[i].init_hr == S_OK) || hr == WINCODEC_ERR_BADHEADER,
1437 "Test %u: SetParameters got unexpected hr %#lx\n", i, hr);
1438 }
1439
1440end:
1441 release_encoder(encoder, dds_encoder, stream);
1442}
1443
1445{
1448 IWICBitmapFrameEncode *frame0 = NULL, *frame1 = NULL;
1449 UINT array_index, mip_level, slice_index;
1450 IWICDdsEncoder *dds_encoder = NULL;
1453 BYTE buffer[1024];
1454 HRESULT hr;
1455
1456 hr = create_and_init_encoder(buffer, sizeof(buffer), &params, &encoder, &dds_encoder, &stream);
1457 if (hr != S_OK) goto end;
1458
1459 hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame0, NULL);
1460 ok(hr == S_OK, "CreateNewFrame failed, hr %#lx\n", hr);
1461 hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame1, NULL);
1462 ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#lx\n", hr);
1463
1464 IWICBitmapFrameEncode_Release(frame0);
1465 hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frame1, NULL);
1466 ok(hr == WINCODEC_ERR_WRONGSTATE, "CreateNewFrame got unexpected hr %#lx\n", hr);
1467
1468 release_encoder(encoder, dds_encoder, stream);
1469
1470 create_and_init_encoder(buffer, sizeof(buffer), &params, &encoder, &dds_encoder, &stream);
1471 hr = IWICDdsEncoder_CreateNewFrame(dds_encoder, &frame0, &array_index, &mip_level, &slice_index);
1472 ok(hr == S_OK, "CreateNewFrame failed, hr %#lx\n", hr);
1473 IWICBitmapFrameEncode_Release(frame0);
1474 release_encoder(encoder, dds_encoder, stream);
1475
1476 create_and_init_encoder(buffer, sizeof(buffer), &params, &encoder, &dds_encoder, &stream);
1477 hr = IWICDdsEncoder_CreateNewFrame(dds_encoder, &frame0, NULL, NULL, NULL);
1478 ok(hr == S_OK, "CreateNewFrame failed, hr %#lx\n", hr);
1479 IWICBitmapFrameEncode_Release(frame0);
1480
1481end:
1482 release_encoder(encoder, dds_encoder, stream);
1483}
1484
1486{
1489 {
1490 &GUID_WICPixelFormat8bppIndexed,
1491 &GUID_WICPixelFormatBlackWhite,
1492 &GUID_WICPixelFormat16bppGray,
1493 &GUID_WICPixelFormat8bppAlpha,
1494 &GUID_WICPixelFormat16bppBGR555,
1495 &GUID_WICPixelFormat16bppBGR565,
1496 &GUID_WICPixelFormat24bppBGR,
1497 &GUID_WICPixelFormat32bppBGR,
1498 &GUID_WICPixelFormat32bppBGRA,
1499 &GUID_WICPixelFormat32bppPBGRA,
1500 &GUID_WICPixelFormat32bppRGB,
1501 &GUID_WICPixelFormat32bppRGBA,
1502 &GUID_WICPixelFormat32bppPRGBA,
1503 &GUID_WICPixelFormat48bppRGB,
1504 &GUID_WICPixelFormat64bppRGB,
1505 &GUID_WICPixelFormat64bppRGBA
1506 };
1507 IWICBitmapFrameEncode *frame = NULL;
1508 IWICDdsEncoder *dds_encoder = NULL;
1513 BYTE buffer[1];
1514 HRESULT hr;
1515 UINT i, j;
1516
1517 for (i = 0; i < ARRAY_SIZE(image_formats); ++i)
1518 {
1519 hr = create_and_init_encoder(buffer, sizeof(buffer), NULL, &encoder, &dds_encoder, &stream);
1520 if (hr != S_OK)
1521 {
1522 release_encoder(encoder, dds_encoder, stream);
1523 return;
1524 }
1525
1526 IWICDdsEncoder_GetParameters(dds_encoder, &params);
1527 params.DxgiFormat = image_formats[i];
1528 IWICDdsEncoder_SetParameters(dds_encoder, &params);
1529
1530 IWICBitmapEncoder_CreateNewFrame(encoder, &frame, NULL);
1531
1532 hr = IWICBitmapFrameEncode_SetPixelFormat(frame, &format);
1533 ok(hr == WINCODEC_ERR_NOTINITIALIZED, "SetPixelFormat got unexpected hr %#lx\n", hr);
1534
1535 IWICBitmapFrameEncode_Initialize(frame, NULL);
1536
1537 for (j = 0; j < ARRAY_SIZE(test_formats); ++j)
1538 {
1539 winetest_push_context("Test %u", j);
1540
1541 format = *(test_formats[j]);
1542 hr = IWICBitmapFrameEncode_SetPixelFormat(frame, &format);
1543 ok(hr == S_OK, "SetPixelFormat failed, hr %#lx\n", hr);
1544 ok(IsEqualGUID(&format, &GUID_WICPixelFormat32bppBGRA),
1545 "Got unexpected GUID %s\n", debugstr_guid(&format));
1546
1548 }
1549
1550 IWICBitmapFrameEncode_Release(frame);
1551 release_encoder(encoder, dds_encoder, stream);
1552 }
1553}
1554
1555static void test_dds_encoder(void)
1556{
1561}
1562
1563START_TEST(ddsformat)
1564{
1565 HRESULT hr;
1567
1568 hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
1569 &IID_IWICImagingFactory, (void **)&factory);
1570 ok(hr == S_OK, "CoCreateInstance failed, hr %#lx\n", hr);
1571 if (hr != S_OK) goto end;
1572
1575
1576end:
1577 if (factory) IWICImagingFactory_Release(factory);
1579}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:20
static previewinfo preview
Definition: print.c:56
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
void copy_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, const struct volume *size, const struct pixel_format_desc *format) DECLSPEC_HIDDEN
Definition: surface.c:1700
format_info
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
DWORD bpp
Definition: surface.c:185
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define GET_RGB565_B(color)
Definition: ddsformat.c:52
static DXGI_FORMAT compressed_formats[]
Definition: ddsformat.c:296
static void decode_block(const BYTE *block_data, UINT block_count, DXGI_FORMAT format, UINT width, UINT height, DWORD *buffer)
Definition: ddsformat.c:604
static BOOL has_extended_header(DDS_HEADER *header)
Definition: ddsformat.c:315
#define GET_RGB565_R(color)
Definition: ddsformat.c:50
#define MAKE_RGB565(r, g, b)
Definition: ddsformat.c:53
#define MAKE_ARGB(a, r, g, b)
Definition: ddsformat.c:54
static BOOL is_compressed(DXGI_FORMAT format)
Definition: ddsformat.c:548
static DWORD rgb565_to_argb(WORD color, BYTE alpha)
Definition: ddsformat.c:308
#define GET_RGB565_G(color)
Definition: ddsformat.c:51
DXGI_FORMAT
Definition: dxgiformat.idl:22
@ DXGI_FORMAT_B8G8R8A8_UNORM
Definition: dxgiformat.idl:110
@ DXGI_FORMAT_BC3_UNORM_SRGB
Definition: dxgiformat.idl:101
@ DXGI_FORMAT_BC3_TYPELESS
Definition: dxgiformat.idl:99
@ DXGI_FORMAT_BC5_UNORM
Definition: dxgiformat.idl:106
@ DXGI_FORMAT_BC1_UNORM
Definition: dxgiformat.idl:94
@ DXGI_FORMAT_R16G16B16A16_UNORM
Definition: dxgiformat.idl:34
@ DXGI_FORMAT_BC1_UNORM_SRGB
Definition: dxgiformat.idl:95
@ DXGI_FORMAT_BC2_TYPELESS
Definition: dxgiformat.idl:96
@ DXGI_FORMAT_R32G32B32_FLOAT
Definition: dxgiformat.idl:29
@ DXGI_FORMAT_UNKNOWN
Definition: dxgiformat.idl:23
@ DXGI_FORMAT_A8_UNORM
Definition: dxgiformat.idl:88
@ DXGI_FORMAT_BC6H_UF16
Definition: dxgiformat.idl:118
@ DXGI_FORMAT_BC6H_SF16
Definition: dxgiformat.idl:119
@ DXGI_FORMAT_BC7_TYPELESS
Definition: dxgiformat.idl:120
@ DXGI_FORMAT_R8_UNORM
Definition: dxgiformat.idl:84
@ DXGI_FORMAT_BC6H_TYPELESS
Definition: dxgiformat.idl:117
@ DXGI_FORMAT_BC7_UNORM
Definition: dxgiformat.idl:121
@ DXGI_FORMAT_BC5_TYPELESS
Definition: dxgiformat.idl:105
@ DXGI_FORMAT_BC2_UNORM_SRGB
Definition: dxgiformat.idl:98
@ DXGI_FORMAT_BC5_SNORM
Definition: dxgiformat.idl:107
@ DXGI_FORMAT_BC4_TYPELESS
Definition: dxgiformat.idl:102
@ DXGI_FORMAT_R32G32B32A32_FLOAT
Definition: dxgiformat.idl:25
@ DXGI_FORMAT_BC3_UNORM
Definition: dxgiformat.idl:100
@ DXGI_FORMAT_BC1_TYPELESS
Definition: dxgiformat.idl:93
@ DXGI_FORMAT_BC7_UNORM_SRGB
Definition: dxgiformat.idl:122
@ DXGI_FORMAT_BC2_UNORM
Definition: dxgiformat.idl:97
@ DXGI_FORMAT_B5G6R5_UNORM
Definition: dxgiformat.idl:108
@ DXGI_FORMAT_BC4_UNORM
Definition: dxgiformat.idl:103
@ DXGI_FORMAT_BC4_SNORM
Definition: dxgiformat.idl:104
@ DXGI_FORMAT_B8G8R8X8_UNORM
Definition: dxgiformat.idl:111
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizei stride
Definition: glext.h:5848
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint color
Definition: glext.h:6243
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLenum dst
Definition: glext.h:6340
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define S_OK
Definition: intsafe.h:52
static DWORD block_size(DWORD block)
Definition: jsutils.c:66
#define debugstr_guid
Definition: kernel32.h:35
JSAMPLE * image_buffer
void wine_init(int argc, char *argv[], char *error, int error_size)
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
Definition: mipmap.c:4858
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL expected
Definition: store.c:2063
static void test_formats(AUDCLNT_SHAREMODE mode)
Definition: render.c:379
#define todo_wine_if(is_todo)
Definition: custom.c:86
#define todo_wine
Definition: custom.c:89
static HPALETTE palette
Definition: clipboard.c:1345
static BYTE test_dds_dxt3[]
Definition: ddsformat.c:293
static BYTE test_dword[4]
Definition: ddsformat.c:387
static BYTE test_qword_b[8]
Definition: ddsformat.c:389
static BYTE test_dds_cube[]
Definition: ddsformat.c:160
static IWICBitmapDecoder * create_decoder(void)
Definition: ddsformat.c:485
static void release_encoder(IWICBitmapEncoder *encoder, IWICDdsEncoder *dds_encoder, IWICStream *stream)
Definition: ddsformat.c:553
static void test_dds_decoder_global_properties(IWICBitmapDecoder *decoder)
Definition: ddsformat.c:805
static BYTE test_dds_64bpp[]
Definition: ddsformat.c:120
static BYTE test_dds_dxt1c[]
Definition: ddsformat.c:252
static void test_dds_encoder_pixel_format(void)
Definition: ddsformat.c:1485
static BYTE test_dds_cube_dx10[]
Definition: ddsformat.c:181
static BYTE test_dds_96bpp[]
Definition: ddsformat.c:133
static void test_dds_decoder_frame_properties(IWICBitmapFrameDecode *frame_decode, IWICDdsFrameDecode *dds_frame, UINT frame_count, WICDdsParameters *params, struct test_data *test, UINT frame_index)
Definition: ddsformat.c:937
static void test_dds_encoder_create_frame(void)
Definition: ddsformat.c:1444
static IWICStream * create_stream(const void *image_data, UINT image_size)
Definition: ddsformat.c:465
static void test_dds_decoder(void)
Definition: ddsformat.c:1280
static BYTE test_dds_alpha[]
Definition: ddsformat.c:41
static BYTE test_dds_array[]
Definition: ddsformat.c:234
static void test_dds_encoder_initialize(void)
Definition: ddsformat.c:1321
static BYTE test_dds_24bpp[]
Definition: ddsformat.c:81
static void test_dds_decoder_frame(IWICBitmapDecoder *decoder, struct test_data *test)
Definition: ddsformat.c:1234
static void test_dds_decoder_image_parameters(void)
Definition: ddsformat.c:850
static HRESULT init_decoder(IWICBitmapDecoder *decoder, IWICStream *stream, HRESULT expected, BOOL wine_init)
Definition: ddsformat.c:532
static BYTE test_dds_dxt4[]
Definition: ddsformat.c:307
static IWICBitmapEncoder * create_encoder(void)
Definition: ddsformat.c:507
static BYTE test_dds_mipmaps[]
Definition: ddsformat.c:204
static void test_dds_decoder_initialize(void)
Definition: ddsformat.c:774
static BYTE test_dds_luminance[]
Definition: ddsformat.c:54
static BOOL color_buffer_match(DWORD *color_buffer_a, DWORD *color_buffer_b, UINT color_count)
Definition: ddsformat.c:749
static BYTE test_word[2]
Definition: ddsformat.c:386
static void test_dds_decoder_frame_data(IWICBitmapFrameDecode *frame, IWICDdsFrameDecode *dds_frame, UINT frame_count, WICDdsParameters *params, struct test_data *test, UINT frame_index)
Definition: ddsformat.c:1034
static BYTE test_dds_128bpp[]
Definition: ddsformat.c:147
static BYTE test_dds_dxt2[]
Definition: ddsformat.c:278
static HRESULT create_and_init_encoder(BYTE *image_buffer, UINT buffer_size, WICDdsParameters *params, IWICBitmapEncoder **encoder, IWICDdsEncoder **dds_encoder, IWICStream **stream)
Definition: ddsformat.c:560
static void test_dds_encoder_params(void)
Definition: ddsformat.c:1375
static BYTE test_qword_a[8]
Definition: ddsformat.c:388
static BYTE test_dds_32bpp_xrgb[]
Definition: ddsformat.c:94
#define BLOCK_HEIGHT
Definition: ddsformat.c:38
static BOOL color_match(DWORD color_a, DWORD color_b)
Definition: ddsformat.c:737
static BYTE test_dds_bad_header[sizeof(test_dds_dxt1c)]
Definition: ddsformat.c:384
static BYTE test_dds_12x12[]
Definition: ddsformat.c:340
static BYTE test_dds_dxt1a[]
Definition: ddsformat.c:265
static BYTE test_dds_dxt5[]
Definition: ddsformat.c:322
static BYTE test_dds_volume[]
Definition: ddsformat.c:218
static BYTE test_byte[1]
Definition: ddsformat.c:385
static BYTE test_dds_rgb565[]
Definition: ddsformat.c:67
static BYTE test_dds_32bpp_argb[]
Definition: ddsformat.c:107
static BYTE test_dds_bad_magic[sizeof(test_dds_dxt1c)]
Definition: ddsformat.c:383
static void test_dds_encoder(void)
Definition: ddsformat.c:1555
#define BLOCK_WIDTH
Definition: ddsformat.c:37
unsigned int UINT
Definition: ndis.h:50
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
static unsigned __int64 next
Definition: rand_nt.c:6
#define test
Definition: rosglue.h:37
void __winetest_cdecl winetest_push_context(const char *fmt,...)
#define win_skip
Definition: test.h:164
void winetest_pop_context(void)
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
& rect
Definition: startmenu.cpp:1413
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
WICDdsAlphaMode AlphaMode
Definition: wincodec.idl:354
WICDdsDimension Dimension
Definition: wincodec.idl:353
DXGI_FORMAT DxgiFormat
Definition: wincodec.idl:352
Definition: main.c:439
Definition: format.c:58
Definition: parse.h:23
const GUID * expected_pixel_format
Definition: ddsformat.c:398
UINT expected_frame_count
Definition: ddsformat.c:395
WICDdsParameters expected_parameters
Definition: ddsformat.c:399
UINT expected_bytes_per_block
Definition: ddsformat.c:396
HRESULT init_hr
Definition: ddsformat.c:394
UINT size
Definition: ddsformat.c:393
UINT pixel_format_bpp
Definition: ddsformat.c:397
BOOL wine_init
Definition: ddsformat.c:400
BYTE * data
Definition: ddsformat.c:392
@ WICBitmapEncoderNoCache
Definition: wincodec.idl:73
@ WICDdsTexture2D
Definition: wincodec.idl:199
@ WICDdsTexture3D
Definition: wincodec.idl:200
@ WICDdsTextureCube
Definition: wincodec.idl:201
@ WICDecodeMetadataCacheOnDemand
Definition: wincodec.idl:29
@ WICDdsAlphaModePremultiplied
Definition: wincodec.idl:208
@ WICDdsAlphaModeUnknown
Definition: wincodec.idl:206
#define WINCODEC_ERR_WRONGSTATE
Definition: winerror.h:3281
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
Definition: winerror.h:3308
#define WINCODEC_ERR_NOTINITIALIZED
Definition: winerror.h:3285
#define WINCODEC_ERR_BADHEADER
Definition: winerror.h:3300
#define WINCODEC_ERR_PALETTEUNAVAILABLE
Definition: winerror.h:3292
#define WINCODEC_ERR_CODECNOTHUMBNAIL
Definition: winerror.h:3291
#define WINCODEC_ERR_UNKNOWNIMAGEFORMAT
Definition: winerror.h:3283
#define WINCODEC_ERR_INSUFFICIENTBUFFER
Definition: winerror.h:3311
#define WINCODEC_ERR_STREAMREAD
Definition: winerror.h:3305
static unsigned int block
Definition: xmlmemory.c:101
unsigned char BYTE
Definition: xxhash.c:193