libavcodec/vc1.c File Reference

VC-1 and WMV3 decoder. More...

#include "internal.h"
#include "dsputil.h"
#include "avcodec.h"
#include "mpegvideo.h"
#include "vc1.h"
#include "vc1data.h"
#include "vc1acdata.h"
#include "msmpeg4data.h"
#include "unary.h"
#include "simple_idct.h"
#include "mathops.h"
#include "vdpau_internal.h"
#include <assert.h>

Go to the source code of this file.

Defines

#define MB_INTRA_VLC_BITS   9
#define DC_VLC_BITS   9
#define AC_VLC_BITS   9
#define FILTSIGN(a)   ((a) >= 0 ? 1 : -1)
#define GET_MQUANT()
 Get macroblock-level quantizer scale.
#define GET_MVDATA(_dmv_x, _dmv_y)
 Get MV differentials.

Enumerations

enum  Imode {
  IMODE_RAW, IMODE_NORM2, IMODE_DIFF2, IMODE_NORM6,
  IMODE_DIFF6, IMODE_ROWSKIP, IMODE_COLSKIP
}
 Imode types. More...

Functions

static int vc1_init_common (VC1Context *v)
 Init VC-1 specific tables and VC1Context members.
static void decode_rowskip (uint8_t *plane, int width, int height, int stride, GetBitContext *gb)
 Decode rows by checking if they are skipped.
static void decode_colskip (uint8_t *plane, int width, int height, int stride, GetBitContext *gb)
 Decode columns by checking if they are skipped.
static int bitplane_decoding (uint8_t *data, int *raw_flag, VC1Context *v)
 Decode a bitplane's bits.
static av_always_inline int vc1_filter_line (uint8_t *src, int stride, int pq)
 VC-1 in-loop deblocking filter for one line.
static void vc1_loop_filter (uint8_t *src, int step, int stride, int len, int pq)
 VC-1 in-loop deblocking filter.
static void vc1_loop_filter_iblk (MpegEncContext *s, int pq)
static int vop_dquant_decoding (VC1Context *v)
 VOP Dquant decoding.
static void vc1_put_block (VC1Context *v, DCTELEM block[6][64])
 Put block onto picture.
static void vc1_mc_1mv (VC1Context *v, int dir)
 Do motion compensation over 1 macroblock Mostly adapted hpel_motion and qpel_motion from mpegvideo.c.
static void vc1_mc_4mv_luma (VC1Context *v, int n)
 Do motion compensation for 4-MV macroblock - luminance block.
static int median4 (int a, int b, int c, int d)
static void vc1_mc_4mv_chroma (VC1Context *v)
 Do motion compensation for 4-MV macroblock - both chroma blocks.
static int decode_sequence_header_adv (VC1Context *v, GetBitContext *gb)
static int decode_sequence_header (AVCodecContext *avctx, GetBitContext *gb)
 Decode Simple/Main Profiles sequence header.
static int decode_entry_point (AVCodecContext *avctx, GetBitContext *gb)
static int vc1_parse_frame_header (VC1Context *v, GetBitContext *gb)
static int vc1_parse_frame_header_adv (VC1Context *v, GetBitContext *gb)
static void vc1_pred_mv (MpegEncContext *s, int n, int dmv_x, int dmv_y, int mv1, int r_x, int r_y, uint8_t *is_intra)
 Predict and set motion vector.
static void vc1_interp_mc (VC1Context *v)
 Motion compensation for direct or interpolated blocks in B-frames.
static av_always_inline int scale_mv (int value, int bfrac, int inv, int qs)
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 void vc1_pred_b_mv (VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mvtype)
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 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.
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, DCTELEM 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, DCTELEM 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, DCTELEM 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, DCTELEM block[64], int n, int mquant, int ttmb, int first_block, uint8_t *dst, int linesize, int skip_block, int apply_filter, int cbp_top, int cbp_left)
 Decode P block.
static int vc1_decode_p_mb (VC1Context *v)
 Decode one P-frame MB (in Simple/Main profile).
static void vc1_decode_b_mb (VC1Context *v)
 Decode one B-frame MB (in Main profile).
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)
static void vc1_decode_blocks (VC1Context *v)
static av_always_inline const
uint8_t * 
find_next_marker (const uint8_t *src, const uint8_t *end)
 Find VC-1 marker in buffer.
static av_always_inline int vc1_unescape_buffer (const uint8_t *src, int size, uint8_t *dst)
static av_cold int vc1_decode_init (AVCodecContext *avctx)
 Initialize a VC1/WMV3 decoder.
static int vc1_decode_frame (AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
 Decode a VC1/WMV3 frame.
static av_cold int vc1_decode_end (AVCodecContext *avctx)
 Close a VC1/WMV3 decoder.

Variables

static const uint16_t table_mb_intra [64][2]
static const int size_table [6] = { 0, 2, 3, 4, 5, 8 }
static const int offset_table [6] = { 0, 1, 3, 7, 15, 31 }
AVCodec vc1_decoder
AVCodec wmv3_decoder


Detailed Description

VC-1 and WMV3 decoder.

Definition in file vc1.c.


Define Documentation

#define AC_VLC_BITS   9

Definition at line 46 of file vc1.c.

#define DC_VLC_BITS   9

Definition at line 45 of file vc1.c.

#define FILTSIGN (  )     ((a) >= 0 ? 1 : -1)

Definition at line 313 of file vc1.c.

#define MB_INTRA_VLC_BITS   9

Definition at line 44 of file vc1.c.


Function Documentation

static int decode_entry_point ( AVCodecContext avctx,
GetBitContext gb 
) [static]

Definition at line 1076 of file vc1.c.

Referenced by vc1_decode_frame(), and vc1_decode_init().

static int decode_sequence_header ( AVCodecContext avctx,
GetBitContext gb 
) [static]

Decode Simple/Main Profiles sequence header.

See also:
Figure 7-8, p16-17
Parameters:
avctx Codec context
gb GetBit context initialized from Codec context extra_data
Returns:
Status

Definition at line 856 of file vc1.c.

Referenced by vc1_decode_init().

static int decode_sequence_header_adv ( VC1Context v,
GetBitContext gb 
) [static]

Definition at line 973 of file vc1.c.

Referenced by decode_sequence_header().

static av_always_inline const uint8_t* find_next_marker ( const uint8_t *  src,
const uint8_t *  end 
) [static]

Find VC-1 marker in buffer.

Returns:
position where next marker starts or end of buffer if no marker found

Definition at line 3969 of file vc1.c.

Referenced by vc1_decode_frame(), and vc1_decode_init().

static int median4 ( int  a,
int  b,
int  c,
int  d 
) [inline, static]

Definition at line 701 of file vc1.c.

Referenced by vc1_mc_4mv_chroma().

static void vc1_decode_b_blocks ( VC1Context v  )  [static]

Definition at line 3863 of file vc1.c.

Referenced by vc1_decode_blocks().

static void vc1_decode_b_mb ( VC1Context v  )  [static]

Decode one B-frame MB (in Main profile).

Definition at line 3424 of file vc1.c.

Referenced by vc1_decode_b_blocks().

static void vc1_decode_blocks ( VC1Context v  )  [static]

Definition at line 3932 of file vc1.c.

Referenced by vc1_decode_frame().

static av_cold int vc1_decode_end ( AVCodecContext avctx  )  [static]

Close a VC1/WMV3 decoder.

Warning:
Initial try at using MpegEncContext stuff

Definition at line 4321 of file vc1.c.

static int vc1_decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
const uint8_t *  buf,
int  buf_size 
) [static]

Decode a VC1/WMV3 frame.

Todo:
TODO: Handle VC-1 IDUs (Transport level?)

Definition at line 4137 of file vc1.c.

static void vc1_decode_i_blocks ( VC1Context v  )  [static]

Decode blocks of I-frame.

Definition at line 3570 of file vc1.c.

Referenced by vc1_decode_blocks().

static void vc1_decode_i_blocks_adv ( VC1Context v  )  [static]

Decode blocks of I-frame for advanced profile.

Definition at line 3683 of file vc1.c.

Referenced by vc1_decode_blocks().

static av_cold int vc1_decode_init ( AVCodecContext avctx  )  [static]

Initialize a VC1/WMV3 decoder.

Todo:
TODO: Handle VC-1 IDUs (Transport level?)

TODO: Decypher remaining bits in extra_data

Definition at line 4005 of file vc1.c.

static void vc1_decode_p_blocks ( VC1Context v  )  [static]

Definition at line 3812 of file vc1.c.

Referenced by vc1_decode_blocks().

static int vc1_decode_p_mb ( VC1Context v  )  [static]

Decode one P-frame MB (in Simple/Main profile).

Definition at line 3130 of file vc1.c.

Referenced by vc1_decode_p_blocks().

static void vc1_decode_skip_blocks ( VC1Context v  )  [static]

Definition at line 3913 of file vc1.c.

Referenced by vc1_decode_blocks().

static av_always_inline int vc1_filter_line ( uint8_t *  src,
int  stride,
int  pq 
) [static]

VC-1 in-loop deblocking filter for one line.

Parameters:
src source block type
stride block stride
pq block quantizer
Returns:
whether other 3 pairs should be filtered or not
See also:
8.6

Definition at line 322 of file vc1.c.

Referenced by vc1_loop_filter().

static int vc1_init_common ( VC1Context v  )  [static]

Init VC-1 specific tables and VC1Context members.

Parameters:
v The VC1Context to initialize
Returns:
Status

Definition at line 55 of file vc1.c.

Referenced by vc1_decode_init().

static void vc1_loop_filter ( uint8_t *  src,
int  step,
int  stride,
int  len,
int  pq 
) [static]

VC-1 in-loop deblocking filter.

Parameters:
src source block type
step distance between horizontally adjacent elements
stride distance between vertically adjacent elements
len edge length to filter (4 or 8 pixels)
pq block quantizer
See also:
8.6

Definition at line 366 of file vc1.c.

Referenced by vc1_decode_p_block(), vc1_decode_p_mb(), and vc1_loop_filter_iblk().

static void vc1_loop_filter_iblk ( MpegEncContext s,
int  pq 
) [static]

Definition at line 382 of file vc1.c.

Referenced by vc1_decode_b_blocks(), vc1_decode_i_blocks(), and vc1_decode_i_blocks_adv().

static void vc1_mc_1mv ( VC1Context v,
int  dir 
) [static]

Do motion compensation over 1 macroblock Mostly adapted hpel_motion and qpel_motion from mpegvideo.c.

Definition at line 479 of file vc1.c.

Referenced by vc1_b_mc(), and vc1_decode_p_mb().

static void vc1_mc_4mv_chroma ( VC1Context v  )  [static]

Do motion compensation for 4-MV macroblock - both chroma blocks.

Definition at line 715 of file vc1.c.

Referenced by vc1_decode_p_mb().

static void vc1_mc_4mv_luma ( VC1Context v,
int  n 
) [static]

Do motion compensation for 4-MV macroblock - luminance block.

Definition at line 629 of file vc1.c.

Referenced by vc1_decode_p_mb().

static int vc1_parse_frame_header ( VC1Context v,
GetBitContext gb 
) [static]

Definition at line 1125 of file vc1.c.

Referenced by vc1_decode_frame().

static int vc1_parse_frame_header_adv ( VC1Context v,
GetBitContext gb 
) [static]

Definition at line 1338 of file vc1.c.

Referenced by vc1_decode_frame().

static void vc1_put_block ( VC1Context v,
DCTELEM  block[6][64] 
) [static]

Put block onto picture.

Definition at line 445 of file vc1.c.

Referenced by vc1_decode_i_blocks(), and vc1_decode_i_blocks_adv().

static av_always_inline int vc1_unescape_buffer ( const uint8_t *  src,
int  size,
uint8_t *  dst 
) [static]

Definition at line 3982 of file vc1.c.

Referenced by vc1_decode_frame(), and vc1_decode_init().

static int vop_dquant_decoding ( VC1Context v  )  [static]

VOP Dquant decoding.

Parameters:
v VC-1 Context

Definition at line 402 of file vc1.c.

Referenced by vc1_parse_frame_header(), and vc1_parse_frame_header_adv().


Variable Documentation

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

Definition at line 3126 of file vc1.c.

Referenced by seq_parse_frame_data().

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

Definition at line 3125 of file vc1.c.

const uint16_t table_mb_intra[64][2] [static]

Definition at line 47 of file vc1.c.

Initial value:

Definition at line 4339 of file vc1.c.

Initial value:

 {
    "wmv3",
    CODEC_TYPE_VIDEO,
    CODEC_ID_WMV3,
    sizeof(VC1Context),
    vc1_decode_init,
    NULL,
    vc1_decode_end,
    vc1_decode_frame,
    CODEC_CAP_DELAY,
    NULL,
    .flush          = ff_mpeg_flush,
    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
    .pix_fmts = ff_pixfmt_list_420
}

Definition at line 4355 of file vc1.c.


Generated on Fri Oct 26 02:35:44 2012 for FFmpeg by  doxygen 1.5.8