65 |
|
|
66 |
typedef int bool; |
typedef int bool; |
67 |
|
|
68 |
|
typedef enum |
69 |
|
{ |
70 |
|
I_VOP = 0, |
71 |
|
P_VOP = 1, |
72 |
|
B_VOP = 2, |
73 |
|
S_VOP = 3 |
74 |
|
} |
75 |
|
VOP_TYPE; |
76 |
|
|
77 |
/***************************************************************************** |
/***************************************************************************** |
78 |
* Structures |
* Structures |
79 |
****************************************************************************/ |
****************************************************************************/ |
80 |
|
|
81 |
typedef struct |
typedef struct |
82 |
{ |
{ |
|
/* --- constants --- */ |
|
83 |
uint32_t width; |
uint32_t width; |
84 |
uint32_t height; |
uint32_t height; |
85 |
|
|
92 |
uint32_t fincr; |
uint32_t fincr; |
93 |
uint32_t fbase; |
uint32_t fbase; |
94 |
|
|
95 |
xvid_global_t global_flags; |
/* constants */ |
96 |
|
int global; |
97 |
int bquant_ratio; |
int bquant_ratio; |
98 |
int bquant_offset; |
int bquant_offset; |
99 |
int frame_drop_ratio; |
int frame_drop_ratio; |
100 |
|
|
|
#ifdef _SMP |
|
|
int num_threads; |
|
|
#endif |
|
|
|
|
|
|
|
101 |
int iMaxKeyInterval; |
int iMaxKeyInterval; |
102 |
int max_bframes; |
int max_bframes; |
103 |
|
|
|
/* --- inbetween vop stuff --- */ |
|
104 |
/* rounding type; alternate 0-1 after each interframe */ |
/* rounding type; alternate 0-1 after each interframe */ |
105 |
/* 1 <= fixed_code <= 4 |
/* 1 <= fixed_code <= 4 |
106 |
automatically adjusted using motion vector statistics inside |
automatically adjusted using motion vector statistics inside |
107 |
*/ |
*/ |
108 |
|
|
109 |
/* vars that not "quite" frame independant */ |
/* vars that not "quite" frame independant */ |
110 |
|
uint32_t m_quant_type; |
111 |
uint32_t m_rounding_type; |
uint32_t m_rounding_type; |
112 |
uint32_t m_fcode; |
uint32_t m_fcode; |
113 |
xvid_vol_t vol_flags; |
uint32_t m_quarterpel; |
114 |
|
int m_reduced_resolution; /* reduced_resolution_enable */ |
115 |
|
|
116 |
|
HINTINFO *hint; |
117 |
|
|
118 |
int64_t m_stamp; |
int64_t m_stamp; |
119 |
} |
} |
129 |
int mblks; |
int mblks; |
130 |
int ublks; |
int ublks; |
131 |
int gblks; |
int gblks; |
132 |
|
int iblks; |
133 |
|
int qblks; |
134 |
} |
} |
135 |
Statistics; |
Statistics; |
136 |
|
|
137 |
|
|
|
/* encoding queue */ |
|
|
typedef struct |
|
|
{ |
|
|
xvid_enc_frame_t frame; |
|
|
unsigned char quant_intra_matrix[64]; |
|
|
unsigned char quant_inter_matrix[64]; |
|
|
IMAGE image; |
|
|
} QUEUEINFO; |
|
|
|
|
|
|
|
138 |
typedef struct |
typedef struct |
139 |
{ |
{ |
|
xvid_vol_t vol_flags; |
|
|
xvid_vop_t vop_flags; |
|
|
xvid_motion_t motion_flags; |
|
|
|
|
|
int coding_type; |
|
140 |
uint32_t quant; |
uint32_t quant; |
141 |
|
uint32_t motion_flags; |
142 |
|
uint32_t global_flags; |
143 |
|
|
144 |
|
VOP_TYPE coding_type; |
145 |
uint32_t rounding_type; |
uint32_t rounding_type; |
146 |
|
uint32_t quarterpel; |
147 |
uint32_t fcode; |
uint32_t fcode; |
148 |
uint32_t bcode; |
uint32_t bcode; |
149 |
|
|
158 |
WARPPOINTS warp; // as in bitstream |
WARPPOINTS warp; // as in bitstream |
159 |
GMC_DATA gmc_data; // common data for all MBs |
GMC_DATA gmc_data; // common data for all MBs |
160 |
|
|
|
int length; /* the encoded size of this frame */ |
|
|
|
|
161 |
Statistics sStat; |
Statistics sStat; |
162 |
} |
} |
163 |
FRAMEINFO; |
FRAMEINFO; |
188 |
int queue_head; |
int queue_head; |
189 |
int queue_tail; |
int queue_tail; |
190 |
int queue_size; |
int queue_size; |
191 |
QUEUEINFO *queue; |
IMAGE *queue; |
192 |
|
|
193 |
/* bframe buffer */ |
/* bframe buffer */ |
194 |
int bframenum_head; |
int bframenum_head; |
199 |
IMAGE f_refh; |
IMAGE f_refh; |
200 |
IMAGE f_refv; |
IMAGE f_refv; |
201 |
IMAGE f_refhv; |
IMAGE f_refhv; |
202 |
|
int bframenum_dx50bvop; |
|
/* closed_gop fixup temporary storage */ |
|
|
int closed_bframenum; /* == -1 if there is no fixup intended */ |
|
|
QUEUEINFO closed_qframe; /* qFrame, only valid when >= 0 */ |
|
203 |
|
|
204 |
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 */ |
205 |
|
|
248 |
|
|
249 |
void init_encoder(uint32_t cpu_flags); |
void init_encoder(uint32_t cpu_flags); |
250 |
|
|
251 |
int enc_create(xvid_enc_create_t * create, xvid_enc_rc_t * rc); |
int encoder_create(XVID_ENC_PARAM * pParam); |
252 |
int enc_destroy(Encoder * pEnc); |
int encoder_destroy(Encoder * pEnc); |
253 |
int enc_encode(Encoder * pEnc, |
int encoder_encode(Encoder * pEnc, |
254 |
xvid_enc_frame_t * pFrame, |
XVID_ENC_FRAME * pFrame, |
255 |
xvid_enc_stats_t * stats); |
XVID_ENC_STATS * pResult); |
256 |
|
|
257 |
|
int encoder_encode_bframes(Encoder * pEnc, |
258 |
|
XVID_ENC_FRAME * pFrame, |
259 |
|
XVID_ENC_STATS * pResult); |
260 |
|
|
261 |
#endif |
#endif |