libavcodec/mpeg4videodec.c File Reference

#include "libavutil/opt.h"
#include "mpegvideo.h"
#include "mpeg4video.h"
#include "h263.h"
#include "thread.h"

Go to the source code of this file.

Defines

#define UNCHECKED_BITSTREAM_READER   1
#define SPRITE_TRAJ_VLC_BITS   6
#define DC_VLC_BITS   9
#define MB_TYPE_B_VLC_BITS   4

Functions

void mpeg4_pred_ac (MpegEncContext *s, DCTELEM *block, int n, int dir)
 Predict the ac.
static int mpeg4_is_resync (MpegEncContext *s)
 check if the next stuff is a resync marker or the end.
static int mpeg4_decode_sprite_trajectory (MpegEncContext *s, GetBitContext *gb)
int mpeg4_decode_video_packet_header (MpegEncContext *s)
 Decode the next video packet.
static int get_amv (MpegEncContext *s, int n)
 Get the average motion vector for a GMC MB.
static int mpeg4_decode_dc (MpegEncContext *s, int n, int *dir_ptr)
 Decode the dc value.
static int mpeg4_decode_partition_a (MpegEncContext *s)
 Decode first partition.
static int mpeg4_decode_partition_b (MpegEncContext *s, int mb_count)
 decode second partition.
int ff_mpeg4_decode_partitions (MpegEncContext *s)
 Decode the first and second partition.
static int mpeg4_decode_block (MpegEncContext *s, DCTELEM *block, int n, int coded, int intra, int rvlc)
 Decode a block.
static int mpeg4_decode_partitioned_mb (MpegEncContext *s, DCTELEM block[6][64])
 decode partition C of one MB.
static int mpeg4_decode_mb (MpegEncContext *s, DCTELEM block[6][64])
static int mpeg4_decode_gop_header (MpegEncContext *s, GetBitContext *gb)
static int mpeg4_decode_profile_level (MpegEncContext *s, GetBitContext *gb)
static int decode_vol_header (MpegEncContext *s, GetBitContext *gb)
static int decode_user_data (MpegEncContext *s, GetBitContext *gb)
 Decode the user data stuff in the header.
static int decode_vop_header (MpegEncContext *s, GetBitContext *gb)
int ff_mpeg4_decode_picture_header (MpegEncContext *s, GetBitContext *gb)
 Decode mpeg4 headers.
static av_cold int decode_init (AVCodecContext *avctx)

Variables

static VLC dc_lum
static VLC dc_chrom
static VLC sprite_trajectory
static VLC mb_type_b_vlc
static const int mb_type_b_map [4]
static const AVProfile mpeg4_video_profiles []
static const AVOption mpeg4_options []
static const AVClass mpeg4_class
static const AVClass mpeg4_vdpau_class
AVCodec ff_mpeg4_decoder
AVCodec ff_mpeg4_vdpau_decoder

Define Documentation

#define DC_VLC_BITS   9

Definition at line 36 of file mpeg4videodec.c.

Referenced by decode_init(), and mpeg4_decode_dc().

#define MB_TYPE_B_VLC_BITS   4

Definition at line 37 of file mpeg4videodec.c.

Referenced by decode_init(), and mpeg4_decode_mb().

#define SPRITE_TRAJ_VLC_BITS   6

Definition at line 35 of file mpeg4videodec.c.

Referenced by decode_init(), and mpeg4_decode_sprite_trajectory().

#define UNCHECKED_BITSTREAM_READER   1

Definition at line 23 of file mpeg4videodec.c.


Function Documentation

static av_cold int decode_init ( AVCodecContext avctx  )  [static]

Definition at line 2223 of file mpeg4videodec.c.

static int decode_user_data ( MpegEncContext s,
GetBitContext gb 
) [static]

Decode the user data stuff in the header.

Also initializes divx/xvid/lavc_version/build.

Definition at line 1861 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

static int decode_vol_header ( MpegEncContext s,
GetBitContext gb 
) [static]

Definition at line 1551 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

static int decode_vop_header ( MpegEncContext s,
GetBitContext gb 
) [static]

Definition at line 1915 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

int ff_mpeg4_decode_partitions ( MpegEncContext s  ) 

Decode the first and second partition.

Returns:
<0 if error (and sets error type in the error_status_table)

Definition at line 793 of file mpeg4videodec.c.

Referenced by decode_slice().

int ff_mpeg4_decode_picture_header ( MpegEncContext s,
GetBitContext gb 
)

Decode mpeg4 headers.

Returns:
<0 if no VOP found (or a damaged one) FRAME_SKIPPED if a not coded VOP is found 0 if a VOP is found

Definition at line 2134 of file mpeg4videodec.c.

Referenced by av_mpeg4_decode_header(), and ff_h263_decode_frame().

static int get_amv ( MpegEncContext s,
int  n 
) [inline, static]

Get the average motion vector for a GMC MB.

Parameters:
n either 0 for the x component or 1 for y
Returns:
the average MV for a GMC MB

Definition at line 449 of file mpeg4videodec.c.

Referenced by mpeg4_decode_mb(), and mpeg4_decode_partition_a().

static int mpeg4_decode_block ( MpegEncContext s,
DCTELEM block,
int  n,
int  coded,
int  intra,
int  rvlc 
) [inline, static]

Decode a block.

Returns:
<0 if an error occurred

Definition at line 846 of file mpeg4videodec.c.

Referenced by mpeg4_decode_mb(), and mpeg4_decode_partitioned_mb().

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

Decode the dc value.

Parameters:
n block index (0-3 are luma, 4-5 are chroma)
dir_ptr the prediction direction will be stored here
Returns:
the quantized dc

Definition at line 496 of file mpeg4videodec.c.

Referenced by mpeg4_decode_block(), mpeg4_decode_partition_a(), and mpeg4_decode_partition_b().

static int mpeg4_decode_gop_header ( MpegEncContext s,
GetBitContext gb 
) [static]

Definition at line 1517 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

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

Definition at line 1174 of file mpeg4videodec.c.

static int mpeg4_decode_partition_a ( MpegEncContext s  )  [static]

Decode first partition.

Returns:
number of MBs decoded or <0 if an error occurred

Definition at line 541 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_partitions().

static int mpeg4_decode_partition_b ( MpegEncContext s,
int  mb_count 
) [static]

decode second partition.

Returns:
<0 if an error occurred

Definition at line 706 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_partitions().

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

decode partition C of one MB.

Returns:
<0 if an error occurred

Definition at line 1092 of file mpeg4videodec.c.

static int mpeg4_decode_profile_level ( MpegEncContext s,
GetBitContext gb 
) [static]

Definition at line 1538 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

static int mpeg4_decode_sprite_trajectory ( MpegEncContext s,
GetBitContext gb 
) [static]

Definition at line 163 of file mpeg4videodec.c.

Referenced by decode_vop_header(), and mpeg4_decode_video_packet_header().

int mpeg4_decode_video_packet_header ( MpegEncContext s  ) 

Decode the next video packet.

Returns:
<0 if something went wrong

Definition at line 361 of file mpeg4videodec.c.

Referenced by ff_h263_resync().

static int mpeg4_is_resync ( MpegEncContext s  )  [inline, static]

check if the next stuff is a resync marker or the end.

Returns:
0 if not

Definition at line 115 of file mpeg4videodec.c.

Referenced by mpeg4_decode_mb(), and mpeg4_decode_partitioned_mb().

void mpeg4_pred_ac ( MpegEncContext s,
DCTELEM block,
int  n,
int  dir 
)

Predict the ac.

Parameters:
n block index (0-3 are luma, 4-5 are chroma)
dir the ac prediction direction

Definition at line 56 of file mpeg4videodec.c.

Referenced by ff_msmpeg4_decode_block(), and mpeg4_decode_block().


Variable Documentation

VLC dc_chrom [static]

Definition at line 40 of file mpeg4videodec.c.

VLC dc_lum [static]

Definition at line 40 of file mpeg4videodec.c.

Initial value:
 {
    .name           = "mpeg4",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_MPEG4,
    .priv_data_size = sizeof(MpegEncContext),
    .init           = decode_init,
    .close          = ff_h263_decode_end,
    .decode         = ff_h263_decode_frame,
    .capabilities   = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_FRAME_THREADS,
    .flush= ff_mpeg_flush,
    .max_lowres= 3,
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
    .pix_fmts= ff_hwaccel_pixfmt_list_420,
    .profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles),
    .update_thread_context= ONLY_IF_THREADS_ENABLED(ff_mpeg_update_thread_context),
    .priv_class = &mpeg4_class,
}

Definition at line 2308 of file mpeg4videodec.c.

Initial value:
 {
    .name           = "mpeg4_vdpau",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_MPEG4,
    .priv_data_size = sizeof(MpegEncContext),
    .init           = decode_init,
    .close          = ff_h263_decode_end,
    .decode         = ff_h263_decode_frame,
    .capabilities   = CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"),
    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE},
    .priv_class = &mpeg4_vdpau_class,
}

Definition at line 2328 of file mpeg4videodec.c.

const int mb_type_b_map[4] [static]
Initial value:
 {
    MB_TYPE_DIRECT2 | MB_TYPE_L0L1,
    MB_TYPE_L0L1 | MB_TYPE_16x16,
    MB_TYPE_L1 | MB_TYPE_16x16,
    MB_TYPE_L0 | MB_TYPE_16x16,
}

Definition at line 44 of file mpeg4videodec.c.

Referenced by mpeg4_decode_mb().

VLC mb_type_b_vlc [static]

Definition at line 42 of file mpeg4videodec.c.

const AVClass mpeg4_class [static]
Initial value:

Definition at line 2294 of file mpeg4videodec.c.

const AVOption mpeg4_options[] [static]
Initial value:
 {
    {"quarter_sample", "1/4 subpel MC", 0x42, FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, 0},
    {"divx_packed", "divx style packed b frames", 0x42, FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, 0},
    {NULL}
}

Definition at line 2288 of file mpeg4videodec.c.

const AVClass mpeg4_vdpau_class [static]
Initial value:
 {
    "MPEG4 Video VDPAU Decoder",
    av_default_item_name,
    mpeg4_options,
    LIBAVUTIL_VERSION_INT,
}

Definition at line 2301 of file mpeg4videodec.c.

const AVProfile mpeg4_video_profiles[] [static]
Initial value:
 {
    { FF_PROFILE_MPEG4_SIMPLE,                    "Simple Profile" },
    { FF_PROFILE_MPEG4_SIMPLE_SCALABLE,           "Simple Scalable Profile" },
    { FF_PROFILE_MPEG4_CORE,                      "Core Profile" },
    { FF_PROFILE_MPEG4_MAIN,                      "Main Profile" },
    { FF_PROFILE_MPEG4_N_BIT,                     "N-bit Profile" },
    { FF_PROFILE_MPEG4_SCALABLE_TEXTURE,          "Scalable Texture Profile" },
    { FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION,     "Simple Face Animation Profile" },
    { FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE,    "Basic Animated Texture Profile" },
    { FF_PROFILE_MPEG4_HYBRID,                    "Hybrid Profile" },
    { FF_PROFILE_MPEG4_ADVANCED_REAL_TIME,        "Advanced Real Time Simple Profile" },
    { FF_PROFILE_MPEG4_CORE_SCALABLE,             "Code Scalable Profile" },
    { FF_PROFILE_MPEG4_ADVANCED_CODING,           "Advanced Coding Profile" },
    { FF_PROFILE_MPEG4_ADVANCED_CORE,             "Advanced Core Profile" },
    { FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE, "Advanced Scalable Texture Profile" },
    { FF_PROFILE_MPEG4_SIMPLE_STUDIO,             "Simple Studio Profile" },
    { FF_PROFILE_MPEG4_ADVANCED_SIMPLE,           "Advanced Simple Profile" },
}

Definition at line 2269 of file mpeg4videodec.c.

Definition at line 41 of file mpeg4videodec.c.