43 #define LUT8_PART(plane, v) \
44 AV_LE2NE64C(UINT64_C(0x0000000)<<32 | v) << plane, \
45 AV_LE2NE64C(UINT64_C(0x1000000)<<32 | v) << plane, \
46 AV_LE2NE64C(UINT64_C(0x0010000)<<32 | v) << plane, \
47 AV_LE2NE64C(UINT64_C(0x1010000)<<32 | v) << plane, \
48 AV_LE2NE64C(UINT64_C(0x0000100)<<32 | v) << plane, \
49 AV_LE2NE64C(UINT64_C(0x1000100)<<32 | v) << plane, \
50 AV_LE2NE64C(UINT64_C(0x0010100)<<32 | v) << plane, \
51 AV_LE2NE64C(UINT64_C(0x1010100)<<32 | v) << plane, \
52 AV_LE2NE64C(UINT64_C(0x0000001)<<32 | v) << plane, \
53 AV_LE2NE64C(UINT64_C(0x1000001)<<32 | v) << plane, \
54 AV_LE2NE64C(UINT64_C(0x0010001)<<32 | v) << plane, \
55 AV_LE2NE64C(UINT64_C(0x1010001)<<32 | v) << plane, \
56 AV_LE2NE64C(UINT64_C(0x0000101)<<32 | v) << plane, \
57 AV_LE2NE64C(UINT64_C(0x1000101)<<32 | v) << plane, \
58 AV_LE2NE64C(UINT64_C(0x0010101)<<32 | v) << plane, \
59 AV_LE2NE64C(UINT64_C(0x1010101)<<32 | v) << plane
61 #define LUT8(plane) { \
62 LUT8_PART(plane, 0x0000000), \
63 LUT8_PART(plane, 0x1000000), \
64 LUT8_PART(plane, 0x0010000), \
65 LUT8_PART(plane, 0x1010000), \
66 LUT8_PART(plane, 0x0000100), \
67 LUT8_PART(plane, 0x1000100), \
68 LUT8_PART(plane, 0x0010100), \
69 LUT8_PART(plane, 0x1010100), \
70 LUT8_PART(plane, 0x0000001), \
71 LUT8_PART(plane, 0x1000001), \
72 LUT8_PART(plane, 0x0010001), \
73 LUT8_PART(plane, 0x1010001), \
74 LUT8_PART(plane, 0x0000101), \
75 LUT8_PART(plane, 0x1000101), \
76 LUT8_PART(plane, 0x0010101), \
77 LUT8_PART(plane, 0x1010101), \
86 #define LUT32(plane) { \
88 0, 0, 0, 1 << plane, \
89 0, 0, 1 << plane, 0, \
90 0, 0, 1 << plane, 1 << plane, \
91 0, 1 << plane, 0, 0, \
92 0, 1 << plane, 0, 1 << plane, \
93 0, 1 << plane, 1 << plane, 0, \
94 0, 1 << plane, 1 << plane, 1 << plane, \
95 1 << plane, 0, 0, 0, \
96 1 << plane, 0, 0, 1 << plane, \
97 1 << plane, 0, 1 << plane, 0, \
98 1 << plane, 0, 1 << plane, 1 << plane, \
99 1 << plane, 1 << plane, 0, 0, \
100 1 << plane, 1 << plane, 0, 1 << plane, \
101 1 << plane, 1 << plane, 1 << plane, 0, \
102 1 << plane, 1 << plane, 1 << plane, 1 << plane, \
119 return x << 16 | x << 8 | x;
138 for (i = 0; i < count; i++)
143 for (i = 0; i < count; i++)
199 uint64_t v =
AV_RN64A(dst) | lut[*buf++];
202 }
while (--buf_size);
216 unsigned mask = (*buf >> 2) & ~3;
217 dst[0] |= lut[mask++];
218 dst[1] |= lut[mask++];
219 dst[2] |= lut[mask++];
221 mask = (*buf++ << 2) & 0x3F;
222 dst[4] |= lut[mask++];
223 dst[5] |= lut[mask++];
224 dst[6] |= lut[mask++];
227 }
while (--buf_size);
242 const uint8_t *
const buf_start = buf;
244 for (x = 0; x < dst_size && buf < buf_end;) {
246 const int8_t value = *buf++;
249 memcpy(dst + x, buf,
FFMIN3(length, dst_size - x, buf_end - buf));
251 }
else if (value > -128) {
253 memset(dst + x, *buf++,
FFMIN(length, dst_size - x));
259 return buf - buf_start;
263 void *
data,
int *got_frame,
268 int buf_size = avpkt->
size;
269 const uint8_t *buf_end = buf + buf_size;
284 for (y = 0; y < avctx->
height; y++) {
286 memset(row, 0, avctx->
width);
294 for (y = 0; y < avctx->
height; y++) {
296 memset(row, 0, avctx->
width << 2);
306 for (y = 0; y < avctx->
height && buf < buf_end; y++) {
308 memcpy(row, buf,
FFMIN(avctx->
width, buf_end - buf));
322 void *
data,
int *got_frame,
327 int buf_size = avpkt->
size;
328 const uint8_t *buf_end = buf + buf_size;
343 for (y = 0; y < avctx->
height; y++) {
345 memset(row, 0, avctx->
width);
352 for (y = 0; y < avctx->
height; y++) {
354 memset(row, 0, avctx->
width << 2);
362 for (y = 0; y < avctx->
height; y++) {
389 .
name =
"iff_byterun1",
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static void decodeplane32(uint32_t *dst, const uint8_t *buf, int buf_size, int plane)
Decode interleaved plane buffer up to 24bpp.
This structure describes decoded (raw) audio or video data.
static int decode_frame_byterun1(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static int cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
Convert CMAP buffer (stored in extradata) to lavc palette format.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static void decodeplane8(uint8_t *dst, const uint8_t *buf, int buf_size, int plane)
Decode interleaved plane buffer up to 8bpp.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static av_cold int decode_end(AVCodecContext *avctx)
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
8 bit with PIX_FMT_RGB32 palette
AVCodec ff_iff_byterun1_decoder
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
bitstream reader API header.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int decode_frame_ilbm(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint16_t mask[17]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
Identical in function to av_frame_make_writable(), except it uses ff_get_buffer() to allocate the buf...
int width
picture width / height.
Libavcodec external API header.
AVCodec ff_iff_ilbm_decoder
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
static void close(AVCodecParserContext *s)
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static av_always_inline uint32_t gray2rgb(const uint32_t x)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
static const uint32_t plane32_lut[32][16 *4]
static av_cold int init(AVCodecParserContext *s)
static av_cold int decode_init(AVCodecContext *avctx)
static const uint64_t plane8_lut[8][256]
static int decode_byterun(uint8_t *dst, int dst_size, const uint8_t *buf, const uint8_t *const buf_end)
Decode one complete byterun1 encoded line.
#define MKTAG(a, b, c, d)
This structure stores compressed data.