diff mpegvideo.h @ 903:22ee74da2cd3 libavcodec

cleanup adding AVVideoFrame moving quality, pict_type, key_frame, qscale_table, ... to AVVideoFrame removing obsolete variables in AVCodecContext skiping of MBs in b frames correctly initalizing AVCodecContext picture buffer cleanup
author michaelni
date Wed, 04 Dec 2002 10:04:03 +0000
parents 2c350f59233a
children 8ae1e4c24e91
line wrap: on
line diff
--- a/mpegvideo.h	Tue Dec 03 19:40:35 2002 +0000
+++ b/mpegvideo.h	Wed Dec 04 10:04:03 2002 +0000
@@ -28,6 +28,8 @@
     FMT_MJPEG, 
 };
 
+#define EDGE_WIDTH 16
+
 #define MPEG_BUF_SIZE (16 * 1024)
 
 #define QMAT_SHIFT_MMX 16
@@ -35,7 +37,8 @@
 
 #define MAX_FCODE 7
 #define MAX_MV 2048
-#define REORDER_BUFFER_SIZE (FF_MAX_B_FRAMES+2)
+
+#define MAX_PICTURE_COUNT 7
 
 #define ME_MAP_SIZE 64
 #define ME_MAP_SHIFT 3
@@ -90,14 +93,6 @@
     int last_non_b_pict_type;
 }RateControlContext;
 
-typedef struct ReorderBuffer{
-    UINT8 *picture[3];
-    int pict_type;
-    int qscale;
-    int force_type;
-    int picture_number;
-    int picture_in_gop_number;
-} ReorderBuffer;
 
 typedef struct ScanTable{
     const UINT8 *scantable;
@@ -109,6 +104,16 @@
 #endif
 } ScanTable;
 
+typedef struct Picture{
+    FF_COMMON_PICTURE    
+
+    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 */
+} Picture;
+
 typedef struct ParseContext{
     UINT8 *buffer;
     int index;
@@ -145,7 +150,6 @@
     int max_qdiff;    /* max qscale difference between frames */
     int encoding;     /* true if we are encoding (vs decoding) */
     int flags;        /* AVCodecContext.flags (HQ, MV4, ...) */
-    int force_input_type;/* 0= no force, otherwise I_TYPE, P_TYPE, ... */
     int max_b_frames; /* max number of b-frames for encoding */
     int b_frame_strategy;
     int luma_elim_threshold;
@@ -160,10 +164,7 @@
     /* sequence parameters */
     int context_initialized;
     int input_picture_number;
-    int input_picture_in_gop_number; /* 0-> first pic in gop, ... */
     int picture_number;
-    int fake_picture_number; /* picture number at the bitstream frame rate */
-    int gop_picture_number;  /* index of the first picture of a GOP based on fake_pic_num & mpeg1 specific */
     int picture_in_gop_number; /* 0-> first pic in gop, ... */
     int b_frames_since_non_b;  /* used for encoding, relative to not yet reordered input */
     int mb_width, mb_height;   /* number of MBs horizontally & vertically */
@@ -171,20 +172,13 @@
     int mb_num;                /* number of MBs of a picture */
     int linesize;              /* line size, in bytes, may be different from width */
     int uvlinesize;            /* line size, for chroma in bytes, may be different from width */
-    UINT8 *new_picture[3];     /* picture to be compressed */
-    UINT8 *picture_buffer[REORDER_BUFFER_SIZE][3]; /* internal buffers used for reordering of input pictures */
-    int picture_buffer_index;
-    ReorderBuffer coded_order[REORDER_BUFFER_SIZE];
-    UINT8 *last_picture[3];      /* previous picture */
-    UINT8 *last_picture_base[3]; /* real start of the picture */
-    UINT8 *next_picture[3];      /* previous picture (for bidir pred) */
-    UINT8 *next_picture_base[3]; /* real start of the picture */
-    UINT8 *aux_picture[3];       /* aux picture (for B frames only) */
-    UINT8 *aux_picture_base[3];  /* real start of the picture */
-    UINT8 *current_picture[3];   /* buffer to store the decompressed current picture */
-    void *last_dr_opaque;
-    void *next_dr_opaque;
-    int ip_buffer_count;         /* number of buffers, currently only >2 if dr1 is used */
+    Picture picture[MAX_PICTURE_COUNT]; /* main picture buffer */
+    Picture *input_picture[MAX_PICTURE_COUNT]; /* next pictures on display order for encoding*/
+    Picture *reordered_input_picture[MAX_PICTURE_COUNT]; /* pointer to the next pictures in codedorder for encoding*/
+    Picture last_picture;       /* previous picture */
+    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 */
@@ -200,17 +194,10 @@
     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 */
-    INT8 *qscale_table;         /* used to store qscale */
-    INT8 *aux_qscale_table;
-    INT8 *next_qscale_table;
-    INT8 *last_qscale_table;     //FIXME move these into some picture struct (MpegEncContext.aux.qscale_table[])
     UINT8 *edge_emu_buffer;
 
-    int input_qscale;           /* qscale prior to reordering of frames */
-    int input_pict_type;        /* pict_type prior to reordering of frames */
-    int force_type;             /* 0= no force, otherwise I_TYPE, P_TYPE, ... */
     int qscale;                 /* QP */
-    float frame_qscale;         /* qscale from the frame level rc */
+    float frame_qscale;         /* qscale from the frame level rc FIXME remove*/
     int adaptive_quant;         /* use adaptive quantization */
     int dquant;                 /* qscale difference to prev qscale */ 
     int pict_type;              /* I_TYPE, P_TYPE, B_TYPE, ... */
@@ -272,9 +259,6 @@
     int mb_x, mb_y;
     int mb_incr;
     int mb_intra;
-    UINT16 *mb_var;       /* Table for MB variances */
-    UINT16 *mc_mb_var;    /* Table for motion compensated MB variances */
-    UINT8 *mb_mean;       /* Table for MB luminance */
     UINT8 *mb_type;       /* Table for MB type */
 #define MB_TYPE_INTRA    0x01
 #define MB_TYPE_INTER    0x02
@@ -325,8 +309,6 @@
 
     /* bit rate control */
     int I_frame_bits; //FIXME used in mpeg12 ...
-    int mb_var_sum;          /* sum of MB variance for current frame */
-    int mc_mb_var_sum;       /* motion compensated MB variance for current frame */
     INT64 wanted_bits;
     INT64 total_bits;
     int frame_bits;        /* bits used for the current frame */
@@ -476,6 +458,10 @@
     /* decompression specific */
     GetBitContext gb;
 
+    /* Mpeg1 specific */
+    int fake_picture_number; /* picture number at the bitstream frame rate */
+    int gop_picture_number;  /* index of the first picture of a GOP based on fake_pic_num & mpeg1 specific */
+    
     /* MPEG2 specific - I wish I had not to support this mess. */
     int progressive_sequence;
     int mpeg_f_code[2][2];
@@ -498,7 +484,6 @@
     int mpeg2;
     int full_pel[2];
     int interlaced_dct;
-    int last_qscale;
     int first_slice;
     
     /* RTP specific */