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

Diff of /trunk/xvidcore/src/encoder.h

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

revision 164, Mon May 6 10:07:19 2002 UTC revision 399, Wed Sep 4 20:56:52 2002 UTC
# Line 1  Line 1 
1  /**************************************************************************  /*****************************************************************************
2   *   *
3   *  Modifications:   *  XVID MPEG-4 VIDEO CODEC
4     *  - Encoder header -
5   *   *
6   *  22.08.2001 added support for EXT_MODE encoding mode   *  Copyright(C) 2002 Michael Militzer
  *             support for EXTENDED API  
  *  22.08.2001 fixed bug in iDQtab  
7   *   *
8   *  Michael Militzer <isibaar@videocoding.de>   *  This program is an implementation of a part of one or more MPEG-4
9     *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
10     *  to use this software module in hardware or software products are
11     *  advised that its use may infringe existing patents or copyrights, and
12     *  any such use would be at such party's own risk.  The original
13     *  developer of this software module and his/her company, and subsequent
14     *  editors and their companies, will have no liability for use of this
15     *  software or modifications or derivatives thereof.
16   *   *
17   **************************************************************************/   *  This program is free software ; you can redistribute it and/or modify
18     *  it under the terms of the GNU General Public License as published by
19     *  the Free Software Foundation ; either version 2 of the License, or
20     *  (at your option) any later version.
21     *
22     *  This program is distributed in the hope that it will be useful,
23     *  but WITHOUT ANY WARRANTY ; without even the implied warranty of
24     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25     *  GNU General Public License for more details.
26     *
27     *  You should have received a copy of the GNU General Public License
28     *  along with this program ; if not, write to the Free Software
29     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
30     *
31     ****************************************************************************/
32    
33  #ifndef _ENCODER_H_  #ifndef _ENCODER_H_
34  #define _ENCODER_H_  #define _ENCODER_H_
35    
   
36  #include "xvid.h"  #include "xvid.h"
   
37  #include "portab.h"  #include "portab.h"
38  #include "global.h"  #include "global.h"
39  #include "image/image.h"  #include "image/image.h"
40    #include "utils/ratecontrol.h"
41    
42    /*****************************************************************************
43     * Constants
44     ****************************************************************************/
45    
46    /* Quatization type */
47  #define H263_QUANT      0  #define H263_QUANT      0
48  #define MPEG4_QUANT     1  #define MPEG4_QUANT     1
49    
50    /* Indicates no quantizer changes in INTRA_Q/INTER_Q modes */
51    #define NO_CHANGE 64
52    
53  typedef uint32_t bool;  /*****************************************************************************
54     * Types
55     ****************************************************************************/
56    
57    typedef int bool;
58    
59  typedef enum  typedef enum
60  {  {
# Line 36  Line 64 
64  }  }
65  VOP_TYPE;  VOP_TYPE;
66    
67  /***********************************  /*****************************************************************************
68     * Structures
69         Encoding Parameters   ****************************************************************************/
   
 ************************************/  
70    
71  typedef struct  typedef struct
72  {  {
# Line 56  Line 82 
82          uint32_t fincr;          uint32_t fincr;
83          uint32_t fbase;          uint32_t fbase;
84    
85    #ifdef _SMP
86            int num_threads;
87    #endif
88    
89  #ifdef BFRAMES  #ifdef BFRAMES
90          int max_bframes;          int max_bframes;
91  #endif  #endif
# Line 72  Line 102 
102    
103          HINTINFO * hint;          HINTINFO * hint;
104    
 #ifdef BFRAMES  
105          uint32_t m_seconds;          uint32_t m_seconds;
106          uint32_t m_ticks;          uint32_t m_ticks;
 #endif  
107    
108  } MBParam;  }
109    MBParam;
110    
111    
112  typedef struct  typedef struct
# Line 91  Line 120 
120      uint32_t fcode;      uint32_t fcode;
121          uint32_t bcode;          uint32_t bcode;
122    
 #ifdef BFRAMES  
123          uint32_t seconds;          uint32_t seconds;
124          uint32_t ticks;          uint32_t ticks;
 #endif  
125    
126          IMAGE image;          IMAGE image;
127    
128          MACROBLOCK * mbs;          MACROBLOCK * mbs;
129    
130  } FRAMEINFO;  }
131    FRAMEINFO;
132    
133  typedef struct  typedef struct
134  {  {
# Line 129  Line 157 
157          FRAMEINFO * current;          FRAMEINFO * current;
158          FRAMEINFO * reference;          FRAMEINFO * reference;
159    
160  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
161          IMAGE sOriginal;          IMAGE sOriginal;
162  #endif  #endif
163      IMAGE vInterH;      IMAGE vInterH;
# Line 140  Line 168 
168    
169  #ifdef BFRAMES  #ifdef BFRAMES
170          /* constants */          /* constants */
171            int global;
172          int bquant_ratio;          int bquant_ratio;
173          /* vars */          int frame_drop_ratio;
174    
175            /* image queue */
176            int queue_head;
177            int queue_tail;
178            int queue_size;
179            IMAGE *queue;
180    
181            /* bframe buffer */
182          int bframenum_head;          int bframenum_head;
183          int bframenum_tail;          int bframenum_tail;
184          int flush_bframes;          int flush_bframes;
# Line 150  Line 187 
187      IMAGE f_refh;      IMAGE f_refh;
188      IMAGE f_refv;      IMAGE f_refv;
189      IMAGE f_refhv;      IMAGE f_refhv;
190            int bframenum_dx50bvop;
191    
192            int last_pframe;
193            int last_sync;
194            int time_pp;
195            int m_framenum; /* debug frame num counter; unlike iFrameNum, does not reset at ivop */
196  #endif  #endif
197    
198      Statistics sStat;      Statistics sStat;
199            RateControl rate_control;
200  }  }
201  Encoder;  Encoder;
202    
203    /*****************************************************************************
204     * Inline functions
205     ****************************************************************************/
206    
207  // indicates no quantizer changes in INTRA_Q/INTER_Q modes  static __inline uint8_t
208  #define NO_CHANGE 64  get_fcode(uint16_t sr)
   
 void init_encoder(uint32_t cpu_flags);  
   
 int encoder_create(XVID_ENC_PARAM * pParam);  
 int encoder_destroy(Encoder * pEnc);  
 int encoder_encode(Encoder * pEnc, XVID_ENC_FRAME * pFrame, XVID_ENC_STATS * pResult);  
   
 static __inline uint8_t get_fcode(uint16_t sr)  
209  {  {
210      if (sr <= 16)      if (sr <= 16)
211                  return 1;                  return 1;
# Line 192  Line 232 
232                  return 0;                  return 0;
233  }  }
234    
235  #endif /* _ENCODER_H_ */  
236    /*****************************************************************************
237     * Prototypes
238     ****************************************************************************/
239    
240    void init_encoder(uint32_t cpu_flags);
241    
242    int encoder_create(XVID_ENC_PARAM * pParam);
243    int encoder_destroy(Encoder * pEnc);
244    int encoder_encode(Encoder * pEnc,
245                                       XVID_ENC_FRAME * pFrame,
246                                       XVID_ENC_STATS * pResult);
247    
248    int encoder_encode_bframes(Encoder * pEnc,
249                                       XVID_ENC_FRAME * pFrame,
250                                       XVID_ENC_STATS * pResult);
251    
252    #endif

Legend:
Removed from v.164  
changed lines
  Added in v.399

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