FFmpeg
Data Structures | Macros | Functions | Variables
clearvideo.c File Reference

ClearVideo decoder. More...

#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
#include "idctdsp.h"
#include "internal.h"
#include "mathops.h"
#include "clearvideodata.h"

Go to the source code of this file.

Data Structures

struct  LevelCodes
 
struct  MV
 
struct  MVInfo
 
struct  TileInfo
 
struct  CLVContext
 

Macros

#define DCT_TEMPLATE(blk, step, bias, shift, dshift, OP)
 
#define ROP(x)   x
 
#define COP(x)   (((x) + 4) >> 3)
 

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, AVFrame *src, int plane, int x, int y, int dx, int dy, int size)
 
static int copyadd_block (AVCodecContext *avctx, AVFrame *dst, AVFrame *src, int plane, int x, int y, int dx, int dy, int size, int bias)
 
static MV mvi_predict (MVInfo *mvi, int mb_x, int mb_y, 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 TileInfodecode_tile_info (GetBitContext *gb, LevelCodes *lc, int level)
 
static int tile_do_block (AVCodecContext *avctx, AVFrame *dst, AVFrame *src, int plane, int x, int y, int dx, int dy, int size, int bias)
 
static int restore_tree (AVCodecContext *avctx, AVFrame *dst, AVFrame *src, int plane, int x, int y, int size, TileInfo *tile, MV root_mv)
 
static void extend_edges (AVFrame *buf, int tile_size)
 
static int clv_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
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 }
 
AVCodec ff_clearvideo_decoder
 

Detailed Description

ClearVideo decoder.

Definition in file clearvideo.c.

Macro Definition Documentation

#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; \
static int shift(int a, int b)
Definition: sonic.c:82
#define t9
Definition: regdef.h:54
#define t8
Definition: regdef.h:53
#define blk(i)
Definition: sha.c:185
#define t7
Definition: regdef.h:35
#define t0
Definition: regdef.h:28
#define U(x)
Definition: vp56_arith.h:37
#define t1
Definition: regdef.h:29
#define t3
Definition: regdef.h:31
#define OP(LOAD, STORE)
Definition: hpeldsp_alpha.c:55
#define t5
Definition: regdef.h:33
int
#define t6
Definition: regdef.h:34
#define t4
Definition: regdef.h:32
#define t2
Definition: regdef.h:30
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step

Definition at line 130 of file clearvideo.c.

Referenced by clv_dct().

#define ROP (   x)    x

Definition at line 154 of file clearvideo.c.

Referenced by clv_dct().

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

Definition at line 155 of file clearvideo.c.

Referenced by clv_dct().

Function Documentation

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

Definition at line 83 of file clearvideo.c.

Referenced by decode_mb().

static void clv_dct ( int16_t *  block)
static

Definition at line 157 of file clearvideo.c.

Referenced by decode_mb().

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

Definition at line 175 of file clearvideo.c.

Referenced by clv_decode_frame().

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

Definition at line 222 of file clearvideo.c.

Referenced by clv_decode_frame(), and tile_do_block().

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

Definition at line 258 of file clearvideo.c.

Referenced by tile_do_block().

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

Definition at line 296 of file clearvideo.c.

Referenced by clv_decode_frame().

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

Definition at line 342 of file clearvideo.c.

Referenced by clv_decode_frame().

static void mvi_update_row ( MVInfo mvi)
static

Definition at line 352 of file clearvideo.c.

Referenced by clv_decode_frame().

static TileInfo* decode_tile_info ( GetBitContext gb,
LevelCodes lc,
int  level 
)
static

Definition at line 362 of file clearvideo.c.

Referenced by clv_decode_frame().

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

Definition at line 415 of file clearvideo.c.

Referenced by restore_tree().

static int restore_tree ( AVCodecContext avctx,
AVFrame dst,
AVFrame src,
int  plane,
int  x,
int  y,
int  size,
TileInfo tile,
MV  root_mv 
)
static

Definition at line 429 of file clearvideo.c.

Referenced by clv_decode_frame().

static void extend_edges ( AVFrame buf,
int  tile_size 
)
static

Definition at line 460 of file clearvideo.c.

Referenced by clv_decode_frame().

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

Definition at line 499 of file clearvideo.c.

static av_cold int clv_decode_init ( AVCodecContext avctx)
static

Definition at line 651 of file clearvideo.c.

static av_cold int clv_decode_end ( AVCodecContext avctx)
static

Definition at line 877 of file clearvideo.c.

Variable Documentation

const MV zero_mv = { 0 }
static

Definition at line 47 of file clearvideo.c.

Referenced by mvi_predict().

AVCodec ff_clearvideo_decoder
Initial value:
= {
.name = "clearvideo",
.long_name = NULL_IF_CONFIG_SMALL("Iterated Systems ClearVideo"),
.priv_data_size = sizeof(CLVContext),
.close = clv_decode_end,
.capabilities = AV_CODEC_CAP_DR1,
}
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:48
static av_cold int clv_decode_init(AVCodecContext *avctx)
Definition: clearvideo.c:651
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
static av_cold int clv_decode_end(AVCodecContext *avctx)
Definition: clearvideo.c:877
#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: internal.h:40
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static int clv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: clearvideo.c:499
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:50

Definition at line 906 of file clearvideo.c.