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