FFmpeg
Macros | Functions | Variables
mpegvideoenc.h File Reference
#include <float.h>
#include "libavutil/opt.h"
#include "mpegvideo.h"

Go to the source code of this file.

Macros

#define UNI_AC_ENC_INDEX(run, level)   ((run)*128 + (level))
 
#define INPLACE_OFFSET   16
 
#define CANDIDATE_MB_TYPE_INTRA   (1 << 0)
 
#define CANDIDATE_MB_TYPE_INTER   (1 << 1)
 
#define CANDIDATE_MB_TYPE_INTER4V   (1 << 2)
 
#define CANDIDATE_MB_TYPE_SKIPPED   (1 << 3)
 
#define CANDIDATE_MB_TYPE_DIRECT   (1 << 4)
 
#define CANDIDATE_MB_TYPE_FORWARD   (1 << 5)
 
#define CANDIDATE_MB_TYPE_BACKWARD   (1 << 6)
 
#define CANDIDATE_MB_TYPE_BIDIR   (1 << 7)
 
#define CANDIDATE_MB_TYPE_INTER_I   (1 << 8)
 
#define CANDIDATE_MB_TYPE_FORWARD_I   (1 << 9)
 
#define CANDIDATE_MB_TYPE_BACKWARD_I   (1 << 10)
 
#define CANDIDATE_MB_TYPE_BIDIR_I   (1 << 11)
 
#define CANDIDATE_MB_TYPE_DIRECT0   (1 << 12)
 
#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_FLAG_NAQ   0x0010
 
#define FF_MPV_FLAG_MV0   0x0020
 
#define FF_MPV_OPT_CMP_FUNC
 
#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_COMMON_BFRAME_OPTS
 
#define FF_MPV_COMMON_MOTION_EST_OPTS
 

Functions

int ff_mpv_encode_init (AVCodecContext *avctx)
 
void ff_mpv_encode_init_x86 (MpegEncContext *s)
 
int ff_mpv_encode_end (AVCodecContext *avctx)
 
int ff_mpv_encode_picture (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
int ff_mpv_reallocate_putbitbuffer (MpegEncContext *s, size_t threshold, size_t size_increase)
 
void ff_write_quant_matrix (PutBitContext *pb, uint16_t *matrix)
 
void ff_dct_encode_init (MpegEncContext *s)
 
void ff_mpvenc_dct_init_mips (MpegEncContext *s)
 
void ff_dct_encode_init_x86 (MpegEncContext *s)
 
void ff_convert_matrix (MpegEncContext *s, int(*qmat)[64], uint16_t(*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra)
 
void ff_block_permute (int16_t *block, const uint8_t *permutation, const uint8_t *scantable, int last)
 Permute an 8x8 block according to permutation. More...
 
static int get_bits_diff (MpegEncContext *s)
 

Variables

const AVClass ff_mpv_enc_class
 

Detailed Description

mpegvideo header.

Definition in file mpegvideoenc.h.

Macro Definition Documentation

◆ UNI_AC_ENC_INDEX

#define UNI_AC_ENC_INDEX (   run,
  level 
)    ((run)*128 + (level))

Definition at line 36 of file mpegvideoenc.h.

◆ INPLACE_OFFSET

#define INPLACE_OFFSET   16

Definition at line 37 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_INTRA

#define CANDIDATE_MB_TYPE_INTRA   (1 << 0)

Definition at line 40 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_INTER

#define CANDIDATE_MB_TYPE_INTER   (1 << 1)

Definition at line 41 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_INTER4V

#define CANDIDATE_MB_TYPE_INTER4V   (1 << 2)

Definition at line 42 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_SKIPPED

#define CANDIDATE_MB_TYPE_SKIPPED   (1 << 3)

Definition at line 43 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_DIRECT

#define CANDIDATE_MB_TYPE_DIRECT   (1 << 4)

Definition at line 45 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_FORWARD

#define CANDIDATE_MB_TYPE_FORWARD   (1 << 5)

Definition at line 46 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_BACKWARD

#define CANDIDATE_MB_TYPE_BACKWARD   (1 << 6)

Definition at line 47 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_BIDIR

#define CANDIDATE_MB_TYPE_BIDIR   (1 << 7)

Definition at line 48 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_INTER_I

#define CANDIDATE_MB_TYPE_INTER_I   (1 << 8)

Definition at line 50 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_FORWARD_I

#define CANDIDATE_MB_TYPE_FORWARD_I   (1 << 9)

Definition at line 51 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_BACKWARD_I

#define CANDIDATE_MB_TYPE_BACKWARD_I   (1 << 10)

Definition at line 52 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_BIDIR_I

#define CANDIDATE_MB_TYPE_BIDIR_I   (1 << 11)

Definition at line 53 of file mpegvideoenc.h.

◆ CANDIDATE_MB_TYPE_DIRECT0

#define CANDIDATE_MB_TYPE_DIRECT0   (1 << 12)

Definition at line 55 of file mpegvideoenc.h.

◆ FF_MPV_FLAG_SKIP_RD

#define FF_MPV_FLAG_SKIP_RD   0x0001

Definition at line 58 of file mpegvideoenc.h.

◆ FF_MPV_FLAG_STRICT_GOP

#define FF_MPV_FLAG_STRICT_GOP   0x0002

Definition at line 59 of file mpegvideoenc.h.

◆ FF_MPV_FLAG_QP_RD

#define FF_MPV_FLAG_QP_RD   0x0004

Definition at line 60 of file mpegvideoenc.h.

◆ FF_MPV_FLAG_CBP_RD

#define FF_MPV_FLAG_CBP_RD   0x0008

Definition at line 61 of file mpegvideoenc.h.

◆ FF_MPV_FLAG_NAQ

#define FF_MPV_FLAG_NAQ   0x0010

Definition at line 62 of file mpegvideoenc.h.

◆ FF_MPV_FLAG_MV0

#define FF_MPV_FLAG_MV0   0x0020

Definition at line 63 of file mpegvideoenc.h.

◆ FF_MPV_OPT_CMP_FUNC

#define FF_MPV_OPT_CMP_FUNC
Value:
{ "sad", "Sum of absolute differences, fast", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SAD }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "sse", "Sum of squared errors", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SSE }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "satd", "Sum of absolute Hadamard transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SATD }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "dct", "Sum of absolute DCT transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCT }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "psnr", "Sum of squared quantization errors, low quality", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_PSNR }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "bit", "Number of bits needed for the block", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_BIT }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "rd", "Rate distortion optimal, slow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_RD }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "zero", "Zero", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_ZERO }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "vsad", "Sum of absolute vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "vsse", "Sum of squared vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSSE }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "nsse", "Noise preserving sum of squared differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_NSSE }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "dct264", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCT264 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "dctmax", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_CHROMA }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }, \
{ "msad", "Sum of absolute differences, median predicted", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_MEDIAN_SAD }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, .unit = "cmp_func" }

Definition at line 65 of file mpegvideoenc.h.

◆ FF_MPV_OFFSET

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

Definition at line 82 of file mpegvideoenc.h.

◆ FF_MPV_OPT_FLAGS

#define FF_MPV_OPT_FLAGS   (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)

Definition at line 83 of file mpegvideoenc.h.

◆ FF_MPV_COMMON_OPTS

#define FF_MPV_COMMON_OPTS

Definition at line 84 of file mpegvideoenc.h.

◆ FF_MPV_COMMON_BFRAME_OPTS

#define FF_MPV_COMMON_BFRAME_OPTS
Value:
{"b_strategy", "Strategy to choose between I/P/B-frames", FF_MPV_OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, FF_MPV_OPT_FLAGS }, \
{"b_sensitivity", "Adjust sensitivity of b_frame_strategy 1", FF_MPV_OFFSET(b_sensitivity), AV_OPT_TYPE_INT, {.i64 = 40 }, 1, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"brd_scale", "Downscale frames for dynamic B-frame decision", FF_MPV_OFFSET(brd_scale), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 3, FF_MPV_OPT_FLAGS },

Definition at line 122 of file mpegvideoenc.h.

◆ FF_MPV_COMMON_MOTION_EST_OPTS

#define FF_MPV_COMMON_MOTION_EST_OPTS
Value:
{"motion_est", "motion estimation algorithm", FF_MPV_OFFSET(motion_est), AV_OPT_TYPE_INT, {.i64 = FF_ME_EPZS }, FF_ME_ZERO, FF_ME_XONE, FF_MPV_OPT_FLAGS, .unit = "motion_est" }, \
{ "zero", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ZERO }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "motion_est" }, \
{ "epzs", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_EPZS }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "motion_est" }, \
{ "xone", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_XONE }, 0, 0, FF_MPV_OPT_FLAGS, .unit = "motion_est" }, \
{"mepc", "Motion estimation bitrate penalty compensation (1.0 = 256)", FF_MPV_OFFSET(me_penalty_compensation), AV_OPT_TYPE_INT, {.i64 = 256 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"mepre", "pre motion estimation", FF_MPV_OFFSET(me_pre), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS }, \
{"intra_penalty", "Penalty for intra blocks in block decision", FF_MPV_OFFSET(intra_penalty), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX/2, FF_MPV_OPT_FLAGS }, \

Definition at line 127 of file mpegvideoenc.h.

Function Documentation

◆ ff_mpv_encode_init()

int ff_mpv_encode_init ( AVCodecContext avctx)

Definition at line 310 of file mpegvideo_enc.c.

Referenced by encode_init(), and wmv2_encode_init().

◆ ff_mpv_encode_init_x86()

void ff_mpv_encode_init_x86 ( MpegEncContext s)

◆ ff_mpv_encode_end()

int ff_mpv_encode_end ( AVCodecContext avctx)

Definition at line 990 of file mpegvideo_enc.c.

Referenced by mjpeg_encode_close().

◆ ff_mpv_encode_picture()

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

Definition at line 1753 of file mpegvideo_enc.c.

◆ ff_mpv_reallocate_putbitbuffer()

int ff_mpv_reallocate_putbitbuffer ( MpegEncContext s,
size_t  threshold,
size_t  size_increase 
)

Definition at line 2799 of file mpegvideo_enc.c.

Referenced by encode_thread(), and ff_mjpeg_encode_stuffing().

◆ ff_write_quant_matrix()

void ff_write_quant_matrix ( PutBitContext pb,
uint16_t *  matrix 
)

Definition at line 224 of file mpegvideo_enc.c.

Referenced by mpeg4_encode_vol_header().

◆ ff_dct_encode_init()

void ff_dct_encode_init ( MpegEncContext s)

Definition at line 294 of file mpegvideo_enc.c.

Referenced by dnxhd_encode_init(), and ff_mpv_encode_init().

◆ ff_mpvenc_dct_init_mips()

void ff_mpvenc_dct_init_mips ( MpegEncContext s)

Definition at line 26 of file mpegvideoenc_init_mips.c.

Referenced by ff_dct_encode_init().

◆ ff_dct_encode_init_x86()

void ff_dct_encode_init_x86 ( MpegEncContext s)

Definition at line 131 of file mpegvideoenc.c.

Referenced by ff_dct_encode_init().

◆ ff_convert_matrix()

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

Definition at line 112 of file mpegvideo_enc.c.

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

◆ ff_block_permute()

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

Permute an 8x8 block according to permutation.

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 4531 of file mpegvideo_enc.c.

Referenced by dct_quantize_c(), dnxhd_10bit_dct_quantize(), and dnxhd_10bit_dct_quantize_444().

◆ get_bits_diff()

static int get_bits_diff ( MpegEncContext s)
inlinestatic

Variable Documentation

◆ ff_mpv_enc_class

const AVClass ff_mpv_enc_class

Definition at line 105 of file mpegvideo_enc.c.

FF_ME_EPZS
#define FF_ME_EPZS
Definition: motion_est.h:41
FF_CMP_VSSE
#define FF_CMP_VSSE
Definition: avcodec.h:904
FF_CMP_CHROMA
#define FF_CMP_CHROMA
Definition: avcodec.h:911
FF_CMP_SSE
#define FF_CMP_SSE
Definition: avcodec.h:896
FF_CMP_BIT
#define FF_CMP_BIT
Definition: avcodec.h:900
FF_MPV_OFFSET
#define FF_MPV_OFFSET(x)
Definition: mpegvideoenc.h:82
NULL
#define NULL
Definition: coverity.c:32
FF_CMP_MEDIAN_SAD
#define FF_CMP_MEDIAN_SAD
Definition: avcodec.h:910
FF_ME_XONE
#define FF_ME_XONE
Definition: motion_est.h:42
FF_CMP_PSNR
#define FF_CMP_PSNR
Definition: avcodec.h:899
FF_CMP_SATD
#define FF_CMP_SATD
Definition: avcodec.h:897
FF_CMP_ZERO
#define FF_CMP_ZERO
Definition: avcodec.h:902
FF_CMP_SAD
#define FF_CMP_SAD
Definition: avcodec.h:895
FF_CMP_RD
#define FF_CMP_RD
Definition: avcodec.h:901
FF_CMP_NSSE
#define FF_CMP_NSSE
Definition: avcodec.h:905
FF_MPV_OPT_FLAGS
#define FF_MPV_OPT_FLAGS
Definition: mpegvideoenc.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:245
FF_CMP_DCT
#define FF_CMP_DCT
Definition: avcodec.h:898
FF_CMP_DCTMAX
#define FF_CMP_DCTMAX
Definition: avcodec.h:908
FF_CMP_DCT264
#define FF_CMP_DCT264
Definition: avcodec.h:909
FF_CMP_VSAD
#define FF_CMP_VSAD
Definition: avcodec.h:903
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:254
FF_ME_ZERO
#define FF_ME_ZERO
Definition: motion_est.h:40