1 |
|
/***************************************************************************** |
2 |
|
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - VFW configuration header - |
5 |
|
* |
6 |
|
* Copyright(C) 2002-2003 Anonymous <xvid-devel@xvid.org> |
7 |
|
* |
8 |
|
* This program is free software ; you can redistribute it and/or modify |
9 |
|
* it under the terms of the GNU General Public License as published by |
10 |
|
* the Free Software Foundation ; either version 2 of the License, or |
11 |
|
* (at your option) any later version. |
12 |
|
* |
13 |
|
* This program is distributed in the hope that it will be useful, |
14 |
|
* but WITHOUT ANY WARRANTY ; without even the implied warranty of |
15 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
* GNU General Public License for more details. |
17 |
|
* |
18 |
|
* You should have received a copy of the GNU General Public License |
19 |
|
* along with this program ; if not, write to the Free Software |
20 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
|
* |
22 |
|
* $Id$ |
23 |
|
* |
24 |
|
****************************************************************************/ |
25 |
|
#ifndef _CONFIG_H_ |
26 |
|
#define _CONFIG_H_ |
27 |
|
|
28 |
|
#include <windows.h> |
29 |
|
#include "vfwext.h" |
30 |
|
#include <xvid.h> |
31 |
|
|
32 |
|
extern HINSTANCE g_hInst; |
33 |
|
|
34 |
|
|
35 |
|
/* small hack */ |
36 |
|
#ifndef IDC_HAND |
37 |
|
#define IDC_HAND MAKEINTRESOURCE(32649) |
38 |
|
#endif |
39 |
|
|
40 |
|
/* one kilobit */ |
41 |
|
#define CONFIG_KBPS 1000 |
42 |
|
|
43 |
|
/* min/max bitrate when not specified by profile */ |
44 |
|
#define DEFAULT_MIN_KBPS 16 |
45 |
|
#define DEFAULT_MAX_KBPS 10000 |
46 |
|
#define DEFAULT_QUANT 400 |
47 |
|
|
48 |
|
/* registry stuff */ |
49 |
|
#define XVID_REG_KEY HKEY_CURRENT_USER |
50 |
|
#define XVID_REG_PARENT "Software\\GNU" |
51 |
|
#define XVID_REG_CHILD "XviD" |
52 |
|
#define XVID_REG_CLASS "config" |
53 |
|
|
54 |
|
#define XVID_BUILD __TIME__ ", " __DATE__ |
55 |
|
#define XVID_WEBSITE "http://www.xvid.org/" |
56 |
|
#define XVID_SPECIAL_BUILD "(Vanilla CVS Build)" |
57 |
|
|
58 |
|
/* constants */ |
59 |
|
#define CONFIG_2PASS_FILE "\\video.pass" |
60 |
|
|
61 |
|
/* codec modes */ |
62 |
|
#define RC_MODE_1PASS 0 |
63 |
|
#define RC_MODE_2PASS1 1 |
64 |
|
#define RC_MODE_2PASS2 2 |
65 |
|
#define RC_MODE_NULL 3 |
66 |
|
|
67 |
|
#define RC_ZONE_WEIGHT 0 |
68 |
|
#define RC_ZONE_QUANT 1 |
69 |
|
|
70 |
|
/* vhq modes */ |
71 |
|
#define VHQ_OFF 0 |
72 |
|
#define VHQ_MODE_DECISION 1 |
73 |
|
#define VHQ_LIMITED_SEARCH 2 |
74 |
|
#define VHQ_MEDIUM_SEARCH 3 |
75 |
|
#define VHQ_WIDE_SEARCH 4 |
76 |
|
|
77 |
|
/* quantizer modes */ |
78 |
|
#define QUANT_MODE_H263 0 |
79 |
|
#define QUANT_MODE_MPEG 1 |
80 |
|
#define QUANT_MODE_CUSTOM 2 |
81 |
|
|
82 |
|
|
83 |
|
#define MAX_ZONES 64 |
84 |
|
typedef struct |
85 |
|
{ |
86 |
|
int frame; |
87 |
|
|
88 |
|
int type; |
89 |
|
int mode; |
90 |
|
int weight; |
91 |
|
int quant; |
92 |
|
|
93 |
|
unsigned int greyscale; |
94 |
|
unsigned int chroma_opt; |
95 |
|
unsigned int bvop_threshold; |
96 |
|
} zone_t; |
97 |
|
|
98 |
|
|
99 |
|
typedef struct |
100 |
|
{ |
101 |
|
/********** ATTENTION **********/ |
102 |
|
int mode; /* Vidomi directly accesses these vars */ |
103 |
|
int bitrate; |
104 |
|
int desired_size; /* please try to avoid modifications here */ |
105 |
|
char stats[MAX_PATH]; |
106 |
|
/*******************************/ |
107 |
|
int use_2pass_bitrate; /* use bitrate for 2pass2 (instead of desired size) */ |
108 |
|
int desired_quant; /* for one-pass constant quant */ |
109 |
|
|
110 |
|
/* profile */ |
111 |
|
char profile_name[MAX_PATH]; |
112 |
|
int profile; /* used internally; *not* written to registry */ |
113 |
|
|
114 |
|
int quant_type; |
115 |
|
BYTE qmatrix_intra[64]; |
116 |
|
BYTE qmatrix_inter[64]; |
117 |
|
int lum_masking; |
118 |
|
int interlacing; |
119 |
|
int qpel; |
120 |
|
int gmc; |
121 |
|
int reduced_resolution; |
122 |
|
int use_bvop; |
123 |
|
int max_bframes; |
124 |
|
int bquant_ratio; |
125 |
|
int bquant_offset; |
126 |
|
int packed; |
127 |
|
int closed_gov; |
128 |
|
int display_aspect_ratio; /* aspect ratio */ |
129 |
|
int ar_x, ar_y; /* picture aspect ratio */ |
130 |
|
int par_x, par_y; /* custom pixel aspect ratio */ |
131 |
|
int ar_mode; /* picture/pixel AR */ |
132 |
|
|
133 |
|
/* zones */ |
134 |
|
int num_zones; |
135 |
|
zone_t zones[MAX_ZONES]; |
136 |
|
int cur_zone; /* used internally; *not* written to registry */ |
137 |
|
|
138 |
|
/* single pass */ |
139 |
|
int rc_reaction_delay_factor; |
140 |
|
int rc_averaging_period; |
141 |
|
int rc_buffer; |
142 |
|
|
143 |
|
/* 2pass1 */ |
144 |
|
int discard1pass; |
145 |
|
|
146 |
|
/* 2pass2 */ |
147 |
|
int keyframe_boost; |
148 |
|
int kfthreshold; |
149 |
|
int kfreduction; |
150 |
|
int curve_compression_high; |
151 |
|
int curve_compression_low; |
152 |
|
int overflow_control_strength; |
153 |
|
int twopass_max_overflow_improvement; |
154 |
|
int twopass_max_overflow_degradation; |
155 |
|
|
156 |
|
/* bitrate calculator */ |
157 |
|
int target_size; |
158 |
|
int subtitle_size; |
159 |
|
int container_type; |
160 |
|
int hours; |
161 |
|
int minutes; |
162 |
|
int seconds; |
163 |
|
int fps; |
164 |
|
int audio_mode; |
165 |
|
int audio_type; |
166 |
|
int audio_rate; |
167 |
|
int audio_size; |
168 |
|
|
169 |
|
/* motion */ |
170 |
|
int motion_search; |
171 |
|
int vhq_mode; |
172 |
|
int chromame; |
173 |
|
int cartoon_mode; |
174 |
|
int turbo; |
175 |
|
int max_key_interval; |
176 |
|
int frame_drop_ratio; |
177 |
|
|
178 |
|
/* quant */ |
179 |
|
int min_iquant; |
180 |
|
int max_iquant; |
181 |
|
int min_pquant; |
182 |
|
int max_pquant; |
183 |
|
int min_bquant; |
184 |
|
int max_bquant; |
185 |
|
int trellis_quant; |
186 |
|
|
187 |
|
/* debug */ |
188 |
|
int num_threads; |
189 |
|
int fourcc_used; |
190 |
|
int vop_debug; |
191 |
|
int debug; |
192 |
|
int display_status; |
193 |
|
int full1pass; |
194 |
|
|
195 |
|
DWORD cpu; |
196 |
|
|
197 |
|
/* internal */ |
198 |
|
int ci_valid; |
199 |
|
VFWEXT_CONFIGURE_INFO_T ci; |
200 |
|
|
201 |
|
BOOL save; |
202 |
|
} CONFIG; |
203 |
|
|
204 |
|
typedef struct PROPSHEETINFO |
205 |
|
{ |
206 |
|
int idd; |
207 |
|
CONFIG * config; |
208 |
|
} PROPSHEETINFO; |
209 |
|
|
210 |
|
typedef struct REG_INT |
211 |
|
{ |
212 |
|
char* reg_value; |
213 |
|
int* config_int; |
214 |
|
int def; |
215 |
|
} REG_INT; |
216 |
|
|
217 |
|
typedef struct REG_STR |
218 |
|
{ |
219 |
|
char* reg_value; |
220 |
|
char* config_str; |
221 |
|
char* def; |
222 |
|
} REG_STR; |
223 |
|
|
224 |
|
|
225 |
|
#define PROFILE_ADAPTQUANT 0x00000001 |
226 |
|
#define PROFILE_BVOP 0x00000002 |
227 |
|
#define PROFILE_MPEGQUANT 0x00000004 |
228 |
|
#define PROFILE_INTERLACE 0x00000008 |
229 |
|
#define PROFILE_QPEL 0x00000010 |
230 |
|
#define PROFILE_GMC 0x00000020 |
231 |
|
#define PROFILE_REDUCED 0x00000040 /* dynamic resolution conversion */ |
232 |
|
|
233 |
|
#define PROFILE_AS (PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_MPEGQUANT|PROFILE_INTERLACE|PROFILE_QPEL|PROFILE_GMC) |
234 |
|
#define PROFILE_ARTS (PROFILE_ADAPTQUANT|PROFILE_REDUCED) |
235 |
|
|
236 |
|
static const int PARS[][2] = { |
237 |
|
{1, 1}, |
238 |
|
{12, 11}, |
239 |
|
{10, 11}, |
240 |
|
{16, 11}, |
241 |
|
{40, 33}, |
242 |
|
{0, 0}, |
243 |
|
}; |
244 |
|
|
245 |
|
|
246 |
|
|
247 |
|
|
248 |
|
typedef struct |
249 |
|
{ |
250 |
|
char * name; |
251 |
|
int id; /* mpeg-4 profile id; iso/iec 14496-2:2001 table G-1 */ |
252 |
|
int width; |
253 |
|
int height; |
254 |
|
int fps; |
255 |
|
int max_objects; |
256 |
|
int total_vmv_buffer_sz; /* macroblock memory; when BVOPS=false, vmv = 2*vcv; when BVOPS=true, vmv = 3*vcv*/ |
257 |
|
int max_vmv_buffer_sz; /* max macroblocks per vop */ |
258 |
|
int vcv_decoder_rate; /* macroblocks decoded per second */ |
259 |
|
int max_acpred_mbs; /* percentage */ |
260 |
|
int max_vbv_size; /* max vbv size (bits) 16368 bits */ |
261 |
|
int max_video_packet_length; /* bits */ |
262 |
|
int max_bitrate; /* kbits/s */ |
263 |
|
unsigned int flags; |
264 |
|
} profile_t; |
265 |
|
|
266 |
|
|
267 |
|
extern const profile_t profiles[]; |
268 |
|
|
269 |
|
|
270 |
|
void config_reg_get(CONFIG * config); |
271 |
|
void config_reg_set(CONFIG * config); |
272 |
|
void sort_zones(zone_t * zones, int zone_num, int * sel); |
273 |
|
|
274 |
|
|
275 |
|
BOOL CALLBACK main_proc(HWND, UINT, WPARAM, LPARAM); |
276 |
|
BOOL CALLBACK about_proc(HWND, UINT, WPARAM, LPARAM); |
277 |
|
|
278 |
|
#endif /* _CONFIG_H_ */ |