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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 164 - (view) (download)

1 : Isibaar 3 /**************************************************************************
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 136 P_VOP = 1,
35 :     B_VOP = 2
36 : Isibaar 3 }
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 152 /* frame rate increment & base */
56 :     uint32_t fincr;
57 :     uint32_t fbase;
58 :    
59 : suxen_drol 164 #ifdef BFRAMES
60 :     int max_bframes;
61 :     #endif
62 :    
63 : Isibaar 3 /* rounding type; alternate 0-1 after each interframe */
64 :     /* 1 <= fixed_code <= 4
65 :     automatically adjusted using motion vector statistics inside
66 :     */
67 :    
68 : suxen_drol 136 /* vars that not "quite" frame independant */
69 :     uint32_t m_quant_type;
70 :     uint32_t m_rounding_type;
71 :     uint32_t m_fcode;
72 :    
73 :     HINTINFO * hint;
74 :    
75 : suxen_drol 152 #ifdef BFRAMES
76 :     uint32_t m_seconds;
77 :     uint32_t m_ticks;
78 :     #endif
79 :    
80 : suxen_drol 136 } MBParam;
81 :    
82 :    
83 :     typedef struct
84 :     {
85 : Isibaar 3 uint32_t quant;
86 :     uint32_t motion_flags;
87 :     uint32_t global_flags;
88 : h 101
89 : suxen_drol 136 VOP_TYPE coding_type;
90 :     uint32_t rounding_type;
91 :     uint32_t fcode;
92 :     uint32_t bcode;
93 : Isibaar 3
94 : suxen_drol 152 #ifdef BFRAMES
95 :     uint32_t seconds;
96 :     uint32_t ticks;
97 :     #endif
98 : suxen_drol 136
99 :     IMAGE image;
100 :    
101 :     MACROBLOCK * mbs;
102 :    
103 :     } FRAMEINFO;
104 :    
105 : Isibaar 3 typedef struct
106 :     {
107 :     int iTextBits;
108 :     float fMvPrevSigma;
109 :     int iMvSum;
110 :     int iMvCount;
111 :     int kblks;
112 :     int mblks;
113 :     int ublks;
114 :     }
115 :     Statistics;
116 :    
117 :    
118 :    
119 :     typedef struct
120 :     {
121 :     MBParam mbParam;
122 :    
123 :     int iFrameNum;
124 :     int iMaxKeyInterval;
125 :     int bitrate;
126 :    
127 :     // images
128 :    
129 : suxen_drol 136 FRAMEINFO * current;
130 :     FRAMEINFO * reference;
131 :    
132 : Isibaar 113 #ifdef _DEBUG
133 :     IMAGE sOriginal;
134 :     #endif
135 : Isibaar 3 IMAGE vInterH;
136 :     IMAGE vInterV;
137 : h 83 IMAGE vInterVf;
138 : Isibaar 3 IMAGE vInterHV;
139 : h 83 IMAGE vInterHVf;
140 : Isibaar 3
141 : suxen_drol 152 #ifdef BFRAMES
142 :     /* constants */
143 :     int bquant_ratio;
144 :     /* vars */
145 :     int bframenum_head;
146 :     int bframenum_tail;
147 :     int flush_bframes;
148 :    
149 :     FRAMEINFO ** bframes;
150 :     IMAGE f_refh;
151 :     IMAGE f_refv;
152 :     IMAGE f_refhv;
153 :     #endif
154 : Isibaar 3 Statistics sStat;
155 :     }
156 :     Encoder;
157 :    
158 :    
159 :     // indicates no quantizer changes in INTRA_Q/INTER_Q modes
160 :     #define NO_CHANGE 64
161 :    
162 :     void init_encoder(uint32_t cpu_flags);
163 :    
164 :     int encoder_create(XVID_ENC_PARAM * pParam);
165 :     int encoder_destroy(Encoder * pEnc);
166 :     int encoder_encode(Encoder * pEnc, XVID_ENC_FRAME * pFrame, XVID_ENC_STATS * pResult);
167 :    
168 :     static __inline uint8_t get_fcode(uint16_t sr)
169 :     {
170 :     if (sr <= 16)
171 :     return 1;
172 :    
173 :     else if (sr <= 32)
174 :     return 2;
175 :    
176 :     else if (sr <= 64)
177 :     return 3;
178 :    
179 :     else if (sr <= 128)
180 :     return 4;
181 :    
182 :     else if (sr <= 256)
183 :     return 5;
184 :    
185 :     else if (sr <= 512)
186 :     return 6;
187 :    
188 :     else if (sr <= 1024)
189 :     return 7;
190 :    
191 :     else
192 :     return 0;
193 :     }
194 :    
195 :     #endif /* _ENCODER_H_ */

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