[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.4, Wed Apr 10 07:40:44 2002 UTC revision 1.24, Sat Nov 16 23:38:16 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 file is part of XviD, a free MPEG-4 video encoder/decoder
9   *   *
10   **************************************************************************/   *  XviD is free software; you can redistribute it and/or modify it
11     *  under the terms of the GNU General Public License as published by
12     *  the Free Software Foundation; either version 2 of the License, or
13     *  (at your option) any later version.
14     *
15     *  This program is distributed in the hope that it will be useful,
16     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18     *  GNU General Public License for more details.
19     *
20     *  You should have received a copy of the GNU General Public License
21     *  along with this program; if not, write to the Free Software
22     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23     *
24     *  Under section 8 of the GNU General Public License, the copyright
25     *  holders of XVID explicitly forbid distribution in the following
26     *  countries:
27     *
28     *    - Japan
29     *    - United States of America
30     *
31     *  Linking XviD statically or dynamically with other modules is making a
32     *  combined work based on XviD.  Thus, the terms and conditions of the
33     *  GNU General Public License cover the whole combination.
34     *
35     *  As a special exception, the copyright holders of XviD give you
36     *  permission to link XviD with independent modules that communicate with
37     *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the
38     *  license terms of these independent modules, and to copy and distribute
39     *  the resulting combined work under terms of your choice, provided that
40     *  every copy of the combined work is accompanied by a complete copy of
41     *  the source code of XviD (the version of XviD used to produce the
42     *  combined work), being distributed under the terms of the GNU General
43     *  Public License plus this exception.  An independent module is a module
44     *  which is not derived from or based on XviD.
45     *
46     *  Note that people who make modified versions of XviD are not obligated
47     *  to grant this special exception for their modified versions; it is
48     *  their choice whether to do so.  The GNU General Public License gives
49     *  permission to release a modified version without this exception; this
50     *  exception also makes it possible to release a modified version which
51     *  carries forward this exception.
52     *
53     * $Id$
54     *
55     ****************************************************************************/
56    
57  #ifndef _ENCODER_H_  #ifndef _ENCODER_H_
58  #define _ENCODER_H_  #define _ENCODER_H_
59    
   
60  #include "xvid.h"  #include "xvid.h"
   
61  #include "portab.h"  #include "portab.h"
62  #include "global.h"  #include "global.h"
63  #include "image/image.h"  #include "image/image.h"
64    #include "utils/ratecontrol.h"
65    
66    /*****************************************************************************
67     * Constants
68     ****************************************************************************/
69    
70    /* Quatization type */
71  #define H263_QUANT      0  #define H263_QUANT      0
72  #define MPEG4_QUANT     1  #define MPEG4_QUANT     1
73    
74    /* Indicates no quantizer changes in INTRA_Q/INTER_Q modes */
75    #define NO_CHANGE 64
76    
77  typedef uint32_t bool;  /*****************************************************************************
78     * Types
79     ****************************************************************************/
80    
81    typedef int bool;
82    
83  typedef enum  typedef enum
84  {  {
85      I_VOP = 0,      I_VOP = 0,
86      P_VOP = 1          P_VOP = 1,
87            B_VOP = 2
88  }  }
89  VOP_TYPE;  VOP_TYPE;
90    
91  /***********************************  /*****************************************************************************
92     * Structures
93         Encoding Parameters   ****************************************************************************/
   
 ************************************/  
94    
95  typedef struct  typedef struct
96  {  {
# Line 51  Line 102 
102          uint32_t mb_width;          uint32_t mb_width;
103          uint32_t mb_height;          uint32_t mb_height;
104    
105      VOP_TYPE coding_type;          /* frame rate increment & base */
106            uint32_t fincr;
107      /* rounding type; alternate 0-1 after each interframe */          uint32_t fbase;
108    
109      uint32_t rounding_type;  #ifdef _SMP
110            int num_threads;
111    #endif
112    
113            /* rounding type; alternate 0-1 after each interframe */
114          /* 1 <= fixed_code <= 4          /* 1 <= fixed_code <= 4
115             automatically adjusted using motion vector statistics inside             automatically adjusted using motion vector statistics inside
116           */           */
117    
118      uint32_t fixed_code;          /* vars that not "quite" frame independant */
119            uint32_t m_quant_type;
120            uint32_t m_rounding_type;
121            uint32_t m_fcode;
122    
123            HINTINFO *hint;
124    
125            uint32_t m_seconds;
126            uint32_t m_ticks;
127    
128    }
129    MBParam;
130    
131    
132    typedef struct
133    {
134      uint32_t quant;      uint32_t quant;
         uint32_t quant_type;  
135          uint32_t motion_flags;          uint32_t motion_flags;
136          uint32_t global_flags;          uint32_t global_flags;
137    
138          HINTINFO * hint;          VOP_TYPE coding_type;
139  } MBParam;          uint32_t rounding_type;
140            uint32_t fcode;
141            uint32_t bcode;
142    
143            uint32_t seconds;
144            uint32_t ticks;
145    
146            IMAGE image;
147    
148            MACROBLOCK *mbs;
149    
150    }
151    FRAMEINFO;
152    
153  typedef struct  typedef struct
154  {  {
# Line 90  Line 170 
170    
171      int iFrameNum;      int iFrameNum;
172      int iMaxKeyInterval;      int iMaxKeyInterval;
         int lum_masking;  
173          int bitrate;          int bitrate;
174    
175          // images          // images
176    
177      IMAGE sCurrent;          FRAMEINFO *current;
178      IMAGE sReference;          FRAMEINFO *reference;
179  #ifdef _DEBUG  
180    #ifdef _DEBUG_PSNR
181          IMAGE sOriginal;          IMAGE sOriginal;
182  #endif  #endif
183      IMAGE vInterH;      IMAGE vInterH;
184      IMAGE vInterV;      IMAGE vInterV;
         IMAGE vInterVf;  
185      IMAGE vInterHV;      IMAGE vInterHV;
         IMAGE vInterHVf;  
   
         // macroblock  
   
         MACROBLOCK * pMBs;  
186    
187      Statistics sStat;      Statistics sStat;
188            RateControl rate_control;
189  }  }
190  Encoder;  Encoder;
191    
192    /*****************************************************************************
193     * Inline functions
194     ****************************************************************************/
195    
196  // indicates no quantizer changes in INTRA_Q/INTER_Q modes  static __inline uint8_t
197  #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)  
198  {  {
199      if (sr <= 16)      if (sr <= 16)
200                  return 1;                  return 1;
# Line 151  Line 221 
221                  return 0;                  return 0;
222  }  }
223    
224  #endif /* _ENCODER_H_ */  
225    /*****************************************************************************
226     * Prototypes
227     ****************************************************************************/
228    
229    void init_encoder(uint32_t cpu_flags);
230    
231    int encoder_create(XVID_ENC_PARAM * pParam);
232    int encoder_destroy(Encoder * pEnc);
233    int encoder_encode(Encoder * pEnc,
234                                       XVID_ENC_FRAME * pFrame,
235                                       XVID_ENC_STATS * pResult);
236    
237    int encoder_encode_bframes(Encoder * pEnc,
238                                       XVID_ENC_FRAME * pFrame,
239                                       XVID_ENC_STATS * pResult);
240    
241    #endif

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.24

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