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

VC-1 and WMV3 block decoding routines. More...

#include "avcodec.h"
#include "mpegutils.h"
#include "mpegvideo.h"
#include "msmpeg4data.h"
#include "unary.h"
#include "vc1.h"
#include "vc1_pred.h"
#include "vc1acdata.h"
#include "vc1data.h"

Go to the source code of this file.

Macros

#define MB_INTRA_VLC_BITS   9
 
#define DC_VLC_BITS   9
 
#define inc_blk_idx(idx)
 

Functions

static void vc1_put_signed_blocks_clamped (VC1Context *v)
 
static int vc1_decode_p_mb (VC1Context *v)
 Decode one P-frame MB.
 
static int vc1_decode_p_mb_intfr (VC1Context *v)
 
static int vc1_decode_p_mb_intfi (VC1Context *v)
 
static void vc1_decode_b_mb (VC1Context *v)
 Decode one B-frame MB (in Main profile)
 
static void vc1_decode_b_mb_intfi (VC1Context *v)
 Decode one B-frame MB (in interlaced field B picture)
 
static int vc1_decode_b_mb_intfr (VC1Context *v)
 Decode one B-frame MB (in interlaced frame B picture)
 
static void vc1_decode_i_blocks (VC1Context *v)
 Decode blocks of I-frame.
 
static void vc1_decode_i_blocks_adv (VC1Context *v)
 Decode blocks of I-frame for advanced profile.
 
static void vc1_decode_p_blocks (VC1Context *v)
 
static void vc1_decode_b_blocks (VC1Context *v)
 
static void vc1_decode_skip_blocks (VC1Context *v)
 
void ff_vc1_decode_blocks (VC1Context *v)
 
VC-1 Bitplane decoding
See Also
8.7, p56
static void init_block_index (VC1Context *v)
 
VC1 Macroblock-level functions in Simple/Main Profiles
See Also
7.1.4, p91 and 8.1.1.7, p(1)04
static int vc1_coded_block_pred (MpegEncContext *s, int n, uint8_t **coded_block_ptr)
 
static void vc1_decode_ac_coeff (VC1Context *v, int *last, int *skip, int *value, int codingset)
 Decode one AC coefficient.
 
static int vc1_decode_i_block (VC1Context *v, int16_t block[64], int n, int coded, int codingset)
 Decode intra block in intra frames - should be faster than decode_intra_block.
 
static int vc1_decode_i_block_adv (VC1Context *v, int16_t block[64], int n, int coded, int codingset, int mquant)
 Decode intra block in intra frames - should be faster than decode_intra_block.
 
static int vc1_decode_intra_block (VC1Context *v, int16_t block[64], int n, int coded, int mquant, int codingset)
 Decode intra block in inter frames - more generic version than vc1_decode_i_block.
 
static int vc1_decode_p_block (VC1Context *v, int16_t block[64], int n, int mquant, int ttmb, int first_block, uint8_t *dst, int linesize, int skip_block, int *ttmb_out)
 Decode P block.
 

Variables

static const int offset_table1 [9] = { 0, 1, 2, 4, 8, 16, 32, 64, 128 }
 
static const int offset_table2 [9] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 }
 
static const int size_table [6] = { 0, 2, 3, 4, 5, 8 }
 
static const int offset_table [6] = { 0, 1, 3, 7, 15, 31 }
 

VC-1 Block-level functions

See Also
7.1.4, p91 and 8.1.1.7, p(1)04
#define GET_MQUANT()
 Get macroblock-level quantizer scale.
 
#define GET_MVDATA(_dmv_x, _dmv_y)
 Get MV differentials.
 
static av_always_inline void get_mvdata_interlaced (VC1Context *v, int *dmv_x, int *dmv_y, int *pred_flag)
 
static void vc1_b_mc (VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mode)
 Reconstruct motion vector for B-frame and do motion compensation.
 
static int vc1_i_pred_dc (MpegEncContext *s, int overlap, int pq, int n, int16_t **dc_val_ptr, int *dir_ptr)
 Get predicted DC value for I-frames only prediction dir: left=0, top=1.
 
static int ff_vc1_pred_dc (MpegEncContext *s, int overlap, int pq, int n, int a_avail, int c_avail, int16_t **dc_val_ptr, int *dir_ptr)
 Get predicted DC value prediction dir: left=0, top=1.
 

Detailed Description

VC-1 and WMV3 block decoding routines.

Definition in file vc1_block.c.

Macro Definition Documentation

#define MB_INTRA_VLC_BITS   9

Definition at line 39 of file vc1_block.c.

Referenced by vc1_decode_i_blocks(), and vc1_decode_i_blocks_adv().

#define DC_VLC_BITS   9

Definition at line 40 of file vc1_block.c.

Referenced by vc1_decode_i_block(), vc1_decode_i_block_adv(), and vc1_decode_intra_block().

#define inc_blk_idx (   idx)
Value:
do { \
idx++; \
if (idx >= v->n_allocated_blks) \
idx = 0; \
} while (0)

Referenced by vc1_put_signed_blocks_clamped().

#define GET_MQUANT ( )
#define GET_MVDATA (   _dmv_x,
  _dmv_y 
)

Get MV differentials.

See Also
MVDATA decoding from 8.3.5.2, p(1)20
Parameters
_dmv_xHorizontal differential for decoded MV
_dmv_yVertical differential for decoded MV

Definition at line 199 of file vc1_block.c.

Referenced by vc1_decode_b_mb(), and vc1_decode_p_mb().

Function Documentation

static void init_block_index ( VC1Context v)
static
static void vc1_put_signed_blocks_clamped ( VC1Context v)
static

Definition at line 67 of file vc1_block.c.

Referenced by vc1_decode_i_blocks_adv().

static av_always_inline void get_mvdata_interlaced ( VC1Context v,
int *  dmv_x,
int *  dmv_y,
int *  pred_flag 
)
static
static void vc1_b_mc ( VC1Context v,
int  dmv_x[2],
int  dmv_y[2],
int  direct,
int  mode 
)
inlinestatic

Reconstruct motion vector for B-frame and do motion compensation.

Definition at line 309 of file vc1_block.c.

Referenced by vc1_decode_b_mb(), and vc1_decode_b_mb_intfi().

static int vc1_i_pred_dc ( MpegEncContext s,
int  overlap,
int  pq,
int  n,
int16_t **  dc_val_ptr,
int *  dir_ptr 
)
inlinestatic

Get predicted DC value for I-frames only prediction dir: left=0, top=1.

Parameters
sMpegEncContext
overlapflag indicating that overlap filtering is used
pqinteger part of picture quantizer
[in]nblock index in the current MB
dc_val_ptrPointer to DC predictor
dir_ptrPrediction direction for use in AC prediction

Definition at line 335 of file vc1_block.c.

Referenced by vc1_decode_i_block().

static int ff_vc1_pred_dc ( MpegEncContext s,
int  overlap,
int  pq,
int  n,
int  a_avail,
int  c_avail,
int16_t **  dc_val_ptr,
int *  dir_ptr 
)
inlinestatic

Get predicted DC value prediction dir: left=0, top=1.

Parameters
sMpegEncContext
overlapflag indicating that overlap filtering is used
pqinteger part of picture quantizer
[in]nblock index in the current MB
a_availflag indicating top block availability
c_availflag indicating left block availability
dc_val_ptrPointer to DC predictor
dir_ptrPrediction direction for use in AC prediction

Definition at line 400 of file vc1_block.c.

Referenced by vc1_decode_i_block_adv(), and vc1_decode_intra_block().

static int vc1_coded_block_pred ( MpegEncContext s,
int  n,
uint8_t **  coded_block_ptr 
)
inlinestatic

Definition at line 477 of file vc1_block.c.

Referenced by vc1_decode_i_blocks(), and vc1_decode_i_blocks_adv().

static void vc1_decode_ac_coeff ( VC1Context v,
int *  last,
int *  skip,
int *  value,
int  codingset 
)
static

Decode one AC coefficient.

Parameters
vThe VC1 context
lastLast coefficient
skipHow much zero coefficients to skip
valueDecoded AC coefficient value
codingsetset of VLC to decode data
See Also
8.1.3.4

Definition at line 513 of file vc1_block.c.

Referenced by vc1_decode_i_block(), vc1_decode_i_block_adv(), vc1_decode_intra_block(), and vc1_decode_p_block().

static int vc1_decode_i_block ( VC1Context v,
int16_t  block[64],
int  n,
int  coded,
int  codingset 
)
static

Decode intra block in intra frames - should be faster than decode_intra_block.

Parameters
vVC1Context
blockblock to decode
[in]nsubblock index
codedare AC coeffs present or not
codingsetset of VLC to decode data

Definition at line 579 of file vc1_block.c.

Referenced by vc1_decode_i_blocks().

static int vc1_decode_i_block_adv ( VC1Context v,
int16_t  block[64],
int  n,
int  coded,
int  codingset,
int  mquant 
)
static

Decode intra block in intra frames - should be faster than decode_intra_block.

Parameters
vVC1Context
blockblock to decode
[in]nsubblock number
codedare AC coeffs present or not
codingsetset of VLC to decode data
mquantquantizer value for this macroblock

Definition at line 742 of file vc1_block.c.

Referenced by vc1_decode_i_blocks_adv().

static int vc1_decode_intra_block ( VC1Context v,
int16_t  block[64],
int  n,
int  coded,
int  mquant,
int  codingset 
)
static

Decode intra block in inter frames - more generic version than vc1_decode_i_block.

Parameters
vVC1Context
blockblock to decode
[in]nsubblock index
codedare AC coeffs present or not
mquantblock quantizer
codingsetset of VLC to decode data

Definition at line 954 of file vc1_block.c.

Referenced by vc1_decode_b_mb(), vc1_decode_b_mb_intfi(), vc1_decode_b_mb_intfr(), vc1_decode_p_mb(), vc1_decode_p_mb_intfi(), and vc1_decode_p_mb_intfr().

static int vc1_decode_p_block ( VC1Context v,
int16_t  block[64],
int  n,
int  mquant,
int  ttmb,
int  first_block,
uint8_t dst,
int  linesize,
int  skip_block,
int *  ttmb_out 
)
static
static int vc1_decode_p_mb ( VC1Context v)
static

Decode one P-frame MB.

Definition at line 1328 of file vc1_block.c.

Referenced by vc1_decode_p_blocks().

static int vc1_decode_p_mb_intfr ( VC1Context v)
static

Definition at line 1572 of file vc1_block.c.

Referenced by vc1_decode_p_blocks().

static int vc1_decode_p_mb_intfi ( VC1Context v)
static

Definition at line 1784 of file vc1_block.c.

Referenced by vc1_decode_p_blocks().

static void vc1_decode_b_mb ( VC1Context v)
static

Decode one B-frame MB (in Main profile)

Definition at line 1907 of file vc1_block.c.

Referenced by vc1_decode_b_blocks().

static void vc1_decode_b_mb_intfi ( VC1Context v)
static

Decode one B-frame MB (in interlaced field B picture)

Definition at line 2062 of file vc1_block.c.

Referenced by vc1_decode_b_blocks().

static int vc1_decode_b_mb_intfr ( VC1Context v)
static

Decode one B-frame MB (in interlaced frame B picture)

Definition at line 2224 of file vc1_block.c.

Referenced by vc1_decode_b_blocks().

static void vc1_decode_i_blocks ( VC1Context v)
static

Decode blocks of I-frame.

Definition at line 2571 of file vc1_block.c.

Referenced by ff_vc1_decode_blocks().

static void vc1_decode_i_blocks_adv ( VC1Context v)
static

Decode blocks of I-frame for advanced profile.

Definition at line 2716 of file vc1_block.c.

Referenced by ff_vc1_decode_blocks().

static void vc1_decode_p_blocks ( VC1Context v)
static

Definition at line 2851 of file vc1_block.c.

Referenced by ff_vc1_decode_blocks().

static void vc1_decode_b_blocks ( VC1Context v)
static

Definition at line 2927 of file vc1_block.c.

Referenced by ff_vc1_decode_blocks().

static void vc1_decode_skip_blocks ( VC1Context v)
static

Definition at line 2991 of file vc1_block.c.

Referenced by ff_vc1_decode_blocks().

void ff_vc1_decode_blocks ( VC1Context v)

Definition at line 3013 of file vc1_block.c.

Referenced by decode_wmv9(), and vc1_decode_frame().

Variable Documentation

const int offset_table1[9] = { 0, 1, 2, 4, 8, 16, 32, 64, 128 }
static

Definition at line 43 of file vc1_block.c.

Referenced by get_mvdata_interlaced().

const int offset_table2[9] = { 0, 1, 3, 7, 15, 31, 63, 127, 255 }
static

Definition at line 44 of file vc1_block.c.

Referenced by get_mvdata_interlaced().

const int size_table[6] = { 0, 2, 3, 4, 5, 8 }
static

Definition at line 1323 of file vc1_block.c.

const int offset_table[6] = { 0, 1, 3, 7, 15, 31 }
static

Definition at line 1324 of file vc1_block.c.