[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 400, Wed Sep 4 21:03:29 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 BFRAMES  #ifdef _SMP
86          int max_bframes;          int num_threads;
87  #endif  #endif
88    
89      /* rounding type; alternate 0-1 after each interframe */      /* rounding type; alternate 0-1 after each interframe */
# Line 72  Line 98 
98    
99          HINTINFO * hint;          HINTINFO * hint;
100    
 #ifdef BFRAMES  
101          uint32_t m_seconds;          uint32_t m_seconds;
102          uint32_t m_ticks;          uint32_t m_ticks;
 #endif  
103    
104  } MBParam;  }
105    MBParam;
106    
107    
108  typedef struct  typedef struct
# Line 91  Line 116 
116      uint32_t fcode;      uint32_t fcode;
117          uint32_t bcode;          uint32_t bcode;
118    
 #ifdef BFRAMES  
119          uint32_t seconds;          uint32_t seconds;
120          uint32_t ticks;          uint32_t ticks;
 #endif  
121    
122          IMAGE image;          IMAGE image;
123    
124          MACROBLOCK * mbs;          MACROBLOCK * mbs;
125    
126  } FRAMEINFO;  }
127    FRAMEINFO;
128    
129  typedef struct  typedef struct
130  {  {
# Line 129  Line 153 
153          FRAMEINFO * current;          FRAMEINFO * current;
154          FRAMEINFO * reference;          FRAMEINFO * reference;
155    
156  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
157          IMAGE sOriginal;          IMAGE sOriginal;
158  #endif  #endif
159      IMAGE vInterH;      IMAGE vInterH;
# Line 138  Line 162 
162      IMAGE vInterHV;      IMAGE vInterHV;
163          IMAGE vInterHVf;          IMAGE vInterHVf;
164    
 #ifdef BFRAMES  
         /* constants */  
         int bquant_ratio;  
         /* vars */  
         int bframenum_head;  
         int bframenum_tail;  
         int flush_bframes;  
   
         FRAMEINFO ** bframes;  
     IMAGE f_refh;  
     IMAGE f_refv;  
     IMAGE f_refhv;  
 #endif  
165      Statistics sStat;      Statistics sStat;
166            RateControl rate_control;
167  }  }
168  Encoder;  Encoder;
169    
170    /*****************************************************************************
171     * Inline functions
172     ****************************************************************************/
173    
174  // indicates no quantizer changes in INTRA_Q/INTER_Q modes  static __inline uint8_t
175  #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)  
176  {  {
177      if (sr <= 16)      if (sr <= 16)
178                  return 1;                  return 1;
# Line 192  Line 199 
199                  return 0;                  return 0;
200  }  }
201    
202  #endif /* _ENCODER_H_ */  
203    /*****************************************************************************
204     * Prototypes
205     ****************************************************************************/
206    
207    void init_encoder(uint32_t cpu_flags);
208    
209    int encoder_create(XVID_ENC_PARAM * pParam);
210    int encoder_destroy(Encoder * pEnc);
211    int encoder_encode(Encoder * pEnc,
212                                       XVID_ENC_FRAME * pFrame,
213                                       XVID_ENC_STATS * pResult);
214    
215    int encoder_encode_bframes(Encoder * pEnc,
216                                       XVID_ENC_FRAME * pFrame,
217                                       XVID_ENC_STATS * pResult);
218    
219    #endif

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

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