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

ClearVideo decoder. More...

#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
#include "idctdsp.h"
#include "mathops.h"
#include "clearvideodata.h"

Go to the source code of this file.

Data Structures

struct  LevelCodes
 
struct  MV
 
struct  MVInfo
 
struct  CLVContext
 

Macros

#define CLV_VLC_BITS   9
 
#define DCT_TEMPLATE(blk, step, bias, shift, dshift, OP)
 
#define ROP(x)
 
#define COP(x)
 

Functions

static int decode_block (CLVContext *ctx, int16_t *blk, int has_ac, int ac_quant)
 
static void clv_dct (int16_t *block)
 
static int decode_mb (CLVContext *c, int x, int y)
 
static int copy_block (AVCodecContext *avctx, AVFrame *dst, const AVFrame *src, int plane, int x, int y, int dx, int dy, int size)
 
static int copyadd_block (AVCodecContext *avctx, AVFrame *dst, const AVFrame *src, int plane, int x, int y, int dx, int dy, int size, int bias)
 
static MVmvi_predict (MVInfo *mvi, int mb_x, int mb_y)
 
static void mvi_update_prediction (MV *mv, MV diff)
 
static void mvi_reset (MVInfo *mvi, int mb_w, int mb_h, int mb_size)
 
static void mvi_update_row (MVInfo *mvi)
 
static int tile_do_block (AVCodecContext *avctx, AVFrame *dst, const AVFrame *src, int plane, int x, int y, int dx, int dy, int size, int bias)
 
static int decode_tile (AVCodecContext *avctx, GetBitContext *gb, const LevelCodes *lc, AVFrame *dst, const AVFrame *src, int plane, int x, int y, int size, MV root_mv, MV *pred)
 
static void extend_edges (AVFrame *buf, int tile_size)
 
static int clv_decode_frame (AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
 
static av_cold const VLCElembuild_vlc (VLCInitState *state, const uint8_t counts[16], const uint16_t **syms)
 
static av_cold void clv_init_static (void)
 
static av_cold int clv_decode_init (AVCodecContext *avctx)
 
static av_cold int clv_decode_end (AVCodecContext *avctx)
 

Variables

static const MV zero_mv = { 0 }
 
static VLCElem dc_vlc [1104]
 
static VLCElem ac_vlc [554]
 
static LevelCodes lev [4+3+3]
 
const FFCodec ff_clearvideo_decoder
 

Detailed Description

ClearVideo decoder.

Definition in file clearvideo.c.

Macro Definition Documentation

◆ CLV_VLC_BITS

#define CLV_VLC_BITS   9

Definition at line 40 of file clearvideo.c.

Referenced by build_vlc(), clv_init_static(), decode_block(), and decode_tile().

◆ DCT_TEMPLATE

#define DCT_TEMPLATE ( blk,
step,
bias,
shift,
dshift,
OP )
Value:
const int t0 = OP(2841 * blk[1 * step] + 565 * blk[7 * step]); \
const int t1 = OP( 565 * blk[1 * step] - 2841 * blk[7 * step]); \
const int t2 = OP(1609 * blk[5 * step] + 2408 * blk[3 * step]); \
const int t3 = OP(2408 * blk[5 * step] - 1609 * blk[3 * step]); \
const int t4 = OP(1108 * blk[2 * step] - 2676 * blk[6 * step]); \
const int t5 = OP(2676 * blk[2 * step] + 1108 * blk[6 * step]); \
const int t6 = ((blk[0 * step] + blk[4 * step]) * (1 << dshift)) + bias; \
const int t7 = ((blk[0 * step] - blk[4 * step]) * (1 << dshift)) + bias; \
const int t8 = t0 + t2; \
const int t9 = t0 - t2; \
const int tA = (int)(181U * (t9 + (t1 - t3)) + 0x80) >> 8; \
const int tB = (int)(181U * (t9 - (t1 - t3)) + 0x80) >> 8; \
const int tC = t1 + t3; \
\
blk[0 * step] = (t6 + t5 + t8) >> shift; \
blk[1 * step] = (t7 + t4 + tA) >> shift; \
blk[2 * step] = (t7 - t4 + tB) >> shift; \
blk[3 * step] = (t6 - t5 + tC) >> shift; \
blk[4 * step] = (t6 - t5 - tC) >> shift; \
blk[5 * step] = (t7 - t4 - tB) >> shift; \
blk[6 * step] = (t7 + t4 - tA) >> shift; \
blk[7 * step] = (t6 + t5 - t8) >> shift; \
#define OP(gb, pixel, count)
static int shift(int a, int b)
Definition bonk.c:261
#define blk(i)
Definition sha.c:55
static int bias(int x, int c)
Definition vqcdec.c:115

Definition at line 126 of file clearvideo.c.

Referenced by clv_dct().

◆ ROP

#define ROP ( x)
Value:
x

Definition at line 150 of file clearvideo.c.

Referenced by clv_dct().

◆ COP

#define COP ( x)
Value:
(((x) + 4) >> 3)

Definition at line 151 of file clearvideo.c.

Referenced by clv_dct().

Function Documentation

◆ decode_block()

static int decode_block ( CLVContext * ctx,
int16_t * blk,
int has_ac,
int ac_quant )
inlinestatic

Definition at line 82 of file clearvideo.c.

Referenced by decode_mb().

◆ clv_dct()

static void clv_dct ( int16_t * block)
static

Definition at line 153 of file clearvideo.c.

Referenced by decode_mb().

◆ decode_mb()

static int decode_mb ( CLVContext * c,
int x,
int y )
static

Definition at line 171 of file clearvideo.c.

Referenced by clv_decode_frame().

◆ copy_block()

static int copy_block ( AVCodecContext * avctx,
AVFrame * dst,
const AVFrame * src,
int plane,
int x,
int y,
int dx,
int dy,
int size )
static

Definition at line 218 of file clearvideo.c.

Referenced by clv_decode_frame(), and tile_do_block().

◆ copyadd_block()

static int copyadd_block ( AVCodecContext * avctx,
AVFrame * dst,
const AVFrame * src,
int plane,
int x,
int y,
int dx,
int dy,
int size,
int bias )
static

Definition at line 255 of file clearvideo.c.

Referenced by tile_do_block().

◆ mvi_predict()

static MV * mvi_predict ( MVInfo * mvi,
int mb_x,
int mb_y )
static

Definition at line 293 of file clearvideo.c.

Referenced by clv_decode_frame().

◆ mvi_update_prediction()

static void mvi_update_prediction ( MV * mv,
MV diff )
static

Definition at line 339 of file clearvideo.c.

Referenced by decode_tile().

◆ mvi_reset()

static void mvi_reset ( MVInfo * mvi,
int mb_w,
int mb_h,
int mb_size )
static

Definition at line 345 of file clearvideo.c.

Referenced by clv_decode_frame().

◆ mvi_update_row()

static void mvi_update_row ( MVInfo * mvi)
static

Definition at line 355 of file clearvideo.c.

Referenced by clv_decode_frame().

◆ tile_do_block()

static int tile_do_block ( AVCodecContext * avctx,
AVFrame * dst,
const AVFrame * src,
int plane,
int x,
int y,
int dx,
int dy,
int size,
int bias )
static

Definition at line 365 of file clearvideo.c.

Referenced by decode_tile().

◆ decode_tile()

static int decode_tile ( AVCodecContext * avctx,
GetBitContext * gb,
const LevelCodes * lc,
AVFrame * dst,
const AVFrame * src,
int plane,
int x,
int y,
int size,
MV root_mv,
MV * pred )
static

Definition at line 379 of file clearvideo.c.

Referenced by clv_decode_frame(), and decode_tile().

◆ extend_edges()

static void extend_edges ( AVFrame * buf,
int tile_size )
static

Definition at line 444 of file clearvideo.c.

Referenced by clv_decode_frame().

◆ clv_decode_frame()

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

Definition at line 483 of file clearvideo.c.

◆ build_vlc()

static av_cold const VLCElem * build_vlc ( VLCInitState * state,
const uint8_t counts[16],
const uint16_t ** syms )
static

Definition at line 625 of file clearvideo.c.

Referenced by clv_init_static(), and decode_frame().

◆ clv_init_static()

static av_cold void clv_init_static ( void )
static

Definition at line 645 of file clearvideo.c.

Referenced by clv_decode_init().

◆ clv_decode_init()

static av_cold int clv_decode_init ( AVCodecContext * avctx)
static

Definition at line 678 of file clearvideo.c.

◆ clv_decode_end()

static av_cold int clv_decode_end ( AVCodecContext * avctx)
static

Definition at line 728 of file clearvideo.c.

Variable Documentation

◆ zero_mv

const MV zero_mv = { 0 }
static

Definition at line 52 of file clearvideo.c.

Referenced by mvi_predict().

◆ dc_vlc

◆ ac_vlc

◆ lev

◆ ff_clearvideo_decoder

const FFCodec ff_clearvideo_decoder
Initial value:
= {
.p.name = "clearvideo",
CODEC_LONG_NAME("Iterated Systems ClearVideo"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(CLVContext),
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
static av_cold int clv_decode_init(AVCodecContext *avctx)
Definition clearvideo.c:678
static av_cold int clv_decode_end(AVCodecContext *avctx)
Definition clearvideo.c:728
static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int *got_frame, AVPacket *avpkt)
Definition clearvideo.c:483
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
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_CLEARVIDEO
Definition codec_id.h:273
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200

Definition at line 740 of file clearvideo.c.