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

Annotation of /xvidcore/src/encoder.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (view) (download)

1 : Isibaar 1.1 /**************************************************************************
2 :     *
3 :     * Modifications:
4 :     *
5 :     * 22.08.2001 added support for EXT_MODE encoding mode
6 :     * support for EXTENDED API
7 :     * 22.08.2001 fixed bug in iDQtab
8 :     *
9 :     * Michael Militzer <isibaar@videocoding.de>
10 :     *
11 :     **************************************************************************/
12 :    
13 :     #ifndef _ENCODER_H_
14 :     #define _ENCODER_H_
15 :    
16 :    
17 :     #include "xvid.h"
18 :    
19 :     #include "portab.h"
20 :     #include "global.h"
21 :     #include "image/image.h"
22 :    
23 :    
24 :     #define H263_QUANT 0
25 :     #define MPEG4_QUANT 1
26 :    
27 :    
28 :     typedef uint32_t bool;
29 :    
30 :    
31 :     typedef enum
32 :     {
33 :     I_VOP = 0,
34 : suxen_drol 1.5 P_VOP = 1,
35 :     B_VOP = 2
36 : Isibaar 1.1 }
37 :     VOP_TYPE;
38 :    
39 :     /***********************************
40 :    
41 :     Encoding Parameters
42 :    
43 :     ************************************/
44 :    
45 :     typedef struct
46 :     {
47 :     uint32_t width;
48 :     uint32_t height;
49 :    
50 :     uint32_t edged_width;
51 :     uint32_t edged_height;
52 :     uint32_t mb_width;
53 :     uint32_t mb_height;
54 :    
55 : suxen_drol 1.6 /* frame rate increment & base */
56 :     uint32_t fincr;
57 :     uint32_t fbase;
58 :    
59 : Isibaar 1.1 /* rounding type; alternate 0-1 after each interframe */
60 :     /* 1 <= fixed_code <= 4
61 :     automatically adjusted using motion vector statistics inside
62 :     */
63 :    
64 : suxen_drol 1.5 /* vars that not "quite" frame independant */
65 :     uint32_t m_quant_type;
66 :     uint32_t m_rounding_type;
67 :     uint32_t m_fcode;
68 :    
69 :     HINTINFO * hint;
70 :    
71 : suxen_drol 1.6 #ifdef BFRAMES
72 :     uint32_t m_seconds;
73 :     uint32_t m_ticks;
74 :     #endif
75 :    
76 : suxen_drol 1.5 } MBParam;
77 :    
78 :    
79 :     typedef struct
80 :     {
81 : Isibaar 1.1 uint32_t quant;
82 :     uint32_t motion_flags;
83 :     uint32_t global_flags;
84 : h 1.3
85 : suxen_drol 1.5 VOP_TYPE coding_type;
86 :     uint32_t rounding_type;
87 :     uint32_t fcode;
88 :     uint32_t bcode;
89 :    
90 : suxen_drol 1.6 #ifdef BFRAMES
91 :     uint32_t seconds;
92 :     uint32_t ticks;
93 :     #endif
94 : suxen_drol 1.5
95 :     IMAGE image;
96 :    
97 :     MACROBLOCK * mbs;
98 :    
99 :     } FRAMEINFO;
100 : Isibaar 1.1
101 :     typedef struct
102 :     {
103 :     int iTextBits;
104 :     float fMvPrevSigma;
105 :     int iMvSum;
106 :     int iMvCount;
107 :     int kblks;
108 :     int mblks;
109 :     int ublks;
110 :     }
111 :     Statistics;
112 :    
113 :    
114 :    
115 :     typedef struct
116 :     {
117 :     MBParam mbParam;
118 :    
119 :     int iFrameNum;
120 :     int iMaxKeyInterval;
121 :     int bitrate;
122 :    
123 :     // images
124 :    
125 : suxen_drol 1.5 FRAMEINFO * current;
126 :     FRAMEINFO * reference;
127 :    
128 : Isibaar 1.4 #ifdef _DEBUG
129 :     IMAGE sOriginal;
130 :     #endif
131 : Isibaar 1.1 IMAGE vInterH;
132 :     IMAGE vInterV;
133 : h 1.2 IMAGE vInterVf;
134 : Isibaar 1.1 IMAGE vInterHV;
135 : h 1.2 IMAGE vInterHVf;
136 : Isibaar 1.1
137 : suxen_drol 1.6 #ifdef BFRAMES
138 :     /* constants */
139 :     int max_bframes;
140 :     int bquant_ratio;
141 :     /* vars */
142 :     int bframenum_head;
143 :     int bframenum_tail;
144 :     int flush_bframes;
145 :    
146 :     FRAMEINFO ** bframes;
147 :     IMAGE f_refh;
148 :     IMAGE f_refv;
149 :     IMAGE f_refhv;
150 :     #endif
151 : Isibaar 1.1 Statistics sStat;
152 :     }
153 :     Encoder;
154 :    
155 :    
156 :     // indicates no quantizer changes in INTRA_Q/INTER_Q modes
157 :     #define NO_CHANGE 64
158 :    
159 :     void init_encoder(uint32_t cpu_flags);
160 :    
161 :     int encoder_create(XVID_ENC_PARAM * pParam);
162 :     int encoder_destroy(Encoder * pEnc);
163 :     int encoder_encode(Encoder * pEnc, XVID_ENC_FRAME * pFrame, XVID_ENC_STATS * pResult);
164 :    
165 :     static __inline uint8_t get_fcode(uint16_t sr)
166 :     {
167 :     if (sr <= 16)
168 :     return 1;
169 :    
170 :     else if (sr <= 32)
171 :     return 2;
172 :    
173 :     else if (sr <= 64)
174 :     return 3;
175 :    
176 :     else if (sr <= 128)
177 :     return 4;
178 :    
179 :     else if (sr <= 256)
180 :     return 5;
181 :    
182 :     else if (sr <= 512)
183 :     return 6;
184 :    
185 :     else if (sr <= 1024)
186 :     return 7;
187 :    
188 :     else
189 :     return 0;
190 :     }
191 :    
192 :     #endif /* _ENCODER_H_ */

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