[cvs] / xvidcore / src / encoder.h Repository:
ViewVC logotype

Diff of /xvidcore/src/encoder.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18.2.3, Sat Oct 5 21:35:35 2002 UTC revision 1.27.2.5, Sun Mar 16 12:04:14 2003 UTC
# Line 46  Line 46 
46  #include "xvid.h"  #include "xvid.h"
47  #include "portab.h"  #include "portab.h"
48  #include "global.h"  #include "global.h"
 #include "image/image.h"  
49  #include "utils/ratecontrol.h"  #include "utils/ratecontrol.h"
50    
51  /*****************************************************************************  /*****************************************************************************
52   * Constants   * Constants
53   ****************************************************************************/   ****************************************************************************/
54    
 /* Quatization type */  
 #define H263_QUANT      0  
 #define MPEG4_QUANT     1  
   
 /* Indicates no quantizer changes in INTRA_Q/INTER_Q modes */  
 #define NO_CHANGE 64  
   
55  /*****************************************************************************  /*****************************************************************************
56   * Types   * Types
57   ****************************************************************************/   ****************************************************************************/
58    
59  typedef int bool;  typedef int bool;
60    
 typedef enum  
 {  
         I_VOP = 0,  
         P_VOP = 1,  
         B_VOP = 2  
 }  
 VOP_TYPE;  
   
61  /*****************************************************************************  /*****************************************************************************
62   * Structures   * Structures
63   ****************************************************************************/   ****************************************************************************/
64    
65  typedef struct  typedef struct
66  {  {
67        /* --- constants --- */
68          uint32_t width;          uint32_t width;
69          uint32_t height;          uint32_t height;
70    
# Line 88  Line 73 
73          uint32_t mb_width;          uint32_t mb_width;
74          uint32_t mb_height;          uint32_t mb_height;
75    
76        int plugin_flags;
77    
78          /* frame rate increment & base */          /* frame rate increment & base */
79          uint32_t fincr;          uint32_t fincr;
80          uint32_t fbase;          uint32_t fbase;
81    
82            xvid_global_t global_flags;
83            int bquant_ratio;
84            int bquant_offset;
85            int frame_drop_ratio;
86    
87  #ifdef _SMP  #ifdef _SMP
88          int num_threads;          int num_threads;
89  #endif  #endif
90    
91  #ifdef BFRAMES  
92            int iMaxKeyInterval;
93          int max_bframes;          int max_bframes;
 #endif  
94    
95    /* --- inbetween vop stuff --- */
96          /* rounding type; alternate 0-1 after each interframe */          /* rounding type; alternate 0-1 after each interframe */
97          /* 1 <= fixed_code <= 4          /* 1 <= fixed_code <= 4
98             automatically adjusted using motion vector statistics inside             automatically adjusted using motion vector statistics inside
99           */           */
100    
101          /* vars that not "quite" frame independant */          /* vars that not "quite" frame independant */
         uint32_t m_quant_type;  
102          uint32_t m_rounding_type;          uint32_t m_rounding_type;
103          uint32_t m_fcode;          uint32_t m_fcode;
104          uint32_t m_quarterpel;      xvid_vol_t vol_flags;
   
         HINTINFO *hint;  
105    
106          int64_t m_stamp;          int64_t m_stamp;
107  }  }
# Line 120  Line 110 
110    
111  typedef struct  typedef struct
112  {  {
113          uint32_t quant;          int iTextBits;
114          uint32_t motion_flags;          int iMvSum;
115          uint32_t global_flags;          int iMvCount;
116            int kblks;
117            int mblks;
118            int ublks;
119            int gblks;
120    }
121    Statistics;
122    
123    
124    /* encoding queue */
125    typedef struct
126    {
127            xvid_enc_frame_t frame;
128            unsigned char quant_intra_matrix[64];
129            unsigned char quant_inter_matrix[64];
130            IMAGE image;
131    } QUEUEINFO;
132    
133    
134    typedef struct
135    {
136        int frame_num;
137        int fincr;
138            xvid_vol_t vol_flags;
139        xvid_vop_t vop_flags;
140            xvid_motion_t motion_flags;
141    
142          VOP_TYPE coding_type;          int coding_type;
143            uint32_t quant;
144          uint32_t rounding_type;          uint32_t rounding_type;
145          uint32_t fcode;          uint32_t fcode;
146          uint32_t bcode;          uint32_t bcode;
# Line 137  Line 153 
153    
154          MACROBLOCK *mbs;          MACROBLOCK *mbs;
155    
156  }          WARPPOINTS warp;                // as in bitstream
157  FRAMEINFO;          GMC_DATA gmc_data;              // common data for all MBs
158    
159  typedef struct      int length;         /* the encoded size of this frame */
 {  
         int iTextBits;  
         float fMvPrevSigma;  
         int iMvSum;  
         int iMvCount;  
         int kblks;  
         int mblks;  
         int ublks;  
 }  
 Statistics;  
160    
161            Statistics sStat;
162    }
163    FRAMEINFO;
164    
165    
166  typedef struct  typedef struct
# Line 159  Line 168 
168          MBParam mbParam;          MBParam mbParam;
169    
170          int iFrameNum;          int iFrameNum;
         int iMaxKeyInterval;  
171          int bitrate;          int bitrate;
172    
173        // plugins
174        unsigned int num_plugins;    /* note: we store plugin flags in MBPARAM */
175        xvid_enc_plugin_t * plugins;
176    
177        // dquant
178    
179        int * temp_dquants;
180    
181          // images          // images
182    
183          FRAMEINFO *current;          FRAMEINFO *current;
184          FRAMEINFO *reference;          FRAMEINFO *reference;
185    
186  #ifdef _DEBUG_PSNR          IMAGE sOriginal;    /* original image copy for i/p frames */
187          IMAGE sOriginal;      IMAGE sOriginal2;   /* original image copy for b-frames */
 #endif  
188          IMAGE vInterH;          IMAGE vInterH;
189          IMAGE vInterV;          IMAGE vInterV;
190          IMAGE vInterVf;          IMAGE vInterVf;
191          IMAGE vInterHV;          IMAGE vInterHV;
192          IMAGE vInterHVf;          IMAGE vInterHVf;
193    
194  #ifdef BFRAMES          IMAGE vGMC;
         /* constants */  
         int global;  
         int bquant_ratio;  
         int frame_drop_ratio;  
195    
196          /* image queue */          /* image queue */
197          int queue_head;          int queue_head;
198          int queue_tail;          int queue_tail;
199          int queue_size;          int queue_size;
200          IMAGE *queue;          QUEUEINFO *queue;
201    
202          /* bframe buffer */          /* bframe buffer */
203          int bframenum_head;          int bframenum_head;
# Line 197  Line 208 
208          IMAGE f_refh;          IMAGE f_refh;
209          IMAGE f_refv;          IMAGE f_refv;
210          IMAGE f_refhv;          IMAGE f_refhv;
211          int bframenum_dx50bvop;  
212        /* closed_gop fixup temporary storage */
213            int closed_bframenum; /* == -1 if there is no fixup intended */
214        QUEUEINFO closed_qframe;    /* qFrame, only valid when >= 0 */
215    
216          int m_framenum; /* debug frame num counter; unlike iFrameNum, does not reset at ivop */          int m_framenum; /* debug frame num counter; unlike iFrameNum, does not reset at ivop */
 #endif  
217    
         Statistics sStat;  
218          RateControl rate_control;          RateControl rate_control;
219    
220            float fMvPrevSigma;
221  }  }
222  Encoder;  Encoder;
223    
# Line 246  Line 260 
260    
261  void init_encoder(uint32_t cpu_flags);  void init_encoder(uint32_t cpu_flags);
262    
263  int encoder_create(XVID_ENC_PARAM * pParam);  int enc_create(xvid_enc_create_t * create, xvid_enc_rc_t * rc);
264  int encoder_destroy(Encoder * pEnc);  int enc_destroy(Encoder * pEnc);
265  int encoder_encode(Encoder * pEnc,  int enc_encode(Encoder * pEnc,
266                                     XVID_ENC_FRAME * pFrame,                                     xvid_enc_frame_t * pFrame,
267                                     XVID_ENC_STATS * pResult);                                     xvid_enc_stats_t * stats);
   
 int encoder_encode_bframes(Encoder * pEnc,  
                                    XVID_ENC_FRAME * pFrame,  
                                    XVID_ENC_STATS * pResult);  
268    
269  #endif  #endif

Legend:
Removed from v.1.18.2.3  
changed lines
  Added in v.1.27.2.5

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4