[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 188, Fri Jun 7 10:21:48 2002 UTC revision 603, Sat Oct 19 11:41:12 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 <isibaar@xvid.org>
  *             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     * $Id: encoder.h,v 1.23 2002-10-19 11:41:11 edgomez Exp $
32     *
33     ****************************************************************************/
34    
35  #ifndef _ENCODER_H_  #ifndef _ENCODER_H_
36  #define _ENCODER_H_  #define _ENCODER_H_
37    
   
38  #include "xvid.h"  #include "xvid.h"
   
39  #include "portab.h"  #include "portab.h"
40  #include "global.h"  #include "global.h"
41  #include "image/image.h"  #include "image/image.h"
42  #include "utils/ratecontrol.h"  #include "utils/ratecontrol.h"
43    
44    /*****************************************************************************
45     * Constants
46     ****************************************************************************/
47    
48    /* Quatization type */
49  #define H263_QUANT      0  #define H263_QUANT      0
50  #define MPEG4_QUANT     1  #define MPEG4_QUANT     1
51    
52    /* Indicates no quantizer changes in INTRA_Q/INTER_Q modes */
53    #define NO_CHANGE 64
54    
55  typedef uint32_t bool;  /*****************************************************************************
56     * Types
57     ****************************************************************************/
58    
59    typedef int bool;
60    
61  typedef enum  typedef enum
62  {  {
# Line 36  Line 66 
66  }  }
67  VOP_TYPE;  VOP_TYPE;
68    
69  /***********************************  /*****************************************************************************
70     * Structures
71         Encoding Parameters   ****************************************************************************/
   
 ************************************/  
72    
73  typedef struct  typedef struct
74  {  {
# Line 56  Line 84 
84          uint32_t fincr;          uint32_t fincr;
85          uint32_t fbase;          uint32_t fbase;
86    
87  #ifdef BFRAMES  #ifdef _SMP
88          int max_bframes;          int num_threads;
89  #endif  #endif
90    
91          /* rounding type; alternate 0-1 after each interframe */          /* rounding type; alternate 0-1 after each interframe */
# Line 72  Line 100 
100    
101          HINTINFO * hint;          HINTINFO * hint;
102    
 #ifdef BFRAMES  
103          uint32_t m_seconds;          uint32_t m_seconds;
104          uint32_t m_ticks;          uint32_t m_ticks;
 #endif  
105    
106  } MBParam;  }
107    MBParam;
108    
109    
110  typedef struct  typedef struct
# Line 91  Line 118 
118          uint32_t fcode;          uint32_t fcode;
119          uint32_t bcode;          uint32_t bcode;
120    
 #ifdef BFRAMES  
121          uint32_t seconds;          uint32_t seconds;
122          uint32_t ticks;          uint32_t ticks;
 #endif  
123    
124          IMAGE image;          IMAGE image;
125    
126          MACROBLOCK * mbs;          MACROBLOCK * mbs;
127    
128  } FRAMEINFO;  }
129    FRAMEINFO;
130    
131  typedef struct  typedef struct
132  {  {
# Line 129  Line 155 
155          FRAMEINFO * current;          FRAMEINFO * current;
156          FRAMEINFO * reference;          FRAMEINFO * reference;
157    
158  #ifdef _DEBUG  #ifdef _DEBUG_PSNR
159          IMAGE sOriginal;          IMAGE sOriginal;
160  #endif  #endif
161          IMAGE vInterH;          IMAGE vInterH;
162          IMAGE vInterV;          IMAGE vInterV;
         IMAGE vInterVf;  
163          IMAGE vInterHV;          IMAGE vInterHV;
         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;          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 193  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.188  
changed lines
  Added in v.603

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