FFmpeg
Data Structures | Functions | Variables
yop.c File Reference
#include <string.h>
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  YopDecContext
 

Functions

static av_cold int yop_decode_close (AVCodecContext *avctx)
 
static av_cold int yop_decode_init (AVCodecContext *avctx)
 
static int yop_paint_block (YopDecContext *s, int linesize, int tag)
 Paint a macroblock using the pattern in paint_lut. More...
 
static int yop_copy_previous_block (YopDecContext *s, int linesize, int copy_tag)
 Copy a previously painted macroblock to the current_block. More...
 
static uint8_t yop_get_next_nibble (YopDecContext *s)
 Return the next nibble in sequence, consuming a new byte on the input only if necessary. More...
 
static int yop_decode_frame (AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
 

Variables

static const uint8_t paint_lut [15][4]
 Lookup table for painting macroblocks. More...
 
static const int8_t motion_vector [16][2]
 Lookup table for copying macroblocks. More...
 
const FFCodec ff_yop_decoder
 

Function Documentation

◆ yop_decode_close()

static av_cold int yop_decode_close ( AVCodecContext avctx)
static

Definition at line 85 of file yop.c.

◆ yop_decode_init()

static av_cold int yop_decode_init ( AVCodecContext avctx)
static

Definition at line 94 of file yop.c.

◆ yop_paint_block()

static int yop_paint_block ( YopDecContext s,
int  linesize,
int  tag 
)
static

Paint a macroblock using the pattern in paint_lut.

Parameters
scodec context
tagthe tag that was in the nibble

Definition at line 135 of file yop.c.

Referenced by yop_decode_frame().

◆ yop_copy_previous_block()

static int yop_copy_previous_block ( YopDecContext s,
int  linesize,
int  copy_tag 
)
static

Copy a previously painted macroblock to the current_block.

Parameters
copy_tagthe tag that was in the nibble

Definition at line 156 of file yop.c.

Referenced by yop_decode_frame().

◆ yop_get_next_nibble()

static uint8_t yop_get_next_nibble ( YopDecContext s)
static

Return the next nibble in sequence, consuming a new byte on the input only if necessary.

Definition at line 180 of file yop.c.

Referenced by yop_decode_frame().

◆ yop_decode_frame()

static int yop_decode_frame ( AVCodecContext avctx,
AVFrame rframe,
int got_frame,
AVPacket avpkt 
)
static

Definition at line 194 of file yop.c.

Variable Documentation

◆ paint_lut

const uint8_t paint_lut[15][4]
static
Initial value:
=
{{1, 2, 3, 4}, {1, 2, 0, 3},
{1, 2, 1, 3}, {1, 2, 2, 3},
{1, 0, 2, 3}, {1, 0, 0, 2},
{1, 0, 1, 2}, {1, 1, 2, 3},
{0, 1, 2, 3}, {0, 1, 0, 2},
{1, 1, 0, 2}, {0, 1, 1, 2},
{0, 0, 1, 2}, {0, 0, 0, 1},
{1, 1, 1, 2},
}

Lookup table for painting macroblocks.

Bytes 0-2 of each entry contain the macroblock positions to be painted (taken as (0, B0, B1, B2)). Byte 3 contains the number of bytes consumed on the input, equal to max(bytes 0-2) + 1.

Definition at line 59 of file yop.c.

Referenced by yop_paint_block().

◆ motion_vector

const int8_t motion_vector[16][2]
static
Initial value:
=
{{-4, -4}, {-2, -4},
{ 0, -4}, { 2, -4},
{-4, -2}, {-4, 0},
{-3, -3}, {-1, -3},
{ 1, -3}, { 3, -3},
{-3, -1}, {-2, -2},
{ 0, -2}, { 2, -2},
{ 4, -2}, {-2, 0},
}

Lookup table for copying macroblocks.

Each entry contains the respective x and y pixel offset for the copy source.

Definition at line 74 of file yop.c.

Referenced by yop_copy_previous_block().

◆ ff_yop_decoder

const FFCodec ff_yop_decoder
Initial value:
= {
.p.name = "yop",
.p.long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.id = AV_CODEC_ID_YOP,
.priv_data_size = sizeof(YopDecContext),
.close = yop_decode_close,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
}

Definition at line 269 of file yop.c.

AV_CODEC_ID_YOP
@ AV_CODEC_ID_YOP
Definition: codec_id.h:189
init
static int init
Definition: av_tx.c:47
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:254
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
yop_decode_close
static av_cold int yop_decode_close(AVCodecContext *avctx)
Definition: yop.c:85
yop_decode_init
static av_cold int yop_decode_init(AVCodecContext *avctx)
Definition: yop.c:94
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: codec_internal.h:31
YopDecContext
Definition: yop.c:35
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
yop_decode_frame
static int yop_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
Definition: yop.c:194