46 |
#include "xvid.h" |
#include "xvid.h" |
47 |
#include "portab.h" |
#include "portab.h" |
48 |
#include "global.h" |
#include "global.h" |
|
#include "utils/ratecontrol.h" |
|
49 |
|
|
50 |
/***************************************************************************** |
/***************************************************************************** |
51 |
* Constants |
* Constants |
52 |
****************************************************************************/ |
****************************************************************************/ |
53 |
|
|
|
/* Quatization type */ |
|
|
#define H263_QUANT 0 |
|
|
#define MPEG4_QUANT 1 |
|
|
|
|
|
/* Indicates no quantizer changes in INTRA_Q/INTER_Q modes */ |
|
|
#define NO_CHANGE 64 |
|
|
|
|
54 |
/***************************************************************************** |
/***************************************************************************** |
55 |
* Types |
* Types |
56 |
****************************************************************************/ |
****************************************************************************/ |
72 |
uint32_t mb_width; |
uint32_t mb_width; |
73 |
uint32_t mb_height; |
uint32_t mb_height; |
74 |
|
|
75 |
|
int plugin_flags; |
76 |
|
|
77 |
/* frame rate increment & base */ |
/* frame rate increment & base */ |
78 |
uint32_t fincr; |
uint32_t fincr; |
79 |
uint32_t fbase; |
uint32_t fbase; |
80 |
|
|
81 |
|
int profile; |
82 |
|
|
83 |
xvid_global_t global_flags; |
xvid_global_t global_flags; |
84 |
int bquant_ratio; |
int bquant_ratio; |
85 |
int bquant_offset; |
int bquant_offset; |
86 |
int frame_drop_ratio; |
int frame_drop_ratio; |
87 |
|
|
88 |
|
int min_quant[3]; |
89 |
|
int max_quant[3]; |
90 |
|
|
91 |
#ifdef _SMP |
#ifdef _SMP |
92 |
int num_threads; |
int num_threads; |
93 |
#endif |
#endif |
137 |
|
|
138 |
typedef struct |
typedef struct |
139 |
{ |
{ |
140 |
|
int frame_num; |
141 |
|
int fincr; |
142 |
xvid_vol_t vol_flags; |
xvid_vol_t vol_flags; |
143 |
xvid_vop_t vop_flags; |
xvid_vop_t vop_flags; |
144 |
xvid_motion_t motion_flags; |
xvid_motion_t motion_flags; |
174 |
int iFrameNum; |
int iFrameNum; |
175 |
int bitrate; |
int bitrate; |
176 |
|
|
177 |
|
// zones |
178 |
|
unsigned int num_zones; |
179 |
|
xvid_enc_zone_t * zones; |
180 |
|
|
181 |
|
// plugins |
182 |
|
unsigned int num_plugins; /* note: we store plugin flags in MBPARAM */ |
183 |
|
xvid_enc_plugin_t * plugins; |
184 |
|
|
185 |
|
// dquant |
186 |
|
|
187 |
|
int * temp_dquants; |
188 |
|
|
189 |
// images |
// images |
190 |
|
|
191 |
FRAMEINFO *current; |
FRAMEINFO *current; |
192 |
FRAMEINFO *reference; |
FRAMEINFO *reference; |
193 |
|
|
194 |
IMAGE sOriginal; |
IMAGE sOriginal; /* original image copy for i/p frames */ |
195 |
|
IMAGE sOriginal2; /* original image copy for b-frames */ |
196 |
IMAGE vInterH; |
IMAGE vInterH; |
197 |
IMAGE vInterV; |
IMAGE vInterV; |
198 |
IMAGE vInterVf; |
IMAGE vInterVf; |
223 |
|
|
224 |
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 */ |
225 |
|
|
|
RateControl rate_control; |
|
|
|
|
226 |
float fMvPrevSigma; |
float fMvPrevSigma; |
227 |
} |
} |
228 |
Encoder; |
Encoder; |
266 |
|
|
267 |
void init_encoder(uint32_t cpu_flags); |
void init_encoder(uint32_t cpu_flags); |
268 |
|
|
269 |
int enc_create(xvid_enc_create_t * create, xvid_enc_rc_t * rc); |
int enc_create(xvid_enc_create_t * create); |
270 |
int enc_destroy(Encoder * pEnc); |
int enc_destroy(Encoder * pEnc); |
271 |
int enc_encode(Encoder * pEnc, |
int enc_encode(Encoder * pEnc, |
272 |
xvid_enc_frame_t * pFrame, |
xvid_enc_frame_t * pFrame, |