diff options
Diffstat (limited to 'libavcodec/mpegvideo.h')
-rw-r--r-- | libavcodec/mpegvideo.h | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index ea08c14fed..40fd295b82 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -3,20 +3,20 @@ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -32,6 +32,8 @@ #include "dsputil.h" #include "error_resilience.h" #include "get_bits.h" +#include "h264chroma.h" +#include "hpeldsp.h" #include "put_bits.h" #include "ratecontrol.h" #include "parser.h" @@ -41,6 +43,7 @@ #include "videodsp.h" #include "libavutil/opt.h" +#include "libavutil/timecode.h" #define FRAME_SKIPPED 100 ///< return value for header parsers if frame is not coded @@ -54,14 +57,13 @@ enum OutputFormat { #define MPEG_BUF_SIZE (16 * 1024) #define QMAT_SHIFT_MMX 16 -#define QMAT_SHIFT 22 +#define QMAT_SHIFT 21 #define MAX_FCODE 7 -#define MAX_MV 2048 +#define MAX_MV 4096 -#define MAX_THREADS 16 - -#define MAX_PICTURE_COUNT 32 +#define MAX_THREADS 32 +#define MAX_PICTURE_COUNT 36 #define ME_MAP_SIZE 64 #define ME_MAP_SHIFT 3 @@ -158,16 +160,18 @@ typedef struct Picture{ 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 used as reference (FIXME need per slice) + 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 sync; ///< has been decoded after a keyframe int mb_var_sum; ///< sum of MB variance for current frame int 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 period_since_free; ///< "cycles" since this Picture has been freed int reference; int shared; @@ -367,11 +371,14 @@ typedef struct MpegEncContext { int *lambda_table; int adaptive_quant; ///< use adaptive quantization int dquant; ///< qscale difference to prev qscale + int closed_gop; ///< MPEG1/2 GOP is closed int pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ... + int vbv_delay; int last_pict_type; //FIXME removes int last_non_b_pict_type; ///< used for mpeg4 gmc b-frames & ratecontrol int droppable; int frame_rate_index; + AVRational mpeg2_frame_rate_ext; int last_lambda_for[5]; ///< last lambda for a specific pict type int skipdct; ///< skip dct and code zero residual @@ -380,6 +387,8 @@ typedef struct MpegEncContext { int h263_long_vectors; ///< use horrible h263v1 long vector mode DSPContext dsp; ///< pointers for accelerated dsp functions + H264ChromaContext h264chroma; + HpelDSPContext hdsp; VideoDSPContext vdsp; int f_code; ///< forward MV resolution int b_code; ///< backward MV resolution for B Frames (mpeg4) @@ -475,13 +484,15 @@ typedef struct MpegEncContext { uint8_t *luma_dc_vlc_length; #define UNI_AC_ENC_INDEX(run,level) ((run)*128 + (level)) - int coded_score[8]; + int coded_score[12]; /** precomputed matrix (combine qscale and DCT renorm) */ int (*q_intra_matrix)[64]; + int (*q_chroma_intra_matrix)[64]; int (*q_inter_matrix)[64]; /** identical to the above but for MMX & these are not permutated, second 64 entries are bias*/ uint16_t (*q_intra_matrix16)[2][64]; + uint16_t (*q_chroma_intra_matrix16)[2][64]; uint16_t (*q_inter_matrix16)[2][64]; /* noise reduction */ @@ -494,6 +505,7 @@ typedef struct MpegEncContext { /* bit rate control */ int64_t total_bits; int frame_bits; ///< bits used for the current frame + int stuffing_bits; ///< bits used for stuffing int next_lambda; ///< next lambda used for retrying to encode a frame RateControlContext rc_context; ///< contains stuff only accessed in ratecontrol.c @@ -611,6 +623,7 @@ typedef struct MpegEncContext { struct MJpegContext *mjpeg_ctx; int mjpeg_vsample[3]; ///< vertical sampling factors, default = {2, 1, 1} int mjpeg_hsample[3]; ///< horizontal sampling factors, default = {2, 1, 1} + int esc_pos; /* MSMPEG4 specific */ int mv_table_index; @@ -675,12 +688,15 @@ typedef struct MpegEncContext { /* RTP specific */ int rtp_mode; + char *tc_opt_str; ///< timecode option string + AVTimecode tc; ///< timecode context + uint8_t *ptr_lastgob; int swap_uv; //vcr2 codec is an MPEG-2 variant with U and V swapped int16_t (*pblocks[12])[64]; int16_t (*block)[64]; ///< points to one of the following blocks - int16_t (*blocks)[8][64]; // for HQ mode we need to keep the best block + int16_t (*blocks)[12][64]; // for HQ mode we need to keep the best block int (*decode_mb)(struct MpegEncContext *s, int16_t block[6][64]); // used by some codecs to avoid a switch() #define SLICE_OK 0 #define SLICE_ERROR -1 @@ -777,8 +793,8 @@ 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_MPV_encode_init_x86(MpegEncContext *s); + 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); @@ -791,7 +807,14 @@ void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, 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); + +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); + +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); void ff_release_unused_pictures(MpegEncContext *s, int remove_current); int ff_find_unused_picture(MpegEncContext *s, int shared); @@ -806,6 +829,7 @@ void ff_set_qscale(MpegEncContext * s, int qscale); 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); @@ -834,7 +858,7 @@ extern const enum AVPixelFormat ff_pixfmt_list_420[]; void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last); static inline void ff_update_block_index(MpegEncContext *s){ - const int block_size = 8; + const int block_size= 8 >> s->avctx->lowres; s->block_index[0]+=2; s->block_index[1]+=2; @@ -940,4 +964,5 @@ void ff_wmv2_encode_mb(MpegEncContext * s, int ff_mpeg_ref_picture(MpegEncContext *s, Picture *dst, Picture *src); void ff_mpeg_unref_picture(MpegEncContext *s, Picture *picture); + #endif /* AVCODEC_MPEGVIDEO_H */ |