summaryrefslogtreecommitdiff
path: root/src/libffmpeg/libavcodec/mpegvideo.h
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-01-08 13:18:42 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-01-08 13:18:42 +0000
commit6f1c8d4eafabd914b87e9171bf4d04f4ef9160ea (patch)
treee70be493d1222b10f96aa5efac01c0ec0d5bcc97 /src/libffmpeg/libavcodec/mpegvideo.h
parent1fb58a63872660424777d41389e426dc90f1b660 (diff)
downloadxine-lib-6f1c8d4eafabd914b87e9171bf4d04f4ef9160ea.tar.gz
xine-lib-6f1c8d4eafabd914b87e9171bf4d04f4ef9160ea.tar.bz2
syncing ffmpeg (with some compilation fixes)
- fixes wma bugs - mace, huffyuv and mp3 decoders imported (but not enabled) tested: wma (v1 and v2), mpeg4, msmpeg4 v1, v2 and v3, divx3, divx4, divx5, xvid and dv decoders. everything looks fine. CVS patchset: 3828 CVS date: 2003/01/08 13:18:42
Diffstat (limited to 'src/libffmpeg/libavcodec/mpegvideo.h')
-rw-r--r--src/libffmpeg/libavcodec/mpegvideo.h90
1 files changed, 75 insertions, 15 deletions
diff --git a/src/libffmpeg/libavcodec/mpegvideo.h b/src/libffmpeg/libavcodec/mpegvideo.h
index 46e19d4b1..e6909817a 100644
--- a/src/libffmpeg/libavcodec/mpegvideo.h
+++ b/src/libffmpeg/libavcodec/mpegvideo.h
@@ -38,7 +38,7 @@ enum OutputFormat {
#define MAX_FCODE 7
#define MAX_MV 2048
-#define MAX_PICTURE_COUNT 7
+#define MAX_PICTURE_COUNT 15
#define ME_MAP_SIZE 64
#define ME_MAP_SHIFT 3
@@ -110,13 +110,14 @@ typedef struct ScanTable{
} ScanTable;
typedef struct Picture{
- FF_COMMON_PICTURE
+ FF_COMMON_FRAME
int mb_var_sum; /* sum of MB variance for current frame */
int mc_mb_var_sum; /* motion compensated MB variance for current frame */
uint16_t *mb_var; /* Table for MB variances */
uint16_t *mc_mb_var; /* Table for motion compensated MB variances */
uint8_t *mb_mean; /* Table for MB luminance */
+ int b_frame_score; /* */
} Picture;
typedef struct ParseContext{
@@ -128,6 +129,39 @@ typedef struct ParseContext{
int frame_start_found;
} ParseContext;
+struct MpegEncContext;
+
+typedef struct MotionEstContext{
+ int skip; /* set if ME is skiped for the current MB */
+ int co_located_mv[4][2]; /* mv from last p frame for direct mode ME */
+ int direct_basis_mv[4][2];
+ uint8_t *scratchpad; /* data area for the me algo, so that the ME doesnt need to malloc/free */
+ uint32_t *map; /* map to avoid duplicate evaluations */
+ uint32_t *score_map; /* map to store the scores */
+ int map_generation;
+ int pre_penalty_factor;
+ int penalty_factor;
+ int sub_penalty_factor;
+ int pre_pass; /* = 1 for the pre pass */
+ int dia_size;
+ UINT16 (*mv_penalty)[MAX_MV*2+1]; /* amount of bits needed to encode a MV */
+ int (*sub_motion_search)(struct MpegEncContext * s,
+ int *mx_ptr, int *my_ptr, int dmin,
+ int xmin, int ymin, int xmax, int ymax,
+ int pred_x, int pred_y, Picture *ref_picture,
+ int n, int size, uint16_t * const mv_penalty);
+ int (*motion_search[7])(struct MpegEncContext * s, int block,
+ int *mx_ptr, int *my_ptr,
+ int P[10][2], int pred_x, int pred_y,
+ int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2],
+ int ref_mv_scale, uint16_t * const mv_penalty);
+ int (*pre_motion_search)(struct MpegEncContext * s, int block,
+ int *mx_ptr, int *my_ptr,
+ int P[10][2], int pred_x, int pred_y,
+ int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2],
+ int ref_mv_scale, uint16_t * const mv_penalty);
+}MotionEstContext;
+
typedef struct MpegEncContext {
struct AVCodecContext *avctx;
/* the following parameters must be initialized before encoding */
@@ -184,7 +218,6 @@ typedef struct MpegEncContext {
Picture next_picture; /* previous picture (for bidir pred) */
Picture new_picture; /* source picture for encoding */
Picture current_picture; /* buffer to store the decompressed current picture */
- int num_available_buffers; /* is 0 at the start & after seeking, after the first I frame its 1 after next I/P 2 */
int last_dc[3]; /* last DC values for MPEG1 */
INT16 *dc_val[3]; /* used for mpeg4 DC prediction, all 3 arrays must be continuous */
int y_dc_scale, c_dc_scale;
@@ -199,7 +232,8 @@ typedef struct MpegEncContext {
UINT8 *mbintra_table; /* used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding */
UINT8 *cbp_table; /* used to store cbp, ac_pred for partitioned decoding */
UINT8 *pred_dir_table; /* used to store pred_dir for partitioned decoding */
- UINT8 *edge_emu_buffer;
+ uint8_t *allocated_edge_emu_buffer;
+ uint8_t *edge_emu_buffer; /* points into the middle of allocated_edge_emu_buffer */
int qscale; /* QP */
float frame_qscale; /* qscale from the frame level rc FIXME remove*/
@@ -222,15 +256,8 @@ typedef struct MpegEncContext {
INT16 (*b_back_mv_table)[2]; /* MV table (1MV per MB) backward mode b-frame encoding */
INT16 (*b_bidir_forw_mv_table)[2]; /* MV table (1MV per MB) bidir mode b-frame encoding */
INT16 (*b_bidir_back_mv_table)[2]; /* MV table (1MV per MB) bidir mode b-frame encoding */
- INT16 (*b_direct_forw_mv_table)[2];/* MV table (1MV per MB) direct mode b-frame encoding */
- INT16 (*b_direct_back_mv_table)[2];/* MV table (1MV per MB) direct mode b-frame encoding */
INT16 (*b_direct_mv_table)[2]; /* MV table (1MV per MB) direct mode b-frame encoding */
int me_method; /* ME algorithm */
- uint8_t *me_scratchpad; /* data area for the me algo, so that the ME doesnt need to malloc/free */
- uint32_t *me_map; /* map to avoid duplicate evaluations */
- uint16_t *me_score_map; /* map to store the SADs */
- int me_map_generation;
- int skip_me; /* set if ME is skiped for the current MB */
int scene_change_score;
int mv_dir;
#define MV_DIR_BACKWARD 1
@@ -250,10 +277,10 @@ typedef struct MpegEncContext {
int mv[2][4][2];
int field_select[2][2];
int last_mv[2][2][2]; /* last MV, used for MV prediction in MPEG1 & B-frame MPEG4 */
- UINT16 (*mv_penalty)[MAX_MV*2+1]; /* amount of bits needed to encode a MV, used for ME */
UINT8 *fcode_tab; /* smallest fcode needed for each MV */
+
+ MotionEstContext me;
- int has_b_frames;
int no_rounding; /* apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
for b-frames rounding mode is allways 0 */
@@ -289,6 +316,13 @@ typedef struct MpegEncContext {
int inter_quant_bias; /* bias for the quantizer */
int min_qcoeff; /* minimum encodable coefficient */
int max_qcoeff; /* maximum encodable coefficient */
+ int ac_esc_length; /* num of bits needed to encode the longest esc */
+ uint8_t *intra_ac_vlc_length;
+ uint8_t *intra_ac_vlc_last_length;
+ uint8_t *inter_ac_vlc_length;
+ uint8_t *inter_ac_vlc_last_length;
+#define UNI_AC_ENC_INDEX(run,level) ((run)*128 + (level))
+
/* precomputed matrix (combine qscale and DCT renorm) */
int __align8 q_intra_matrix[32][64];
int __align8 q_inter_matrix[32][64];
@@ -344,7 +378,7 @@ typedef struct MpegEncContext {
int resync_mb_x; /* x position of last resync marker */
int resync_mb_y; /* y position of last resync marker */
- GetBitContext last_resync_gb; /* used to serach for the next resync marker */
+ GetBitContext last_resync_gb; /* used to search for the next resync marker */
int mb_num_left; /* number of MBs left in this video packet (for partitioned Slices only)*/
int next_p_frame_damaged; /* set if the next p frame is damaged, to avoid showing trashed b frames */
int error_resilience;
@@ -459,6 +493,7 @@ typedef struct MpegEncContext {
/* [mb_intra][isChroma][level][run][last] */
int (*ac_stats)[2][MAX_LEVEL+1][MAX_RUN+1][2];
int inter_intra_pred;
+ int mspel;
/* decompression specific */
GetBitContext gb;
@@ -520,6 +555,7 @@ typedef struct MpegEncContext {
void (*fdct)(DCTELEM *block/* align 16*/);
void (*idct_put)(UINT8 *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
void (*idct_add)(UINT8 *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
+ //FIXME move above funcs into dspContext perhaps
} MpegEncContext;
@@ -529,6 +565,9 @@ void MPV_common_end(MpegEncContext *s);
void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx);
void MPV_frame_end(MpegEncContext *s);
+int MPV_encode_init(AVCodecContext *avctx);
+int MPV_encode_end(AVCodecContext *avctx);
+int MPV_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data);
#ifdef HAVE_MMX
void MPV_common_init_mmx(MpegEncContext *s);
#endif
@@ -554,6 +593,10 @@ void ff_clean_intra_table_entries(MpegEncContext *s);
void ff_init_scantable(MpegEncContext *s, ScanTable *st, const UINT8 *src_scantable);
void ff_error_resilience(MpegEncContext *s);
void ff_draw_horiz_band(MpegEncContext *s);
+void ff_emulated_edge_mc(MpegEncContext *s, UINT8 *src, int linesize, int block_w, int block_h,
+ int src_x, int src_y, int w, int h);
+char ff_get_pict_type_char(int pict_type);
+
extern int ff_bit_exact;
@@ -584,6 +627,8 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
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_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type);
+void ff_init_me(MpegEncContext *s);
+int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y);
/* mpeg12.c */
@@ -630,6 +675,11 @@ extern UINT8 ff_mpeg4_y_dc_scale_table[32];
extern UINT8 ff_mpeg4_c_dc_scale_table[32];
extern const INT16 ff_mpeg4_default_intra_matrix[64];
extern const INT16 ff_mpeg4_default_non_intra_matrix[64];
+int ff_h263_decode_init(AVCodecContext *avctx);
+int ff_h263_decode_frame(AVCodecContext *avctx,
+ void *data, int *data_size,
+ UINT8 *buf, int buf_size);
+int ff_h263_decode_end(AVCodecContext *avctx);
void h263_encode_mb(MpegEncContext *s,
DCTELEM block[6][64],
int motion_x, int motion_y);
@@ -666,6 +716,7 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s);
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
int ff_h263_resync(MpegEncContext *s);
int ff_h263_get_gob_height(MpegEncContext *s);
+void ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my);
/* rv10.c */
@@ -683,7 +734,16 @@ int msmpeg4_decode_picture_header(MpegEncContext * s);
int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
int ff_msmpeg4_decode_init(MpegEncContext *s);
void ff_msmpeg4_encode_init(MpegEncContext *s);
-
+int ff_wmv2_decode_picture_header(MpegEncContext * s);
+void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr);
+void ff_mspel_motion(MpegEncContext *s,
+ UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,
+ UINT8 **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,
+ DCTELEM block[6][64],
+ int motion_x, int motion_y);
/* mjpegenc.c */
int mjpeg_init(MpegEncContext *s);