Libav
Macros | Functions | Variables
mpeg4videodec.c File Reference
#include "error_resilience.h"
#include "internal.h"
#include "mpegvideo.h"
#include "mpeg4video.h"
#include "h263.h"
#include "thread.h"

Go to the source code of this file.

Macros

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

Functions

void ff_mpeg4_pred_ac (MpegEncContext *s, int16_t *block, int n, int dir)
 Predict the ac. More...
 
static int mpeg4_is_resync (MpegEncContext *s)
 check if the next stuff is a resync marker or the end. More...
 
static int mpeg4_decode_sprite_trajectory (Mpeg4DecContext *ctx, GetBitContext *gb)
 
int ff_mpeg4_decode_video_packet_header (Mpeg4DecContext *ctx)
 Decode the next video packet. More...
 
static int get_amv (Mpeg4DecContext *ctx, int n)
 Get the average motion vector for a GMC MB. More...
 
static int mpeg4_decode_dc (MpegEncContext *s, int n, int *dir_ptr)
 Decode the dc value. More...
 
static int mpeg4_decode_partition_a (Mpeg4DecContext *ctx)
 Decode first partition. More...
 
static int mpeg4_decode_partition_b (MpegEncContext *s, int mb_count)
 decode second partition. More...
 
int ff_mpeg4_decode_partitions (Mpeg4DecContext *ctx)
 Decode the first and second partition. More...
 
static int mpeg4_decode_block (Mpeg4DecContext *ctx, int16_t *block, int n, int coded, int intra, int rvlc)
 Decode a block. More...
 
static int mpeg4_decode_partitioned_mb (MpegEncContext *s, int16_t block[6][64])
 decode partition C of one MB. More...
 
static int mpeg4_decode_mb (MpegEncContext *s, int16_t 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 (Mpeg4DecContext *ctx, GetBitContext *gb)
 
static int decode_user_data (Mpeg4DecContext *ctx, GetBitContext *gb)
 Decode the user data stuff in the header. More...
 
static int decode_vop_header (Mpeg4DecContext *ctx, GetBitContext *gb)
 
int ff_mpeg4_decode_picture_header (Mpeg4DecContext *ctx, GetBitContext *gb)
 Decode mpeg4 headers. More...
 
int ff_mpeg4_frame_end (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 
static int mpeg4_update_thread_context (AVCodecContext *dst, const AVCodecContext *src)
 
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 []
 
AVCodec ff_mpeg4_decoder
 

Macro Definition Documentation

#define SPRITE_TRAJ_VLC_BITS   6

Definition at line 34 of file mpeg4videodec.c.

Referenced by decode_init(), and mpeg4_decode_sprite_trajectory().

#define DC_VLC_BITS   9

Definition at line 35 of file mpeg4videodec.c.

Referenced by decode_init(), and mpeg4_decode_dc().

#define MB_TYPE_B_VLC_BITS   4

Definition at line 36 of file mpeg4videodec.c.

Referenced by decode_init(), and mpeg4_decode_mb().

Function Documentation

void ff_mpeg4_pred_ac ( MpegEncContext s,
int16_t *  block,
int  n,
int  dir 
)

Predict the ac.

Parameters
nblock index (0-3 are luma, 4-5 are chroma)
dirthe ac prediction direction

Definition at line 54 of file mpeg4videodec.c.

Referenced by ff_msmpeg4_decode_block(), and mpeg4_decode_block().

static int mpeg4_is_resync ( MpegEncContext s)
inlinestatic

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

Returns
0 if not

Definition at line 109 of file mpeg4videodec.c.

Referenced by mpeg4_decode_mb(), and mpeg4_decode_partitioned_mb().

static int mpeg4_decode_sprite_trajectory ( Mpeg4DecContext ctx,
GetBitContext gb 
)
static

Definition at line 153 of file mpeg4videodec.c.

Referenced by decode_vop_header(), and ff_mpeg4_decode_video_packet_header().

int ff_mpeg4_decode_video_packet_header ( Mpeg4DecContext ctx)

Decode the next video packet.

Returns
<0 if something went wrong

Definition at line 372 of file mpeg4videodec.c.

Referenced by ff_h263_resync().

static int get_amv ( Mpeg4DecContext ctx,
int  n 
)
inlinestatic

Get the average motion vector for a GMC MB.

Parameters
neither 0 for the x component or 1 for y
Returns
the average MV for a GMC MB

Definition at line 478 of file mpeg4videodec.c.

Referenced by mpeg4_decode_mb(), and mpeg4_decode_partition_a().

static int mpeg4_decode_dc ( MpegEncContext s,
int  n,
int *  dir_ptr 
)
inlinestatic

Decode the dc value.

Parameters
nblock index (0-3 are luma, 4-5 are chroma)
dir_ptrthe prediction direction will be stored here
Returns
the quantized dc

Definition at line 531 of file mpeg4videodec.c.

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

static int mpeg4_decode_partition_a ( Mpeg4DecContext ctx)
static

Decode first partition.

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

Definition at line 578 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 772 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_partitions().

int ff_mpeg4_decode_partitions ( Mpeg4DecContext ctx)

Decode the first and second partition.

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

Definition at line 865 of file mpeg4videodec.c.

Referenced by decode_slice().

static int mpeg4_decode_block ( Mpeg4DecContext ctx,
int16_t *  block,
int  n,
int  coded,
int  intra,
int  rvlc 
)
inlinestatic

Decode a block.

Returns
<0 if an error occurred

Definition at line 928 of file mpeg4videodec.c.

Referenced by mpeg4_decode_mb(), and mpeg4_decode_partitioned_mb().

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

decode partition C of one MB.

Returns
<0 if an error occurred

Definition at line 1173 of file mpeg4videodec.c.

Referenced by decode_vop_header().

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

Definition at line 1258 of file mpeg4videodec.c.

Referenced by decode_init(), and decode_vop_header().

static int mpeg4_decode_gop_header ( MpegEncContext s,
GetBitContext gb 
)
static

Definition at line 1629 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

static int mpeg4_decode_profile_level ( MpegEncContext s,
GetBitContext gb 
)
static

Definition at line 1647 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

static int decode_vol_header ( Mpeg4DecContext ctx,
GetBitContext gb 
)
static

Definition at line 1664 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

static int decode_user_data ( Mpeg4DecContext ctx,
GetBitContext gb 
)
static

Decode the user data stuff in the header.

Also initializes divx/xvid/lavc_version/build.

Definition at line 1995 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

static int decode_vop_header ( Mpeg4DecContext ctx,
GetBitContext gb 
)
static

Definition at line 2079 of file mpeg4videodec.c.

Referenced by ff_mpeg4_decode_picture_header().

int ff_mpeg4_decode_picture_header ( Mpeg4DecContext ctx,
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 2324 of file mpeg4videodec.c.

Referenced by av_mpeg4_decode_header(), and ff_h263_decode_frame().

int ff_mpeg4_frame_end ( AVCodecContext avctx,
const uint8_t buf,
int  buf_size 
)

Definition at line 2497 of file mpeg4videodec.c.

Referenced by ff_h263_decode_frame().

static int mpeg4_update_thread_context ( AVCodecContext dst,
const AVCodecContext src 
)
static

Definition at line 2540 of file mpeg4videodec.c.

static av_cold int decode_init ( AVCodecContext avctx)
static

Definition at line 2557 of file mpeg4videodec.c.

Variable Documentation

VLC dc_lum
static

Definition at line 38 of file mpeg4videodec.c.

VLC dc_chrom
static

Definition at line 38 of file mpeg4videodec.c.

VLC sprite_trajectory
static

Definition at line 39 of file mpeg4videodec.c.

VLC mb_type_b_vlc
static

Definition at line 40 of file mpeg4videodec.c.

const int mb_type_b_map[4]
static
Initial value:
= {
}
#define MB_TYPE_DIRECT2
Definition: avcodec.h:810
#define MB_TYPE_L0L1
Definition: avcodec.h:820
#define MB_TYPE_L1
Definition: avcodec.h:819
#define MB_TYPE_16x16
Definition: avcodec.h:805
#define MB_TYPE_L0
Definition: avcodec.h:818

Definition at line 42 of file mpeg4videodec.c.

Referenced by mpeg4_decode_mb().

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" },
}
#define FF_PROFILE_MPEG4_SIMPLE
Definition: avcodec.h:2646
#define FF_PROFILE_MPEG4_SIMPLE_STUDIO
Definition: avcodec.h:2660
#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE
Definition: avcodec.h:2647
#define FF_PROFILE_MPEG4_CORE_SCALABLE
Definition: avcodec.h:2656
#define FF_PROFILE_MPEG4_CORE
Definition: avcodec.h:2648
#define FF_PROFILE_MPEG4_MAIN
Definition: avcodec.h:2649
#define FF_PROFILE_MPEG4_N_BIT
Definition: avcodec.h:2650
#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION
Definition: avcodec.h:2652
#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE
Definition: avcodec.h:2651
#define FF_PROFILE_MPEG4_ADVANCED_CORE
Definition: avcodec.h:2658
#define FF_PROFILE_MPEG4_HYBRID
Definition: avcodec.h:2654
#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE
Definition: avcodec.h:2661
#define FF_PROFILE_MPEG4_ADVANCED_CODING
Definition: avcodec.h:2657
#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME
Definition: avcodec.h:2655
#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE
Definition: avcodec.h:2653
#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE
Definition: avcodec.h:2659

Definition at line 2606 of file mpeg4videodec.c.

AVCodec ff_mpeg4_decoder
Initial value:
= {
.name = "mpeg4",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
.priv_data_size = sizeof(Mpeg4DecContext),
}
static const AVProfile profiles[]
Definition: dcadec.c:2072
#define CODEC_CAP_TRUNCATED
Definition: avcodec.h:712
static av_cold int decode_init(AVCodecContext *avctx)
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
Definition: mimic.c:269
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:711
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: avcodec.h:740
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:142
void ff_mpeg_flush(AVCodecContext *avctx)
Definition: mpegvideo.c:2433
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
Definition: internal.h:182
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: h263dec.c:361
#define CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
Definition: avcodec.h:705
enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[]
Definition: h263dec.c:636
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:489
static int mpeg4_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
static const AVProfile mpeg4_video_profiles[]
#define CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:782
static av_cold void flush(AVCodecContext *avctx)
Flush (reset) the frame ID after seeking.
Definition: alsdec.c:1766
static av_cold int init(AVCodecParserContext *s)
Definition: h264_parser.c:498
int ff_h263_decode_end(AVCodecContext *avctx)
Definition: h263dec.c:125

Definition at line 2625 of file mpeg4videodec.c.