FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
mpegvideo.h File Reference

mpegvideo header. More...

#include "avcodec.h"
#include "dsputil.h"
#include "error_resilience.h"
#include "get_bits.h"
#include "h264chroma.h"
#include "h263dsp.h"
#include "hpeldsp.h"
#include "put_bits.h"
#include "ratecontrol.h"
#include "parser.h"
#include "mpeg12data.h"
#include "rl.h"
#include "thread.h"
#include "videodsp.h"
#include "libavutil/opt.h"
#include "libavutil/timecode.h"

Go to the source code of this file.

Data Structures

struct  Picture
 Picture. More...
 
struct  MotionEstContext
 Motion estimation context. More...
 
struct  MpegEncContext
 MpegEncContext. More...
 

Macros

#define FRAME_SKIPPED   100
 return value for header parsers if frame is not coded
 
#define MPEG_BUF_SIZE   (16 * 1024)
 
#define QMAT_SHIFT_MMX   16
 
#define QMAT_SHIFT   21
 
#define MAX_FCODE   7
 
#define MAX_MV   4096
 
#define MAX_THREADS   32
 
#define MAX_PICTURE_COUNT   36
 
#define MAX_B_FRAMES   16
 
#define ME_MAP_SIZE   64
 
#define ME_MAP_SHIFT   3
 
#define ME_MAP_MV_BITS   11
 
#define MAX_MB_BYTES   (30*16*16*3/8 + 120)
 
#define INPLACE_OFFSET   16
 
#define SEQ_END_CODE   0x000001b7
 
#define SEQ_START_CODE   0x000001b3
 
#define GOP_START_CODE   0x000001b8
 
#define PICTURE_START_CODE   0x00000100
 
#define SLICE_MIN_START_CODE   0x00000101
 
#define SLICE_MAX_START_CODE   0x000001af
 
#define EXT_START_CODE   0x000001b5
 
#define USER_START_CODE   0x000001b2
 
#define DELAYED_PIC_REF   4
 Value of Picture.reference when Picture is not a reference picture, but is held for delayed output.
 
#define MB_TYPE_INTRA   MB_TYPE_INTRA4x4
 
#define IS_INTRA4x4(a)   ((a)&MB_TYPE_INTRA4x4)
 
#define IS_INTRA16x16(a)   ((a)&MB_TYPE_INTRA16x16)
 
#define IS_PCM(a)   ((a)&MB_TYPE_INTRA_PCM)
 
#define IS_INTRA(a)   ((a)&7)
 
#define IS_INTER(a)   ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8))
 
#define IS_SKIP(a)   ((a)&MB_TYPE_SKIP)
 
#define IS_INTRA_PCM(a)   ((a)&MB_TYPE_INTRA_PCM)
 
#define IS_INTERLACED(a)   ((a)&MB_TYPE_INTERLACED)
 
#define IS_DIRECT(a)   ((a)&MB_TYPE_DIRECT2)
 
#define IS_GMC(a)   ((a)&MB_TYPE_GMC)
 
#define IS_16X16(a)   ((a)&MB_TYPE_16x16)
 
#define IS_16X8(a)   ((a)&MB_TYPE_16x8)
 
#define IS_8X16(a)   ((a)&MB_TYPE_8x16)
 
#define IS_8X8(a)   ((a)&MB_TYPE_8x8)
 
#define IS_SUB_8X8(a)   ((a)&MB_TYPE_16x16)
 
#define IS_SUB_8X4(a)   ((a)&MB_TYPE_16x8)
 
#define IS_SUB_4X8(a)   ((a)&MB_TYPE_8x16)
 
#define IS_SUB_4X4(a)   ((a)&MB_TYPE_8x8)
 
#define IS_ACPRED(a)   ((a)&MB_TYPE_ACPRED)
 
#define IS_QUANT(a)   ((a)&MB_TYPE_QUANT)
 
#define IS_DIR(a, part, list)   ((a) & (MB_TYPE_P0L0<<((part)+2*(list))))
 
#define USES_LIST(a, list)   ((a) & ((MB_TYPE_P0L0|MB_TYPE_P1L0)<<(2*(list))))
 does this mb use listX, note does not work if subMBs
 
#define HAS_CBP(a)   ((a)&MB_TYPE_CBP)
 
#define MV_DIR_FORWARD   1
 
#define MV_DIR_BACKWARD   2
 
#define MV_DIRECT   4
 bidirectional mode where the difference equals the MV of the last P/S/I-Frame (mpeg4)
 
#define MV_TYPE_16X16   0
 1 vector for the whole mb
 
#define MV_TYPE_8X8   1
 4 vectors (h263, mpeg4 4MV)
 
#define MV_TYPE_16X8   2
 2 vectors, one per 16x8 block
 
#define MV_TYPE_FIELD   3
 2 vectors, one per field
 
#define MV_TYPE_DMV   4
 2 vectors, special mpeg2 Dual Prime Vectors
 
#define CANDIDATE_MB_TYPE_INTRA   0x01
 
#define CANDIDATE_MB_TYPE_INTER   0x02
 
#define CANDIDATE_MB_TYPE_INTER4V   0x04
 
#define CANDIDATE_MB_TYPE_SKIPPED   0x08
 
#define CANDIDATE_MB_TYPE_DIRECT   0x10
 
#define CANDIDATE_MB_TYPE_FORWARD   0x20
 
#define CANDIDATE_MB_TYPE_BACKWARD   0x40
 
#define CANDIDATE_MB_TYPE_BIDIR   0x80
 
#define CANDIDATE_MB_TYPE_INTER_I   0x100
 
#define CANDIDATE_MB_TYPE_FORWARD_I   0x200
 
#define CANDIDATE_MB_TYPE_BACKWARD_I   0x400
 
#define CANDIDATE_MB_TYPE_BIDIR_I   0x800
 
#define CANDIDATE_MB_TYPE_DIRECT0   0x1000
 
#define QUANT_BIAS_SHIFT   8
 
#define UNI_AC_ENC_INDEX(run, level)   ((run)*128 + (level))
 
#define PICT_TOP_FIELD   1
 
#define PICT_BOTTOM_FIELD   2
 
#define PICT_FRAME   3
 
#define CHROMA_420   1
 
#define CHROMA_422   2
 
#define CHROMA_444   3
 
#define SLICE_OK   0
 
#define SLICE_ERROR   -1
 
#define SLICE_END   -2
 end marker found
 
#define SLICE_NOEND   -3
 no end marker or error found but mb count exceeded
 
#define REBASE_PICTURE(pic, new_ctx, old_ctx)
 
#define FF_MPV_FLAG_SKIP_RD   0x0001
 
#define FF_MPV_FLAG_STRICT_GOP   0x0002
 
#define FF_MPV_FLAG_QP_RD   0x0004
 
#define FF_MPV_FLAG_CBP_RD   0x0008
 
#define FF_MPV_OFFSET(x)   offsetof(MpegEncContext, x)
 
#define FF_MPV_OPT_FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
 
#define FF_MPV_COMMON_OPTS
 
#define FF_MPV_GENERIC_CLASS(name)
 

Enumerations

enum  OutputFormat { FMT_MPEG1, FMT_H261, FMT_H263, FMT_MJPEG }
 

Functions

void ff_MPV_common_defaults (MpegEncContext *s)
 Set the given MpegEncContext to common defaults (same for encoding and decoding).
 
void ff_MPV_decode_defaults (MpegEncContext *s)
 Set the given MpegEncContext to defaults for decoding.
 
int ff_MPV_common_init (MpegEncContext *s)
 init common structure for both encoder and decoder.
 
int ff_MPV_common_frame_size_change (MpegEncContext *s)
 
void ff_MPV_common_end (MpegEncContext *s)
 
void ff_MPV_decode_mb (MpegEncContext *s, int16_t block[12][64])
 
int ff_MPV_frame_start (MpegEncContext *s, AVCodecContext *avctx)
 generic function called after decoding the header and before a frame is decoded.
 
void ff_MPV_frame_end (MpegEncContext *s)
 
int ff_MPV_encode_init (AVCodecContext *avctx)
 
int ff_MPV_encode_end (AVCodecContext *avctx)
 
int ff_MPV_encode_picture (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
void ff_dct_encode_init_x86 (MpegEncContext *s)
 
void ff_MPV_common_init_x86 (MpegEncContext *s)
 
void ff_MPV_common_init_axp (MpegEncContext *s)
 
void ff_MPV_common_init_arm (MpegEncContext *s)
 
void ff_MPV_common_init_ppc (MpegEncContext *s)
 
void ff_clean_intra_table_entries (MpegEncContext *s)
 Clean dc, ac, coded_block for the current non-intra MB.
 
void ff_draw_horiz_band (AVCodecContext *avctx, Picture *cur, Picture *last, int y, int h, int picture_structure, int first_field, int low_delay)
 
void ff_mpeg_draw_horiz_band (MpegEncContext *s, int y, int h)
 
void ff_mpeg_flush (AVCodecContext *avctx)
 
void ff_print_debug_info (MpegEncContext *s, Picture *p, AVFrame *pict)
 
void ff_print_debug_info2 (AVCodecContext *avctx, Picture *p, AVFrame *pict, uint8_t *mbskip_table, int *low_delay, int mb_width, int mb_height, int mb_stride, int quarter_sample)
 Print debugging info for the given picture.
 
int ff_mpv_export_qp_table (MpegEncContext *s, AVFrame *f, Picture *p, int qp_type)
 
void ff_write_quant_matrix (PutBitContext *pb, uint16_t *matrix)
 
int ff_find_unused_picture (MpegEncContext *s, int shared)
 
void ff_denoise_dct (MpegEncContext *s, int16_t *block)
 
int ff_update_duplicate_context (MpegEncContext *dst, MpegEncContext *src)
 
int ff_MPV_lowest_referenced_row (MpegEncContext *s, int dir)
 find the lowest MB row referenced in the MVs
 
void ff_MPV_report_decode_progress (MpegEncContext *s)
 
int ff_mpeg_update_thread_context (AVCodecContext *dst, const AVCodecContext *src)
 
void ff_set_qscale (MpegEncContext *s, int qscale)
 set qscale and update qscale dependent variables.
 
void ff_mpeg_er_frame_start (MpegEncContext *s)
 
int ff_dct_common_init (MpegEncContext *s)
 
int ff_dct_encode_init (MpegEncContext *s)
 
void ff_convert_matrix (DSPContext *dsp, int(*qmat)[64], uint16_t(*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra)
 
int ff_dct_quantize_c (MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow)
 
void ff_init_block_index (MpegEncContext *s)
 
void ff_MPV_motion (MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, op_pixels_func(*pix_op)[4], qpel_mc_func(*qpix_op)[16])
 
int ff_alloc_picture (MpegEncContext *s, Picture *pic, int shared)
 Allocate a Picture.
 
void ff_block_permute (int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last)
 permute block according to permuatation.
 
static void ff_update_block_index (MpegEncContext *s)
 
static int get_bits_diff (MpegEncContext *s)
 
static int ff_h263_round_chroma (int x)
 
void ff_estimate_p_frame_motion (MpegEncContext *s, int mb_x, int mb_y)
 
void ff_estimate_b_frame_motion (MpegEncContext *s, int mb_x, int mb_y)
 
int ff_get_best_fcode (MpegEncContext *s, int16_t(*mv_table)[2], int type)
 
void ff_fix_long_p_mvs (MpegEncContext *s)
 
void ff_fix_long_mvs (MpegEncContext *s, uint8_t *field_select_table, int field_select, int16_t(*mv_table)[2], int f_code, int type, int truncate)
 
int ff_init_me (MpegEncContext *s)
 
int ff_pre_estimate_p_frame_motion (MpegEncContext *s, int mb_x, int mb_y)
 
int ff_epzs_motion_search (MpegEncContext *s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t(*last_mv)[2], int ref_mv_scale, int size, int h)
 
int ff_get_mb_score (MpegEncContext *s, int mx, int my, int src_index, int ref_index, int size, int h, int add_rate)
 
void ff_mpeg1_encode_picture_header (MpegEncContext *s, int picture_number)
 
void ff_mpeg1_encode_mb (MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y)
 
void ff_mpeg1_encode_init (MpegEncContext *s)
 
void ff_mpeg1_encode_slice_header (MpegEncContext *s)
 
void ff_rv10_encode_picture_header (MpegEncContext *s, int picture_number)
 
int ff_rv_decode_dc (MpegEncContext *s, int n)
 
void ff_rv20_encode_picture_header (MpegEncContext *s, int picture_number)
 
void ff_msmpeg4_encode_picture_header (MpegEncContext *s, int picture_number)
 
void ff_msmpeg4_encode_ext_header (MpegEncContext *s)
 
void ff_msmpeg4_encode_mb (MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y)
 
int ff_msmpeg4_decode_picture_header (MpegEncContext *s)
 
int ff_msmpeg4_decode_ext_header (MpegEncContext *s, int buf_size)
 
int ff_msmpeg4_decode_init (AVCodecContext *avctx)
 
void ff_msmpeg4_encode_init (MpegEncContext *s)
 
int ff_wmv2_decode_picture_header (MpegEncContext *s)
 
int ff_wmv2_decode_secondary_picture_header (MpegEncContext *s)
 
void ff_wmv2_add_mb (MpegEncContext *s, int16_t block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
 
void ff_mspel_motion (MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, op_pixels_func(*pix_op)[4], int motion_x, int motion_y, int h)
 
int ff_wmv2_encode_picture_header (MpegEncContext *s, int picture_number)
 
void ff_wmv2_encode_mb (MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y)
 
int ff_mpeg_ref_picture (MpegEncContext *s, Picture *dst, Picture *src)
 
void ff_mpeg_unref_picture (MpegEncContext *s, Picture *picture)
 Deallocate a picture.
 
void ff_free_picture_tables (Picture *pic)
 

Variables

const AVOption ff_mpv_generic_options []
 
enum AVPixelFormat ff_pixfmt_list_420 []
 
const uint8_t ff_mpeg1_dc_scale_table [128]
 
const uint8_t *const ff_mpeg2_dc_scale_table [4]
 
const uint8_t ff_aic_dc_scale_table [32]
 
const uint8_t ff_h263_chroma_qscale_table [32]
 

Detailed Description

mpegvideo header.

Definition in file mpegvideo.h.

Macro Definition Documentation

#define FRAME_SKIPPED   100

return value for header parsers if frame is not coded

Definition at line 49 of file mpegvideo.h.

Referenced by decode_vop_header(), ff_h263_decode_frame(), and ff_mpeg4_decode_picture_header().

#define MPEG_BUF_SIZE   (16 * 1024)

Definition at line 58 of file mpegvideo.h.

#define QMAT_SHIFT_MMX   16

Definition at line 60 of file mpegvideo.h.

Referenced by ff_convert_matrix().

#define QMAT_SHIFT   21

Definition at line 61 of file mpegvideo.h.

Referenced by dct_quantize_trellis_c(), ff_convert_matrix(), and ff_dct_quantize_c().

#define MAX_FCODE   7

Definition at line 63 of file mpegvideo.h.

Referenced by ff_mpeg1_encode_init(), and init_mv_penalty_and_fcode().

#define MAX_MV   4096
#define MAX_THREADS   32

Definition at line 66 of file mpegvideo.h.

#define MAX_PICTURE_COUNT   36
#define MAX_B_FRAMES   16

Definition at line 69 of file mpegvideo.h.

Referenced by ff_MPV_encode_init().

#define ME_MAP_SIZE   64
#define ME_MAP_SHIFT   3
#define ME_MAP_MV_BITS   11
#define MAX_MB_BYTES   (30*16*16*3/8 + 120)
#define INPLACE_OFFSET   16
#define SEQ_END_CODE   0x000001b7

Definition at line 80 of file mpegvideo.h.

Referenced by ff_mpeg1_find_frame_end(), and mpeg_decode_frame().

#define SEQ_START_CODE   0x000001b3
#define GOP_START_CODE   0x000001b8

Definition at line 82 of file mpegvideo.h.

Referenced by decode_chunks(), and mpeg1_encode_sequence_header().

#define PICTURE_START_CODE   0x00000100
#define SLICE_MIN_START_CODE   0x00000101
#define SLICE_MAX_START_CODE   0x000001af

Definition at line 85 of file mpegvideo.h.

#define EXT_START_CODE   0x000001b5

Definition at line 86 of file mpegvideo.h.

#define USER_START_CODE   0x000001b2

Definition at line 87 of file mpegvideo.h.

#define DELAYED_PIC_REF   4

Value of Picture.reference when Picture is not a reference picture, but is held for delayed output.

Definition at line 93 of file mpegvideo.h.

#define MB_TYPE_INTRA   MB_TYPE_INTRA4x4
#define IS_INTRA4x4 (   a)    ((a)&MB_TYPE_INTRA4x4)
#define IS_INTRA16x16 (   a)    ((a)&MB_TYPE_INTRA16x16)
#define IS_PCM (   a)    ((a)&MB_TYPE_INTRA_PCM)

Definition at line 165 of file mpegvideo.h.

Referenced by ff_print_debug_info2().

#define IS_INTRA (   a)    ((a)&7)

Definition at line 166 of file mpegvideo.h.

#define IS_INTER (   a)    ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8))
#define IS_SKIP (   a)    ((a)&MB_TYPE_SKIP)
#define IS_INTRA_PCM (   a)    ((a)&MB_TYPE_INTRA_PCM)
#define IS_INTERLACED (   a)    ((a)&MB_TYPE_INTERLACED)
#define IS_DIRECT (   a)    ((a)&MB_TYPE_DIRECT2)
#define IS_GMC (   a)    ((a)&MB_TYPE_GMC)

Definition at line 172 of file mpegvideo.h.

Referenced by ff_print_debug_info2().

#define IS_16X16 (   a)    ((a)&MB_TYPE_16x16)
#define IS_16X8 (   a)    ((a)&MB_TYPE_16x8)
#define IS_8X16 (   a)    ((a)&MB_TYPE_8x16)
#define IS_8X8 (   a)    ((a)&MB_TYPE_8x8)
#define IS_SUB_8X8 (   a)    ((a)&MB_TYPE_16x16)
#define IS_SUB_8X4 (   a)    ((a)&MB_TYPE_16x8)
#define IS_SUB_4X8 (   a)    ((a)&MB_TYPE_8x16)
#define IS_SUB_4X4 (   a)    ((a)&MB_TYPE_8x8)

Definition at line 180 of file mpegvideo.h.

Referenced by await_references(), and hl_motion().

#define IS_ACPRED (   a)    ((a)&MB_TYPE_ACPRED)

Definition at line 181 of file mpegvideo.h.

Referenced by ff_print_debug_info2(), and mpeg4_decode_partitioned_mb().

#define IS_QUANT (   a)    ((a)&MB_TYPE_QUANT)

Definition at line 182 of file mpegvideo.h.

Referenced by ff_h261_encode_mb(), ff_h263_decode_mb(), h261_decode_mb(), and mpeg_decode_mb().

#define IS_DIR (   a,
  part,
  list 
)    ((a) & (MB_TYPE_P0L0<<((part)+2*(list))))
#define USES_LIST (   a,
  list 
)    ((a) & ((MB_TYPE_P0L0|MB_TYPE_P1L0)<<(2*(list))))
#define HAS_CBP (   a)    ((a)&MB_TYPE_CBP)

Definition at line 185 of file mpegvideo.h.

Referenced by ff_h261_encode_mb(), ff_h263_decode_mb(), h261_decode_mb(), and mpeg_decode_mb().

#define MV_DIR_FORWARD   1
#define MV_DIR_BACKWARD   2
#define MV_DIRECT   4

bidirectional mode where the difference equals the MV of the last P/S/I-Frame (mpeg4)

Definition at line 453 of file mpegvideo.h.

Referenced by encode_mb_internal(), encode_thread(), ff_h263_decode_mb(), ff_mpeg4_encode_mb(), and mpeg4_decode_mb().

#define MV_TYPE_16X16   0
#define MV_TYPE_8X8   1
#define MV_TYPE_16X8   2

2 vectors, one per 16x8 block

Definition at line 457 of file mpegvideo.h.

Referenced by ff_MPV_lowest_referenced_row(), ff_xvmc_decode_mb(), mpeg_decode_mb(), MPV_motion_internal(), and MPV_motion_lowres().

#define MV_TYPE_FIELD   3
#define MV_TYPE_DMV   4

2 vectors, special mpeg2 Dual Prime Vectors

Definition at line 459 of file mpegvideo.h.

Referenced by ff_xvmc_decode_mb(), mpeg_decode_mb(), MPV_motion_internal(), and MPV_motion_lowres().

#define CANDIDATE_MB_TYPE_INTRA   0x01
#define CANDIDATE_MB_TYPE_INTER   0x02
#define CANDIDATE_MB_TYPE_INTER4V   0x04
#define CANDIDATE_MB_TYPE_SKIPPED   0x08

Definition at line 484 of file mpegvideo.h.

Referenced by encode_thread(), and ff_estimate_p_frame_motion().

#define CANDIDATE_MB_TYPE_DIRECT   0x10

Definition at line 487 of file mpegvideo.h.

Referenced by encode_thread(), ff_clean_mpeg4_qscales(), and ff_estimate_b_frame_motion().

#define CANDIDATE_MB_TYPE_FORWARD   0x20

Definition at line 488 of file mpegvideo.h.

Referenced by encode_picture(), encode_thread(), and ff_estimate_b_frame_motion().

#define CANDIDATE_MB_TYPE_BACKWARD   0x40

Definition at line 489 of file mpegvideo.h.

Referenced by encode_picture(), encode_thread(), and ff_estimate_b_frame_motion().

#define CANDIDATE_MB_TYPE_BIDIR   0x80
#define CANDIDATE_MB_TYPE_INTER_I   0x100

Definition at line 492 of file mpegvideo.h.

Referenced by encode_picture(), encode_thread(), and ff_estimate_p_frame_motion().

#define CANDIDATE_MB_TYPE_FORWARD_I   0x200

Definition at line 493 of file mpegvideo.h.

Referenced by encode_picture(), encode_thread(), and ff_estimate_b_frame_motion().

#define CANDIDATE_MB_TYPE_BACKWARD_I   0x400

Definition at line 494 of file mpegvideo.h.

Referenced by encode_picture(), encode_thread(), and ff_estimate_b_frame_motion().

#define CANDIDATE_MB_TYPE_BIDIR_I   0x800

Definition at line 495 of file mpegvideo.h.

Referenced by encode_picture(), encode_thread(), and ff_estimate_b_frame_motion().

#define CANDIDATE_MB_TYPE_DIRECT0   0x1000

Definition at line 497 of file mpegvideo.h.

Referenced by encode_thread(), and ff_estimate_b_frame_motion().

#define QUANT_BIAS_SHIFT   8

Definition at line 510 of file mpegvideo.h.

Referenced by ff_convert_matrix(), ff_dct_quantize_c(), and ff_MPV_encode_init().

#define UNI_AC_ENC_INDEX (   run,
  level 
)    ((run)*128 + (level))
#define PICT_TOP_FIELD   1
#define PICT_BOTTOM_FIELD   2
#define PICT_FRAME   3
#define CHROMA_420   1
#define CHROMA_422   2

Definition at line 678 of file mpegvideo.h.

Referenced by encode_mb(), encode_mb_internal(), and ff_MPV_encode_init().

#define CHROMA_444   3

Definition at line 679 of file mpegvideo.h.

Referenced by encode_mb_internal(), ff_mjpeg_encode_mb(), and ff_MPV_encode_init().

#define SLICE_OK   0
#define SLICE_ERROR   -1

Definition at line 705 of file mpegvideo.h.

Referenced by h261_decode_mb(), and rv10_decode_packet().

#define SLICE_END   -2
#define SLICE_NOEND   -3

no end marker or error found but mb count exceeded

Definition at line 707 of file mpegvideo.h.

Referenced by decode_slice(), and mpeg4_decode_partitioned_mb().

#define REBASE_PICTURE (   pic,
  new_ctx,
  old_ctx 
)
Value:
((pic && pic >= old_ctx->picture && \
pic < old_ctx->picture + MAX_PICTURE_COUNT) ? \
&new_ctx->picture[pic - old_ctx->picture] : NULL)

Definition at line 751 of file mpegvideo.h.

#define FF_MPV_FLAG_SKIP_RD   0x0001

Definition at line 757 of file mpegvideo.h.

Referenced by encode_thread().

#define FF_MPV_FLAG_STRICT_GOP   0x0002

Definition at line 758 of file mpegvideo.h.

Referenced by select_input_picture().

#define FF_MPV_FLAG_QP_RD   0x0004

Definition at line 759 of file mpegvideo.h.

Referenced by encode_mb_internal(), encode_thread(), and ff_MPV_encode_init().

#define FF_MPV_FLAG_CBP_RD   0x0008

Definition at line 760 of file mpegvideo.h.

Referenced by encode_mb_internal(), ff_MPV_encode_init(), get_b_cbp(), and get_p_cbp().

#define FF_MPV_OFFSET (   x)    offsetof(MpegEncContext, x)

Definition at line 762 of file mpegvideo.h.

#define FF_MPV_OPT_FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)

Definition at line 763 of file mpegvideo.h.

#define FF_MPV_COMMON_OPTS
Value:
{ "mpv_flags", "Flags common for all mpegvideo-based encoders.", FF_MPV_OFFSET(mpv_flags), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "mpv_flags" },\
{ "skip_rd", "RD optimal MB level residual skipping", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_SKIP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
{ "strict_gop", "Strictly enforce gop size", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_STRICT_GOP }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
{ "qp_rd", "Use rate distortion optimization for qp selection", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_QP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
{ "cbp_rd", "use rate distortion optimization for CBP", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_CBP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\
{ "luma_elim_threshold", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\
FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
{ "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\
FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\
{ "quantizer_noise_shaping", NULL, FF_MPV_OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS },\
{ "error_rate", "Simulate errors in the bitstream to test error concealment.", \
FF_MPV_OFFSET(error_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS },

Definition at line 764 of file mpegvideo.h.

#define FF_MPV_GENERIC_CLASS (   name)
Value:
static const AVClass name ## _class = {\
.class_name = #name " encoder",\
.item_name = av_default_item_name,\
.version = LIBAVUTIL_VERSION_INT,\
};

Definition at line 780 of file mpegvideo.h.

Enumeration Type Documentation

Enumerator:
FMT_MPEG1 
FMT_H261 
FMT_H263 
FMT_MJPEG 

Definition at line 51 of file mpegvideo.h.

Function Documentation

void ff_MPV_common_defaults ( MpegEncContext s)

Set the given MpegEncContext to common defaults (same for encoding and decoding).

The changed fields will not depend upon the prior state of the MpegEncContext.

Definition at line 1017 of file mpegvideo.c.

Referenced by ff_MPV_decode_defaults(), and MPV_encode_defaults().

void ff_MPV_decode_defaults ( MpegEncContext s)

Set the given MpegEncContext to defaults for decoding.

the changed fields will not depend upon the prior state of the MpegEncContext.

Definition at line 1040 of file mpegvideo.c.

Referenced by ff_h263_decode_init(), ff_rv34_decode_init(), h261_decode_init(), mpeg_decode_init(), and rv10_decode_init().

int ff_MPV_common_init ( MpegEncContext s)

init common structure for both encoder and decoder.

this assumes that some variables like width/height are already set

Definition at line 1210 of file mpegvideo.c.

Referenced by ff_h263_decode_frame(), ff_h263_decode_init(), ff_mpeg_update_thread_context(), ff_MPV_encode_init(), ff_rv34_decode_init(), ff_rv34_decode_init_thread_copy(), h261_decode_frame(), rv10_decode_init(), rv20_decode_picture_header(), and vcr2_init_sequence().

int ff_MPV_common_frame_size_change ( MpegEncContext s)
void ff_MPV_common_end ( MpegEncContext s)
void ff_MPV_decode_mb ( MpegEncContext s,
int16_t  block[12][64] 
)
int ff_MPV_frame_start ( MpegEncContext s,
AVCodecContext avctx 
)

generic function called after decoding the header and before a frame is decoded.

Definition at line 1649 of file mpegvideo.c.

Referenced by decode_wmv9(), ff_h263_decode_frame(), ff_rv34_decode_frame(), h261_decode_frame(), mpeg_field_start(), rv10_decode_packet(), and vc1_decode_frame().

void ff_MPV_frame_end ( MpegEncContext s)
int ff_MPV_encode_init ( AVCodecContext avctx)

Definition at line 244 of file mpegvideo_enc.c.

Referenced by encode_init(), and wmv2_encode_init().

int ff_MPV_encode_end ( AVCodecContext avctx)

Definition at line 914 of file mpegvideo_enc.c.

Referenced by ff_MPV_encode_init(), and mpeg12_class().

int ff_MPV_encode_picture ( AVCodecContext avctx,
AVPacket pkt,
const AVFrame frame,
int *  got_packet 
)

Definition at line 1609 of file mpegvideo_enc.c.

Referenced by amv_encode_picture(), and mpeg12_class().

void ff_dct_encode_init_x86 ( MpegEncContext s)

Definition at line 197 of file mpegvideoenc.c.

Referenced by ff_dct_encode_init().

void ff_MPV_common_init_x86 ( MpegEncContext s)

Definition at line 448 of file mpegvideo.c.

Referenced by ff_dct_common_init().

void ff_MPV_common_init_axp ( MpegEncContext s)

Definition at line 106 of file mpegvideo_alpha.c.

Referenced by ff_dct_common_init().

void ff_MPV_common_init_arm ( MpegEncContext s)

Definition at line 41 of file mpegvideo_arm.c.

Referenced by ff_dct_common_init().

void ff_MPV_common_init_ppc ( MpegEncContext s)

Definition at line 118 of file mpegvideo_altivec.c.

Referenced by ff_dct_common_init().

void ff_clean_intra_table_entries ( MpegEncContext s)

Clean dc, ac, coded_block for the current non-intra MB.

Definition at line 2728 of file mpegvideo.c.

Referenced by encode_thread(), mpeg4_decode_partition_a(), and MPV_decode_mb_internal().

void ff_draw_horiz_band ( AVCodecContext avctx,
Picture cur,
Picture last,
int  y,
int  h,
int  picture_structure,
int  first_field,
int  low_delay 
)
Parameters
his the normal height, this will be reduced automatically if needed for the last row

Definition at line 3028 of file mpegvideo.c.

Referenced by ff_mpeg_draw_horiz_band(), and svq3_decode_frame().

void ff_mpeg_draw_horiz_band ( MpegEncContext s,
int  y,
int  h 
)
void ff_mpeg_flush ( AVCodecContext avctx)

Definition at line 3145 of file mpegvideo.c.

Referenced by decode_wmv9(), and flush().

void ff_print_debug_info ( MpegEncContext s,
Picture p,
AVFrame pict 
)
void ff_print_debug_info2 ( AVCodecContext avctx,
Picture p,
AVFrame pict,
uint8_t mbskip_table,
int *  low_delay,
int  mb_width,
int  mb_height,
int  mb_stride,
int  quarter_sample 
)

Print debugging info for the given picture.

Definition at line 1974 of file mpegvideo.c.

Referenced by ff_print_debug_info(), and h264_decode_frame().

int ff_mpv_export_qp_table ( MpegEncContext s,
AVFrame f,
Picture p,
int  qp_type 
)

Definition at line 2266 of file mpegvideo.c.

Referenced by ff_h263_decode_frame(), finish_frame(), rv10_decode_frame(), and slice_end().

void ff_write_quant_matrix ( PutBitContext pb,
uint16_t *  matrix 
)

Definition at line 159 of file mpegvideo_enc.c.

Referenced by mpeg1_encode_sequence_header(), and mpeg4_encode_vol_header().

int ff_find_unused_picture ( MpegEncContext s,
int  shared 
)
void ff_denoise_dct ( MpegEncContext s,
int16_t *  block 
)
int ff_update_duplicate_context ( MpegEncContext dst,
MpegEncContext src 
)

Definition at line 854 of file mpegvideo.c.

Referenced by decode_chunks(), and encode_picture().

int ff_MPV_lowest_referenced_row ( MpegEncContext s,
int  dir 
)

find the lowest MB row referenced in the MVs

Definition at line 2663 of file mpegvideo.c.

Referenced by MPV_decode_mb_internal().

void ff_MPV_report_decode_progress ( MpegEncContext s)

Definition at line 3190 of file mpegvideo.c.

Referenced by decode_slice(), and mpeg_decode_slice().

int ff_mpeg_update_thread_context ( AVCodecContext dst,
const AVCodecContext src 
)
void ff_set_qscale ( MpegEncContext s,
int  qscale 
)
void ff_mpeg_er_frame_start ( MpegEncContext s)
int ff_dct_common_init ( MpegEncContext s)

Definition at line 348 of file mpegvideo.c.

Referenced by dnxhd_encode_init(), ff_mpeg4_workaround_bugs(), and ff_MPV_common_init().

int ff_dct_encode_init ( MpegEncContext s)

Definition at line 226 of file mpegvideo_enc.c.

Referenced by dnxhd_encode_init(), and ff_MPV_encode_init().

void ff_convert_matrix ( DSPContext dsp,
int(*)  qmat[64],
uint16_t(*)  qmat16[2][64],
const uint16_t *  quant_matrix,
int  bias,
int  qmin,
int  qmax,
int  intra 
)

Definition at line 72 of file mpegvideo_enc.c.

Referenced by dnxhd_init_qmat(), encode_picture(), and ff_MPV_encode_init().

int ff_dct_quantize_c ( MpegEncContext s,
int16_t *  block,
int  n,
int  qscale,
int *  overflow 
)

Definition at line 4327 of file mpegvideo_enc.c.

Referenced by dnxhd_encode_init(), encode_mb_internal(), and ff_dct_encode_init().

void ff_init_block_index ( MpegEncContext s)
void ff_MPV_motion ( MpegEncContext s,
uint8_t dest_y,
uint8_t dest_cb,
uint8_t dest_cr,
int  dir,
uint8_t **  ref_picture,
op_pixels_func(*)  pix_op[4],
qpel_mc_func(*)  qpix_op[16] 
)

Definition at line 969 of file mpegvideo_motion.c.

Referenced by encode_mb_internal(), and MPV_decode_mb_internal().

int ff_alloc_picture ( MpegEncContext s,
Picture pic,
int  shared 
)

Allocate a Picture.

The pixels are allocated/set by calling get_buffer() if shared = 0.

The pixels are allocated/set by calling get_buffer() if shared = 0

Definition at line 586 of file mpegvideo.c.

Referenced by ff_MPV_frame_start(), load_input_picture(), and select_input_picture().

void ff_block_permute ( int16_t *  block,
uint8_t permutation,
const uint8_t scantable,
int  last 
)

permute block according to permuatation.

Parameters
lastlast non zero element in scantable order

permute block according to permuatation.

Parameters
blockthe block which will be permuted according to the given permutation vector
permutationthe permutation vector
lastthe last non zero coefficient in scantable order, used to speed the permutation up
scantablethe used scantable, this is only used to speed the permutation up, the block is not (inverse) permutated to scantable order!

Definition at line 3124 of file mpegvideo.c.

Referenced by ff_dct_quantize_c().

static void ff_update_block_index ( MpegEncContext s)
inlinestatic
static int get_bits_diff ( MpegEncContext s)
inlinestatic
static int ff_h263_round_chroma ( int  x)
inlinestatic

Definition at line 888 of file mpegvideo.h.

Referenced by chroma_4mv_motion(), chroma_4mv_motion_lowres(), and h263_mv4_search().

void ff_estimate_p_frame_motion ( MpegEncContext s,
int  mb_x,
int  mb_y 
)

< the variance of the block (sum of squared (p[y][x]-average))

< sum of squared differences with the estimated motion vector

Definition at line 868 of file motion_est.c.

Referenced by estimate_motion_thread(), and svq1_encode_plane().

void ff_estimate_b_frame_motion ( MpegEncContext s,
int  mb_x,
int  mb_y 
)

Definition at line 1511 of file motion_est.c.

Referenced by estimate_motion_thread().

int ff_get_best_fcode ( MpegEncContext s,
int16_t(*)  mv_table[2],
int  type 
)

Definition at line 1618 of file motion_est.c.

Referenced by encode_picture().

void ff_fix_long_p_mvs ( MpegEncContext s)

Definition at line 1671 of file motion_est.c.

Referenced by encode_picture(), and svq1_encode_plane().

void ff_fix_long_mvs ( MpegEncContext s,
uint8_t field_select_table,
int  field_select,
int16_t(*)  mv_table[2],
int  f_code,
int  type,
int  truncate 
)
Parameters
truncate1 for truncation, 0 for using intra

Definition at line 1721 of file motion_est.c.

Referenced by encode_picture(), and svq1_encode_plane().

int ff_init_me ( MpegEncContext s)

Definition at line 295 of file motion_est.c.

Referenced by encode_frame(), encode_picture(), and svq1_encode_plane().

int ff_pre_estimate_p_frame_motion ( MpegEncContext s,
int  mb_x,
int  mb_y 
)

Definition at line 1072 of file motion_est.c.

Referenced by pre_estimate_motion_thread().

int ff_epzs_motion_search ( MpegEncContext s,
int *  mx_ptr,
int *  my_ptr,
int  P[10][2],
int  src_index,
int  ref_index,
int16_t(*)  last_mv[2],
int  ref_mv_scale,
int  size,
int  h 
)
int ff_get_mb_score ( MpegEncContext s,
int  mx,
int  my,
int  src_index,
int  ref_index,
int  size,
int  h,
int  add_rate 
)

Definition at line 190 of file motion_est_template.c.

Referenced by encode_q_branch().

void ff_mpeg1_encode_picture_header ( MpegEncContext s,
int  picture_number 
)

Definition at line 391 of file mpeg12enc.c.

Referenced by encode_picture().

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

Definition at line 962 of file mpeg12enc.c.

Referenced by encode_mb_internal().

void ff_mpeg1_encode_init ( MpegEncContext s)

Definition at line 971 of file mpeg12enc.c.

Referenced by ff_MPV_encode_init().

void ff_mpeg1_encode_slice_header ( MpegEncContext s)

Definition at line 377 of file mpeg12enc.c.

Referenced by encode_thread(), and ff_mpeg1_encode_picture_header().

void ff_rv10_encode_picture_header ( MpegEncContext s,
int  picture_number 
)

Definition at line 31 of file rv10enc.c.

Referenced by encode_picture().

int ff_rv_decode_dc ( MpegEncContext s,
int  n 
)

Definition at line 189 of file rv10.c.

Referenced by h263_decode_block().

void ff_rv20_encode_picture_header ( MpegEncContext s,
int  picture_number 
)

Definition at line 32 of file rv20enc.c.

Referenced by encode_picture().

void ff_msmpeg4_encode_picture_header ( MpegEncContext s,
int  picture_number 
)

Definition at line 214 of file msmpeg4enc.c.

Referenced by encode_picture().

void ff_msmpeg4_encode_ext_header ( MpegEncContext s)

Definition at line 274 of file msmpeg4enc.c.

Referenced by encode_thread(), and ff_msmpeg4_encode_picture_header().

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

Definition at line 371 of file msmpeg4enc.c.

Referenced by encode_mb_internal().

int ff_msmpeg4_decode_picture_header ( MpegEncContext s)

Definition at line 396 of file msmpeg4dec.c.

Referenced by ff_h263_decode_frame().

int ff_msmpeg4_decode_ext_header ( MpegEncContext s,
int  buf_size 
)

Definition at line 551 of file msmpeg4dec.c.

Referenced by ff_h263_decode_frame(), and ff_msmpeg4_decode_picture_header().

int ff_msmpeg4_decode_init ( AVCodecContext avctx)

Definition at line 286 of file msmpeg4dec.c.

Referenced by vc1_decode_frame(), vc1_decode_init(), wmv2_decode_init(), and wmv9_init().

void ff_msmpeg4_encode_init ( MpegEncContext s)

Definition at line 115 of file msmpeg4enc.c.

Referenced by ff_MPV_encode_init().

int ff_wmv2_decode_picture_header ( MpegEncContext s)

Definition at line 113 of file wmv2dec.c.

Referenced by ff_h263_decode_frame().

int ff_wmv2_decode_secondary_picture_header ( MpegEncContext s)

Definition at line 133 of file wmv2dec.c.

Referenced by ff_h263_decode_frame().

void ff_wmv2_add_mb ( MpegEncContext s,
int16_t  block[6][64],
uint8_t dest_y,
uint8_t dest_cb,
uint8_t dest_cr 
)

Definition at line 76 of file wmv2.c.

Referenced by MPV_decode_mb_internal().

void ff_mspel_motion ( MpegEncContext s,
uint8_t dest_y,
uint8_t dest_cb,
uint8_t dest_cr,
uint8_t **  ref_picture,
op_pixels_func(*)  pix_op[4],
int  motion_x,
int  motion_y,
int  h 
)

Definition at line 90 of file wmv2.c.

Referenced by MPV_motion_internal().

int ff_wmv2_encode_picture_header ( MpegEncContext s,
int  picture_number 
)

Definition at line 69 of file wmv2enc.c.

Referenced by encode_picture().

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

Definition at line 149 of file wmv2enc.c.

Referenced by encode_mb_internal().

int ff_mpeg_ref_picture ( MpegEncContext s,
Picture dst,
Picture src 
)
void ff_mpeg_unref_picture ( MpegEncContext s,
Picture picture 
)
void ff_free_picture_tables ( Picture pic)

Variable Documentation

const AVOption ff_mpv_generic_options[]

Definition at line 67 of file mpegvideo_enc.c.

enum AVPixelFormat ff_pixfmt_list_420[]

Definition at line 107 of file mpegvideo.c.

const uint8_t ff_mpeg1_dc_scale_table[128]
const uint8_t* const ff_mpeg2_dc_scale_table[4]

Definition at line 100 of file mpegvideo.c.

Referenced by encode_picture(), and ff_mpeg12_common_init().

const uint8_t ff_aic_dc_scale_table[32]
const uint8_t ff_h263_chroma_qscale_table[32]