FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
cdgraphics.c File Reference

CD Graphics Video Decoder. More...

#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  CDGraphicsContext
 

Macros

#define CDG_FULL_WIDTH   300
 default screen sizes More...
 
#define CDG_FULL_HEIGHT   216
 
#define CDG_DISPLAY_WIDTH   294
 
#define CDG_DISPLAY_HEIGHT   204
 
#define CDG_BORDER_WIDTH   6
 
#define CDG_BORDER_HEIGHT   12
 
#define CDG_COMMAND   0x09
 masks More...
 
#define CDG_MASK   0x3F
 
#define CDG_INST_MEMORY_PRESET   1
 instruction codes More...
 
#define CDG_INST_BORDER_PRESET   2
 
#define CDG_INST_TILE_BLOCK   6
 
#define CDG_INST_SCROLL_PRESET   20
 
#define CDG_INST_SCROLL_COPY   24
 
#define CDG_INST_TRANSPARENT_COL   28
 
#define CDG_INST_LOAD_PAL_LO   30
 
#define CDG_INST_LOAD_PAL_HIGH   31
 
#define CDG_INST_TILE_BLOCK_XOR   38
 
#define CDG_PACKET_SIZE   24
 data sizes More...
 
#define CDG_DATA_SIZE   16
 
#define CDG_TILE_HEIGHT   12
 
#define CDG_TILE_WIDTH   6
 
#define CDG_MINIMUM_PKT_SIZE   6
 
#define CDG_MINIMUM_SCROLL_SIZE   3
 
#define CDG_HEADER_SIZE   8
 
#define CDG_PALETTE_SIZE   16
 
#define UP   2
 
#define DOWN   1
 
#define LEFT   2
 
#define RIGHT   1
 

Functions

static av_cold int cdg_decode_init (AVCodecContext *avctx)
 
static void cdg_border_preset (CDGraphicsContext *cc, uint8_t *data)
 
static void cdg_load_palette (CDGraphicsContext *cc, uint8_t *data, int low)
 
static int cdg_tile_block (CDGraphicsContext *cc, uint8_t *data, int b)
 
static void cdg_copy_rect_buf (int out_tl_x, int out_tl_y, uint8_t *out, int in_tl_x, int in_tl_y, uint8_t *in, int w, int h, int stride)
 
static void cdg_fill_rect_preset (int tl_x, int tl_y, uint8_t *out, int color, int w, int h, int stride)
 
static void cdg_fill_wrapper (int out_tl_x, int out_tl_y, uint8_t *out, int in_tl_x, int in_tl_y, uint8_t *in, int color, int w, int h, int stride, int roll)
 
static void cdg_scroll (CDGraphicsContext *cc, uint8_t *data, AVFrame *new_frame, int roll_over)
 
static int cdg_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int cdg_decode_end (AVCodecContext *avctx)
 

Variables

AVCodec ff_cdgraphics_decoder
 

Detailed Description

CD Graphics Video Decoder.

Author
Michael Tison
See Also
http://wiki.multimedia.cx/index.php?title=CD_Graphics
http://www.ccs.neu.edu/home/bchafy/cdb/info/cdg

Definition in file cdgraphics.c.

Macro Definition Documentation

#define CDG_FULL_WIDTH   300

default screen sizes

Definition at line 35 of file cdgraphics.c.

Referenced by cdg_border_preset(), cdg_decode_init(), cdg_scroll(), and cdg_tile_block().

#define CDG_FULL_HEIGHT   216
#define CDG_DISPLAY_WIDTH   294

Definition at line 37 of file cdgraphics.c.

#define CDG_DISPLAY_HEIGHT   204

Definition at line 38 of file cdgraphics.c.

#define CDG_BORDER_WIDTH   6

Definition at line 39 of file cdgraphics.c.

Referenced by cdg_border_preset(), and cdg_scroll().

#define CDG_BORDER_HEIGHT   12

Definition at line 40 of file cdgraphics.c.

Referenced by cdg_border_preset(), and cdg_scroll().

#define CDG_COMMAND   0x09

masks

Definition at line 43 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_MASK   0x3F

Definition at line 44 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_INST_MEMORY_PRESET   1

instruction codes

Definition at line 47 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_INST_BORDER_PRESET   2

Definition at line 48 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_INST_TILE_BLOCK   6

Definition at line 49 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_INST_SCROLL_PRESET   20

Definition at line 50 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_INST_SCROLL_COPY   24

Definition at line 51 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_INST_TRANSPARENT_COL   28

Definition at line 52 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_INST_LOAD_PAL_LO   30

Definition at line 53 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_INST_LOAD_PAL_HIGH   31

Definition at line 54 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_INST_TILE_BLOCK_XOR   38

Definition at line 55 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_PACKET_SIZE   24

data sizes

Definition at line 58 of file cdgraphics.c.

#define CDG_DATA_SIZE   16

Definition at line 59 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_TILE_HEIGHT   12

Definition at line 60 of file cdgraphics.c.

Referenced by cdg_tile_block().

#define CDG_TILE_WIDTH   6

Definition at line 61 of file cdgraphics.c.

Referenced by cdg_tile_block().

#define CDG_MINIMUM_PKT_SIZE   6

Definition at line 62 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_MINIMUM_SCROLL_SIZE   3

Definition at line 63 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_HEADER_SIZE   8

Definition at line 64 of file cdgraphics.c.

Referenced by cdg_decode_frame().

#define CDG_PALETTE_SIZE   16

Definition at line 65 of file cdgraphics.c.

Referenced by cdg_scroll().

#define UP   2

Definition at line 166 of file cdgraphics.c.

Referenced by cdg_scroll().

#define DOWN   1

Definition at line 167 of file cdgraphics.c.

Referenced by cdg_scroll().

#define LEFT   2
#define RIGHT   1

Definition at line 169 of file cdgraphics.c.

Referenced by cdg_scroll().

Function Documentation

static av_cold int cdg_decode_init ( AVCodecContext avctx)
static

Definition at line 74 of file cdgraphics.c.

static void cdg_border_preset ( CDGraphicsContext cc,
uint8_t data 
)
static

fill the top and bottom borders

fill the side borders

Definition at line 90 of file cdgraphics.c.

Referenced by cdg_decode_frame().

static void cdg_load_palette ( CDGraphicsContext cc,
uint8_t data,
int  low 
)
static

Definition at line 112 of file cdgraphics.c.

Referenced by cdg_decode_frame().

static int cdg_tile_block ( CDGraphicsContext cc,
uint8_t data,
int  b 
)
static

Definition at line 132 of file cdgraphics.c.

Referenced by cdg_decode_frame().

static void cdg_copy_rect_buf ( int  out_tl_x,
int  out_tl_y,
uint8_t out,
int  in_tl_x,
int  in_tl_y,
uint8_t in,
int  w,
int  h,
int  stride 
)
static

Definition at line 171 of file cdgraphics.c.

Referenced by cdg_fill_wrapper().

static void cdg_fill_rect_preset ( int  tl_x,
int  tl_y,
uint8_t out,
int  color,
int  w,
int  h,
int  stride 
)
static

Definition at line 183 of file cdgraphics.c.

Referenced by cdg_fill_wrapper().

static void cdg_fill_wrapper ( int  out_tl_x,
int  out_tl_y,
uint8_t out,
int  in_tl_x,
int  in_tl_y,
uint8_t in,
int  color,
int  w,
int  h,
int  stride,
int  roll 
)
static

Definition at line 192 of file cdgraphics.c.

Referenced by cdg_scroll().

static void cdg_scroll ( CDGraphicsContext cc,
uint8_t data,
AVFrame new_frame,
int  roll_over 
)
static

find the difference and save the offset for cdg_tile_block usage

Definition at line 204 of file cdgraphics.c.

Referenced by cdg_decode_frame().

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

Definition at line 266 of file cdgraphics.c.

static av_cold int cdg_decode_end ( AVCodecContext avctx)
static

Definition at line 369 of file cdgraphics.c.

Variable Documentation

AVCodec ff_cdgraphics_decoder
Initial value:
= {
.name = "cdgraphics",
.long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"),
.priv_data_size = sizeof(CDGraphicsContext),
.close = cdg_decode_end,
.capabilities = AV_CODEC_CAP_DR1,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int cdg_decode_init(AVCodecContext *avctx)
Definition: cdgraphics.c:74
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static av_cold int cdg_decode_end(AVCodecContext *avctx)
Definition: cdgraphics.c:369
static int cdg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: cdgraphics.c:266
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:572
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:856

Definition at line 378 of file cdgraphics.c.