FFmpeg
Loading...
Searching...
No Matches
cdgraphics.c File Reference

CD Graphics Video Decoder. More...

#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "libavutil/attributes.h"

Go to the source code of this file.

Data Structures

struct  CDGraphicsContext
 

Macros

#define CDG_FULL_WIDTH   300
 default screen sizes
 
#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
 
#define CDG_MASK   0x3F
 
#define CDG_INST_MEMORY_PRESET   1
 instruction codes
 
#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
 
#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, AVFrame *frame, int *got_frame, AVPacket *avpkt)
 
static av_cold void cdg_decode_flush (AVCodecContext *avctx)
 
static av_cold int cdg_decode_end (AVCodecContext *avctx)
 

Variables

const FFCodec ff_cdgraphics_decoder
 

Detailed Description

Macro Definition Documentation

◆ CDG_FULL_WIDTH

#define CDG_FULL_WIDTH   300

default screen sizes

Definition at line 38 of file cdgraphics.c.

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

◆ CDG_FULL_HEIGHT

#define CDG_FULL_HEIGHT   216

Definition at line 39 of file cdgraphics.c.

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

◆ CDG_DISPLAY_WIDTH

#define CDG_DISPLAY_WIDTH   294

Definition at line 40 of file cdgraphics.c.

◆ CDG_DISPLAY_HEIGHT

#define CDG_DISPLAY_HEIGHT   204

Definition at line 41 of file cdgraphics.c.

◆ CDG_BORDER_WIDTH

#define CDG_BORDER_WIDTH   6

Definition at line 42 of file cdgraphics.c.

Referenced by cdg_border_preset(), and cdg_scroll().

◆ CDG_BORDER_HEIGHT

#define CDG_BORDER_HEIGHT   12

Definition at line 43 of file cdgraphics.c.

Referenced by cdg_border_preset(), and cdg_scroll().

◆ CDG_COMMAND

#define CDG_COMMAND   0x09

masks

Definition at line 46 of file cdgraphics.c.

Referenced by cdg_decode_frame(), read_packet(), and read_probe().

◆ CDG_MASK

#define CDG_MASK   0x3F

Definition at line 47 of file cdgraphics.c.

Referenced by cdg_decode_frame(), read_packet(), and read_probe().

◆ CDG_INST_MEMORY_PRESET

#define CDG_INST_MEMORY_PRESET   1

instruction codes

Definition at line 50 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_INST_BORDER_PRESET

#define CDG_INST_BORDER_PRESET   2

Definition at line 51 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_INST_TILE_BLOCK

#define CDG_INST_TILE_BLOCK   6

Definition at line 52 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_INST_SCROLL_PRESET

#define CDG_INST_SCROLL_PRESET   20

Definition at line 53 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_INST_SCROLL_COPY

#define CDG_INST_SCROLL_COPY   24

Definition at line 54 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_INST_TRANSPARENT_COL

#define CDG_INST_TRANSPARENT_COL   28

Definition at line 55 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_INST_LOAD_PAL_LO

#define CDG_INST_LOAD_PAL_LO   30

Definition at line 56 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_INST_LOAD_PAL_HIGH

#define CDG_INST_LOAD_PAL_HIGH   31

Definition at line 57 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_INST_TILE_BLOCK_XOR

#define CDG_INST_TILE_BLOCK_XOR   38

Definition at line 58 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_PACKET_SIZE

#define CDG_PACKET_SIZE   24

data sizes

Definition at line 61 of file cdgraphics.c.

Referenced by read_header(), read_packet(), and read_probe().

◆ CDG_DATA_SIZE

#define CDG_DATA_SIZE   16

Definition at line 62 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_TILE_HEIGHT

#define CDG_TILE_HEIGHT   12

Definition at line 63 of file cdgraphics.c.

Referenced by cdg_tile_block().

◆ CDG_TILE_WIDTH

#define CDG_TILE_WIDTH   6

Definition at line 64 of file cdgraphics.c.

Referenced by cdg_tile_block().

◆ CDG_MINIMUM_PKT_SIZE

#define CDG_MINIMUM_PKT_SIZE   6

Definition at line 65 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_MINIMUM_SCROLL_SIZE

#define CDG_MINIMUM_SCROLL_SIZE   3

Definition at line 66 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_HEADER_SIZE

#define CDG_HEADER_SIZE   8

Definition at line 67 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ CDG_PALETTE_SIZE

#define CDG_PALETTE_SIZE   16

Definition at line 68 of file cdgraphics.c.

Referenced by cdg_decode_frame(), cdg_decode_init(), and cdg_scroll().

◆ UP

◆ DOWN

◆ LEFT

◆ RIGHT

Function Documentation

◆ cdg_decode_init()

static av_cold int cdg_decode_init ( AVCodecContext * avctx)
static

Definition at line 78 of file cdgraphics.c.

◆ cdg_border_preset()

static void cdg_border_preset ( CDGraphicsContext * cc,
uint8_t * data )
static

fill the top and bottom borders

fill the side borders

Definition at line 93 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ cdg_load_palette()

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

Definition at line 115 of file cdgraphics.c.

Referenced by cdg_decode_frame().

◆ cdg_tile_block()

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().

◆ cdg_copy_rect_buf()

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().

◆ cdg_fill_rect_preset()

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().

◆ 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().

◆ 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().

◆ cdg_decode_frame()

static int cdg_decode_frame ( AVCodecContext * avctx,
AVFrame * frame,
int * got_frame,
AVPacket * avpkt )
static

Definition at line 266 of file cdgraphics.c.

◆ cdg_decode_flush()

static av_cold void cdg_decode_flush ( AVCodecContext * avctx)
static

Definition at line 372 of file cdgraphics.c.

◆ cdg_decode_end()

static av_cold int cdg_decode_end ( AVCodecContext * avctx)
static

Definition at line 385 of file cdgraphics.c.

Variable Documentation

◆ ff_cdgraphics_decoder

const FFCodec ff_cdgraphics_decoder
Initial value:
= {
.p.name = "cdgraphics",
CODEC_LONG_NAME("CD Graphics video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(CDGraphicsContext),
.flush = cdg_decode_flush,
.p.capabilities = AV_CODEC_CAP_DR1,
}
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
static av_cold int cdg_decode_init(AVCodecContext *avctx)
Definition cdgraphics.c:78
static int cdg_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition cdgraphics.c:266
static av_cold void cdg_decode_flush(AVCodecContext *avctx)
Definition cdgraphics.c:372
static av_cold int cdg_decode_end(AVCodecContext *avctx)
Definition cdgraphics.c:385
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#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_CDGRAPHICS
Definition codec_id.h:182
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200

Definition at line 394 of file cdgraphics.c.