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

VC-1 and WMV3 decoder common code. More...

#include "libavutil/attributes.h"
#include "internal.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "vc1.h"
#include "vc1data.h"
#include "wmv2data.h"
#include "unary.h"
#include "simple_idct.h"

Go to the source code of this file.

Macros

#define INIT_LUT(lumscale, lumshift, luty, lutuv, chain)
 
#define ROTATE(DEF, L, N, C, A)
 

Functions

static int vop_dquant_decoding (VC1Context *v)
 VOP Dquant decoding. More...
 
static int decode_sequence_header_adv (VC1Context *v, GetBitContext *gb)
 
int ff_vc1_decode_sequence_header (AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
 Decode Simple/Main Profiles sequence header. More...
 
int ff_vc1_decode_entry_point (AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
 
static void rotate_luts (VC1Context *v)
 
static int read_bfraction (VC1Context *v, GetBitContext *gb)
 
int ff_vc1_parse_frame_header (VC1Context *v, GetBitContext *gb)
 
int ff_vc1_parse_frame_header_adv (VC1Context *v, GetBitContext *gb)
 
av_cold int ff_vc1_init_common (VC1Context *v)
 Init VC-1 specific tables and VC1Context members. More...
 
VC-1 Bitplane decoding
See Also
8.7, p56
static void decode_rowskip (uint8_t *plane, int width, int height, int stride, GetBitContext *gb)
 Decode rows by checking if they are skipped. More...
 
static void decode_colskip (uint8_t *plane, int width, int height, int stride, GetBitContext *gb)
 Decode columns by checking if they are skipped. More...
 
static int bitplane_decoding (uint8_t *data, int *raw_flag, VC1Context *v)
 Decode a bitplane's bits. More...
 

Variables

static const uint32_t vc1_ac_tables [AC_MODES][186][2]
 
static const uint16_t vlc_offs []
 

Detailed Description

VC-1 and WMV3 decoder common code.

Definition in file vc1.c.

Macro Definition Documentation

#define INIT_LUT (   lumscale,
  lumshift,
  luty,
  lutuv,
  chain 
)
Value:
do { \
int scale, shift, i; \
if (!lumscale) { \
scale = -64; \
shift = (255 - lumshift * 2) * 64; \
if (lumshift > 31) \
shift += 128 << 6; \
} else { \
scale = lumscale + 32; \
if (lumshift > 31) \
shift = (lumshift - 64) * 64; \
shift = lumshift << 6; \
} \
for (i = 0; i < 256; i++) { \
int iy = chain ? luty[i] : i; \
int iu = chain ? lutuv[i] : i; \
luty[i] = av_clip_uint8((scale * iy + shift + 32) >> 6); \
lutuv[i] = av_clip_uint8((scale * (iu - 128) + 128*64 + 32) >> 6);\
} \
} while(0)
static int shift(int a, int b)
Definition: sonic.c:82
if(ret< 0)
Definition: vf_mcdeint.c:282
for(j=16;j >0;--j)

Definition at line 570 of file vc1.c.

Referenced by ff_vc1_parse_frame_header(), ff_vc1_parse_frame_header_adv(), and rotate_luts().

#define ROTATE (   DEF,
  L,
  N,
  C,
  A 
)
Value:
do { \
if (v->s.pict_type == AV_PICTURE_TYPE_BI || v->s.pict_type == AV_PICTURE_TYPE_B) { \
C = A; \
} else { \
DEF; \
memcpy(&tmp, L , sizeof(tmp)); \
memcpy(L , N , sizeof(tmp)); \
memcpy(N , &tmp, sizeof(tmp)); \
C = N; \
} \
} while(0)
BI type.
Definition: avutil.h:274
#define C
#define DEF(type, name, bytes, read, write)
Definition: bytestream.h:42
#define N
Definition: vf_pp7.c:73
#define A(x)
Definition: vp56_arith.h:28
#define L(x)
Definition: vp56_arith.h:36
if(ret< 0)
Definition: vf_mcdeint.c:282
Bi-dir predicted.
Definition: avutil.h:270
static uint8_t tmp[8]
Definition: des.c:38

Referenced by avfilter_register_all(), and rotate_luts().

Function Documentation

static void decode_rowskip ( uint8_t plane,
int  width,
int  height,
int  stride,
GetBitContext gb 
)
static

Decode rows by checking if they are skipped.

Parameters
planeBuffer to store decoded bits
[in]widthWidth of this buffer
[in]heightHeight of this buffer
[in]strideof this buffer

Definition at line 52 of file vc1.c.

Referenced by bitplane_decoding().

static void decode_colskip ( uint8_t plane,
int  width,
int  height,
int  stride,
GetBitContext gb 
)
static

Decode columns by checking if they are skipped.

Parameters
planeBuffer to store decoded bits
[in]widthWidth of this buffer
[in]heightHeight of this buffer
[in]strideof this buffer
Todo:
FIXME: Optimize

Definition at line 74 of file vc1.c.

Referenced by bitplane_decoding().

static int bitplane_decoding ( uint8_t data,
int *  raw_flag,
VC1Context v 
)
static

Decode a bitplane's bits.

Parameters
databitplane where to store the decode bits
[out]raw_flagpointer to the flag indicating that this bitplane is not coded explicitly
vVC-1 context for bit reading and logging
Returns
Status
Todo:
FIXME: Optimize

Definition at line 97 of file vc1.c.

Referenced by ff_vc1_parse_frame_header(), and ff_vc1_parse_frame_header_adv().

static int vop_dquant_decoding ( VC1Context v)
static

VOP Dquant decoding.

Parameters
vVC-1 Context

Definition at line 230 of file vc1.c.

Referenced by ff_vc1_parse_frame_header(), and ff_vc1_parse_frame_header_adv().

static int decode_sequence_header_adv ( VC1Context v,
GetBitContext gb 
)
static

Definition at line 402 of file vc1.c.

Referenced by ff_vc1_decode_sequence_header().

int ff_vc1_decode_sequence_header ( AVCodecContext avctx,
VC1Context v,
GetBitContext gb 
)

Decode Simple/Main Profiles sequence header.

See Also
Figure 7-8, p16-17
Parameters
avctxCodec context
gbGetBit context initialized from Codec context extra_data
Returns
Status

Definition at line 276 of file vc1.c.

Referenced by vc1_decode_init(), and vc1_extract_header().

int ff_vc1_decode_entry_point ( AVCodecContext avctx,
VC1Context v,
GetBitContext gb 
)

Definition at line 509 of file vc1.c.

Referenced by vc1_decode_frame(), vc1_decode_init(), and vc1_extract_header().

static void rotate_luts ( VC1Context v)
static

Definition at line 592 of file vc1.c.

Referenced by ff_vc1_parse_frame_header(), and ff_vc1_parse_frame_header_adv().

static int read_bfraction ( VC1Context v,
GetBitContext gb 
)
static

Definition at line 615 of file vc1.c.

Referenced by ff_vc1_parse_frame_header(), and ff_vc1_parse_frame_header_adv().

int ff_vc1_parse_frame_header ( VC1Context v,
GetBitContext gb 
)

Definition at line 627 of file vc1.c.

Referenced by decode_wmv9(), vc1_decode_frame(), and vc1_extract_header().

int ff_vc1_parse_frame_header_adv ( VC1Context v,
GetBitContext gb 
)

Definition at line 844 of file vc1.c.

Referenced by vc1_decode_frame(), and vc1_extract_header().

av_cold int ff_vc1_init_common ( VC1Context v)

Init VC-1 specific tables and VC1Context members.

Parameters
vThe VC1Context to initialize
Returns
Status

Definition at line 1575 of file vc1.c.

Referenced by vc1_decode_init(), vc1_parse_init(), and wmv9_init().

Variable Documentation

const uint32_t vc1_ac_tables[AC_MODES][186][2]
static

Definition at line 1339 of file vc1.c.

Referenced by ff_vc1_init_common().

const uint16_t vlc_offs[]
static
Initial value:
= {
0, 520, 552, 616, 1128, 1160, 1224, 1740, 1772, 1836, 1900, 2436,
2986, 3050, 3610, 4154, 4218, 4746, 5326, 5390, 5902, 6554, 7658, 8342,
9304, 9988, 10630, 11234, 12174, 13006, 13560, 14232, 14786, 15432, 16350, 17522,
20372, 21818, 22330, 22394, 23166, 23678, 23742, 24820, 25332, 25396, 26460, 26980,
27048, 27592, 27600, 27608, 27616, 27624, 28224, 28258, 28290, 28802, 28834, 28866,
29378, 29412, 29444, 29960, 29994, 30026, 30538, 30572, 30604, 31120, 31154, 31186,
31714, 31746, 31778, 32306, 32340, 32372
}

Definition at line 1560 of file vc1.c.

Referenced by ff_vc1_init_common().