Defines | Functions | Variables

libavcodec/msmpeg4.c File Reference

MSMPEG4 backend for ffmpeg encoder and decoder. More...

#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
#include "msmpeg4.h"
#include "libavutil/x86_cpu.h"
#include "h263.h"
#include "mpeg4video.h"
#include "msmpeg4data.h"

Go to the source code of this file.

Defines

#define DC_VLC_BITS   9
#define V2_INTRA_CBPC_VLC_BITS   3
#define V2_MB_TYPE_VLC_BITS   7
#define MV_VLC_BITS   9
#define V2_MV_VLC_BITS   9
#define TEX_VLC_BITS   9
#define II_BITRATE   128*1024
#define MBAC_BITRATE   50*1024
#define DEFAULT_INTER_INDEX   3
#define DC_MAX   119

Functions

static av_cold void init_h263_dc_for_msmpeg4 (void)
static av_cold void common_init (MpegEncContext *s)
static void init_mv_table (MVTable *tab)
void ff_msmpeg4_code012 (PutBitContext *pb, int n)
static int get_size_of_code (MpegEncContext *s, RLTable *rl, int last, int run, int level, int intra)
av_cold void ff_msmpeg4_encode_init (MpegEncContext *s)
static void find_best_tables (MpegEncContext *s)
void msmpeg4_encode_picture_header (MpegEncContext *s, int picture_number)
void msmpeg4_encode_ext_header (MpegEncContext *s)
int ff_msmpeg4_coded_block_pred (MpegEncContext *s, int n, uint8_t **coded_block_ptr)
void ff_msmpeg4_encode_motion (MpegEncContext *s, int mx, int my)
void ff_msmpeg4_handle_slices (MpegEncContext *s)
static void msmpeg4v2_encode_motion (MpegEncContext *s, int val)
void msmpeg4_encode_mb (MpegEncContext *s, DCTELEM block[6][64], int motion_x, int motion_y)
static int msmpeg4v1_pred_dc (MpegEncContext *s, int n, int32_t **dc_val_ptr)
static int get_dc (uint8_t *src, int stride, int scale)
static int msmpeg4_pred_dc (MpegEncContext *s, int n, int16_t **dc_val_ptr, int *dir_ptr)
static void msmpeg4_encode_dc (MpegEncContext *s, int level, int n, int *dir_ptr)
void ff_msmpeg4_encode_block (MpegEncContext *s, DCTELEM *block, int n)
static int msmpeg4v2_decode_motion (MpegEncContext *s, int pred, int f_code)
static int msmpeg4v12_decode_mb (MpegEncContext *s, DCTELEM block[6][64])
static int msmpeg4v34_decode_mb (MpegEncContext *s, DCTELEM block[6][64])
av_cold int ff_msmpeg4_decode_init (AVCodecContext *avctx)
int msmpeg4_decode_picture_header (MpegEncContext *s)
int msmpeg4_decode_ext_header (MpegEncContext *s, int buf_size)
static int msmpeg4_decode_dc (MpegEncContext *s, int n, int *dir_ptr)
int ff_msmpeg4_decode_block (MpegEncContext *s, DCTELEM *block, int n, int coded, const uint8_t *scan_table)
int ff_msmpeg4_decode_motion (MpegEncContext *s, int *mx_ptr, int *my_ptr)

Variables

static uint32_t v2_dc_lum_table [512][2]
static uint32_t v2_dc_chroma_table [512][2]
const uint8_t wmv3_dc_scale_table [32]
static uint8_t rl_length [NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]
static uint8_t static_rl_table_store [NB_RL_TABLES][2][2 *MAX_RUN+MAX_LEVEL+3]
VLC ff_mb_non_intra_vlc [4]
static VLC v2_dc_lum_vlc
static VLC v2_dc_chroma_vlc
static VLC v2_intra_cbpc_vlc
static VLC v2_mb_type_vlc
static VLC v2_mv_vlc
VLC ff_inter_intra_vlc
AVCodec ff_msmpeg4v1_decoder
AVCodec ff_msmpeg4v2_decoder
AVCodec ff_msmpeg4v3_decoder
AVCodec ff_wmv1_decoder

Detailed Description

MSMPEG4 backend for ffmpeg encoder and decoder.

Definition in file msmpeg4.c.


Define Documentation

#define DC_MAX   119

Definition at line 841 of file msmpeg4.c.

Referenced by msmpeg4_decode_dc(), and msmpeg4_encode_dc().

#define DC_VLC_BITS   9

Definition at line 47 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_init(), and msmpeg4_decode_dc().

#define DEFAULT_INTER_INDEX   3

Definition at line 57 of file msmpeg4.c.

Referenced by msmpeg4v34_decode_mb().

#define II_BITRATE   128*1024

Definition at line 54 of file msmpeg4.c.

Referenced by msmpeg4_encode_picture_header().

#define MBAC_BITRATE   50*1024

Definition at line 55 of file msmpeg4.c.

Referenced by msmpeg4_decode_picture_header(), and msmpeg4_encode_picture_header().

#define MV_VLC_BITS   9

Definition at line 50 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_init(), and ff_msmpeg4_decode_motion().

#define TEX_VLC_BITS   9

Definition at line 52 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_block().

#define V2_INTRA_CBPC_VLC_BITS   3

Definition at line 48 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_init(), and msmpeg4v12_decode_mb().

#define V2_MB_TYPE_VLC_BITS   7

Definition at line 49 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_init(), and msmpeg4v12_decode_mb().

#define V2_MV_VLC_BITS   9

Definition at line 51 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_init(), and msmpeg4v2_decode_motion().


Function Documentation

static av_cold void common_init ( MpegEncContext s  )  [static]

Definition at line 133 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_init(), and ff_msmpeg4_encode_init().

void ff_msmpeg4_code012 ( PutBitContext pb,
int  n 
)

Definition at line 201 of file msmpeg4.c.

Referenced by ff_wmv2_encode_picture_header(), and msmpeg4_encode_picture_header().

int ff_msmpeg4_coded_block_pred ( MpegEncContext s,
int  n,
uint8_t **  coded_block_ptr 
)
int ff_msmpeg4_decode_block ( MpegEncContext s,
DCTELEM block,
int  n,
int  coded,
const uint8_t *  scan_table 
)
av_cold int ff_msmpeg4_decode_init ( AVCodecContext avctx  ) 

Definition at line 1262 of file msmpeg4.c.

Referenced by vc1_decode_init(), and wmv2_decode_init().

int ff_msmpeg4_decode_motion ( MpegEncContext s,
int *  mx_ptr,
int *  my_ptr 
)

Definition at line 1847 of file msmpeg4.c.

Referenced by msmpeg4v34_decode_mb(), and wmv2_decode_motion().

void ff_msmpeg4_encode_block ( MpegEncContext s,
DCTELEM block,
int  n 
)

Definition at line 922 of file msmpeg4.c.

Referenced by ff_wmv2_encode_mb(), and msmpeg4_encode_mb().

av_cold void ff_msmpeg4_encode_init ( MpegEncContext s  ) 

Definition at line 252 of file msmpeg4.c.

Referenced by MPV_encode_init().

void ff_msmpeg4_encode_motion ( MpegEncContext s,
int  mx,
int  my 
)

Definition at line 456 of file msmpeg4.c.

Referenced by ff_wmv2_encode_mb(), and msmpeg4_encode_mb().

void ff_msmpeg4_handle_slices ( MpegEncContext s  ) 

Definition at line 494 of file msmpeg4.c.

Referenced by ff_wmv2_encode_mb(), and msmpeg4_encode_mb().

static void find_best_tables ( MpegEncContext s  )  [static]

Definition at line 286 of file msmpeg4.c.

Referenced by msmpeg4_encode_picture_header().

static int get_dc ( uint8_t *  src,
int  stride,
int  scale 
) [static]

Definition at line 680 of file msmpeg4.c.

Referenced by msmpeg4_pred_dc().

static int get_size_of_code ( MpegEncContext s,
RLTable rl,
int  last,
int  run,
int  level,
int  intra 
) [static]

Definition at line 211 of file msmpeg4.c.

Referenced by ff_msmpeg4_encode_init().

static av_cold void init_h263_dc_for_msmpeg4 ( void   )  [static]

Definition at line 79 of file msmpeg4.c.

Referenced by common_init().

static void init_mv_table ( MVTable tab  )  [static]

Definition at line 185 of file msmpeg4.c.

Referenced by ff_msmpeg4_encode_init().

static int msmpeg4_decode_dc ( MpegEncContext s,
int  n,
int *  dir_ptr 
) [static]

Definition at line 1554 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_block().

int msmpeg4_decode_ext_header ( MpegEncContext s,
int  buf_size 
)

Definition at line 1524 of file msmpeg4.c.

Referenced by ff_h263_decode_frame(), and msmpeg4_decode_picture_header().

int msmpeg4_decode_picture_header ( MpegEncContext s  ) 

Definition at line 1370 of file msmpeg4.c.

Referenced by ff_h263_decode_frame().

static void msmpeg4_encode_dc ( MpegEncContext s,
int  level,
int  n,
int *  dir_ptr 
) [static]

Definition at line 843 of file msmpeg4.c.

Referenced by ff_msmpeg4_encode_block().

void msmpeg4_encode_ext_header ( MpegEncContext s  ) 

Definition at line 413 of file msmpeg4.c.

Referenced by encode_thread(), and msmpeg4_encode_picture_header().

void msmpeg4_encode_mb ( MpegEncContext s,
DCTELEM  block[6][64],
int  motion_x,
int  motion_y 
)

Definition at line 540 of file msmpeg4.c.

Referenced by encode_mb_internal().

void msmpeg4_encode_picture_header ( MpegEncContext s,
int  picture_number 
)

Definition at line 354 of file msmpeg4.c.

Referenced by encode_picture().

static int msmpeg4_pred_dc ( MpegEncContext s,
int  n,
int16_t **  dc_val_ptr,
int *  dir_ptr 
) [inline, static]

Definition at line 694 of file msmpeg4.c.

Referenced by msmpeg4_decode_dc(), and msmpeg4_encode_dc().

static int msmpeg4v12_decode_mb ( MpegEncContext s,
DCTELEM  block[6][64] 
) [static]

Definition at line 1085 of file msmpeg4.c.

static int msmpeg4v1_pred_dc ( MpegEncContext s,
int  n,
int32_t **  dc_val_ptr 
) [inline, static]

Definition at line 665 of file msmpeg4.c.

Referenced by msmpeg4_decode_dc().

static int msmpeg4v2_decode_motion ( MpegEncContext s,
int  pred,
int  f_code 
) [static]

Definition at line 1054 of file msmpeg4.c.

Referenced by msmpeg4v12_decode_mb().

static void msmpeg4v2_encode_motion ( MpegEncContext s,
int  val 
) [static]

Definition at line 507 of file msmpeg4.c.

Referenced by msmpeg4_encode_mb().

static int msmpeg4v34_decode_mb ( MpegEncContext s,
DCTELEM  block[6][64] 
) [static]

Definition at line 1171 of file msmpeg4.c.


Variable Documentation

Definition at line 1051 of file msmpeg4.c.

Referenced by ff_wmv2_decode_mb().

Definition at line 1045 of file msmpeg4.c.

Referenced by ff_wmv2_decode_mb().

Initial value:
 {
    "msmpeg4v1",
    AVMEDIA_TYPE_VIDEO,
    CODEC_ID_MSMPEG4V1,
    sizeof(MpegEncContext),
    ff_msmpeg4_decode_init,
    NULL,
    ff_h263_decode_end,
    ff_h263_decode_frame,
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_EXPERIMENTAL,
    .max_lowres= 3,
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
    .pix_fmts= ff_pixfmt_list_420,
}

Definition at line 1886 of file msmpeg4.c.

Initial value:
 {
    "msmpeg4v2",
    AVMEDIA_TYPE_VIDEO,
    CODEC_ID_MSMPEG4V2,
    sizeof(MpegEncContext),
    ff_msmpeg4_decode_init,
    NULL,
    ff_h263_decode_end,
    ff_h263_decode_frame,
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
    .max_lowres= 3,
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
    .pix_fmts= ff_pixfmt_list_420,
}

Definition at line 1901 of file msmpeg4.c.

Initial value:
 {
    "msmpeg4",
    AVMEDIA_TYPE_VIDEO,
    CODEC_ID_MSMPEG4V3,
    sizeof(MpegEncContext),
    ff_msmpeg4_decode_init,
    NULL,
    ff_h263_decode_end,
    ff_h263_decode_frame,
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
    .max_lowres= 3,
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
    .pix_fmts= ff_pixfmt_list_420,
}

Definition at line 1916 of file msmpeg4.c.

Initial value:
 {
    "wmv1",
    AVMEDIA_TYPE_VIDEO,
    CODEC_ID_WMV1,
    sizeof(MpegEncContext),
    ff_msmpeg4_decode_init,
    NULL,
    ff_h263_decode_end,
    ff_h263_decode_frame,
    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
    .max_lowres= 3,
    .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
    .pix_fmts= ff_pixfmt_list_420,
}

Definition at line 1931 of file msmpeg4.c.

uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2] [static]

Definition at line 72 of file msmpeg4.c.

Referenced by ff_msmpeg4_encode_init(), and find_best_tables().

uint8_t static_rl_table_store[NB_RL_TABLES][2][2 *MAX_RUN+MAX_LEVEL+3] [static]

Definition at line 75 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_init(), and ff_msmpeg4_encode_init().

uint32_t v2_dc_chroma_table[512][2] [static]

Definition at line 60 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_init(), init_h263_dc_for_msmpeg4(), and msmpeg4_encode_dc().

Definition at line 1047 of file msmpeg4.c.

uint32_t v2_dc_lum_table[512][2] [static]

Definition at line 59 of file msmpeg4.c.

Referenced by ff_msmpeg4_decode_init(), init_h263_dc_for_msmpeg4(), and msmpeg4_encode_dc().

VLC v2_dc_lum_vlc [static]

Definition at line 1046 of file msmpeg4.c.

Definition at line 1048 of file msmpeg4.c.

VLC v2_mb_type_vlc [static]

Definition at line 1049 of file msmpeg4.c.

VLC v2_mv_vlc [static]

Definition at line 1050 of file msmpeg4.c.

const uint8_t wmv3_dc_scale_table[32]

Definition at line 274 of file vc1data.c.

Referenced by common_init().