diff options
Diffstat (limited to 'chromium/third_party/ffmpeg/libavcodec/mpegvideo.h')
-rw-r--r-- | chromium/third_party/ffmpeg/libavcodec/mpegvideo.h | 156 |
1 files changed, 34 insertions, 122 deletions
diff --git a/chromium/third_party/ffmpeg/libavcodec/mpegvideo.h b/chromium/third_party/ffmpeg/libavcodec/mpegvideo.h index 65c4f9e0d5f..7a49d2ea1d0 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mpegvideo.h +++ b/chromium/third_party/ffmpeg/libavcodec/mpegvideo.h @@ -86,19 +86,13 @@ enum OutputFormat { #define EXT_START_CODE 0x000001b5 #define USER_START_CODE 0x000001b2 -/** - * Value of Picture.reference when Picture is not a reference picture, but - * is held for delayed output. - */ -#define DELAYED_PIC_REF 4 - struct MpegEncContext; /** * Picture. */ typedef struct Picture{ - struct AVFrame f; + struct AVFrame *f; ThreadFrame tf; AVBufferRef *qscale_table_buf; @@ -108,31 +102,7 @@ typedef struct Picture{ int16_t (*motion_val[2])[2]; AVBufferRef *mb_type_buf; - uint32_t *mb_type; - -#if !FF_API_MB_TYPE -#define MB_TYPE_INTRA4x4 0x0001 -#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific -#define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific -#define MB_TYPE_16x16 0x0008 -#define MB_TYPE_16x8 0x0010 -#define MB_TYPE_8x16 0x0020 -#define MB_TYPE_8x8 0x0040 -#define MB_TYPE_INTERLACED 0x0080 -#define MB_TYPE_DIRECT2 0x0100 //FIXME -#define MB_TYPE_ACPRED 0x0200 -#define MB_TYPE_GMC 0x0400 -#define MB_TYPE_SKIP 0x0800 -#define MB_TYPE_P0L0 0x1000 -#define MB_TYPE_P1L0 0x2000 -#define MB_TYPE_P0L1 0x4000 -#define MB_TYPE_P1L1 0x8000 -#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) -#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) -#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) -#define MB_TYPE_QUANT 0x00010000 -#define MB_TYPE_CBP 0x00020000 -#endif + uint32_t *mb_type; ///< types and macros are defined in mpegutils.h AVBufferRef *mbskip_table_buf; uint8_t *mbskip_table; @@ -158,56 +128,16 @@ typedef struct Picture{ */ void *hwaccel_picture_private; -#define MB_TYPE_INTRA MB_TYPE_INTRA4x4 //default mb_type if there is just one type -#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) //note reused -#define IS_SUB_8X4(a) ((a)&MB_TYPE_16x8) //note reused -#define IS_SUB_4X8(a) ((a)&MB_TYPE_8x16) //note reused -#define IS_SUB_4X4(a) ((a)&MB_TYPE_8x8) //note reused -#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) - - int field_poc[2]; ///< h264 top/bottom POC - int poc; ///< h264 frame POC - int frame_num; ///< h264 frame_num (raw frame_num from slice header) - int mmco_reset; ///< h264 MMCO_RESET set this 1. Reordering code must not mix pictures before and after MMCO_RESET. - int pic_id; /**< h264 pic_num (short -> no wrap version of pic_num, - pic_num & max_pic_num; long -> long_pic_num) */ - int long_ref; ///< 1->long term reference 0->short term reference - int ref_poc[2][2][32]; ///< h264 POCs of the frames/fields used as reference (FIXME need per slice) - int ref_count[2][2]; ///< number of entries in ref_poc (FIXME need per slice) - int mbaff; ///< h264 1 -> MBAFF frame 0-> not MBAFF int field_picture; ///< whether or not the picture was encoded in separate fields - int mb_var_sum; ///< sum of MB variance for current frame - int mc_mb_var_sum; ///< motion compensated MB variance for current frame + int64_t mb_var_sum; ///< sum of MB variance for current frame + int64_t mc_mb_var_sum; ///< motion compensated MB variance for current frame int b_frame_score; int needs_realloc; ///< Picture needs to be reallocated (eg due to a frame size change) int reference; int shared; - int recovered; ///< Picture at IDR or recovery point + recovery count - - int crop; - int crop_left; - int crop_top; } Picture; /** @@ -250,8 +180,8 @@ typedef struct MotionEstContext{ int stride; int uvstride; /* temp variables for picture complexity calculation */ - int mc_mb_var_sum_temp; - int mb_var_sum_temp; + int64_t mc_mb_var_sum_temp; + int64_t mb_var_sum_temp; int scene_change_score; /* cmp, chroma_cmp;*/ op_pixels_func (*hpel_put)[4]; @@ -271,6 +201,21 @@ typedef struct MotionEstContext{ */ typedef struct MpegEncContext { AVClass *class; + + int y_dc_scale, c_dc_scale; + int ac_pred; + int block_last_index[12]; ///< last non zero coefficient in block + int h263_aic; ///< Advanded INTRA Coding (AIC) + + /* scantables */ + ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage + ScanTable intra_scantable; + ScanTable intra_h_scantable; + ScanTable intra_v_scantable; + + /* WARNING: changes above this line require updates to hardcoded + * offsets used in asm. */ + struct AVCodecContext *avctx; /* the following parameters must be initialized before encoding */ int width, height;///< picture size. must be a multiple of 16 @@ -308,7 +253,6 @@ typedef struct MpegEncContext { int mb_width, mb_height; ///< number of MBs horizontally & vertically int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 int b8_stride; ///< 2*mb_width+1 used for some 8x8 block arrays to allow simple addressing - int b4_stride; ///< 4*mb_width+1 used for some 4x4 block arrays to allow simple addressing int h_edge_pos, v_edge_pos;///< horizontal / vertical position of the right/bottom edge (pixel replication) int mb_num; ///< number of MBs of a picture ptrdiff_t linesize; ///< line size, in bytes, may be different from width @@ -317,20 +261,6 @@ typedef struct MpegEncContext { Picture **input_picture; ///< next pictures on display order for encoding Picture **reordered_input_picture; ///< pointer to the next pictures in codedorder for encoding - int y_dc_scale, c_dc_scale; - int ac_pred; - int block_last_index[12]; ///< last non zero coefficient in block - int h263_aic; ///< Advanded INTRA Coding (AIC) - - /* scantables */ - ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage - ScanTable intra_scantable; - ScanTable intra_h_scantable; - ScanTable intra_v_scantable; - - /* WARNING: changes above this line require updates to hardcoded - * offsets used in asm. */ - int64_t user_specified_pts; ///< last non-zero pts from AVFrame which was passed into avcodec_encode_video2() /** * pts difference between the first and second input frame, used for @@ -475,24 +405,7 @@ typedef struct MpegEncContext { int mb_x, mb_y; int mb_skip_run; int mb_intra; - uint16_t *mb_type; ///< Table for candidate MB types for encoding -#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 MB_TYPE_GMC 0x10 - -#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 + uint16_t *mb_type; ///< Table for candidate MB types for encoding (defines in mpegutils.h) int block_index[6]; ///< index to current MB in block based arrays with edges int block_wrap[6]; @@ -656,11 +569,9 @@ typedef struct MpegEncContext { /* MPEG-2-specific - I wished not to have to support this mess. */ int progressive_sequence; int mpeg_f_code[2][2]; + + // picture structure defines are loaded from mpegutils.h int picture_structure; -/* picture type */ -#define PICT_TOP_FIELD 1 -#define PICT_BOTTOM_FIELD 2 -#define PICT_FRAME 3 int intra_dc_precision; int frame_pred_frame_dct; @@ -693,6 +604,7 @@ typedef struct MpegEncContext { uint8_t *ptr_lastgob; int swap_uv; //vcr2 codec is an MPEG-2 variant with U and V swapped + int pack_pblocks; //xvmc needs to keep blocks without gaps. int16_t (*pblocks[12])[64]; int16_t (*block)[64]; ///< points to one of the following blocks @@ -755,6 +667,8 @@ typedef struct MpegEncContext { #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_OFFSET(x) offsetof(MpegEncContext, x) #define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) @@ -764,6 +678,8 @@ typedef struct MpegEncContext { { "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" },\ +{ "naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_NAQ }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ +{ "mv0", "always try a mb with mv=<0,0>", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_MV0 }, 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)",\ @@ -799,23 +715,19 @@ 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, - AVFrame *frame, int *got_packet); + 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_bfin(MpegEncContext *s); void ff_MPV_common_init_ppc(MpegEncContext *s); void ff_clean_intra_table_entries(MpegEncContext *s); -void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, - Picture *last, int y, int h, int picture_structure, - int first_field, int draw_edges, int low_delay, - int v_edge_pos, int h_edge_pos); 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, +void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, uint8_t *mbskip_table, + uint32_t *mbtype_table, int8_t *qscale_table, int16_t (*motion_val[2])[2], int *low_delay, int mb_width, int mb_height, int mb_stride, int quarter_sample); @@ -830,7 +742,9 @@ 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); +/* Error resilience */ void ff_mpeg_er_frame_start(MpegEncContext *s); +void ff_mpeg_set_erpic(ERPicture *dst, Picture *src); int ff_dct_common_init(MpegEncContext *s); int ff_dct_encode_init(MpegEncContext *s); @@ -853,8 +767,6 @@ void ff_MPV_motion(MpegEncContext *s, */ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared); -extern const enum AVPixelFormat ff_pixfmt_list_420[]; - /** * permute block according to permuatation. * @param last last non zero element in scantable order |