40 #define LUT8_PART(plane, v) \
41 AV_LE2NE64C(UINT64_C(0x0000000)<<32 | v) << plane, \
42 AV_LE2NE64C(UINT64_C(0x1000000)<<32 | v) << plane, \
43 AV_LE2NE64C(UINT64_C(0x0010000)<<32 | v) << plane, \
44 AV_LE2NE64C(UINT64_C(0x1010000)<<32 | v) << plane, \
45 AV_LE2NE64C(UINT64_C(0x0000100)<<32 | v) << plane, \
46 AV_LE2NE64C(UINT64_C(0x1000100)<<32 | v) << plane, \
47 AV_LE2NE64C(UINT64_C(0x0010100)<<32 | v) << plane, \
48 AV_LE2NE64C(UINT64_C(0x1010100)<<32 | v) << plane, \
49 AV_LE2NE64C(UINT64_C(0x0000001)<<32 | v) << plane, \
50 AV_LE2NE64C(UINT64_C(0x1000001)<<32 | v) << plane, \
51 AV_LE2NE64C(UINT64_C(0x0010001)<<32 | v) << plane, \
52 AV_LE2NE64C(UINT64_C(0x1010001)<<32 | v) << plane, \
53 AV_LE2NE64C(UINT64_C(0x0000101)<<32 | v) << plane, \
54 AV_LE2NE64C(UINT64_C(0x1000101)<<32 | v) << plane, \
55 AV_LE2NE64C(UINT64_C(0x0010101)<<32 | v) << plane, \
56 AV_LE2NE64C(UINT64_C(0x1010101)<<32 | v) << plane
58 #define LUT8(plane) { \
59 LUT8_PART(plane, 0x0000000), \
60 LUT8_PART(plane, 0x1000000), \
61 LUT8_PART(plane, 0x0010000), \
62 LUT8_PART(plane, 0x1010000), \
63 LUT8_PART(plane, 0x0000100), \
64 LUT8_PART(plane, 0x1000100), \
65 LUT8_PART(plane, 0x0010100), \
66 LUT8_PART(plane, 0x1010100), \
67 LUT8_PART(plane, 0x0000001), \
68 LUT8_PART(plane, 0x1000001), \
69 LUT8_PART(plane, 0x0010001), \
70 LUT8_PART(plane, 0x1010001), \
71 LUT8_PART(plane, 0x0000101), \
72 LUT8_PART(plane, 0x1000101), \
73 LUT8_PART(plane, 0x0010101), \
74 LUT8_PART(plane, 0x1010101), \
83 #define LUT32(plane) { \
85 0, 0, 0, 1 << plane, \
86 0, 0, 1 << plane, 0, \
87 0, 0, 1 << plane, 1 << plane, \
88 0, 1 << plane, 0, 0, \
89 0, 1 << plane, 0, 1 << plane, \
90 0, 1 << plane, 1 << plane, 0, \
91 0, 1 << plane, 1 << plane, 1 << plane, \
92 1 << plane, 0, 0, 0, \
93 1 << plane, 0, 0, 1 << plane, \
94 1 << plane, 0, 1 << plane, 0, \
95 1 << plane, 0, 1 << plane, 1 << plane, \
96 1 << plane, 1 << plane, 0, 0, \
97 1 << plane, 1 << plane, 0, 1 << plane, \
98 1 << plane, 1 << plane, 1 << plane, 0, \
99 1 << plane, 1 << plane, 1 << plane, 1 << plane, \
116 return x << 16 | x << 8 | x;
135 for (i=0; i < count; i++) {
141 for (i=0; i < count; i++) {
182 static void decodeplane8(uint8_t *dst,
const uint8_t *buf,
int buf_size,
int plane)
186 uint64_t
v =
AV_RN64A(dst) | lut[*buf++];
189 }
while (--buf_size);
199 static void decodeplane32(uint32_t *dst,
const uint8_t *buf,
int buf_size,
int plane)
203 unsigned mask = (*buf >> 2) & ~3;
204 dst[0] |= lut[mask++];
205 dst[1] |= lut[mask++];
206 dst[2] |= lut[mask++];
208 mask = (*buf++ << 2) & 0x3F;
209 dst[4] |= lut[mask++];
210 dst[5] |= lut[mask++];
211 dst[6] |= lut[mask++];
214 }
while (--buf_size);
227 const uint8_t *buf,
const uint8_t *
const buf_end) {
228 const uint8_t *
const buf_start = buf;
230 for (x = 0; x < dst_size && buf < buf_end;) {
232 const int8_t value = *buf++;
235 memcpy(dst + x, buf,
FFMIN3(length, dst_size - x, buf_end - buf));
237 }
else if (value > -128) {
239 memset(dst + x, *buf++,
FFMIN(length, dst_size - x));
245 return buf - buf_start;
249 void *
data,
int *data_size,
253 const uint8_t *buf = avpkt->
data;
254 int buf_size = avpkt->
size;
255 const uint8_t *buf_end = buf+buf_size;
274 for(y = 0; y < avctx->
height; y++ ) {
276 memset(row, 0, avctx->
width);
283 for(y = 0; y < avctx->
height; y++ ) {
285 memset(row, 0, avctx->
width << 2);
293 for(y = 0; y < avctx->
height; y++ ) {
295 memcpy(row, buf,
FFMIN(avctx->
width, buf_end - buf));
306 void *
data,
int *data_size,
310 const uint8_t *buf = avpkt->
data;
311 int buf_size = avpkt->
size;
312 const uint8_t *buf_end = buf+buf_size;
331 for(y = 0; y < avctx->
height ; y++ ) {
333 memset(row, 0, avctx->
width);
340 for(y = 0; y < avctx->
height ; y++ ) {
342 memset(row, 0, avctx->
width << 2);
350 for(y = 0; y < avctx->
height ; y++ ) {
383 .
name =
"iff_byterun1",