diff options
Diffstat (limited to 'src/libffmpeg/libavcodec/mpegvideo.h')
-rw-r--r-- | src/libffmpeg/libavcodec/mpegvideo.h | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/src/libffmpeg/libavcodec/mpegvideo.h b/src/libffmpeg/libavcodec/mpegvideo.h index 715fb6d92..a1c459e97 100644 --- a/src/libffmpeg/libavcodec/mpegvideo.h +++ b/src/libffmpeg/libavcodec/mpegvideo.h @@ -27,11 +27,13 @@ #define AVCODEC_MPEGVIDEO_H #include "dsputil.h" +#include "bitstream.h" #define FRAME_SKIPED 100 ///< return value for header parsers if frame is not coded enum OutputFormat { FMT_MPEG1, + FMT_H261, FMT_H263, FMT_MJPEG, FMT_H264, @@ -49,7 +51,7 @@ enum OutputFormat { #define MAX_THREADS 8 -#define MAX_PICTURE_COUNT 15 +#define MAX_PICTURE_COUNT 32 #define ME_MAP_SIZE 64 #define ME_MAP_SHIFT 3 @@ -66,6 +68,8 @@ enum OutputFormat { #define SI_TYPE FF_SI_TYPE ///< Switching Intra #define SP_TYPE FF_SP_TYPE ///< Switching Predicted +#define MAX_MB_BYTES (30*16*16*3/8 + 120) + typedef struct Predictor{ double coeff; double count; @@ -169,6 +173,8 @@ typedef struct Picture{ int frame_num; ///< h264 frame_num int pic_id; ///< h264 pic_num or long_term_pic_idx int long_ref; ///< 1->long term reference 0->short term reference + int ref_poc[2][16]; ///< h264 POCs of the frames used as reference + int ref_count[2]; ///< number of entries in ref_poc int mb_var_sum; ///< sum of MB variance for current frame int mc_mb_var_sum; ///< motion compensated MB variance for current frame @@ -262,7 +268,7 @@ typedef struct MpegEncContext { int h263_msmpeg4; ///< generate MSMPEG4 compatible stream (deprecated, use msmpeg4_version instead) int h263_flv; ///< use flv h263 header - int codec_id; /* see CODEC_ID_xxx */ + enum CodecID codec_id; /* see CODEC_ID_xxx */ int fixed_qscale; ///< fixed qscale if non zero int encoding; ///< true if we are encoding (vs decoding) int flags; ///< AVCodecContext.flags (HQ, MV4, ...) @@ -368,8 +374,6 @@ typedef struct MpegEncContext { int last_non_b_pict_type; ///< used for mpeg4 gmc b-frames & ratecontrol int dropable; int frame_rate_index; - int frame_rate_ext_n; ///< MPEG-2 specific framerate modificators (numerator) - int frame_rate_ext_d; ///< MPEG-2 specific framerate modificators (denominator) /* motion compensation */ int unrestricted_mv; ///< mv can point outside of the coded picture @@ -599,9 +603,9 @@ typedef struct MpegEncContext { int divx_version; int divx_build; int divx_packed; -#define BITSTREAM_BUFFER_SIZE 1024*256 uint8_t *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them int bitstream_buffer_size; + int allocated_bitstream_buffer_size; int xvid_build; @@ -669,6 +673,8 @@ typedef struct MpegEncContext { #define CHROMA_420 1 #define CHROMA_422 2 #define CHROMA_444 3 + int chroma_x_shift;//depend on pix_format, that depend on chroma_format + int chroma_y_shift; int progressive_frame; int full_pel[2]; @@ -703,6 +709,10 @@ typedef struct MpegEncContext { DCTELEM *block/*align 16*/, int n, int qscale); void (*dct_unquantize_h263_inter)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale); + void (*dct_unquantize_h261_intra)(struct MpegEncContext *s, + DCTELEM *block/*align 16*/, int n, int qscale); + void (*dct_unquantize_h261_inter)(struct MpegEncContext *s, + DCTELEM *block/*align 16*/, int n, int qscale); void (*dct_unquantize_intra)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both) DCTELEM *block/*align 16*/, int n, int qscale); void (*dct_unquantize_inter)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both) @@ -717,7 +727,7 @@ int DCT_common_init(MpegEncContext *s); void MPV_decode_defaults(MpegEncContext *s); int MPV_common_init(MpegEncContext *s); void MPV_common_end(MpegEncContext *s); -void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); +void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]); int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx); void MPV_frame_end(MpegEncContext *s); int MPV_encode_init(AVCodecContext *avctx); @@ -768,15 +778,17 @@ extern enum PixelFormat ff_yuv420p_list[2]; void ff_init_block_index(MpegEncContext *s); static inline void ff_update_block_index(MpegEncContext *s){ + const int block_size= 8>>s->avctx->lowres; + s->block_index[0]+=2; s->block_index[1]+=2; s->block_index[2]+=2; s->block_index[3]+=2; s->block_index[4]++; s->block_index[5]++; - s->dest[0]+= 16; - s->dest[1]+= 8; - s->dest[2]+= 8; + s->dest[0]+= 2*block_size; + s->dest[1]+= block_size; + s->dest[2]+= block_size; } static inline int get_bits_diff(MpegEncContext *s){ @@ -799,7 +811,11 @@ void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_ int16_t (*mv_table)[2], int f_code, int type, int truncate); void ff_init_me(MpegEncContext *s); int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y); - +inline 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 inline ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index, + int ref_index, int size, int h, int add_rate); /* mpeg12.c */ extern const int16_t ff_mpeg1_default_intra_matrix[64]; @@ -830,8 +846,8 @@ typedef struct RLTable { RL_VLC_ELEM *rl_vlc[32]; ///< decoding only } RLTable; -void init_rl(RLTable *rl); -void init_vlc_rl(RLTable *rl); +void init_rl(RLTable *rl, int use_static); +void init_vlc_rl(RLTable *rl, int use_static); static inline int get_rl_index(const RLTable *rl, int last, int run, int level) { @@ -852,6 +868,15 @@ extern const int16_t ff_mpeg4_default_non_intra_matrix[64]; extern const uint8_t ff_h263_chroma_qscale_table[32]; extern const uint8_t ff_h263_loop_filter_strength[32]; +/* h261.c */ +void ff_h261_loop_filter(MpegEncContext *s); +void ff_h261_reorder_mb_index(MpegEncContext* s); +void ff_h261_encode_mb(MpegEncContext *s, + DCTELEM block[6][64], + int motion_x, int motion_y); +void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number); +void ff_h261_encode_init(MpegEncContext *s); + /* h263.c, h263dec.c */ int ff_h263_decode_init(AVCodecContext *avctx); @@ -912,6 +937,7 @@ int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size); /* rv10.c */ void rv10_encode_picture_header(MpegEncContext *s, int picture_number); int rv_decode_dc(MpegEncContext *s, int n); +void rv20_encode_picture_header(MpegEncContext *s, int picture_number); /* msmpeg4.c */ |