69 int mask = 0x10000, bitbuf = 0;
70 int v, count, segments;
73 segments = bytestream2_get_le32(gb);
74 offset = bytestream2_get_le32(gb);
75 if (segments == 0 && offset == frame_end - frame)
77 if (frame_end - frame <= offset)
83 if (mask == 0x10000) {
84 bitbuf = bytestream2_get_le16u(gb);
87 if (frame_end - frame < 2)
90 v = bytestream2_get_le16(gb);
91 offset = (v & 0x1FFF) << 1;
92 count = ((v >> 13) + 2) << 1;
93 if (frame - frame_start < offset || frame_end - frame < count)
98 *frame++ = bytestream2_get_byte(gb);
99 *frame++ = bytestream2_get_byte(gb);
111 int mask = 0x10000, bitbuf = 0;
112 int v,
offset, count, segments;
114 segments = bytestream2_get_le16(gb);
118 if (mask == 0x10000) {
119 bitbuf = bytestream2_get_le16u(gb);
122 if (frame_end - frame < 2)
125 v = bytestream2_get_le16(gb);
126 offset = (v & 0x1FFF) << 1;
127 count = ((v >> 13) + 2) << 1;
128 if (frame - frame_start < offset || frame_end - frame < count)
132 }
else if (bitbuf & (mask << 1)) {
133 frame += bytestream2_get_le16(gb);
135 *frame++ = bytestream2_get_byte(gb);
136 *frame++ = bytestream2_get_byte(gb);
148 int mask = 0x10000, bitbuf = 0;
149 int i,
v,
offset, count, segments;
151 segments = bytestream2_get_le16(gb);
155 if (mask == 0x10000) {
156 bitbuf = bytestream2_get_le16u(gb);
161 v = bytestream2_get_le16(gb);
162 offset = (v & 0x1FFF) << 2;
163 count = ((v >> 13) + 2) << 1;
164 if (frame - frame_start < offset || frame_end - frame < count*2 + width)
166 for (i = 0; i < count; i++) {
167 frame[0] = frame[1] =
172 }
else if (bitbuf & (mask << 1)) {
173 v = bytestream2_get_le16(gb)*2;
174 if (frame - frame_end < v)
178 if (frame_end - frame < width + 3)
180 frame[0] = frame[1] =
181 frame[
width] = frame[width + 1] = bytestream2_get_byte(gb);
183 frame[0] = frame[1] =
184 frame[
width] = frame[width + 1] = bytestream2_get_byte(gb);
196 int count, lines, segments;
198 count = bytestream2_get_le16(gb);
201 frame += width * count;
202 lines = bytestream2_get_le16(gb);
203 if (count + lines > height)
211 segments = bytestream2_get_byteu(gb);
213 if (frame - line_ptr <= bytestream2_peek_byte(gb))
215 line_ptr += bytestream2_get_byte(gb);
216 count = (int8_t)bytestream2_get_byte(gb);
218 if (frame - line_ptr < count)
224 if (frame - line_ptr < count)
226 memset(line_ptr, bytestream2_get_byte(gb), count);
239 int count, i,
v, lines, segments;
242 lines = bytestream2_get_le16(gb);
249 segments = bytestream2_get_le16u(gb);
250 while ((segments & 0xC000) == 0xC000) {
251 unsigned skip_lines = -(int16_t)segments;
252 unsigned delta = -((int16_t)segments * width);
253 if (frame_end - frame <= delta || y + lines + skip_lines > height)
257 segments = bytestream2_get_le16(gb);
259 if (frame_end <= frame)
261 if (segments & 0x8000) {
262 frame[width - 1] = segments & 0xFF;
263 segments = bytestream2_get_le16(gb);
269 if (frame - line_ptr <= bytestream2_peek_byte(gb))
271 line_ptr += bytestream2_get_byte(gb);
272 count = (int8_t)bytestream2_get_byte(gb);
274 if (frame - line_ptr < count * 2)
278 line_ptr += count * 2;
281 if (frame - line_ptr < count * 2)
283 v = bytestream2_get_le16(gb);
284 for (i = 0; i < count; i++)
285 bytestream_put_le16(&line_ptr, v);
300 memset(frame, 0, width * height);
313 "COPY",
"TSW1",
"BDLT",
"WDLT",
"????",
"DSW1",
"BLCK",
"DDS1"
317 void *
data,
int *got_frame,
323 uint32_t chunk_type, chunk_size;
339 chunk_size = bytestream2_get_le32(&gb);
340 chunk_type = bytestream2_get_le32(&gb);
343 if (chunk_type == 1) {
344 pal_elems =
FFMIN(chunk_size / 3, 256);
345 for (i = 0; i < pal_elems; i++) {
346 s->
pal[i] = bytestream2_get_be24(&gb) << 2;
347 s->
pal[i] |= 0xFF
U << 24 | (s->
pal[i] >> 6) & 0x30303;
350 }
else if (chunk_type <= 9) {
365 for (i = 0; i < avctx->
height; i++) {
366 memcpy(dst, buf, avctx->
width);