iff.c File Reference

IFF PBM/ILBM bitmap decoder. More...

#include "libavutil/imgutils.h"
#include "bytestream.h"
#include "avcodec.h"
#include "internal.h"
#include "get_bits.h"

Go to the source code of this file.

Data Structures

struct  IffContext

Macros

#define LUT8_PART(plane, v)
#define LUT8(plane)
#define LUT32(plane)

Functions

static av_always_inline uint32_t gray2rgb (const uint32_t x)
static int ff_cmap_read_palette (AVCodecContext *avctx, uint32_t *pal)
 Convert CMAP buffer (stored in extradata) to lavc palette format.
static av_cold int decode_init (AVCodecContext *avctx)
static void decodeplane8 (uint8_t *dst, const uint8_t *buf, int buf_size, int plane)
 Decode interleaved plane buffer up to 8bpp.
static void decodeplane32 (uint32_t *dst, const uint8_t *buf, int buf_size, int plane)
 Decode interleaved plane buffer up to 24bpp.
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.
static int decode_frame_ilbm (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static int decode_frame_byterun1 (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static av_cold int decode_end (AVCodecContext *avctx)

Variables

static const uint64_t plane8_lut [8][256]
static const uint32_t plane32_lut [32][16 *4]
AVCodec ff_iff_ilbm_decoder
AVCodec ff_iff_byterun1_decoder

Detailed Description

IFF PBM/ILBM bitmap decoder.

Definition in file iff.c.

Macro Definition Documentation

#define LUT32 (   plane)
Value:
{ \
0, 0, 0, 0, \
0, 0, 0, 1 << plane, \
0, 0, 1 << plane, 0, \
0, 0, 1 << plane, 1 << plane, \
0, 1 << plane, 0, 0, \
0, 1 << plane, 0, 1 << plane, \
0, 1 << plane, 1 << plane, 0, \
0, 1 << plane, 1 << plane, 1 << plane, \
1 << plane, 0, 0, 0, \
1 << plane, 0, 0, 1 << plane, \
1 << plane, 0, 1 << plane, 0, \
1 << plane, 0, 1 << plane, 1 << plane, \
1 << plane, 1 << plane, 0, 0, \
1 << plane, 1 << plane, 0, 1 << plane, \
1 << plane, 1 << plane, 1 << plane, 0, \
1 << plane, 1 << plane, 1 << plane, 1 << plane, \
}

Definition at line 84 of file iff.c.

#define LUT8 (   plane)
Value:
{ \
LUT8_PART(plane, 0x0000000), \
LUT8_PART(plane, 0x1000000), \
LUT8_PART(plane, 0x0010000), \
LUT8_PART(plane, 0x1010000), \
LUT8_PART(plane, 0x0000100), \
LUT8_PART(plane, 0x1000100), \
LUT8_PART(plane, 0x0010100), \
LUT8_PART(plane, 0x1010100), \
LUT8_PART(plane, 0x0000001), \
LUT8_PART(plane, 0x1000001), \
LUT8_PART(plane, 0x0010001), \
LUT8_PART(plane, 0x1010001), \
LUT8_PART(plane, 0x0000101), \
LUT8_PART(plane, 0x1000101), \
LUT8_PART(plane, 0x0010101), \
LUT8_PART(plane, 0x1010101), \
}

Definition at line 59 of file iff.c.

#define LUT8_PART (   plane,
  v 
)
Value:
AV_LE2NE64C(UINT64_C(0x0000000)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x1000000)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x0010000)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x1010000)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x0000100)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x1000100)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x0010100)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x1010100)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x0000001)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x1000001)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x0010001)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x1010001)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x0000101)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x1000101)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x0010101)<<32 | v) << plane, \
AV_LE2NE64C(UINT64_C(0x1010101)<<32 | v) << plane

Definition at line 41 of file iff.c.

Function Documentation

static int decode_byterun ( uint8_t *  dst,
int  dst_size,
const uint8_t *  buf,
const uint8_t *const  buf_end 
)
static

Decode one complete byterun1 encoded line.

Parameters
dstthe destination buffer where to store decompressed bitstream
dst_sizethe destination plane size in bytes
bufthe source byterun1 compressed bitstream
buf_endthe EOF of source byterun1 compressed bitstream
Returns
number of consumed bytes in byterun1 compressed bitstream

Definition at line 227 of file iff.c.

Referenced by decode_frame_byterun1().

static av_cold int decode_end ( AVCodecContext avctx)
static

Definition at line 362 of file iff.c.

static int decode_frame_byterun1 ( AVCodecContext avctx,
void data,
int *  data_size,
AVPacket avpkt 
)
static

Definition at line 306 of file iff.c.

static int decode_frame_ilbm ( AVCodecContext avctx,
void data,
int *  data_size,
AVPacket avpkt 
)
static

Definition at line 249 of file iff.c.

static av_cold int decode_init ( AVCodecContext avctx)
static

Definition at line 149 of file iff.c.

static void decodeplane32 ( uint32_t *  dst,
const uint8_t *  buf,
int  buf_size,
int  plane 
)
static

Decode interleaved plane buffer up to 24bpp.

Parameters
dstDestination buffer
bufSource buffer
buf_size
planeplane number to decode as

Definition at line 200 of file iff.c.

Referenced by decode_frame_byterun1(), and decode_frame_ilbm().

static void decodeplane8 ( uint8_t *  dst,
const uint8_t *  buf,
int  buf_size,
int  plane 
)
static

Decode interleaved plane buffer up to 8bpp.

Parameters
dstDestination buffer
bufSource buffer
buf_size
planeplane number to decode as

Definition at line 183 of file iff.c.

Referenced by decode_frame_byterun1(), and decode_frame_ilbm().

static int ff_cmap_read_palette ( AVCodecContext avctx,
uint32_t *  pal 
)
static

Convert CMAP buffer (stored in extradata) to lavc palette format.

Definition at line 123 of file iff.c.

Referenced by decode_frame_byterun1(), and decode_frame_ilbm().

static av_always_inline uint32_t gray2rgb ( const uint32_t  x)
static

Definition at line 116 of file iff.c.

Referenced by ff_cmap_read_palette().

Variable Documentation

AVCodec ff_iff_byterun1_decoder
Initial value:
{
.name = "iff_byterun1",
.priv_data_size = sizeof(IffContext),
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("IFF ByteRun1"),
}

Definition at line 383 of file iff.c.

AVCodec ff_iff_ilbm_decoder
Initial value:
{
.name = "iff_ilbm",
.priv_data_size = sizeof(IffContext),
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"),
}

Definition at line 371 of file iff.c.

const uint32_t plane32_lut[32][16 *4]
static
Initial value:
{
LUT32( 0), LUT32( 1), LUT32( 2), LUT32( 3),
LUT32( 4), LUT32( 5), LUT32( 6), LUT32( 7),
LUT32( 8), LUT32( 9), LUT32(10), LUT32(11),
LUT32(12), LUT32(13), LUT32(14), LUT32(15),
LUT32(16), LUT32(17), LUT32(18), LUT32(19),
LUT32(20), LUT32(21), LUT32(22), LUT32(23),
LUT32(24), LUT32(25), LUT32(26), LUT32(27),
LUT32(28), LUT32(29), LUT32(30), LUT32(31),
}

Definition at line 104 of file iff.c.

Referenced by decodeplane32().

const uint64_t plane8_lut[8][256]
static
Initial value:
{
LUT8(0), LUT8(1), LUT8(2), LUT8(3),
LUT8(4), LUT8(5), LUT8(6), LUT8(7),
}

Definition at line 79 of file iff.c.

Referenced by decodeplane8().