FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
clearvideo.c File Reference

ClearVideo decoder. More...

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

Go to the source code of this file.

Data Structures

struct  CLVContext
 

Macros

#define NUM_DC_CODES   127
 
#define NUM_AC_CODES   103
 
#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 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 uint8_t clv_dc_codes [NUM_DC_CODES]
 
static const uint8_t clv_dc_bits [NUM_DC_CODES]
 
static const uint16_t clv_ac_syms [NUM_AC_CODES]
 
static const uint8_t clv_ac_codes [NUM_AC_CODES]
 
static const uint8_t clv_ac_bits [NUM_AC_CODES]
 
AVCodec ff_clearvideo_decoder
 

Detailed Description

ClearVideo decoder.

Definition in file clearvideo.c.

Macro Definition Documentation

#define NUM_DC_CODES   127

Definition at line 33 of file clearvideo.c.

Referenced by clv_decode_init().

#define NUM_AC_CODES   103

Definition at line 34 of file clearvideo.c.

Referenced by clv_decode_init().

#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

Definition at line 181 of file clearvideo.c.

Referenced by clv_dct().

#define ROP (   x)    x

Definition at line 205 of file clearvideo.c.

Referenced by clv_dct().

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

Definition at line 206 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 134 of file clearvideo.c.

Referenced by decode_mb().

static void clv_dct ( int16_t *  block)
static

Definition at line 208 of file clearvideo.c.

Referenced by decode_mb().

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

Definition at line 226 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 274 of file clearvideo.c.

static av_cold int clv_decode_init ( AVCodecContext avctx)
static

Definition at line 338 of file clearvideo.c.

static av_cold int clv_decode_end ( AVCodecContext avctx)
static

Definition at line 374 of file clearvideo.c.

Variable Documentation

const uint8_t clv_dc_codes[NUM_DC_CODES]
static
Initial value:
= {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x13, 0x14, 0x07, 0x0B,
0x0C, 0x08, 0x08, 0x09, 0x04, 0x06, 0x07, 0x05,
0x04, 0x05, 0x04, 0x06, 0x05, 0x06, 0x07, 0x05,
0x06, 0x07, 0x06, 0x07, 0x08, 0x06, 0x07, 0x08,
0x09, 0x0A, 0x0B, 0x07, 0x08, 0x09, 0x07, 0x08,
0x06, 0x07, 0x08, 0x06, 0x04, 0x05, 0x02, 0x01,
0x03, 0x06, 0x07, 0x07, 0x09, 0x0A, 0x0B, 0x09,
0x0A, 0x0B, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x09,
0x0D, 0x0A, 0x0B, 0x08, 0x09, 0x0A, 0x0B, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x06, 0x07, 0x06, 0x08,
0x07, 0x09, 0x0A, 0x0B, 0x09, 0x0A, 0x0B, 0x0C,
0x14, 0x0D, 0x0D, 0x0E, 0x0F, 0x15, 0x15, 0x16,
0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
}

Definition at line 36 of file clearvideo.c.

Referenced by clv_decode_init().

const uint8_t clv_dc_bits[NUM_DC_CODES]
static
Initial value:
= {
22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 21, 22, 22, 19, 20,
20, 19, 18, 18, 15, 17, 17, 16,
14, 15, 12, 13, 14, 14, 14, 12,
12, 12, 11, 11, 11, 10, 10, 10,
10, 10, 10, 9, 9, 9, 8, 8,
7, 7, 7, 6, 5, 5, 3, 1,
3, 5, 5, 6, 7, 7, 7, 8,
8, 8, 9, 9, 9, 9, 10, 11,
10, 11, 11, 12, 12, 12, 12, 13,
14, 14, 14, 14, 15, 15, 16, 17,
16, 17, 18, 18, 19, 19, 19, 19,
21, 19, 20, 19, 19, 21, 22, 22,
22, 22, 22, 22, 22, 22, 22, 22,
22, 22, 22, 22, 22, 22, 22,
}

Definition at line 55 of file clearvideo.c.

Referenced by clv_decode_init().

const uint16_t clv_ac_syms[NUM_AC_CODES]
static
Initial value:
= {
0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008,
0x0009, 0x000A, 0x000B, 0x000C, 0x0011, 0x0012, 0x0013, 0x0014,
0x0015, 0x0016, 0x0021, 0x0022, 0x0023, 0x0024, 0x0031, 0x0032,
0x0033, 0x0041, 0x0042, 0x0043, 0x0051, 0x0052, 0x0053, 0x0061,
0x0062, 0x0063, 0x0071, 0x0072, 0x0081, 0x0082, 0x0091, 0x0092,
0x00A1, 0x00A2, 0x00B1, 0x00C1, 0x00D1, 0x00E1, 0x00F1, 0x0101,
0x0111, 0x0121, 0x0131, 0x0141, 0x0151, 0x0161, 0x0171, 0x0181,
0x0191, 0x01A1, 0x1001, 0x1002, 0x1003, 0x1011, 0x1012, 0x1021,
0x1031, 0x1041, 0x1051, 0x1061, 0x1071, 0x1081, 0x1091, 0x10A1,
0x10B1, 0x10C1, 0x10D1, 0x10E1, 0x10F1, 0x1101, 0x1111, 0x1121,
0x1131, 0x1141, 0x1151, 0x1161, 0x1171, 0x1181, 0x1191, 0x11A1,
0x11B1, 0x11C1, 0x11D1, 0x11E1, 0x11F1, 0x1201, 0x1211, 0x1221,
0x1231, 0x1241, 0x1251, 0x1261, 0x1271, 0x1281, 0x1BFF,
}

Definition at line 74 of file clearvideo.c.

Referenced by clv_decode_init().

const uint8_t clv_ac_codes[NUM_AC_CODES]
static
Initial value:
= {
0x02, 0x0F, 0x15, 0x17, 0x1F, 0x25, 0x24, 0x21,
0x20, 0x07, 0x06, 0x20, 0x06, 0x14, 0x1E, 0x0F,
0x21, 0x50, 0x0E, 0x1D, 0x0E, 0x51, 0x0D, 0x23,
0x0D, 0x0C, 0x22, 0x52, 0x0B, 0x0C, 0x53, 0x13,
0x0B, 0x54, 0x12, 0x0A, 0x11, 0x09, 0x10, 0x08,
0x16, 0x55, 0x15, 0x14, 0x1C, 0x1B, 0x21, 0x20,
0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x22, 0x23,
0x56, 0x57, 0x07, 0x19, 0x05, 0x0F, 0x04, 0x0E,
0x0D, 0x0C, 0x13, 0x12, 0x11, 0x10, 0x1A, 0x19,
0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x18, 0x17,
0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x07, 0x06,
0x05, 0x04, 0x24, 0x25, 0x26, 0x27, 0x58, 0x59,
0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x03,
}

Definition at line 90 of file clearvideo.c.

Referenced by clv_decode_init().

const uint8_t clv_ac_bits[NUM_AC_CODES]
static
Initial value:
= {
2, 4, 6, 7, 8, 9, 9, 10,
10, 11, 11, 11, 3, 6, 8, 10,
11, 12, 4, 8, 10, 12, 5, 9,
10, 5, 9, 12, 5, 10, 12, 6,
10, 12, 6, 10, 6, 10, 6, 10,
7, 12, 7, 7, 8, 8, 9, 9,
9, 9, 9, 9, 9, 9, 11, 11,
12, 12, 4, 9, 11, 6, 11, 6,
6, 6, 7, 7, 7, 7, 8, 8,
8, 8, 8, 8, 8, 8, 9, 9,
9, 9, 9, 9, 9, 9, 10, 10,
10, 10, 11, 11, 11, 11, 12, 12,
12, 12, 12, 12, 12, 12, 7,
}

Definition at line 106 of file clearvideo.c.

Referenced by clv_decode_init().

AVCodec ff_clearvideo_decoder
Initial value:
= {
.name = "clearvideo",
.priv_data_size = sizeof(CLVContext),
.close = clv_decode_end,
.capabilities = AV_CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Iterated Systems ClearVideo"),
}
static av_cold int clv_decode_init(AVCodecContext *avctx)
Definition: clearvideo.c:338
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:42
static av_cold int clv_decode_end(AVCodecContext *avctx)
Definition: clearvideo.c:374
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static int clv_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: clearvideo.c:274
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:1002

Definition at line 386 of file clearvideo.c.