36 |
* support for EXTENDED API |
* support for EXTENDED API |
37 |
* - 22.08.2001 fixed bug in iDQtab |
* - 22.08.2001 fixed bug in iDQtab |
38 |
* |
* |
39 |
* $Id: encoder.h,v 1.27 2003-02-15 15:22:17 edgomez Exp $ |
* $Id: encoder.h,v 1.27.2.6 2003-03-26 11:01:03 suxen_drol Exp $ |
40 |
* |
* |
41 |
****************************************************************************/ |
****************************************************************************/ |
42 |
|
|
52 |
* Constants |
* Constants |
53 |
****************************************************************************/ |
****************************************************************************/ |
54 |
|
|
|
/* Quatization type */ |
|
|
#define H263_QUANT 0 |
|
|
#define MPEG4_QUANT 1 |
|
|
|
|
|
/* Indicates no quantizer changes in INTRA_Q/INTER_Q modes */ |
|
|
#define NO_CHANGE 64 |
|
|
|
|
55 |
/***************************************************************************** |
/***************************************************************************** |
56 |
* Types |
* Types |
57 |
****************************************************************************/ |
****************************************************************************/ |
58 |
|
|
59 |
typedef int bool; |
typedef int bool; |
60 |
|
|
|
typedef enum |
|
|
{ |
|
|
I_VOP = 0, |
|
|
P_VOP = 1, |
|
|
B_VOP = 2, |
|
|
S_VOP = 3 |
|
|
} |
|
|
VOP_TYPE; |
|
|
|
|
61 |
/***************************************************************************** |
/***************************************************************************** |
62 |
* Structures |
* Structures |
63 |
****************************************************************************/ |
****************************************************************************/ |
64 |
|
|
65 |
typedef struct |
typedef struct |
66 |
{ |
{ |
67 |
|
/* --- constants --- */ |
68 |
uint32_t width; |
uint32_t width; |
69 |
uint32_t height; |
uint32_t height; |
70 |
|
|
73 |
uint32_t mb_width; |
uint32_t mb_width; |
74 |
uint32_t mb_height; |
uint32_t mb_height; |
75 |
|
|
76 |
|
int plugin_flags; |
77 |
|
|
78 |
/* frame rate increment & base */ |
/* frame rate increment & base */ |
79 |
uint32_t fincr; |
uint32_t fincr; |
80 |
uint32_t fbase; |
uint32_t fbase; |
81 |
|
|
82 |
/* constants */ |
xvid_global_t global_flags; |
|
int global; |
|
83 |
int bquant_ratio; |
int bquant_ratio; |
84 |
int bquant_offset; |
int bquant_offset; |
85 |
int frame_drop_ratio; |
int frame_drop_ratio; |
86 |
|
|
87 |
|
#ifdef _SMP |
88 |
|
int num_threads; |
89 |
|
#endif |
90 |
|
|
91 |
|
|
92 |
int iMaxKeyInterval; |
int iMaxKeyInterval; |
93 |
int max_bframes; |
int max_bframes; |
94 |
|
|
95 |
|
/* --- inbetween vop stuff --- */ |
96 |
/* rounding type; alternate 0-1 after each interframe */ |
/* rounding type; alternate 0-1 after each interframe */ |
97 |
/* 1 <= fixed_code <= 4 |
/* 1 <= fixed_code <= 4 |
98 |
automatically adjusted using motion vector statistics inside |
automatically adjusted using motion vector statistics inside |
99 |
*/ |
*/ |
100 |
|
|
101 |
/* vars that not "quite" frame independant */ |
/* vars that not "quite" frame independant */ |
|
uint32_t m_quant_type; |
|
102 |
uint32_t m_rounding_type; |
uint32_t m_rounding_type; |
103 |
uint32_t m_fcode; |
uint32_t m_fcode; |
104 |
uint32_t m_quarterpel; |
xvid_vol_t vol_flags; |
|
int m_reduced_resolution; /* reduced_resolution_enable */ |
|
|
|
|
|
HINTINFO *hint; |
|
105 |
|
|
106 |
int64_t m_stamp; |
int64_t m_stamp; |
107 |
} |
} |
121 |
Statistics; |
Statistics; |
122 |
|
|
123 |
|
|
124 |
|
/* encoding queue */ |
125 |
typedef struct |
typedef struct |
126 |
{ |
{ |
127 |
uint32_t quant; |
xvid_enc_frame_t frame; |
128 |
uint32_t motion_flags; |
unsigned char quant_intra_matrix[64]; |
129 |
uint32_t global_flags; |
unsigned char quant_inter_matrix[64]; |
130 |
|
IMAGE image; |
131 |
|
} QUEUEINFO; |
132 |
|
|
133 |
|
|
134 |
|
typedef struct |
135 |
|
{ |
136 |
|
int frame_num; |
137 |
|
int fincr; |
138 |
|
xvid_vol_t vol_flags; |
139 |
|
xvid_vop_t vop_flags; |
140 |
|
xvid_motion_t motion_flags; |
141 |
|
|
142 |
VOP_TYPE coding_type; |
int coding_type; |
143 |
|
uint32_t quant; |
144 |
uint32_t rounding_type; |
uint32_t rounding_type; |
|
uint32_t quarterpel; |
|
145 |
uint32_t fcode; |
uint32_t fcode; |
146 |
uint32_t bcode; |
uint32_t bcode; |
147 |
|
|
156 |
WARPPOINTS warp; // as in bitstream |
WARPPOINTS warp; // as in bitstream |
157 |
GMC_DATA gmc_data; // common data for all MBs |
GMC_DATA gmc_data; // common data for all MBs |
158 |
|
|
159 |
|
int length; /* the encoded size of this frame */ |
160 |
|
|
161 |
Statistics sStat; |
Statistics sStat; |
162 |
} |
} |
163 |
FRAMEINFO; |
FRAMEINFO; |
170 |
int iFrameNum; |
int iFrameNum; |
171 |
int bitrate; |
int bitrate; |
172 |
|
|
173 |
|
// plugins |
174 |
|
unsigned int num_plugins; /* note: we store plugin flags in MBPARAM */ |
175 |
|
xvid_enc_plugin_t * plugins; |
176 |
|
|
177 |
|
// dquant |
178 |
|
|
179 |
|
int * temp_dquants; |
180 |
|
|
181 |
// images |
// images |
182 |
|
|
183 |
FRAMEINFO *current; |
FRAMEINFO *current; |
184 |
FRAMEINFO *reference; |
FRAMEINFO *reference; |
185 |
|
|
186 |
IMAGE sOriginal; |
IMAGE sOriginal; /* original image copy for i/p frames */ |
187 |
|
IMAGE sOriginal2; /* original image copy for b-frames */ |
188 |
IMAGE vInterH; |
IMAGE vInterH; |
189 |
IMAGE vInterV; |
IMAGE vInterV; |
190 |
IMAGE vInterVf; |
IMAGE vInterVf; |
197 |
int queue_head; |
int queue_head; |
198 |
int queue_tail; |
int queue_tail; |
199 |
int queue_size; |
int queue_size; |
200 |
IMAGE *queue; |
QUEUEINFO *queue; |
201 |
|
|
202 |
/* bframe buffer */ |
/* bframe buffer */ |
203 |
int bframenum_head; |
int bframenum_head; |
208 |
IMAGE f_refh; |
IMAGE f_refh; |
209 |
IMAGE f_refv; |
IMAGE f_refv; |
210 |
IMAGE f_refhv; |
IMAGE f_refhv; |
211 |
int bframenum_dx50bvop; |
|
212 |
|
/* closed_gop fixup temporary storage */ |
213 |
|
int closed_bframenum; /* == -1 if there is no fixup intended */ |
214 |
|
QUEUEINFO closed_qframe; /* qFrame, only valid when >= 0 */ |
215 |
|
|
216 |
int m_framenum; /* debug frame num counter; unlike iFrameNum, does not reset at ivop */ |
int m_framenum; /* debug frame num counter; unlike iFrameNum, does not reset at ivop */ |
217 |
|
|
260 |
|
|
261 |
void init_encoder(uint32_t cpu_flags); |
void init_encoder(uint32_t cpu_flags); |
262 |
|
|
263 |
int encoder_create(XVID_ENC_PARAM * pParam); |
int enc_create(xvid_enc_create_t * create); |
264 |
int encoder_destroy(Encoder * pEnc); |
int enc_destroy(Encoder * pEnc); |
265 |
int encoder_encode(Encoder * pEnc, |
int enc_encode(Encoder * pEnc, |
266 |
XVID_ENC_FRAME * pFrame, |
xvid_enc_frame_t * pFrame, |
267 |
XVID_ENC_STATS * pResult); |
xvid_enc_stats_t * stats); |
|
|
|
|
int encoder_encode_bframes(Encoder * pEnc, |
|
|
XVID_ENC_FRAME * pFrame, |
|
|
XVID_ENC_STATS * pResult); |
|
268 |
|
|
269 |
#endif |
#endif |