FFmpeg
Data Structures | Macros | Functions | Variables
rl2.c File Reference
#include <string.h>
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.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  Rl2Context
 

Macros

#define EXTRADATA1_SIZE   (6 + 256 * 3)
 video base, clr count, palette More...
 

Functions

static void rl2_rle_decode (Rl2Context *s, const uint8_t *in, int size, uint8_t *out, ptrdiff_t stride, int video_base)
 Run Length Decode a single 320x200 frame. More...
 
static av_cold int rl2_decode_init (AVCodecContext *avctx)
 Initialize the decoder. More...
 
static int rl2_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
 
static av_cold int rl2_decode_end (AVCodecContext *avctx)
 Uninit decoder. More...
 

Variables

const FFCodec ff_rl2_decoder
 

Detailed Description

RL2 Video Decoder

Author
Sascha Sommer (sasch.nosp@m.asom.nosp@m.mer@f.nosp@m.reen.nosp@m.et.de)
See also
http://wiki.multimedia.cx/index.php?title=RL2

Definition in file rl2.c.

Macro Definition Documentation

◆ EXTRADATA1_SIZE

#define EXTRADATA1_SIZE   (6 + 256 * 3)

video base, clr count, palette

Definition at line 39 of file rl2.c.

Function Documentation

◆ rl2_rle_decode()

static void rl2_rle_decode ( Rl2Context s,
const uint8_t *  in,
int  size,
uint8_t *  out,
ptrdiff_t  stride,
int  video_base 
)
static

Run Length Decode a single 320x200 frame.

Parameters
srl2 context
ininput buffer
sizeinput buffer size
outoutput buffer
stridestride of the output buffer
video_baseoffset of the rle data inside the frame

copy start of the background frame

decode the variable part of the frame

copy the rest from the background frame

Definition at line 59 of file rl2.c.

Referenced by rl2_decode_frame(), and rl2_decode_init().

◆ rl2_decode_init()

static av_cold int rl2_decode_init ( AVCodecContext avctx)
static

Initialize the decoder.

Parameters
avctxdecoder context
Returns
0 success, -1 on error

parse extra data

get frame_offset

initialize palette

decode background frame if present

Definition at line 148 of file rl2.c.

◆ rl2_decode_frame()

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

run length decode

make the palette available on the way out

report that the buffer was completely consumed

Definition at line 198 of file rl2.c.

◆ rl2_decode_end()

static av_cold int rl2_decode_end ( AVCodecContext avctx)
static

Uninit decoder.

Parameters
avctxdecoder context
Returns
0 success, -1 on error

Definition at line 227 of file rl2.c.

Variable Documentation

◆ ff_rl2_decoder

const FFCodec ff_rl2_decoder
Initial value:
= {
.p.name = "rl2",
CODEC_LONG_NAME("RL2 video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_RL2,
.priv_data_size = sizeof(Rl2Context),
.close = rl2_decode_end,
.p.capabilities = AV_CODEC_CAP_DR1,
}

Definition at line 237 of file rl2.c.

FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
rl2_decode_frame
static int rl2_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition: rl2.c:198
AV_CODEC_ID_RL2
@ AV_CODEC_ID_RL2
Definition: codec_id.h:166
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
Rl2Context
Definition: rl2.c:41
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
rl2_decode_init
static av_cold int rl2_decode_init(AVCodecContext *avctx)
Initialize the decoder.
Definition: rl2.c:148
rl2_decode_end
static av_cold int rl2_decode_end(AVCodecContext *avctx)
Uninit decoder.
Definition: rl2.c:227
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201