71 #define LUT8_PART(plane, v) \
72 AV_LE2NE64C(UINT64_C(0x0000000)<<32 | v) << plane, \
73 AV_LE2NE64C(UINT64_C(0x1000000)<<32 | v) << plane, \
74 AV_LE2NE64C(UINT64_C(0x0010000)<<32 | v) << plane, \
75 AV_LE2NE64C(UINT64_C(0x1010000)<<32 | v) << plane, \
76 AV_LE2NE64C(UINT64_C(0x0000100)<<32 | v) << plane, \
77 AV_LE2NE64C(UINT64_C(0x1000100)<<32 | v) << plane, \
78 AV_LE2NE64C(UINT64_C(0x0010100)<<32 | v) << plane, \
79 AV_LE2NE64C(UINT64_C(0x1010100)<<32 | v) << plane, \
80 AV_LE2NE64C(UINT64_C(0x0000001)<<32 | v) << plane, \
81 AV_LE2NE64C(UINT64_C(0x1000001)<<32 | v) << plane, \
82 AV_LE2NE64C(UINT64_C(0x0010001)<<32 | v) << plane, \
83 AV_LE2NE64C(UINT64_C(0x1010001)<<32 | v) << plane, \
84 AV_LE2NE64C(UINT64_C(0x0000101)<<32 | v) << plane, \
85 AV_LE2NE64C(UINT64_C(0x1000101)<<32 | v) << plane, \
86 AV_LE2NE64C(UINT64_C(0x0010101)<<32 | v) << plane, \
87 AV_LE2NE64C(UINT64_C(0x1010101)<<32 | v) << plane
89 #define LUT8(plane) { \
90 LUT8_PART(plane, 0x0000000), \
91 LUT8_PART(plane, 0x1000000), \
92 LUT8_PART(plane, 0x0010000), \
93 LUT8_PART(plane, 0x1010000), \
94 LUT8_PART(plane, 0x0000100), \
95 LUT8_PART(plane, 0x1000100), \
96 LUT8_PART(plane, 0x0010100), \
97 LUT8_PART(plane, 0x1010100), \
98 LUT8_PART(plane, 0x0000001), \
99 LUT8_PART(plane, 0x1000001), \
100 LUT8_PART(plane, 0x0010001), \
101 LUT8_PART(plane, 0x1010001), \
102 LUT8_PART(plane, 0x0000101), \
103 LUT8_PART(plane, 0x1000101), \
104 LUT8_PART(plane, 0x0010101), \
105 LUT8_PART(plane, 0x1010101), \
114 #define LUT32(plane) { \
116 0, 0, 0, 1U << plane, \
117 0, 0, 1U << plane, 0, \
118 0, 0, 1U << plane, 1U << plane, \
119 0, 1U << plane, 0, 0, \
120 0, 1U << plane, 0, 1U << plane, \
121 0, 1U << plane, 1U << plane, 0, \
122 0, 1U << plane, 1U << plane, 1U << plane, \
123 1U << plane, 0, 0, 0, \
124 1U << plane, 0, 0, 1U << plane, \
125 1U << plane, 0, 1U << plane, 0, \
126 1U << plane, 0, 1U << plane, 1U << plane, \
127 1U << plane, 1U << plane, 0, 0, \
128 1U << plane, 1U << plane, 0, 1U << plane, \
129 1U << plane, 1U << plane, 1U << plane, 0, \
130 1U << plane, 1U << plane, 1U << plane, 1U << plane, \
147 return x << 16 | x << 8 | x;
170 pal[
i] = 0xFF000000 |
AV_RB24(palette +
i*3);
171 if (
s->flags &&
count >= 32) {
172 for (
i = 0;
i < 32;
i++)
173 pal[
i + 32] = 0xFF000000 | (
AV_RB24(palette +
i*3) & 0xFEFEFE) >> 1;
192 pal[
s->transparency] &= 0xFFFFFF;
209 unsigned buf_size = 0;
225 chunk_id = bytestream2_get_le32(gb);
226 data_size = bytestream2_get_be32(gb);
228 if (chunk_id ==
MKTAG(
'B',
'M',
'H',
'D')) {
230 }
else if (chunk_id ==
MKTAG(
'A',
'N',
'H',
'D')) {
235 s->compression = (bytestream2_get_byte(gb) << 8) | (
s->compression & 0xFF);
237 extra = bytestream2_get_be32(gb);
238 s->is_short = !(extra & 1);
239 s->is_brush = extra == 2;
240 s->is_interlaced = !!(extra & 0x40);
243 }
else if (chunk_id ==
MKTAG(
'D',
'L',
'T',
'A') ||
244 chunk_id ==
MKTAG(
'B',
'O',
'D',
'Y')) {
245 if (chunk_id ==
MKTAG(
'B',
'O',
'D',
'Y'))
246 s->compression &= 0xFF;
248 }
else if (chunk_id ==
MKTAG(
'C',
'M',
'A',
'P')) {
249 int count = data_size / 3;
250 uint32_t *pal =
s->pal;
256 pal[
i] = 0xFF000000 | bytestream2_get_le24(gb);
259 pal[
i] = 0xFF000000 | bytestream2_get_be24(gb);
268 buf_size = bytestream_get_be16(&
buf);
269 if (buf_size <= 1 || palette_size < 0) {
271 "Invalid palette size received: %u -> palette data offset: %d\n",
272 buf_size, palette_size);
277 if (buf_size >= 41) {
278 s->compression = bytestream_get_byte(&
buf);
279 s->bpp = bytestream_get_byte(&
buf);
280 s->ham = bytestream_get_byte(&
buf);
281 s->flags = bytestream_get_byte(&
buf);
282 s->transparency = bytestream_get_be16(&
buf);
283 s->masking = bytestream_get_byte(&
buf);
284 for (
i = 0;
i < 16;
i++)
285 s->tvdc[
i] = bytestream_get_be16(&
buf);
291 }
else if (
s->ham != (
s->bpp > 6 ? 6 : 4)) {
292 av_log(avctx,
AV_LOG_ERROR,
"Invalid number of hold bits for HAM: %u, BPP: %u\n",
s->ham,
s->bpp);
298 if (
s->bpp >= 8 && !
s->ham) {
311 if (!
s->mask_palbuf) {
321 if (!
s->bpp ||
s->bpp > 32) {
325 if (
s->video_size &&
s->planesize *
s->bpp * avctx->
height >
s->video_size)
344 ham_count = 8 * (1 <<
s->ham);
346 if (!
s->ham_palbuf) {
353 memset(
s->ham_palbuf, 0, (1 <<
s->ham) * 2 * sizeof (uint32_t));
355 s->ham_palbuf[
i*2+1] = 0xFF000000 |
AV_RL24(palette +
i*3);
361 s->ham_palbuf[
i*2] = 0xFF000000;
366 uint32_t
tmp =
i << (8 -
s->ham);
368 s->ham_palbuf[(
i+
count)*2] = 0xFF00FFFF;
369 s->ham_palbuf[(
i+
count*2)*2] = 0xFFFFFF00;
370 s->ham_palbuf[(
i+
count*3)*2] = 0xFFFF00FF;
371 s->ham_palbuf[(
i+
count)*2+1] = 0xFF000000 |
tmp << 16;
372 s->ham_palbuf[(
i+
count*2)*2+1] = 0xFF000000 |
tmp;
373 s->ham_palbuf[(
i+
count*3)*2+1] = 0xFF000000 |
tmp << 8;
376 for (
i = 0;
i < ham_count;
i++)
377 s->ham_palbuf[(1 <<
s->bpp) +
i] =
s->ham_palbuf[
i] | 0xFF000000;
448 if (!
s->video[0] || !
s->video[1] || !
s->pal)
477 }
while (--buf_size);
491 unsigned mask = (*
buf >> 2) & ~3;
492 dst[0] |= lut[
mask++];
493 dst[1] |= lut[
mask++];
494 dst[2] |= lut[
mask++];
497 dst[4] |= lut[
mask++];
498 dst[5] |= lut[
mask++];
499 dst[6] |= lut[
mask++];
502 }
while (--buf_size);
505 #define DECODE_HAM_PLANE32(x) \
506 first = buf[x] << 1; \
507 second = buf[(x)+1] << 1; \
508 delta &= pal[first++]; \
509 delta |= pal[first]; \
511 delta &= pal[second++]; \
512 delta |= pal[second]; \
524 const uint32_t *
const pal,
unsigned buf_size)
526 uint32_t
delta = pal[1];
528 uint32_t
first, second;
535 }
while (--buf_size);
539 const uint32_t *
const pal,
unsigned width)
542 *dst++ = pal[*
buf++];
561 const int8_t
value = bytestream2_get_byte(gb);
567 }
else if (
value > -128) {
569 memset(dst + x, bytestream2_get_byte(gb),
length);
577 memset(dst+x, 0, dst_size - x);
587 int i, y_pos = 0, x_pos = 0;
589 if (bytestream2_get_be32(gb) !=
MKBETAG(
'V',
'D',
'A',
'T'))
593 count = bytestream2_get_be16(gb) - 2;
600 for (
i = 0;
i <
count && x_pos < line_size;
i++) {
601 int8_t cmd = bytestream2_get_byte(&
cmds);
605 l = bytestream2_get_be16(gb);
606 while (l-- > 0 && x_pos < line_size) {
607 dst[x_pos + y_pos * line_size ] = bytestream2_get_byte(gb);
608 dst[x_pos + y_pos++ * line_size + 1] = bytestream2_get_byte(gb);
614 }
else if (cmd < 0) {
616 while (l-- > 0 && x_pos < line_size) {
617 dst[x_pos + y_pos * line_size ] = bytestream2_get_byte(gb);
618 dst[x_pos + y_pos++ * line_size + 1] = bytestream2_get_byte(gb);
624 }
else if (cmd == 1) {
625 l = bytestream2_get_be16(gb);
626 r = bytestream2_get_be16(gb);
627 while (l-- > 0 && x_pos < line_size) {
628 dst[x_pos + y_pos * line_size ] =
r >> 8;
629 dst[x_pos + y_pos++ * line_size + 1] =
r & 0xFF;
637 r = bytestream2_get_be16(gb);
638 while (l-- > 0 && x_pos < line_size) {
639 dst[x_pos + y_pos * line_size ] =
r >> 8;
640 dst[x_pos + y_pos++ * line_size + 1] =
r & 0xFF;
652 #define DECODE_RGBX_COMMON(type) \
654 length = bytestream2_get_byte(gb); \
656 length = bytestream2_get_be16(gb); \
661 for (i = 0; i < length; i++) { \
662 *(type *)(dst + y*linesize + x * sizeof(type)) = pixel; \
683 uint32_t
pixel = 0xFF000000 | bytestream2_get_be24(gb);
684 length = bytestream2_get_byte(gb) & 0x7F;
700 uint32_t
pixel = bytestream2_get_be16u(gb);
720 while (src_end -
src >= 5) {
722 opcode = *(int8_t *)
src++;
724 int size = opcode + 1;
729 memcpy(dst + y*linesize + x * 4,
src,
length * 4);
741 int size = -opcode + 1;
744 *(uint32_t *)(dst + y*linesize + x * 4) =
pixel;
770 int x = 0, y = 0,
plane = 0;
774 for (
i = 0;
i < src_size * 2;) {
775 #define GETNIBBLE ((i & 1) ? (src[i>>1] & 0xF) : (src[i>>1] >> 4))
783 if (
i >= src_size * 2)
788 for (j = 0; j < d; j++) {
810 int w,
int bpp,
int dst_size)
812 int planepitch =
FFALIGN(
w, 16) >> 3;
813 int pitch = planepitch * bpp;
816 unsigned ofssrc, pos;
822 for (k = 0; k < bpp; k++) {
823 ofssrc = bytestream2_get_be32(&ptrs);
829 if (ofssrc >= buf_end -
buf)
834 int16_t
offset = bytestream2_get_be16(&gb);
838 unsigned data = bytestream2_get_be16(&gb);
841 noffset = (pos / planepitch) * pitch + (pos % planepitch) + k * planepitch;
843 bytestream2_put_be16(&pb,
data);
845 uint16_t
count = bytestream2_get_be16(&gb);
849 uint16_t
data = bytestream2_get_be16(&gb);
852 noffset = (pos / planepitch) * pitch + (pos % planepitch) + k * planepitch;
854 bytestream2_put_be16(&pb,
data);
863 int w,
int xor,
int bpp,
int dst_size)
865 int ncolumns = ((
w + 15) / 16) * 2;
866 int dstpitch = ncolumns * bpp;
867 unsigned ofsdst, ofssrc, opcode, x;
875 for (k = 0; k < bpp; k++) {
876 ofssrc = bytestream2_get_be32(&ptrs);
881 if (ofssrc >= buf_end -
buf)
885 for (j = 0; j < ncolumns; j++) {
886 ofsdst = j + k * ncolumns;
888 i = bytestream2_get_byte(&gb);
890 opcode = bytestream2_get_byte(&gb);
893 opcode = bytestream2_get_byte(&gb);
894 x = bytestream2_get_byte(&gb);
898 if (xor && ofsdst < dst_size) {
899 bytestream2_put_byte(&pb, dst[ofsdst] ^ x);
901 bytestream2_put_byte(&pb, x);
906 }
else if (opcode < 0x80) {
907 ofsdst += opcode * dstpitch;
913 if (xor && ofsdst < dst_size) {
914 bytestream2_put_byte(&pb, dst[ofsdst] ^ bytestream2_get_byte(&gb));
916 bytestream2_put_byte(&pb, bytestream2_get_byte(&gb));
930 int w,
int h,
int bpp,
int dst_size)
934 uint32_t
type,
flag, cols, groups, rows, bytes;
936 int planepitch_byte = (
w + 7) / 8;
937 int planepitch = ((
w + 15) / 16) * 2;
938 int kludge_j,
b,
g,
r, d;
941 pitch = planepitch * bpp;
942 kludge_j =
w < 320 ? (320 -
w) / 8 / 2 : 0;
947 type = bytestream2_get_be16(&gb);
953 flag = bytestream2_get_be16(&gb);
954 cols = bytestream2_get_be16(&gb);
955 groups = bytestream2_get_be16(&gb);
957 for (
g = 0;
g < groups;
g++) {
958 offset = bytestream2_get_be16(&gb);
970 for (
b = 0;
b < cols;
b++) {
971 for (d = 0; d < bpp; d++) {
986 if ((cols * bpp) & 1)
991 flag = bytestream2_get_be16(&gb);
992 rows = bytestream2_get_be16(&gb);
993 bytes = bytestream2_get_be16(&gb);
994 groups = bytestream2_get_be16(&gb);
996 for (
g = 0;
g < groups;
g++) {
997 offset = bytestream2_get_be16(&gb);
1004 for (
r = 0;
r < rows;
r++) {
1005 for (d = 0; d < bpp; d++) {
1006 unsigned noffset =
offset + (
r * pitch) + d * planepitch;
1013 for (
b = 0;
b < bytes;
b++) {
1016 if (noffset >= dst_size)
1018 ptr = dst + noffset;
1029 if ((rows * bytes * bpp) & 1)
1041 int w,
int bpp,
int dst_size)
1043 int ncolumns = (
w + 15) >> 4;
1044 int dstpitch = ncolumns * bpp * 2;
1045 unsigned ofsdst, ofssrc, ofsdata, opcode, x;
1050 if (buf_end -
buf <= 64)
1057 for (k = 0; k < bpp; k++) {
1058 ofssrc = bytestream2_get_be32(&ptrs);
1059 ofsdata = bytestream2_get_be32(&dptrs);
1064 if (ofssrc >= buf_end -
buf)
1067 if (ofsdata >= buf_end -
buf)
1072 for (j = 0; j < ncolumns; j++) {
1073 ofsdst = (j + k * ncolumns) * 2;
1075 i = bytestream2_get_byte(&gb);
1077 opcode = bytestream2_get_byte(&gb);
1080 opcode = bytestream2_get_byte(&gb);
1081 x = bytestream2_get_be16(&dgb);
1085 bytestream2_put_be16(&pb, x);
1089 }
else if (opcode < 0x80) {
1090 ofsdst += opcode * dstpitch;
1096 bytestream2_put_be16(&pb, bytestream2_get_be16(&dgb));
1109 int w,
int bpp,
int dst_size)
1111 int ncolumns = (
w + 31) >> 5;
1112 int dstpitch = ((
w + 15) / 16 * 2) * bpp;
1113 unsigned ofsdst, ofssrc, ofsdata, opcode, x;
1118 if (buf_end -
buf <= 64)
1121 h = (((
w + 15) / 16 * 2) != ((
w + 31) / 32 * 4)) ? 1 : 0;
1126 for (k = 0; k < bpp; k++) {
1127 ofssrc = bytestream2_get_be32(&ptrs);
1128 ofsdata = bytestream2_get_be32(&dptrs);
1133 if (ofssrc >= buf_end -
buf)
1136 if (ofsdata >= buf_end -
buf)
1141 for (j = 0; j < ncolumns; j++) {
1142 ofsdst = (j + k * ncolumns) * 4 -
h * (2 * k);
1144 i = bytestream2_get_byte(&gb);
1146 opcode = bytestream2_get_byte(&gb);
1149 opcode = bytestream2_get_byte(&gb);
1150 if (
h && (j == (ncolumns - 1))) {
1151 x = bytestream2_get_be16(&dgb);
1154 x = bytestream2_get_be32(&dgb);
1162 if (
h && (j == (ncolumns - 1))) {
1163 bytestream2_put_be16(&pb, x);
1165 bytestream2_put_be32(&pb, x);
1170 }
else if (opcode < 0x80) {
1171 ofsdst += opcode * dstpitch;
1177 if (
h && (j == (ncolumns - 1))) {
1178 bytestream2_put_be16(&pb, bytestream2_get_be16(&dgb));
1181 bytestream2_put_be32(&pb, bytestream2_get_be32(&dgb));
1195 int w,
int bpp,
int dst_size)
1197 int ncolumns = (
w + 15) >> 4;
1198 int dstpitch = ncolumns * bpp * 2;
1199 unsigned ofsdst, ofssrc, opcode, x;
1207 for (k = 0; k < bpp; k++) {
1208 ofssrc = bytestream2_get_be32(&ptrs);
1213 if (ofssrc >= buf_end -
buf)
1217 for (j = 0; j < ncolumns; j++) {
1218 ofsdst = (j + k * ncolumns) * 2;
1220 i = bytestream2_get_be16(&gb);
1222 opcode = bytestream2_get_be16(&gb);
1225 opcode = bytestream2_get_be16(&gb);
1226 x = bytestream2_get_be16(&gb);
1230 bytestream2_put_be16(&pb, x);
1234 }
else if (opcode < 0x8000) {
1235 ofsdst += opcode * dstpitch;
1242 bytestream2_put_be16(&pb, bytestream2_get_be16(&gb));
1255 int w,
int bpp,
int dst_size)
1257 int ncolumns = (
w + 31) >> 5;
1258 int dstpitch = ((
w + 15) / 16 * 2) * bpp;
1259 unsigned ofsdst, ofssrc, opcode, x;
1260 unsigned skip = 0x80000000,
mask = skip - 1;
1265 h = (((
w + 15) / 16 * 2) != ((
w + 31) / 32 * 4)) ? 1 : 0;
1269 for (k = 0; k < bpp; k++) {
1270 ofssrc = bytestream2_get_be32(&ptrs);
1275 if (ofssrc >= buf_end -
buf)
1279 for (j = 0; j < ncolumns; j++) {
1280 ofsdst = (j + k * ncolumns) * 4 -
h * (2 * k);
1282 if (
h && (j == (ncolumns - 1))) {
1287 i = bytestream2_get_be32(&gb);
1289 opcode = bytestream2_get_be32(&gb);
1292 if (
h && (j == ncolumns - 1)) {
1293 opcode = bytestream2_get_be16(&gb);
1294 x = bytestream2_get_be16(&gb);
1296 opcode = bytestream2_get_be32(&gb);
1297 x = bytestream2_get_be32(&gb);
1305 if (
h && (j == ncolumns - 1))
1306 bytestream2_put_be16(&pb, x);
1308 bytestream2_put_be32(&pb, x);
1312 }
else if (opcode < skip) {
1313 ofsdst += opcode * dstpitch;
1320 if (
h && (j == ncolumns - 1)) {
1321 bytestream2_put_be16(&pb, bytestream2_get_be16(&gb));
1323 bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));
1337 int w,
int flag,
int bpp,
int dst_size)
1339 int planepitch =
FFALIGN(
w, 16) >> 3;
1340 int pitch = planepitch * bpp;
1341 int planepitch_byte = (
w + 7) / 8;
1342 unsigned entries, ofssrc;
1347 if (buf_end -
buf <= 4 * bpp)
1353 for (k = 0; k < bpp; k++) {
1354 ofssrc = bytestream2_get_be32(&ptrs);
1359 if (ofssrc >= buf_end -
buf)
1364 entries = bytestream2_get_be32(&gb);
1366 int32_t opcode = bytestream2_get_be32(&gb);
1367 unsigned offset = bytestream2_get_be32(&gb);
1371 uint32_t x = bytestream2_get_be32(&gb);
1375 bytestream2_put_be32(&pb, x);
1381 bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));
1393 int w,
int flag,
int bpp,
int dst_size)
1395 int planepitch =
FFALIGN(
w, 16) >> 3;
1396 int pitch = planepitch * bpp;
1397 int planepitch_byte = (
w + 7) / 8;
1398 unsigned entries, ofssrc;
1403 if (buf_end -
buf <= 4 * bpp)
1409 for (k = 0; k < bpp; k++) {
1410 ofssrc = bytestream2_get_be32(&ptrs);
1415 if (ofssrc >= buf_end -
buf)
1420 entries = bytestream2_get_be16(&gb);
1422 int16_t opcode = bytestream2_get_be16(&gb);
1423 unsigned offset = bytestream2_get_be32(&gb);
1427 uint16_t x = bytestream2_get_be16(&gb);
1429 bytestream2_put_be16(&pb, x);
1436 bytestream2_put_be16(&pb, bytestream2_get_be16(&gb));
1448 int w,
int flag,
int bpp,
int dst_size)
1452 unsigned poff0, poff1;
1454 int planepitch_byte = (
w + 7) / 8;
1455 int planepitch = ((
w + 15) / 16) * 2;
1456 int pitch = planepitch * bpp;
1458 if (buf_end -
buf <= 64)
1465 dstpitch =
flag ? (((
w + 7) / 8) * bpp): 2;
1467 for (k = 0; k < bpp; k++) {
1468 poff0 = bytestream2_get_be32(&off0);
1469 poff1 = bytestream2_get_be32(&off1);
1474 if (2LL * poff0 >= buf_end -
buf)
1477 if (2LL * poff1 >= buf_end -
buf)
1484 uint32_t
offset = bytestream2_get_be16(&ogb);
1485 int16_t cnt = bytestream2_get_be16(&ogb);
1488 offset = ((2 *
offset) / planepitch_byte) * pitch + ((2 *
offset) % planepitch_byte) + k * planepitch;
1494 data = bytestream2_get_be16(&dgb);
1495 for (
i = 0;
i < cnt;
i++) {
1496 bytestream2_put_be16(&pb,
data);
1503 for (
i = 0;
i < cnt;
i++) {
1504 data = bytestream2_get_be16(&dgb);
1505 bytestream2_put_be16(&pb,
data);
1516 avpriv_request_sample(avctx,
"bitmap (compression 0x%0x, bpp %i, ham %i, interlaced %i)",
s->compression,
s->bpp,
s->ham,
s->is_interlaced);
1521 void *
data,
int *got_frame,
1527 int buf_size = avpkt->
size;
1557 if (
s->compression <= 0xff && (avctx->
codec_tag ==
MKTAG(
'A',
'N',
'I',
'M'))) {
1559 memcpy(
s->pal,
s->frame->data[1], 256 * 4);
1562 switch (
s->compression) {
1568 for (y = 0; y < avctx->
height &&
buf < buf_end; y++) {
1571 buf +=
s->planesize;
1574 }
else if (
s->ham) {
1576 for (y = 0; y < avctx->
height; y++) {
1578 memset(
s->ham_buf, 0,
s->planesize * 8);
1592 for (y = 0; y < avctx->
height &&
buf < buf_end; y++) {
1594 memcpy(row,
buf,
FFMIN(raw_width, buf_end -
buf));
1597 for (x = 0; x < avctx->
width; x++)
1598 row[4 * x + 3] = row[4 * x + 3] & 0xF0 | (row[4 * x + 3] >> 4);
1604 memcpy(
s->video[0],
buf,
FFMIN(buf_end -
buf,
s->video_size));
1606 for (y = 0; y < avctx->
height; y++) {
1608 memset(row, 0, avctx->
width);
1611 buf +=
s->planesize;
1614 }
else if (
s->ham) {
1615 for (y = 0; y < avctx->
height; y++) {
1617 memset(
s->ham_buf, 0,
s->planesize * 8);
1620 buf +=
s->planesize;
1625 for (y = 0; y < avctx->
height; y++) {
1627 memset(row, 0, avctx->
width << 2);
1631 buf +=
s->planesize;
1637 for (y = 0; y < avctx->
height && buf_end >
buf; y++) {
1642 }
else if (
s->ham) {
1643 for (y = 0; y < avctx->
height && buf_end >
buf; y++) {
1661 for (y = 0; y < avctx->
height; y++) {
1663 memset(row, 0, avctx->
width);
1667 memcpy(
video,
s->planebuf,
s->planesize);
1674 for (y = 0; y < avctx->
height; y++) {
1676 memset(
s->mask_buf, 0, avctx->
width *
sizeof(uint32_t));
1683 }
else if (
s->ham) {
1685 for (y = 0; y < avctx->
height; y++) {
1687 memset(
s->ham_buf, 0,
s->planesize * 8);
1691 memcpy(
video,
s->planebuf,
s->planesize);
1699 for (y = 0; y < avctx->
height; y++) {
1701 memset(row, 0, avctx->
width << 2);
1710 for (y = 0; y < avctx->
height; y++) {
1714 }
else if (
s->ham) {
1715 for (y = 0; y < avctx->
height; y++) {
1731 for (y = 0; y < avctx->
height &&
buf < buf_end; y++) {
1734 buf +=
s->planesize;
1737 }
else if (
s->ham) {
1739 for (y = 0; y < avctx->
height; y++) {
1741 memset(
s->ham_buf, 0,
s->planesize * 8);
1761 for (y = 0; y < avctx->
height; y++) {
1815 if (
s->is_interlaced)
1821 if (
s->is_interlaced)
1833 if (
s->compression <= 0xff && (avctx->
codec_tag ==
MKTAG(
'A',
'N',
'I',
'M'))) {
1834 memcpy(
s->video[1],
s->video[0],
s->video_size);
1837 if (
s->compression > 0xff) {
1840 for (y = 0; y < avctx->
height; y++) {
1842 memset(row, 0, avctx->
width);
1845 buf +=
s->planesize;
1849 memcpy(
frame->data[1],
s->pal, 256 * 4);
1850 }
else if (
s->ham) {
1854 memset(
s->ham_palbuf, 0, (1 <<
s->ham) * 2 *
sizeof(uint32_t));
1856 s->ham_palbuf[
i*2+1] =
s->pal[
i];
1859 uint32_t
tmp =
i << (8 -
s->ham);
1861 s->ham_palbuf[(
i+
count)*2] = 0xFF00FFFF;
1862 s->ham_palbuf[(
i+
count*2)*2] = 0xFFFFFF00;
1863 s->ham_palbuf[(
i+
count*3)*2] = 0xFFFF00FF;
1864 s->ham_palbuf[(
i+
count)*2+1] = 0xFF000000 |
tmp << 16;
1865 s->ham_palbuf[(
i+
count*2)*2+1] = 0xFF000000 |
tmp;
1866 s->ham_palbuf[(
i+
count*3)*2+1] = 0xFF000000 |
tmp << 8;
1869 for (
i = 0;
i < 8 * (1 <<
s->ham);
i++)
1870 s->ham_palbuf[(1 <<
s->bpp) +
i] =
s->ham_palbuf[
i] | 0xFF000000;
1872 for (y = 0; y < avctx->
height; y++) {
1874 memset(
s->ham_buf, 0,
s->planesize * 8);
1877 buf +=
s->planesize;
1891 frame->key_frame = 1;
1894 frame->key_frame = 0;
1903 #if CONFIG_IFF_ILBM_DECODER