1 /*
2 * Renderware TeXture Dictionary (.txd) image decoder
3 * Copyright (c) 2007 Ivo van Poorten
4 *
5 * See also: http://wiki.multimedia.cx/index.php?title=TXD
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
31
32 #define TXD_DXT1 0x31545844
33 #define TXD_DXT3 0x33545844
34
37 {
41 unsigned int y, v;
42 uint8_t *ptr;
43 uint32_t *pal;
46
49
51
53 version = bytestream2_get_le32(&gb);
56 w = bytestream2_get_le16(&gb);
57 h = bytestream2_get_le16(&gb);
58 depth = bytestream2_get_byte(&gb);
60 flags = bytestream2_get_byte(&gb);
61
62 if (version < 8 || version > 9) {
65 }
66
67 if (depth == 8) {
71 } else if (depth == 16) {
74 case 0:
80 break;
84 }
85 } else if (depth == 32) {
89 } else {
92 }
93
96
99
102
104
107
108 if (depth == 8) {
109 pal = (uint32_t *) p->
data[1];
110 for (y = 0; y < 256; y++) {
111 v = bytestream2_get_be32(&gb);
112 pal[y] = (v >> 8) + (v << 24);
113 }
115 for (y=0; y<
h; y++) {
118 }
119 } else if (depth == 16) {
122 case 0:
124 for (j = 0; j < avctx->
height; j += 4) {
125 for (
i = 0;
i < avctx->
width;
i += 4) {
126 uint8_t *p = ptr +
i * 4 + j *
stride;
129 }
130 }
131 break;
133 for (j = 0; j < avctx->
height; j += 4) {
134 for (
i = 0;
i < avctx->
width;
i += 4) {
135 uint8_t *p = ptr +
i * 4 + j *
stride;
138 }
139 }
140 break;
141 default:
143 }
144 } else if (depth == 32) {
146 case 0x15:
147 case 0x16:
148 for (y=0; y<
h; y++) {
151 }
152 break;
153 default:
155 }
156 }
157
158 *got_frame = 1;
159
161
165 }
166
174 };