[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.27.2.11, Sat Jun 28 15:49:11 2003 UTC revision 1.27.4.1, Sat May 3 23:24:25 2003 UTC
# Line 1  Line 1 
1  /*****************************************************************************  /*****************************************************************************
2   *   *
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - Encoder related header  -   *  - Encoder header -
5   *   *
6   *  Copyright(C) 2002-2003 Michael Militzer <isibaar@xvid.org>   *  This program is an implementation of a part of one or more MPEG-4
7   *               2002-2003 Peter Ross <pross@xvid.org>   *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
8     *  to use this software module in hardware or software products are
9     *  advised that its use may infringe existing patents or copyrights, and
10     *  any such use would be at such party's own risk.  The original
11     *  developer of this software module and his/her company, and subsequent
12     *  editors and their companies, will have no liability for use of this
13     *  software or modifications or derivatives thereof.
14   *   *
15   *  This program is free software ; you can redistribute it and/or modify   *  This program is free software ; you can redistribute it and/or modify
16   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
# Line 20  Line 26 
26   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
27   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
28   *   *
29     ****************************************************************************/
30    /*****************************************************************************
31     *
32     *  History
33     *
34     *  - 13.06.2002 Added legal header
35     *  - 22.08.2001 Added support for EXT_MODE encoding mode
36     *               support for EXTENDED API
37     *  - 22.08.2001 fixed bug in iDQtab
38     *
39   * $Id$   * $Id$
40   *   *
41   ****************************************************************************/   ****************************************************************************/
# Line 30  Line 46 
46  #include "xvid.h"  #include "xvid.h"
47  #include "portab.h"  #include "portab.h"
48  #include "global.h"  #include "global.h"
49    #include "utils/ratecontrol.h"
50    
51  /*****************************************************************************  /*****************************************************************************
52   * Constants   * Constants
53   ****************************************************************************/   ****************************************************************************/
54    
55    /* Quatization type */
56    #define H263_QUANT      0
57    #define MPEG4_QUANT     1
58    
59    /* Indicates no quantizer changes in INTRA_Q/INTER_Q modes */
60    #define NO_CHANGE 64
61    
62  /*****************************************************************************  /*****************************************************************************
63   * Types   * Types
64   ****************************************************************************/   ****************************************************************************/
65    
66  typedef int bool;  typedef int bool;
67    
68    typedef enum
69    {
70            I_VOP = 0,
71            P_VOP = 1,
72            B_VOP = 2,
73            S_VOP = 3
74    }
75    VOP_TYPE;
76    
77  /*****************************************************************************  /*****************************************************************************
78   * Structures   * Structures
79   ****************************************************************************/   ****************************************************************************/
80    
81  typedef struct  typedef struct
82  {  {
     /* --- constants --- */  
83          uint32_t width;          uint32_t width;
84          uint32_t height;          uint32_t height;
85    
# Line 56  Line 88 
88          uint32_t mb_width;          uint32_t mb_width;
89          uint32_t mb_height;          uint32_t mb_height;
90    
     int plugin_flags;  
   
91          /* frame rate increment & base */          /* frame rate increment & base */
92          uint32_t fincr;          uint32_t fincr;
93          uint32_t fbase;          uint32_t fbase;
94    
95      int profile;          /* constants */
96            int global;
         xvid_global_t global_flags;  
97          int bquant_ratio;          int bquant_ratio;
98          int bquant_offset;          int bquant_offset;
99          int frame_drop_ratio;          int frame_drop_ratio;
100    
     int min_quant[3];  
     int max_quant[3];  
   
 #ifdef _SMP  
         int num_threads;  
 #endif  
   
   
101          int iMaxKeyInterval;          int iMaxKeyInterval;
102          int max_bframes;          int max_bframes;
103    
 /* --- inbetween vop stuff --- */  
104          /* rounding type; alternate 0-1 after each interframe */          /* rounding type; alternate 0-1 after each interframe */
105          /* 1 <= fixed_code <= 4          /* 1 <= fixed_code <= 4
106             automatically adjusted using motion vector statistics inside             automatically adjusted using motion vector statistics inside
107           */           */
108    
109          /* vars that not "quite" frame independant */          /* vars that not "quite" frame independant */
110            uint32_t m_quant_type;
111          uint32_t m_rounding_type;          uint32_t m_rounding_type;
112          uint32_t m_fcode;          uint32_t m_fcode;
113      xvid_vol_t vol_flags;          uint32_t m_quarterpel;
114            int m_reduced_resolution;       /* reduced_resolution_enable */
115    
116            HINTINFO *hint;
117    
118          int64_t m_stamp;          int64_t m_stamp;
119  }  }
# Line 105  Line 129 
129          int mblks;          int mblks;
130          int ublks;          int ublks;
131          int gblks;          int gblks;
132            int iblks;
133            int qblks;
134  }  }
135  Statistics;  Statistics;
136    
137    
 /* encoding queue */  
 typedef struct  
 {  
         xvid_enc_frame_t frame;  
         unsigned char quant_intra_matrix[64];  
         unsigned char quant_inter_matrix[64];  
         IMAGE image;  
 } QUEUEINFO;  
   
   
138  typedef struct  typedef struct
139  {  {
     int frame_num;  
     int fincr;  
         xvid_vol_t vol_flags;  
     xvid_vop_t vop_flags;  
         xvid_motion_t motion_flags;  
   
         int coding_type;  
140          uint32_t quant;          uint32_t quant;
141            uint32_t motion_flags;
142            uint32_t global_flags;
143    
144            VOP_TYPE coding_type;
145          uint32_t rounding_type;          uint32_t rounding_type;
146            uint32_t quarterpel;
147          uint32_t fcode;          uint32_t fcode;
148          uint32_t bcode;          uint32_t bcode;
149    
# Line 141  Line 155 
155    
156          MACROBLOCK *mbs;          MACROBLOCK *mbs;
157    
158          WARPPOINTS warp;                /* as in bitstream */          WARPPOINTS warp;                // as in bitstream
159          GMC_DATA gmc_data;              /* common data for all MBs */          GMC_DATA gmc_data;              // common data for all MBs
         NEW_GMC_DATA new_gmc_data;              /* common data for all MBs */  
   
     int length;         /* the encoded size of this frame */  
160    
161          Statistics sStat;          Statistics sStat;
162  }  }
# Line 159  Line 170 
170          int iFrameNum;          int iFrameNum;
171          int bitrate;          int bitrate;
172    
173      /* zones */          // images
     unsigned int num_zones;  
     xvid_enc_zone_t * zones;  
   
     /* plugins */  
     unsigned int num_plugins;    /* note: we store plugin flags in MBPARAM */  
     xvid_enc_plugin_t * plugins;  
   
     /* dquant */  
   
     int * temp_dquants;  
   
         /* images */  
174    
175          FRAMEINFO *current;          FRAMEINFO *current;
176          FRAMEINFO *reference;          FRAMEINFO *reference;
177    
178          IMAGE sOriginal;    /* original image copy for i/p frames */          IMAGE sOriginal;
     IMAGE sOriginal2;   /* original image copy for b-frames */  
179          IMAGE vInterH;          IMAGE vInterH;
180          IMAGE vInterV;          IMAGE vInterV;
181          IMAGE vInterVf;          IMAGE vInterVf;
# Line 190  Line 188 
188          int queue_head;          int queue_head;
189          int queue_tail;          int queue_tail;
190          int queue_size;          int queue_size;
191          QUEUEINFO *queue;          IMAGE *queue;
192    
193          /* bframe buffer */          /* bframe buffer */
194          int bframenum_head;          int bframenum_head;
# Line 201  Line 199 
199          IMAGE f_refh;          IMAGE f_refh;
200          IMAGE f_refv;          IMAGE f_refv;
201          IMAGE f_refhv;          IMAGE f_refhv;
202            int bframenum_dx50bvop;
     /* closed_gop fixup temporary storage */  
         int closed_bframenum; /* == -1 if there is no fixup intended */  
     QUEUEINFO closed_qframe;    /* qFrame, only valid when >= 0 */  
203    
204          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 */
205    
206            RateControl rate_control;
207    
208          float fMvPrevSigma;          float fMvPrevSigma;
209  }  }
210  Encoder;  Encoder;
# Line 251  Line 248 
248    
249  void init_encoder(uint32_t cpu_flags);  void init_encoder(uint32_t cpu_flags);
250    
251  int enc_create(xvid_enc_create_t * create);  int encoder_create(XVID_ENC_PARAM * pParam);
252  int enc_destroy(Encoder * pEnc);  int encoder_destroy(Encoder * pEnc);
253  int enc_encode(Encoder * pEnc,  int encoder_encode(Encoder * pEnc,
254                                     xvid_enc_frame_t * pFrame,                                     XVID_ENC_FRAME * pFrame,
255                                     xvid_enc_stats_t * stats);                                     XVID_ENC_STATS * pResult);
256    
257    int encoder_encode_bframes(Encoder * pEnc,
258                                       XVID_ENC_FRAME * pFrame,
259                                       XVID_ENC_STATS * pResult);
260    
261  #endif  #endif

Legend:
Removed from v.1.27.2.11  
changed lines
  Added in v.1.27.4.1

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