FFmpeg
Loading...
Searching...
No Matches
xpmdec.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/mem.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"

Go to the source code of this file.

Data Structures

struct  XPMDecContext
 
struct  ColorEntry
 

Macros

#define MIN_ELEMENT   ' '
 
#define MAX_ELEMENT   0xfe
 
#define NB_ELEMENTS   (MAX_ELEMENT - MIN_ELEMENT + 1)
 
#define TIMES256(idx)
 
#define TIMES64(idx)
 
#define TIMES16(idx)
 
#define TIMES4(idx)
 
#define ENTRY(x)
 

Functions

static int color_table_compare (const void *lhs, const void *rhs)
 
static unsigned hex_char_to_number (uint8_t x)
 
static size_t mod_strcspn (const char *string, const char *reject)
 
static uint32_t color_string_to_rgba (const char *p, size_t len)
 
static int ascii2index (const uint8_t *cpixel, int cpp)
 
static int xpm_decode_frame (AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
 
static av_cold int xpm_decode_close (AVCodecContext *avctx)
 

Variables

static const ColorEntry color_table []
 
const FFCodec ff_xpm_decoder
 

Macro Definition Documentation

◆ MIN_ELEMENT

#define MIN_ELEMENT   ' '

Definition at line 30 of file xpmdec.c.

Referenced by ascii2index().

◆ MAX_ELEMENT

#define MAX_ELEMENT   0xfe

Definition at line 31 of file xpmdec.c.

Referenced by ascii2index().

◆ NB_ELEMENTS

#define NB_ELEMENTS   (MAX_ELEMENT - MIN_ELEMENT + 1)

Definition at line 32 of file xpmdec.c.

Referenced by ascii2index(), and xpm_decode_frame().

◆ TIMES256

#define TIMES256 ( idx)
Value:
TIMES64(4 * (idx)) TIMES64(4 * (idx) + 1) TIMES64(4 * (idx) + 2) TIMES64(4 * (idx) + 3)
#define TIMES64(idx)

Referenced by hex_char_to_number().

◆ TIMES64

#define TIMES64 ( idx)
Value:
TIMES16(4 * (idx)) TIMES16(4 * (idx) + 1) TIMES16(4 * (idx) + 2) TIMES16(4 * (idx) + 3)
#define TIMES16(idx)

◆ TIMES16

#define TIMES16 ( idx)
Value:
TIMES4(4 * (idx)) TIMES4(4 * (idx) + 1) TIMES4(4 * (idx) + 2) TIMES4(4 * (idx) + 3)
#define TIMES4(idx)

◆ TIMES4

#define TIMES4 ( idx)
Value:
ENTRY(4 * (idx)) ENTRY(4 * (idx) + 1) ENTRY(4 * (idx) + 2) ENTRY(4 * (idx) + 3)
#define ENTRY(idx, string)

◆ ENTRY

#define ENTRY ( x)
Value:
[x] = ((x) >= 'a' && (x) <= 'f') ? (x) - ('a' - 10) : \
((x) >= 'A' && (x) <= 'F') ? (x) - ('A' - 10) : \
((x) >= '0' && (x) <= '9') ? (x) - '0' : 0,

Function Documentation

◆ color_table_compare()

static int color_table_compare ( const void * lhs,
const void * rhs )
static

Definition at line 46 of file xpmdec.c.

Referenced by av_parse_color(), and color_string_to_rgba().

◆ hex_char_to_number()

static unsigned hex_char_to_number ( uint8_t x)
static

Definition at line 195 of file xpmdec.c.

Referenced by color_string_to_rgba().

◆ mod_strcspn()

static size_t mod_strcspn ( const char * string,
const char * reject )
static

Definition at line 218 of file xpmdec.c.

Referenced by xpm_decode_frame().

◆ color_string_to_rgba()

static uint32_t color_string_to_rgba ( const char * p,
size_t len )
static

Definition at line 244 of file xpmdec.c.

Referenced by xpm_decode_frame().

◆ ascii2index()

static int ascii2index ( const uint8_t * cpixel,
int cpp )
static

Definition at line 298 of file xpmdec.c.

Referenced by xpm_decode_frame().

◆ xpm_decode_frame()

static int xpm_decode_frame ( AVCodecContext * avctx,
AVFrame * p,
int * got_frame,
AVPacket * avpkt )
static

Definition at line 312 of file xpmdec.c.

◆ xpm_decode_close()

static av_cold int xpm_decode_close ( AVCodecContext * avctx)
static

Definition at line 437 of file xpmdec.c.

Variable Documentation

◆ color_table

◆ ff_xpm_decoder

const FFCodec ff_xpm_decoder
Initial value:
= {
.p.name = "xpm",
CODEC_LONG_NAME("XPM (X PixMap) image"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_XPM,
.p.capabilities = AV_CODEC_CAP_DR1,
.priv_data_size = sizeof(XPMDecContext),
}
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_XPM
Definition codec_id.h:274
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold int xpm_decode_close(AVCodecContext *avctx)
Definition xpmdec.c:437
static int xpm_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
Definition xpmdec.c:312

Definition at line 448 of file xpmdec.c.