FFmpeg
Data Structures | Macros | Functions | Variables
mpeg4video.h File Reference
#include <stdint.h>
#include "get_bits.h"
#include "mpegvideo.h"
#include "rl.h"

Go to the source code of this file.

Data Structures

struct  Mpeg4DecContext
 

Macros

#define RECT_SHAPE   0
 
#define BIN_SHAPE   1
 
#define BIN_ONLY_SHAPE   2
 
#define GRAY_SHAPE   3
 
#define SIMPLE_VO_TYPE   1
 
#define CORE_VO_TYPE   3
 
#define MAIN_VO_TYPE   4
 
#define NBIT_VO_TYPE   5
 
#define ARTS_VO_TYPE   10
 
#define ACE_VO_TYPE   12
 
#define SIMPLE_STUDIO_VO_TYPE   14
 
#define CORE_STUDIO_VO_TYPE   15
 
#define ADV_SIMPLE_VO_TYPE   17
 
#define VOT_VIDEO_ID   1
 
#define VOT_STILL_TEXTURE_ID   2
 
#define EXTENDED_PAR   15
 
#define STATIC_SPRITE   1
 
#define GMC_SPRITE   2
 
#define MOTION_MARKER   0x1F001
 
#define DC_MARKER   0x6B001
 
#define VOS_STARTCODE   0x1B0
 
#define USER_DATA_STARTCODE   0x1B2
 
#define GOP_STARTCODE   0x1B3
 
#define VISUAL_OBJ_STARTCODE   0x1B5
 
#define VOP_STARTCODE   0x1B6
 
#define SLICE_STARTCODE   0x1B7
 
#define EXT_STARTCODE   0x1B8
 
#define QUANT_MATRIX_EXT_ID   0x3
 
#define MAX_NVOP_SIZE   19
 
#define IS_3IV1   0
 

Functions

void ff_mpeg4_encode_mb (MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y)
 
void ff_mpeg4_pred_ac (MpegEncContext *s, int16_t *block, int n, int dir)
 Predict the ac. More...
 
void ff_set_mpeg4_time (MpegEncContext *s)
 
int ff_mpeg4_encode_picture_header (MpegEncContext *s, int picture_number)
 
int ff_mpeg4_decode_picture_header (Mpeg4DecContext *ctx, GetBitContext *gb, int header)
 Decode MPEG-4 headers. More...
 
void ff_mpeg4_encode_video_packet_header (MpegEncContext *s)
 
void ff_mpeg4_clean_buffers (MpegEncContext *s)
 
void ff_mpeg4_stuffing (PutBitContext *pbc)
 add MPEG-4 stuffing bits (01...1) More...
 
void ff_mpeg4_init_partitions (MpegEncContext *s)
 
void ff_mpeg4_merge_partitions (MpegEncContext *s)
 
void ff_clean_mpeg4_qscales (MpegEncContext *s)
 modify mb_type & qscale so that encoding is actually possible in MPEG-4 More...
 
int ff_mpeg4_decode_partitions (Mpeg4DecContext *ctx)
 Decode the first and second partition. More...
 
int ff_mpeg4_get_video_packet_prefix_length (MpegEncContext *s)
 
int ff_mpeg4_decode_video_packet_header (Mpeg4DecContext *ctx)
 Decode the next video packet. More...
 
int ff_mpeg4_decode_studio_slice_header (Mpeg4DecContext *ctx)
 Decode the next video packet. More...
 
void ff_mpeg4_init_direct_mv (MpegEncContext *s)
 
void ff_mpeg4videodec_static_init (void)
 
int ff_mpeg4_workaround_bugs (AVCodecContext *avctx)
 
int ff_mpeg4_frame_end (AVCodecContext *avctx, const uint8_t *buf, int buf_size)
 
int ff_mpeg4_set_direct_mv (MpegEncContext *s, int mx, int my)
 
static int ff_mpeg4_pred_dc (MpegEncContext *s, int n, int level, int *dir_ptr, int encoding)
 Predict the dc. More...
 

Variables

static const uint8_t mpeg4_block_count [4] = {0, 6, 8, 12}
 
const uint8_t ff_mpeg4_DCtab_lum [13][2]
 
const uint8_t ff_mpeg4_DCtab_chrom [13][2]
 
const uint16_t ff_mpeg4_intra_vlc [103][2]
 
const int8_t ff_mpeg4_intra_level [102]
 
const int8_t ff_mpeg4_intra_run [102]
 
RLTable ff_mpeg4_rl_intra
 
RLTable ff_rvlc_rl_inter
 
RLTable ff_rvlc_rl_intra
 
const uint8_t ff_sprite_trajectory_lens [15]
 
const uint8_t ff_mb_type_b_tab [4][2]
 
const int16_t ff_mpeg4_default_intra_matrix [64]
 
const int16_t ff_mpeg4_default_non_intra_matrix [64]
 
const uint8_t ff_mpeg4_y_dc_scale_table [32]
 
const uint8_t ff_mpeg4_c_dc_scale_table [32]
 
const uint16_t ff_mpeg4_resync_prefix [8]
 
const uint8_t ff_mpeg4_dc_threshold [8]
 
const uint8_t ff_mpeg4_studio_dc_luma [19][2]
 
const uint8_t ff_mpeg4_studio_dc_chroma [19][2]
 
const uint8_t ff_mpeg4_studio_intra [12][24][2]
 
uint8_t ff_mpeg4_static_rl_table_store [3][2][2 *MAX_RUN+MAX_LEVEL+3]
 

Macro Definition Documentation

◆ RECT_SHAPE

#define RECT_SHAPE   0

Definition at line 33 of file mpeg4video.h.

◆ BIN_SHAPE

#define BIN_SHAPE   1

Definition at line 34 of file mpeg4video.h.

◆ BIN_ONLY_SHAPE

#define BIN_ONLY_SHAPE   2

Definition at line 35 of file mpeg4video.h.

◆ GRAY_SHAPE

#define GRAY_SHAPE   3

Definition at line 36 of file mpeg4video.h.

◆ SIMPLE_VO_TYPE

#define SIMPLE_VO_TYPE   1

Definition at line 38 of file mpeg4video.h.

◆ CORE_VO_TYPE

#define CORE_VO_TYPE   3

Definition at line 39 of file mpeg4video.h.

◆ MAIN_VO_TYPE

#define MAIN_VO_TYPE   4

Definition at line 40 of file mpeg4video.h.

◆ NBIT_VO_TYPE

#define NBIT_VO_TYPE   5

Definition at line 41 of file mpeg4video.h.

◆ ARTS_VO_TYPE

#define ARTS_VO_TYPE   10

Definition at line 42 of file mpeg4video.h.

◆ ACE_VO_TYPE

#define ACE_VO_TYPE   12

Definition at line 43 of file mpeg4video.h.

◆ SIMPLE_STUDIO_VO_TYPE

#define SIMPLE_STUDIO_VO_TYPE   14

Definition at line 44 of file mpeg4video.h.

◆ CORE_STUDIO_VO_TYPE

#define CORE_STUDIO_VO_TYPE   15

Definition at line 45 of file mpeg4video.h.

◆ ADV_SIMPLE_VO_TYPE

#define ADV_SIMPLE_VO_TYPE   17

Definition at line 46 of file mpeg4video.h.

◆ VOT_VIDEO_ID

#define VOT_VIDEO_ID   1

Definition at line 48 of file mpeg4video.h.

◆ VOT_STILL_TEXTURE_ID

#define VOT_STILL_TEXTURE_ID   2

Definition at line 49 of file mpeg4video.h.

◆ EXTENDED_PAR

#define EXTENDED_PAR   15

Definition at line 52 of file mpeg4video.h.

◆ STATIC_SPRITE

#define STATIC_SPRITE   1

Definition at line 55 of file mpeg4video.h.

◆ GMC_SPRITE

#define GMC_SPRITE   2

Definition at line 56 of file mpeg4video.h.

◆ MOTION_MARKER

#define MOTION_MARKER   0x1F001

Definition at line 58 of file mpeg4video.h.

◆ DC_MARKER

#define DC_MARKER   0x6B001

Definition at line 59 of file mpeg4video.h.

◆ VOS_STARTCODE

#define VOS_STARTCODE   0x1B0

Definition at line 61 of file mpeg4video.h.

◆ USER_DATA_STARTCODE

#define USER_DATA_STARTCODE   0x1B2

Definition at line 62 of file mpeg4video.h.

◆ GOP_STARTCODE

#define GOP_STARTCODE   0x1B3

Definition at line 63 of file mpeg4video.h.

◆ VISUAL_OBJ_STARTCODE

#define VISUAL_OBJ_STARTCODE   0x1B5

Definition at line 64 of file mpeg4video.h.

◆ VOP_STARTCODE

#define VOP_STARTCODE   0x1B6

Definition at line 65 of file mpeg4video.h.

◆ SLICE_STARTCODE

#define SLICE_STARTCODE   0x1B7

Definition at line 66 of file mpeg4video.h.

◆ EXT_STARTCODE

#define EXT_STARTCODE   0x1B8

Definition at line 67 of file mpeg4video.h.

◆ QUANT_MATRIX_EXT_ID

#define QUANT_MATRIX_EXT_ID   0x3

Definition at line 69 of file mpeg4video.h.

◆ MAX_NVOP_SIZE

#define MAX_NVOP_SIZE   19

Definition at line 72 of file mpeg4video.h.

◆ IS_3IV1

#define IS_3IV1   0

Definition at line 188 of file mpeg4video.h.

Function Documentation

◆ ff_mpeg4_encode_mb()

void ff_mpeg4_encode_mb ( MpegEncContext s,
int16_t  block[6][64],
int  motion_x,
int  motion_y 
)

Definition at line 476 of file mpeg4videoenc.c.

Referenced by encode_mb_internal().

◆ ff_mpeg4_pred_ac()

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 71 of file mpeg4videodec.c.

Referenced by ff_msmpeg4_decode_block(), and mpeg4_decode_block().

◆ ff_set_mpeg4_time()

void ff_set_mpeg4_time ( MpegEncContext s)

Definition at line 874 of file mpeg4videoenc.c.

Referenced by encode_picture().

◆ ff_mpeg4_encode_picture_header()

int ff_mpeg4_encode_picture_header ( MpegEncContext s,
int  picture_number 
)

Definition at line 1059 of file mpeg4videoenc.c.

Referenced by encode_picture().

◆ ff_mpeg4_decode_picture_header()

int ff_mpeg4_decode_picture_header ( Mpeg4DecContext ctx,
GetBitContext gb,
int  header 
)

Decode MPEG-4 headers.

Parameters
headerIf set the absence of a VOP is not treated as error; otherwise, it is treated as such.
Returns
<0 if an error occurred FRAME_SKIPPED if a not coded VOP is found 0 else

Definition at line 3221 of file mpeg4videodec.c.

Referenced by ff_h263_decode_frame(), and mpeg4_decode_header().

◆ ff_mpeg4_encode_video_packet_header()

void ff_mpeg4_encode_video_packet_header ( MpegEncContext s)

Definition at line 1361 of file mpeg4videoenc.c.

Referenced by encode_thread().

◆ ff_mpeg4_clean_buffers()

void ff_mpeg4_clean_buffers ( MpegEncContext s)

Definition at line 45 of file mpeg4video.c.

Referenced by encode_thread(), ff_h263_decode_frame(), and ff_msmpeg4_handle_slices().

◆ ff_mpeg4_stuffing()

void ff_mpeg4_stuffing ( PutBitContext pbc)

add MPEG-4 stuffing bits (01...1)

Definition at line 864 of file mpeg4videoenc.c.

Referenced by mpeg4_encode_gop_header(), mpeg4_encode_visual_object_header(), mpeg4_encode_vol_header(), and write_slice_end().

◆ ff_mpeg4_init_partitions()

void ff_mpeg4_init_partitions ( MpegEncContext s)

Definition at line 1322 of file mpeg4videoenc.c.

Referenced by encode_thread().

◆ ff_mpeg4_merge_partitions()

void ff_mpeg4_merge_partitions ( MpegEncContext s)

Definition at line 1335 of file mpeg4videoenc.c.

Referenced by write_slice_end().

◆ ff_clean_mpeg4_qscales()

void ff_clean_mpeg4_qscales ( MpegEncContext s)

modify mb_type & qscale so that encoding is actually possible in MPEG-4

Definition at line 214 of file mpeg4videoenc.c.

Referenced by estimate_qp().

◆ 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 975 of file mpeg4videodec.c.

Referenced by decode_slice().

◆ ff_mpeg4_get_video_packet_prefix_length()

int ff_mpeg4_get_video_packet_prefix_length ( MpegEncContext s)

◆ 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 445 of file mpeg4videodec.c.

Referenced by ff_h263_resync().

◆ ff_mpeg4_decode_studio_slice_header()

int ff_mpeg4_decode_studio_slice_header ( Mpeg4DecContext ctx)

Decode the next video packet.

Returns
<0 if something went wrong

Definition at line 546 of file mpeg4videodec.c.

Referenced by decode_slice().

◆ ff_mpeg4_init_direct_mv()

void ff_mpeg4_init_direct_mv ( MpegEncContext s)

◆ ff_mpeg4videodec_static_init()

void ff_mpeg4videodec_static_init ( void  )

Definition at line 3377 of file mpeg4videodec.c.

Referenced by mpeg4_init_static(), and mpeg4video_parse_init().

◆ ff_mpeg4_workaround_bugs()

int ff_mpeg4_workaround_bugs ( AVCodecContext avctx)

Definition at line 2729 of file mpeg4videodec.c.

Referenced by ff_h263_decode_frame().

◆ ff_mpeg4_frame_end()

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

Definition at line 3403 of file mpeg4videodec.c.

Referenced by ff_h263_decode_frame().

◆ ff_mpeg4_set_direct_mv()

int ff_mpeg4_set_direct_mv ( MpegEncContext s,
int  mx,
int  my 
)
Returns
the mb_type

Definition at line 117 of file mpeg4video.c.

Referenced by encode_thread(), and mpeg4_decode_mb().

◆ ff_mpeg4_pred_dc()

static int ff_mpeg4_pred_dc ( MpegEncContext s,
int  n,
int  level,
int dir_ptr,
int  encoding 
)
inlinestatic

Predict the dc.

encoding quantized level -> quantized diff decoding quantized diff -> quantized level

Parameters
nblock index (0-3 are luma, 4-5 are chroma)
dir_ptrpointer to an integer where the prediction direction will be stored

Definition at line 198 of file mpeg4video.h.

Referenced by ff_mpeg4_encode_mb(), mpeg4_decode_block(), and mpeg4_decode_dc().

Variable Documentation

◆ mpeg4_block_count

const uint8_t mpeg4_block_count[4] = {0, 6, 8, 12}
static

Definition at line 121 of file mpeg4video.h.

Referenced by mpeg4_decode_studio_mb().

◆ ff_mpeg4_DCtab_lum

const uint8_t ff_mpeg4_DCtab_lum[13][2]

◆ ff_mpeg4_DCtab_chrom

const uint8_t ff_mpeg4_DCtab_chrom[13][2]

◆ ff_mpeg4_intra_vlc

const uint16_t ff_mpeg4_intra_vlc[103][2]

Definition at line 47 of file mpeg4data.h.

◆ ff_mpeg4_intra_level

const int8_t ff_mpeg4_intra_level[102]

Definition at line 77 of file mpeg4data.h.

◆ ff_mpeg4_intra_run

const int8_t ff_mpeg4_intra_run[102]

Definition at line 93 of file mpeg4data.h.

◆ ff_mpeg4_rl_intra

RLTable ff_mpeg4_rl_intra

Definition at line 109 of file mpeg4data.h.

Referenced by encode_init(), ff_mpeg4videodec_static_init(), and mpeg4_decode_block().

◆ ff_rvlc_rl_inter

RLTable ff_rvlc_rl_inter

Definition at line 214 of file mpeg4data.h.

Referenced by ff_mpeg4videodec_static_init(), and mpeg4_decode_block().

◆ ff_rvlc_rl_intra

RLTable ff_rvlc_rl_intra

Definition at line 318 of file mpeg4data.h.

Referenced by ff_mpeg4videodec_static_init(), and mpeg4_decode_block().

◆ ff_sprite_trajectory_lens

const uint8_t ff_sprite_trajectory_lens[15]

Definition at line 326 of file mpeg4data.h.

Referenced by ff_mpeg4videodec_static_init().

◆ ff_mb_type_b_tab

const uint8_t ff_mb_type_b_tab[4][2]

Definition at line 330 of file mpeg4data.h.

Referenced by ff_mpeg4videodec_static_init().

◆ ff_mpeg4_default_intra_matrix

const int16_t ff_mpeg4_default_intra_matrix[64]

Definition at line 335 of file mpeg4data.h.

Referenced by ff_mpv_encode_init(), and mpeg4_load_default_matrices().

◆ ff_mpeg4_default_non_intra_matrix

const int16_t ff_mpeg4_default_non_intra_matrix[64]

Definition at line 346 of file mpeg4data.h.

Referenced by ff_mpv_encode_init(), and mpeg4_load_default_matrices().

◆ ff_mpeg4_y_dc_scale_table

const uint8_t ff_mpeg4_y_dc_scale_table[32]

Definition at line 357 of file mpeg4data.h.

Referenced by decode_vop_header(), encode_init(), and ff_msmpeg4_common_init().

◆ ff_mpeg4_c_dc_scale_table

const uint8_t ff_mpeg4_c_dc_scale_table[32]

Definition at line 361 of file mpeg4data.h.

Referenced by decode_vop_header(), encode_init(), and ff_msmpeg4_common_init().

◆ ff_mpeg4_resync_prefix

const uint16_t ff_mpeg4_resync_prefix[8]

Definition at line 366 of file mpeg4data.h.

Referenced by mpeg4_is_resync().

◆ ff_mpeg4_dc_threshold

const uint8_t ff_mpeg4_dc_threshold[8]

Definition at line 370 of file mpeg4data.h.

Referenced by decode_vop_header().

◆ ff_mpeg4_studio_dc_luma

const uint8_t ff_mpeg4_studio_dc_luma[19][2]

Definition at line 375 of file mpeg4data.h.

Referenced by mpeg4_init_static().

◆ ff_mpeg4_studio_dc_chroma

const uint8_t ff_mpeg4_studio_dc_chroma[19][2]

Definition at line 382 of file mpeg4data.h.

Referenced by mpeg4_init_static().

◆ ff_mpeg4_studio_intra

const uint8_t ff_mpeg4_studio_intra[12][24][2]

Definition at line 389 of file mpeg4data.h.

Referenced by mpeg4_init_static().

◆ ff_mpeg4_static_rl_table_store

uint8_t ff_mpeg4_static_rl_table_store[3][2][2 *MAX_RUN+MAX_LEVEL+3]

Definition at line 28 of file mpeg4video.c.

Referenced by encode_init(), and ff_mpeg4videodec_static_init().