41 #define LUT8_PART(plane, v) \
42 AV_LE2NE64C(UINT64_C(0x0000000)<<32 | v) << plane, \
43 AV_LE2NE64C(UINT64_C(0x1000000)<<32 | v) << plane, \
44 AV_LE2NE64C(UINT64_C(0x0010000)<<32 | v) << plane, \
45 AV_LE2NE64C(UINT64_C(0x1010000)<<32 | v) << plane, \
46 AV_LE2NE64C(UINT64_C(0x0000100)<<32 | v) << plane, \
47 AV_LE2NE64C(UINT64_C(0x1000100)<<32 | v) << plane, \
48 AV_LE2NE64C(UINT64_C(0x0010100)<<32 | v) << plane, \
49 AV_LE2NE64C(UINT64_C(0x1010100)<<32 | v) << plane, \
50 AV_LE2NE64C(UINT64_C(0x0000001)<<32 | v) << plane, \
51 AV_LE2NE64C(UINT64_C(0x1000001)<<32 | v) << plane, \
52 AV_LE2NE64C(UINT64_C(0x0010001)<<32 | v) << plane, \
53 AV_LE2NE64C(UINT64_C(0x1010001)<<32 | v) << plane, \
54 AV_LE2NE64C(UINT64_C(0x0000101)<<32 | v) << plane, \
55 AV_LE2NE64C(UINT64_C(0x1000101)<<32 | v) << plane, \
56 AV_LE2NE64C(UINT64_C(0x0010101)<<32 | v) << plane, \
57 AV_LE2NE64C(UINT64_C(0x1010101)<<32 | v) << plane
59 #define LUT8(plane) { \
60 LUT8_PART(plane, 0x0000000), \
61 LUT8_PART(plane, 0x1000000), \
62 LUT8_PART(plane, 0x0010000), \
63 LUT8_PART(plane, 0x1010000), \
64 LUT8_PART(plane, 0x0000100), \
65 LUT8_PART(plane, 0x1000100), \
66 LUT8_PART(plane, 0x0010100), \
67 LUT8_PART(plane, 0x1010100), \
68 LUT8_PART(plane, 0x0000001), \
69 LUT8_PART(plane, 0x1000001), \
70 LUT8_PART(plane, 0x0010001), \
71 LUT8_PART(plane, 0x1010001), \
72 LUT8_PART(plane, 0x0000101), \
73 LUT8_PART(plane, 0x1000101), \
74 LUT8_PART(plane, 0x0010101), \
75 LUT8_PART(plane, 0x1010101), \
84 #define LUT32(plane) { \
86 0, 0, 0, 1 << plane, \
87 0, 0, 1 << plane, 0, \
88 0, 0, 1 << plane, 1 << plane, \
89 0, 1 << plane, 0, 0, \
90 0, 1 << plane, 0, 1 << plane, \
91 0, 1 << plane, 1 << plane, 0, \
92 0, 1 << plane, 1 << plane, 1 << plane, \
93 1 << plane, 0, 0, 0, \
94 1 << plane, 0, 0, 1 << plane, \
95 1 << plane, 0, 1 << plane, 0, \
96 1 << plane, 0, 1 << plane, 1 << plane, \
97 1 << plane, 1 << plane, 0, 0, \
98 1 << plane, 1 << plane, 0, 1 << plane, \
99 1 << plane, 1 << plane, 1 << plane, 0, \
100 1 << plane, 1 << plane, 1 << plane, 1 << plane, \
117 return x << 16 | x << 8 | x;
136 for (i=0; i < count; i++) {
142 for (i=0; i < count; i++) {
187 uint64_t v =
AV_RN64A(dst) | lut[*buf++];
190 }
while (--buf_size);
204 unsigned mask = (*buf >> 2) & ~3;
205 dst[0] |= lut[mask++];
206 dst[1] |= lut[mask++];
207 dst[2] |= lut[mask++];
209 mask = (*buf++ << 2) & 0x3F;
210 dst[4] |= lut[mask++];
211 dst[5] |= lut[mask++];
212 dst[6] |= lut[mask++];
215 }
while (--buf_size);
229 const uint8_t *
const buf_start = buf;
231 for (x = 0; x < dst_size && buf < buf_end;) {
233 const int8_t value = *buf++;
236 memcpy(dst + x, buf,
FFMIN3(length, dst_size - x, buf_end - buf));
238 }
else if (value > -128) {
240 memset(dst + x, *buf++,
FFMIN(length, dst_size - x));
246 return buf - buf_start;
250 void *
data,
int *got_frame,
255 int buf_size = avpkt->
size;
256 const uint8_t *buf_end = buf+buf_size;
275 for (y = 0; y < avctx->
height && buf < buf_end; y++ ) {
277 memset(row, 0, avctx->
width);
284 for(y = 0; y < avctx->
height; y++ ) {
286 memset(row, 0, avctx->
width << 2);
294 for(y = 0; y < avctx->
height; y++ ) {
296 memcpy(row, buf,
FFMIN(avctx->
width, buf_end - buf));
307 void *
data,
int *got_frame,
312 int buf_size = avpkt->
size;
313 const uint8_t *buf_end = buf+buf_size;
332 for(y = 0; y < avctx->
height ; y++ ) {
334 memset(row, 0, avctx->
width);
341 for(y = 0; y < avctx->
height ; y++ ) {
343 memset(row, 0, avctx->
width << 2);
351 for(y = 0; y < avctx->
height ; y++ ) {
384 .
name =
"iff_byterun1",
static int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
Convert CMAP buffer (stored in extradata) to lavc palette format.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
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.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
static int decode_frame_byterun1(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int(* reget_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of a frame to get cr buffer for it.
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)
8 bit with PIX_FMT_RGB32 palette
AVCodec ff_iff_byterun1_decoder
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
bitstream reader API header.
#define MKTAG(a, b, c, d)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int init(AVCodecParserContext *s)
static int decode_frame_ilbm(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
static const uint16_t mask[17]
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
#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.
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 width
picture width / height.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
Get a buffer for a frame.
AVCodec ff_iff_ilbm_decoder
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
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)
#define FF_INPUT_BUFFER_PADDING_SIZE
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]
#define AVERROR_INVALIDDATA
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.
This structure stores compressed data.