libavcodec/iff.c File Reference

IFF PBM/ILBM bitmap decoder. More...

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

Go to the source code of this file.

Data Structures

struct  IffContext

Defines

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

Enumerations

enum  mask_type { MASK_NONE, MASK_HAS_MASK, MASK_HAS_TRANSPARENT_COLOR, MASK_LASSO }

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 int extract_header (AVCodecContext *const avctx, const AVPacket *const avpkt)
 Extracts the IFF extra context and updates internal decoder structures.
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 void decode_ham_plane32 (uint32_t *dst, const uint8_t *buf, const uint32_t *const pal, unsigned buf_size)
 Converts one line of HAM6/8-encoded chunky buffer 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.


Define Documentation

#define DECODE_HAM_PLANE32 (  ) 

Value:

first       = buf[x] << 1;      \
    second      = buf[(x)+1] << 1;  \
    delta      &= pal[first++];     \
    delta      |= pal[first];       \
    dst[x]      = delta;            \
    delta      &= pal[second++];    \
    delta      |= pal[second];      \
    dst[(x)+1]  = delta

Definition at line 361 of file iff.c.

Referenced by decode_ham_plane32().

#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 99 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 74 of file iff.c.

#define LUT8_PART ( plane,
 ) 

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 56 of file iff.c.


Enumeration Type Documentation

enum mask_type

Enumerator:
MASK_NONE 
MASK_HAS_MASK 
MASK_HAS_TRANSPARENT_COLOR 
MASK_LASSO 

Definition at line 34 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:
dst the destination buffer where to store decompressed bitstream
dst_size the destination plane size in bytes
buf the source byterun1 compressed bitstream
buf_end the EOF of source byterun1 compressed bitstream
Returns:
number of consumed bytes in byterun1 compressed bitstream

Definition at line 403 of file iff.c.

Referenced by decode_frame_byterun1().

static av_cold int decode_end ( AVCodecContext avctx  )  [static]

Definition at line 576 of file iff.c.

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

Definition at line 502 of file iff.c.

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

Definition at line 425 of file iff.c.

static void decode_ham_plane32 ( uint32_t *  dst,
const uint8_t *  buf,
const uint32_t *const   pal,
unsigned  buf_size 
) [static]

Converts one line of HAM6/8-encoded chunky buffer to 24bpp.

Parameters:
dst the destination 24bpp buffer
buf the source 8bpp chunky buffer
pal the HAM decode table
buf_size the plane size in bytes

Definition at line 379 of file iff.c.

Referenced by decode_frame_byterun1(), and decode_frame_ilbm().

static av_cold int decode_init ( AVCodecContext avctx  )  [static]

Definition at line 282 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:
dst Destination buffer
buf Source buffer
buf_size 
plane plane number to decode as

Definition at line 343 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:
dst Destination buffer
buf Source buffer
buf_size 
plane plane number to decode as

Definition at line 326 of file iff.c.

Referenced by decode_frame_byterun1(), and decode_frame_ilbm().

static int extract_header ( AVCodecContext *const   avctx,
const AVPacket *const   avpkt 
) [static]

Extracts the IFF extra context and updates internal decoder structures.

Parameters:
avctx the AVCodecContext where to extract extra context to
avpkt the AVPacket to extract extra context from or NULL to use avctx
Returns:
0 in case of success, a negative error code otherwise

Definition at line 174 of file iff.c.

Referenced by decode_frame_byterun1(), decode_frame_ilbm(), and decode_init().

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 138 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 131 of file iff.c.

Referenced by extract_header(), and ff_cmap_read_palette().


Variable Documentation

Initial value:

Definition at line 600 of file iff.c.

Initial value:

Definition at line 587 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 119 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 94 of file iff.c.

Referenced by decodeplane8().


Generated on Fri Oct 26 02:39:45 2012 for FFmpeg by  doxygen 1.5.8