libavcodec/iff.c File Reference

IFF ACBM/DEEP/ILBM/PBM bitmap decoder. More...

#include "libavutil/imgutils.h"
#include "bytestream.h"
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"
Include dependency graph for libavcodec/iff.c:

Go to the source code of this file.

Data Structures

struct  IffContext
 

Macros

#define LUT8_PART(plane, v)
 
#define LUT8(plane)
 
#define LUT32(plane)
 
#define DECODE_HAM_PLANE32(x)
 
#define DECODE_RGBX_COMMON(type)
 
#define GETNIBBLE   ((i & 1) ? (src[i>>1] & 0xF) : (src[i>>1] >> 4))
 

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 cmap_read_palette (AVCodecContext *avctx, uint32_t *pal)
 Convert CMAP buffer (stored in extradata) to lavc palette format. More...
 
static int extract_header (AVCodecContext *const avctx, const AVPacket *const avpkt)
 Extracts the IFF extra context and updates internal decoder structures. More...
 
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. More...
 
static void decodeplane32 (uint32_t *dst, const uint8_t *buf, int buf_size, int plane)
 Decode interleaved plane buffer up to 24bpp. More...
 
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. More...
 
static void lookup_pal_indicies (uint32_t *dst, const uint32_t *buf, const uint32_t *const pal, unsigned width)
 
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. More...
 
static void decode_rgb8 (GetByteContext *gb, uint8_t *dst, int width, int height, int linesize)
 Decode RGB8 buffer. More...
 
static void decode_rgbn (GetByteContext *gb, uint8_t *dst, int width, int height, int linesize)
 Decode RGBN buffer. More...
 
static void decode_deep_rle32 (uint8_t *dst, const uint8_t *src, int src_size, int width, int height, int linesize)
 Decode DEEP RLE 32-bit buffer. More...
 
static void decode_deep_tvdc32 (uint8_t *dst, const uint8_t *src, int src_size, int width, int height, int linesize, const int16_t *tvdc)
 Decode DEEP TVDC 32-bit buffer. More...
 
static int unsupported (AVCodecContext *avctx)
 
static int decode_frame (AVCodecContext *avctx, void *data, int *got_frame, 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]
 

Detailed Description

IFF ACBM/DEEP/ILBM/PBM bitmap decoder.

Definition in file libavcodec/iff.c.

Macro Definition Documentation

#define DECODE_HAM_PLANE32 (   x)
Value:
first = buf[x] << 1; \
second = buf[(x)+1] << 1; \
delta &= pal[first++]; \
delta |= pal[first]; \
delta &= pal[second++]; \
delta |= pal[second]; \
dst[(x)+1] = delta
float delta
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But first
Discrete Time axis x
void * buf
Definition: avisynth_c.h:594
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160

Definition at line 420 of file libavcodec/iff.c.

Referenced by decode_ham_plane32().

#define DECODE_RGBX_COMMON (   type)
Value:
if (!length) { \
length = bytestream2_get_byte(gb); \
if (!length) { \
length = bytestream2_get_be16(gb); \
} \
} \
for (i = 0; i < length; i++) { \
*(type *)(dst + y*linesize + x * sizeof(type)) = pixel; \
x += 1; \
if (x >= width) { \
y += 1; \
if (y >= height) \
x = 0; \
} \
}
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
Discrete Time axis x
static int width
Definition: tests/utils.c:158
BYTE int const BYTE int int int height
Definition: avisynth_c.h:713
synthesis window for stochastic i
#define type
uint8_t pixel
Definition: tiny_ssim.c:40
function y
Definition: D.m:1
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame This method is called when a frame is wanted on an output For an it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return it should return
const char int length
Definition: avisynth_c.h:668
for(j=16;j >0;--j)

Definition at line 492 of file libavcodec/iff.c.

Referenced by decode_rgb8(), and decode_rgbn().

#define GETNIBBLE   ((i & 1) ? (src[i>>1] & 0xF) : (src[i>>1] >> 4))

Referenced by decode_deep_tvdc32().

#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 103 of file libavcodec/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), \
}
#define LUT8_PART(plane, v)

Definition at line 78 of file libavcodec/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
float v
#define AV_LE2NE64C(x)
Definition: bswap.h:107

Definition at line 60 of file libavcodec/iff.c.

Enumeration Type Documentation

enum mask_type
Enumerator
MASK_NONE 
MASK_HAS_MASK 
MASK_HAS_TRANSPARENT_COLOR 
MASK_LASSO 

Definition at line 35 of file libavcodec/iff.c.

Function Documentation

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

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

Definition at line 142 of file libavcodec/iff.c.

Referenced by decode_frame().

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 470 of file libavcodec/iff.c.

Referenced by decode_frame().

static void decode_deep_rle32 ( uint8_t dst,
const uint8_t src,
int  src_size,
int  width,
int  height,
int  linesize 
)
static

Decode DEEP RLE 32-bit buffer.

Parameters
[out]dstDestination buffer
[in]srcSource buffer
src_sizeSource buffer size (bytes)
widthWidth of destination buffer (pixels)
heightHeight of destination buffer (pixels)
linesizeLine size of destination buffer (bytes)

Definition at line 556 of file libavcodec/iff.c.

Referenced by decode_frame().

static void decode_deep_tvdc32 ( uint8_t dst,
const uint8_t src,
int  src_size,
int  width,
int  height,
int  linesize,
const int16_t *  tvdc 
)
static

Decode DEEP TVDC 32-bit buffer.

Parameters
[out]dstDestination buffer
[in]srcSource buffer
src_sizeSource buffer size (bytes)
widthWidth of destination buffer (pixels)
heightHeight of destination buffer (pixels)
linesizeLine size of destination buffer (bytes)

Definition at line 606 of file libavcodec/iff.c.

Referenced by decode_frame().

static av_cold int decode_end ( AVCodecContext avctx)
static

Definition at line 861 of file libavcodec/iff.c.

static int decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame,
AVPacket avpkt 
)
static

Definition at line 653 of file libavcodec/iff.c.

Referenced by decode_end().

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
dstthe destination 24bpp buffer
bufthe source 8bpp chunky buffer
palthe HAM decode table
buf_sizethe plane size in bytes

Definition at line 438 of file libavcodec/iff.c.

Referenced by decode_frame().

static av_cold int decode_init ( AVCodecContext avctx)
static

Definition at line 323 of file libavcodec/iff.c.

Referenced by decode_end().

static void decode_rgb8 ( GetByteContext gb,
uint8_t dst,
int  width,
int  height,
int  linesize 
)
static

Decode RGB8 buffer.

Parameters
[out]dstDestination buffer
widthWidth of destination buffer (pixels)
heightHeight of destination buffer (pixels)
linesizeLine size of destination buffer (bytes)

Definition at line 519 of file libavcodec/iff.c.

Referenced by decode_frame().

static void decode_rgbn ( GetByteContext gb,
uint8_t dst,
int  width,
int  height,
int  linesize 
)
static

Decode RGBN buffer.

Parameters
[out]dstDestination buffer
widthWidth of destination buffer (pixels)
heightHeight of destination buffer (pixels)
linesizeLine size of destination buffer (bytes)

Definition at line 536 of file libavcodec/iff.c.

Referenced by decode_frame().

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 402 of file libavcodec/iff.c.

Referenced by decode_frame().

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 381 of file libavcodec/iff.c.

Referenced by decode_frame().

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

Extracts the IFF extra context and updates internal decoder structures.

Parameters
avctxthe AVCodecContext where to extract extra context to
avpktthe 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 191 of file libavcodec/iff.c.

Referenced by decode_frame(), and decode_init().

static av_always_inline uint32_t gray2rgb ( const uint32_t  x)
static

Definition at line 135 of file libavcodec/iff.c.

Referenced by cmap_read_palette(), and extract_header().

static void lookup_pal_indicies ( uint32_t *  dst,
const uint32_t *  buf,
const uint32_t *const  pal,
unsigned  width 
)
static

Definition at line 453 of file libavcodec/iff.c.

Referenced by decode_frame().

static int unsupported ( AVCodecContext avctx)
static

Definition at line 646 of file libavcodec/iff.c.

Referenced by decode_frame(), mov_read_elst(), and txd_decode_frame().

Variable Documentation

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),
}
#define LUT32(plane)

Definition at line 123 of file libavcodec/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),
}
#define LUT8(plane)

Definition at line 98 of file libavcodec/iff.c.

Referenced by decodeplane8().