60 |
#include <shlobj.h> |
#include <shlobj.h> |
61 |
#include <prsht.h> |
#include <prsht.h> |
62 |
|
|
63 |
#include <xvid.h> // XviD API |
#include <stdio.h> /* sprintf */ |
64 |
|
#include <xvid.h> /* XviD API */ |
65 |
|
|
66 |
#include "debug.h" |
#include "debug.h" |
|
#include "codec.h" |
|
67 |
#include "config.h" |
#include "config.h" |
68 |
#include "resource.h" |
#include "resource.h" |
69 |
|
|
70 |
|
|
71 |
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
72 |
#define IsDlgChecked(hwnd,idc) (IsDlgButtonChecked(hwnd,idc) == BST_CHECKED) |
#define IsDlgChecked(hwnd,idc) (IsDlgButtonChecked(hwnd,idc) == BST_CHECKED) |
73 |
|
#define CheckDlg(hwnd,idc,value) CheckDlgButton(hwnd,idc, value?BST_CHECKED:BST_UNCHECKED) |
74 |
#define EnableDlgWindow(hwnd,idc,state) EnableWindow(GetDlgItem(hwnd,idc),state) |
#define EnableDlgWindow(hwnd,idc,state) EnableWindow(GetDlgItem(hwnd,idc),state) |
75 |
|
|
76 |
HINSTANCE g_hInst; |
HINSTANCE g_hInst; |
100 |
/* MPEG-4 PROFILES/LEVELS ============================================================== */ |
/* MPEG-4 PROFILES/LEVELS ============================================================== */ |
101 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
102 |
|
|
|
#define PROFILE_BVOP 0x00000001 |
|
|
#define PROFILE_MPEGQUANT 0x00000002 |
|
|
#define PROFILE_INTERLACE 0x00000004 |
|
|
#define PROFILE_QPEL 0x00000008 |
|
|
#define PROFILE_GMC 0x00000010 |
|
|
#define PROFILE_REDUCED 0x00000020 /* dynamic resolution conversion */ |
|
103 |
|
|
|
#define PROFILE_AS (PROFILE_BVOP|PROFILE_MPEGQUANT|PROFILE_INTERLACE|PROFILE_QPEL|PROFILE_GMC) |
|
|
#define PROFILE_ARTS (PROFILE_REDUCED) |
|
|
|
|
|
|
|
|
typedef struct |
|
|
{ |
|
|
char * name; |
|
|
int width; |
|
|
int height; |
|
|
int fps; |
|
|
int max_objects; |
|
|
int total_vmv_buffer_sz; /* macroblock memory; when BVOPS=false, vmv = 2*vcv; when BVOPS=true, vmv = 3*vcv*/ |
|
|
int max_vmv_buffer_sz; /* max macroblocks per vop */ |
|
|
int vcv_decoder_rate; /* macroblocks decoded per second */ |
|
|
int max_acpred_mbs; /* percentage */ |
|
|
int max_vbv_size; /* max vbv size (bits) 16368 bits */ |
|
|
int max_video_packet_length; /* bits */ |
|
|
int max_bitrate; /* kbits/s */ |
|
|
unsigned int flags; |
|
|
} profile_t; |
|
104 |
|
|
105 |
/* default vbv_occupancy is (64/170)*vbv_buffer_size */ |
/* default vbv_occupancy is (64/170)*vbv_buffer_size */ |
106 |
|
|
107 |
static const profile_t profiles[] = |
const profile_t profiles[] = |
108 |
{ |
{ |
109 |
/* name w h fps obj Tvmv vmv vcv ac% vbv pkt kbps flags */ |
/* name p@l, w h fps obj Tvmv vmv vcv ac% vbv pkt kbps flags */ |
110 |
{ "(unrestricted)", 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
{ "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100, 10*16368, 2048, 64, 0 }, |
111 |
|
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */ |
112 |
|
/* if ac preidition is used, adaptive quantization must not be used */ |
113 |
|
/* <=qcif must be used */ |
114 |
|
{ "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, PROFILE_ADAPTQUANT }, |
115 |
|
{ "Simple @ L2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 4096, 128, PROFILE_ADAPTQUANT }, |
116 |
|
{ "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384, PROFILE_ADAPTQUANT }, |
117 |
|
|
118 |
|
{ "ARTS @ L1", 0x91, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 8192, 64, PROFILE_ARTS }, |
119 |
|
{ "ARTS @ L2", 0x92, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 16384, 128, PROFILE_ARTS }, |
120 |
|
{ "ARTS @ L3", 0x93, 352, 288, 30, 4, 792, 396, 11880, 100, 40*16368, 16384, 384, PROFILE_ARTS }, |
121 |
|
{ "ARTS @ L4", 0x94, 352, 288, 30, 16, 792, 396, 11880, 100, 80*16368, 16384, 2000, PROFILE_ARTS }, |
122 |
|
|
123 |
|
{ "AS @ L0", 0xf0, 176, 144, 30, 1, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
124 |
|
{ "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
125 |
|
{ "AS @ L2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100, 40*16368, 4096, 384, PROFILE_AS }, |
126 |
|
{ "AS @ L3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100, 40*16368, 4096, 768, PROFILE_AS }, |
127 |
|
/* ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */ |
128 |
|
{ "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, |
129 |
|
{ "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
130 |
|
|
131 |
|
#ifdef DXN_PROFILES |
132 |
|
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
133 |
|
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
134 |
|
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
135 |
|
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
136 |
|
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
137 |
|
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
138 |
|
#endif |
139 |
|
|
140 |
{ "Simple @ L1", 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, 0 }, |
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
|
{ "Simple @ L2", 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 4096, 128, 0 }, |
|
|
{ "Simple @ L3", 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384, 0 }, |
|
|
|
|
|
{ "ARTS @ L1", 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 8192, 64, PROFILE_ARTS }, |
|
|
{ "ARTS @ L2", 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 16384, 128, PROFILE_ARTS }, |
|
|
{ "ARTS @ L3", 352, 288, 30, 4, 792, 396, 11880, 100, 40*16368, 16384, 384, PROFILE_ARTS }, |
|
|
{ "ARTS @ L4", 352, 288, 30, 16, 792, 396, 11880, 100, 80*16368, 16384, 2000, PROFILE_ARTS }, |
|
|
|
|
|
{ "AS @ L0", 176, 144, 30, 1, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
|
|
{ "AS @ L1", 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
|
|
{ "AS @ L2", 352, 288, 15, 4, 1188, 396, 5940, 100, 40*16368, 4096, 384, PROFILE_AS }, |
|
|
{ "AS @ L3", 352, 288, 30, 4, 1188, 396, 11880, 100, 40*16368, 4096, 768, PROFILE_AS }, |
|
|
{ "AS @ L4", 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, |
|
|
{ "AS @ L5", 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
|
|
|
|
|
{ "DXN Handheld", 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, 0 }, |
|
|
{ "DXN Portable NTSC", 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_BVOP }, |
|
|
{ "DXN Portable PAL", 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_BVOP }, |
|
|
{ "DXN HT NTSC", 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_BVOP|PROFILE_INTERLACE }, |
|
|
{ "DXN HT NTSC", 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_BVOP|PROFILE_INTERLACE }, |
|
|
{ "DXN HDTV", 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_BVOP|PROFILE_INTERLACE }, |
|
141 |
}; |
}; |
142 |
|
|
143 |
|
|
149 |
CONFIG reg; |
CONFIG reg; |
150 |
|
|
151 |
static const REG_INT reg_ints[] = { |
static const REG_INT reg_ints[] = { |
152 |
{"mode", ®.mode, RC_MODE_CBR}, |
{"mode", ®.mode, RC_MODE_1PASS}, |
153 |
{"quality", ®.quality, 85}, |
{"bitrate", ®.bitrate, 700}, |
154 |
{"quant", ®.quant, 5}, |
{"desired_size", ®.desired_size, 570000}, |
155 |
{"rc_bitrate", ®.rc_bitrate, 900000}, |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
|
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
|
|
{"rc_buffer", ®.rc_buffer, 100}, |
|
156 |
|
|
157 |
{"motion_search", ®.motion_search, 6}, |
/* profile */ |
158 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
|
{"fourcc_used", ®.fourcc_used, 0}, |
|
|
{"vhq_mode", ®.vhq_mode, 0}, |
|
|
{"max_key_interval", ®.max_key_interval, 300}, |
|
|
{"min_key_interval", ®.min_key_interval, 1}, |
|
159 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
160 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
161 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
162 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
163 |
{"chromame", ®.chromame, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
|
{"greyscale", ®.greyscale, 0}, |
|
164 |
{"use_bvop", ®.use_bvop, 0}, |
{"use_bvop", ®.use_bvop, 0}, |
165 |
{"max_bframes", ®.max_bframes, 2}, |
{"max_bframes", ®.max_bframes, 2}, |
166 |
{"bquant_ratio", ®.bquant_ratio, 150}, |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
167 |
{"bquant_offset", ®.bquant_offset, 100}, |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
|
{"bvop_threshold", ®.bvop_threshold, 0}, |
|
168 |
{"packed", ®.packed, 0}, |
{"packed", ®.packed, 0}, |
169 |
{"closed_gov", ®.closed_gov, 1}, |
{"closed_gov", ®.closed_gov, 1}, |
170 |
{"debug", ®.debug, 0}, |
|
171 |
{"reduced_resolution", ®.reduced_resolution, 0}, |
/* aspect ratio */ |
172 |
{"chroma_opt", ®.chroma_opt, 0}, |
{"ar_mode", ®.ar_mode, 0}, |
173 |
|
{"aspect_ratio", ®.display_aspect_ratio, 0}, |
174 |
|
{"par_x", ®.par_x, 1}, |
175 |
|
{"par_y", ®.par_y, 1}, |
176 |
|
{"ar_x", ®.ar_x, 4}, |
177 |
|
{"ar_y", ®.ar_y, 3}, |
178 |
|
|
179 |
|
/* zones */ |
180 |
|
{"num_zones", ®.num_zones, 1}, |
181 |
|
|
182 |
|
/* single pass */ |
183 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
184 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
185 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
186 |
|
|
187 |
|
/* 2pass1 */ |
188 |
|
{"discard1pass", ®.discard1pass, 1}, |
189 |
|
|
190 |
|
/* 2pass2 */ |
191 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
192 |
|
{"kfreduction", ®.kfreduction, 20}, |
193 |
|
{"kfthreshold", ®.kfthreshold, 1}, |
194 |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
195 |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
196 |
|
{"overflow_control_strength", ®.overflow_control_strength, 5}, |
197 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
198 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
199 |
|
|
200 |
|
/* motion */ |
201 |
|
{"motion_search", ®.motion_search, 6}, |
202 |
|
{"vhq_mode", ®.vhq_mode, 0}, |
203 |
|
{"chromame", ®.chromame, 0}, |
204 |
|
{"cartoon_mode", ®.cartoon_mode, 0}, |
205 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
206 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
207 |
|
|
208 |
|
/* quant */ |
209 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 2}, |
210 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
211 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 2}, |
212 |
{"max_pquant", ®.max_pquant, 31}, |
{"max_pquant", ®.max_pquant, 31}, |
213 |
|
{"min_bquant", ®.min_bquant, 2}, |
214 |
|
{"max_bquant", ®.max_bquant, 31}, |
215 |
|
{"trellis_quant", ®.trellis_quant, 0}, |
216 |
|
|
217 |
{"desired_size", ®.desired_size, 570000}, |
/* debug */ |
218 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
{"fourcc_used", ®.fourcc_used, 0}, |
219 |
{"discard1pass", ®.discard1pass, 1}, |
{"debug", ®.debug, 0x0}, |
220 |
{"kftreshold", ®.kftreshold, 10}, |
{"vop_debug", ®.vop_debug, 0}, |
221 |
{"kfreduction", ®.kfreduction, 20}, |
{"display_status", ®.display_status, 1}, |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
|
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
|
|
{"use_alt_curve", ®.use_alt_curve, 0}, |
|
|
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
|
|
{"alt_curve_auto_str", ®.alt_curve_auto_str, 30}, |
|
|
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
|
|
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
|
|
{"alt_curve_type", ®.alt_curve_type, 1}, |
|
|
{"alt_curve_high_dist", ®.alt_curve_high_dist, 500}, |
|
|
{"alt_curve_low_dist", ®.alt_curve_low_dist, 90}, |
|
|
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
|
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
|
|
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
|
|
{"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
|
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
|
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
|
|
|
|
|
/* decoder */ |
|
|
// {"deblock_y", ®.deblock_y, 0}, |
|
|
// {"deblock_uv", ®.deblock_uv, 0} |
|
222 |
}; |
}; |
223 |
|
|
224 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
226 |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
227 |
}; |
}; |
228 |
|
|
229 |
/* get config settings from registry */ |
|
230 |
|
zone_t stmp; |
231 |
|
static const REG_INT reg_zone[] = { |
232 |
|
{"zone%i_frame", &stmp.frame, 0}, |
233 |
|
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
234 |
|
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
235 |
|
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
236 |
|
{"zone%i_type", &stmp.type, XVID_TYPE_AUTO}, |
237 |
|
{"zone%i_greyscale", &stmp.greyscale, 0}, |
238 |
|
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
239 |
|
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
240 |
|
}; |
241 |
|
|
242 |
|
static const BYTE default_qmatrix_intra[] = { |
243 |
|
8, 17,18,19,21,23,25,27, |
244 |
|
17,18,19,21,23,25,27,28, |
245 |
|
20,21,22,23,24,26,28,30, |
246 |
|
21,22,23,24,26,28,30,32, |
247 |
|
22,23,24,26,28,30,32,35, |
248 |
|
23,24,26,28,30,32,35,38, |
249 |
|
25,26,28,30,32,35,38,41, |
250 |
|
27,28,30,32,35,38,41,45 |
251 |
|
}; |
252 |
|
|
253 |
|
static const BYTE default_qmatrix_inter[] = { |
254 |
|
16,17,18,19,20,21,22,23, |
255 |
|
17,18,19,20,21,22,23,24, |
256 |
|
18,19,20,21,22,23,24,25, |
257 |
|
19,20,21,22,23,24,26,27, |
258 |
|
20,21,22,23,25,26,27,28, |
259 |
|
21,22,23,24,26,27,28,30, |
260 |
|
22,23,24,26,27,28,30,31, |
261 |
|
23,24,25,27,28,30,31,33 |
262 |
|
}; |
263 |
|
|
264 |
|
|
265 |
|
|
266 |
#define REG_GET_B(X, Y, Z) size=sizeof((Z));if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {memcpy(Y, Z, sizeof((Z)));} |
#define REG_GET_B(X, Y, Z) size=sizeof((Z));if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {memcpy(Y, Z, sizeof((Z)));} |
267 |
|
|
268 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
269 |
{ |
{ |
270 |
|
char tmp[32]; |
271 |
HKEY hKey; |
HKEY hKey; |
272 |
DWORD size; |
DWORD size; |
273 |
int i; |
int i,j; |
274 |
xvid_gbl_info_t info; |
xvid_gbl_info_t info; |
275 |
|
|
276 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
281 |
|
|
282 |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
283 |
|
|
284 |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
/* read integer values */ |
285 |
{ |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT); i++) { |
286 |
size = sizeof(int); |
size = sizeof(int); |
287 |
|
if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS) { |
|
if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS) |
|
|
{ |
|
288 |
*reg_ints[i].config_int = reg_ints[i].def; |
*reg_ints[i].config_int = reg_ints[i].def; |
289 |
} |
} |
290 |
} |
} |
291 |
|
|
292 |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
/* read string values */ |
293 |
{ |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR); i++) { |
294 |
size = MAX_PATH; |
size = MAX_PATH; |
295 |
|
if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS) { |
|
if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS) |
|
|
{ |
|
296 |
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
297 |
} |
} |
298 |
} |
} |
299 |
|
|
|
{ |
|
|
BYTE default_qmatrix_intra[] = { |
|
|
8, 17,18,19,21,23,25,27, |
|
|
17,18,19,21,23,25,27,28, |
|
|
20,21,22,23,24,26,28,30, |
|
|
21,22,23,24,26,28,30,32, |
|
|
22,23,24,26,28,30,32,35, |
|
|
23,24,26,28,30,32,35,38, |
|
|
25,26,28,30,32,35,38,41, |
|
|
27,28,30,32,35,38,41,45 |
|
|
}; |
|
|
|
|
|
BYTE default_qmatrix_inter[] = { |
|
|
16,17,18,19,20,21,22,23, |
|
|
17,18,19,20,21,22,23,24, |
|
|
18,19,20,21,22,23,24,25, |
|
|
19,20,21,22,23,24,26,27, |
|
|
20,21,22,23,25,26,27,28, |
|
|
21,22,23,24,26,27,28,30, |
|
|
22,23,24,26,27,28,30,31, |
|
|
23,24,25,27,28,30,31,33 |
|
|
}; |
|
|
|
|
|
REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra); |
|
|
REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter); |
|
|
} |
|
|
|
|
300 |
reg.profile = 0; |
reg.profile = 0; |
301 |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
302 |
if (strcmpi(profiles[i].name, reg.profile_name) == 0) { |
if (strcmpi(profiles[i].name, reg.profile_name) == 0) { |
306 |
|
|
307 |
memcpy(config, ®, sizeof(CONFIG)); |
memcpy(config, ®, sizeof(CONFIG)); |
308 |
|
|
309 |
|
|
310 |
|
/* read quant matrices */ |
311 |
|
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra); |
312 |
|
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter); |
313 |
|
|
314 |
|
|
315 |
|
/* read zones */ |
316 |
|
if (config->num_zones>MAX_ZONES) { |
317 |
|
config->num_zones=MAX_ZONES; |
318 |
|
}else if (config->num_zones<=0) { |
319 |
|
config->num_zones = 1; |
320 |
|
} |
321 |
|
|
322 |
|
for (i=0; i<config->num_zones; i++) { |
323 |
|
for (j=0; j<sizeof(reg_zone)/sizeof(REG_INT); j++) { |
324 |
|
size = sizeof(int); |
325 |
|
|
326 |
|
wsprintf(tmp, reg_zone[j].reg_value, i); |
327 |
|
if (RegQueryValueEx(hKey, tmp, 0, 0, (LPBYTE)reg_zone[j].config_int, &size) != ERROR_SUCCESS) |
328 |
|
*reg_zone[j].config_int = reg_zone[j].def; |
329 |
|
} |
330 |
|
|
331 |
|
memcpy(&config->zones[i], &stmp, sizeof(zone_t)); |
332 |
|
} |
333 |
|
|
334 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
335 |
} |
} |
336 |
|
|
341 |
|
|
342 |
void config_reg_set(CONFIG * config) |
void config_reg_set(CONFIG * config) |
343 |
{ |
{ |
344 |
|
char tmp[64]; |
345 |
HKEY hKey; |
HKEY hKey; |
346 |
DWORD dispo; |
DWORD dispo; |
347 |
int i; |
int i,j; |
348 |
|
|
349 |
if (RegCreateKeyEx( |
if (RegCreateKeyEx( |
350 |
XVID_REG_KEY, |
XVID_REG_KEY, |
363 |
|
|
364 |
memcpy(®, config, sizeof(CONFIG)); |
memcpy(®, config, sizeof(CONFIG)); |
365 |
|
|
366 |
strcpy(reg.profile_name, profiles[reg.profile].name); |
/* set integer values */ |
367 |
|
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT); i++) { |
|
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
|
|
{ |
|
368 |
RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int)); |
RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int)); |
369 |
} |
} |
370 |
|
|
371 |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
/* set string values */ |
372 |
{ |
strcpy(reg.profile_name, profiles[reg.profile].name); |
373 |
|
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR); i++) { |
374 |
RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1); |
RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1); |
375 |
} |
} |
376 |
|
|
377 |
REG_SET_B("qmatrix_intra", reg.qmatrix_intra); |
/* set quant matrices */ |
378 |
REG_SET_B("qmatrix_inter", reg.qmatrix_inter); |
REG_SET_B("qmatrix_intra", config->qmatrix_intra); |
379 |
|
REG_SET_B("qmatrix_inter", config->qmatrix_inter); |
380 |
|
|
381 |
|
/* set seections */ |
382 |
|
for (i=0; i<config->num_zones; i++) { |
383 |
|
memcpy(&stmp, &config->zones[i], sizeof(zone_t)); |
384 |
|
for (j=0; j<sizeof(reg_zone)/sizeof(REG_INT); j++) { |
385 |
|
wsprintf(tmp, reg_zone[j].reg_value, i); |
386 |
|
RegSetValueEx(hKey, tmp, 0, REG_DWORD, (LPBYTE)reg_zone[j].config_int, sizeof(int)); |
387 |
|
} |
388 |
|
} |
389 |
|
|
390 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
391 |
} |
} |
397 |
{ |
{ |
398 |
HKEY hKey; |
HKEY hKey; |
399 |
|
|
400 |
if (RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT, 0, KEY_ALL_ACCESS, &hKey)) |
if (RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT, 0, KEY_ALL_ACCESS, &hKey)) { |
|
{ |
|
401 |
DPRINTF("Couldn't open registry key for deletion - GetLastError=%i", GetLastError()); |
DPRINTF("Couldn't open registry key for deletion - GetLastError=%i", GetLastError()); |
402 |
return; |
return; |
403 |
} |
} |
404 |
|
|
405 |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) { |
|
{ |
|
406 |
DPRINTF("Couldn't delete registry key - GetLastError=%i", GetLastError()); |
DPRINTF("Couldn't delete registry key - GetLastError=%i", GetLastError()); |
407 |
return; |
return; |
408 |
} |
} |
414 |
|
|
415 |
|
|
416 |
/* leaves current config value if dialog item is empty */ |
/* leaves current config value if dialog item is empty */ |
|
|
|
417 |
int config_get_int(HWND hDlg, INT item, int config) |
int config_get_int(HWND hDlg, INT item, int config) |
418 |
{ |
{ |
419 |
BOOL success = FALSE; |
BOOL success = FALSE; |
|
|
|
420 |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
|
|
|
421 |
return (success) ? tmp : config; |
return (success) ? tmp : config; |
422 |
} |
} |
423 |
|
|
425 |
int config_get_uint(HWND hDlg, UINT item, int config) |
int config_get_uint(HWND hDlg, UINT item, int config) |
426 |
{ |
{ |
427 |
BOOL success = FALSE; |
BOOL success = FALSE; |
|
|
|
428 |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
|
|
|
429 |
return (success) ? tmp : config; |
return (success) ? tmp : config; |
430 |
} |
} |
431 |
|
|
432 |
|
|
433 |
|
/* we use "100 base" floats */ |
434 |
|
|
435 |
|
#define FLOAT_BUF_SZ 20 |
436 |
|
int get_dlgitem_float(HWND hDlg, UINT item, int def) |
437 |
|
{ |
438 |
|
char buf[FLOAT_BUF_SZ]; |
439 |
|
|
440 |
|
if (GetDlgItemText(hDlg, item, buf, FLOAT_BUF_SZ) == 0) |
441 |
|
return def; |
442 |
|
|
443 |
|
return (int)(atof(buf)*100); |
444 |
|
} |
445 |
|
|
446 |
|
void set_dlgitem_float(HWND hDlg, UINT item, int value) |
447 |
|
{ |
448 |
|
char buf[FLOAT_BUF_SZ]; |
449 |
|
sprintf(buf, "%.2f", (float)value/100); |
450 |
|
SetDlgItemText(hDlg, item, buf); |
451 |
|
} |
452 |
|
|
453 |
|
|
454 |
|
#define HEX_BUF_SZ 16 |
455 |
|
unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def) |
456 |
|
{ |
457 |
|
char buf[HEX_BUF_SZ]; |
458 |
|
unsigned int value; |
459 |
|
|
460 |
|
if (GetDlgItemText(hDlg, item, buf, HEX_BUF_SZ) == 0) |
461 |
|
return def; |
462 |
|
|
463 |
|
if (sscanf(buf,"0x%x", &value)==1 || sscanf(buf,"%x", &value)==1) { |
464 |
|
return value; |
465 |
|
} |
466 |
|
|
467 |
|
return def; |
468 |
|
} |
469 |
|
|
470 |
|
void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
471 |
|
{ |
472 |
|
char buf[HEX_BUF_SZ]; |
473 |
|
wsprintf(buf, "0x%x", value); |
474 |
|
SetDlgItemText(hDlg, item, buf); |
475 |
|
} |
476 |
|
|
477 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
478 |
/* QUANT MATRIX DIALOG ================================================================= */ |
/* QUANT MATRIX DIALOG ================================================================= */ |
482 |
{ |
{ |
483 |
int i; |
int i; |
484 |
|
|
485 |
for (i=0 ; i<64 ; ++i) |
for (i=0 ; i<64; i++) { |
|
{ |
|
486 |
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
487 |
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
488 |
} |
} |
493 |
{ |
{ |
494 |
int i; |
int i; |
495 |
|
|
496 |
for (i=0; i<64 ; ++i) |
for (i=0; i<64; i++) { |
|
{ |
|
497 |
int temp; |
int temp; |
498 |
|
|
499 |
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
506 |
} |
} |
507 |
} |
} |
508 |
|
|
|
/* quantization matrix dialog proc */ |
|
509 |
|
|
510 |
BOOL CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
void quant_loadsave(HWND hDlg, CONFIG * config, int save) |
511 |
{ |
{ |
|
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
|
|
|
|
|
switch (uMsg) |
|
|
{ |
|
|
case WM_INITDIALOG : |
|
|
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
|
|
config = (CONFIG*)lParam; |
|
|
quant_upload(hDlg, config); |
|
|
|
|
|
if (g_hTooltip) |
|
|
{ |
|
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
|
|
} |
|
|
break; |
|
|
|
|
|
case WM_COMMAND : |
|
|
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
quant_download(hDlg, config); |
|
|
EndDialog(hDlg, IDOK); |
|
|
} |
|
|
else if (LOWORD(wParam) == IDCANCEL) |
|
|
{ |
|
|
EndDialog(hDlg, IDCANCEL); |
|
|
} |
|
|
else if ((LOWORD(wParam) == IDC_LOAD || LOWORD(wParam) == IDC_SAVE) && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
OPENFILENAME ofn; |
|
512 |
char file[MAX_PATH]; |
char file[MAX_PATH]; |
513 |
|
OPENFILENAME ofn; |
514 |
HANDLE hFile; |
HANDLE hFile; |
515 |
DWORD read=128, wrote=0; |
DWORD read=128, wrote=0; |
516 |
BYTE quant_data[128]; |
BYTE quant_data[128]; |
525 |
ofn.nMaxFile = MAX_PATH; |
ofn.nMaxFile = MAX_PATH; |
526 |
ofn.Flags = OFN_PATHMUSTEXIST; |
ofn.Flags = OFN_PATHMUSTEXIST; |
527 |
|
|
528 |
if (LOWORD(wParam) == IDC_SAVE) |
if (save) { |
|
{ |
|
529 |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
530 |
if (GetSaveFileName(&ofn)) |
if (GetSaveFileName(&ofn)) { |
|
{ |
|
531 |
hFile = CreateFile(file, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); |
hFile = CreateFile(file, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); |
532 |
|
|
533 |
quant_download(hDlg, config); |
quant_download(hDlg, config); |
534 |
memcpy(quant_data, config->qmatrix_intra, 64); |
memcpy(quant_data, config->qmatrix_intra, 64); |
535 |
memcpy(quant_data+64, config->qmatrix_inter, 64); |
memcpy(quant_data+64, config->qmatrix_inter, 64); |
536 |
|
|
537 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) { |
|
{ |
|
538 |
DPRINTF("Couldn't save quant matrix"); |
DPRINTF("Couldn't save quant matrix"); |
539 |
} |
}else{ |
540 |
else |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) { |
|
{ |
|
|
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
|
|
{ |
|
541 |
DPRINTF("Couldnt write quant matrix"); |
DPRINTF("Couldnt write quant matrix"); |
542 |
} |
} |
543 |
} |
} |
|
|
|
544 |
CloseHandle(hFile); |
CloseHandle(hFile); |
545 |
} |
} |
546 |
} |
}else{ |
|
else |
|
|
{ |
|
547 |
ofn.Flags |= OFN_FILEMUSTEXIST; |
ofn.Flags |= OFN_FILEMUSTEXIST; |
548 |
if (GetOpenFileName(&ofn)) |
if (GetOpenFileName(&ofn)) { |
|
{ |
|
549 |
hFile = CreateFile(file, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); |
hFile = CreateFile(file, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); |
550 |
|
|
551 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) { |
|
{ |
|
552 |
DPRINTF("Couldn't load quant matrix"); |
DPRINTF("Couldn't load quant matrix"); |
553 |
} |
} else { |
554 |
else |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) { |
|
{ |
|
|
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
|
|
{ |
|
555 |
DPRINTF("Couldnt read quant matrix"); |
DPRINTF("Couldnt read quant matrix"); |
556 |
} |
}else{ |
|
else |
|
|
{ |
|
557 |
memcpy(config->qmatrix_intra, quant_data, 64); |
memcpy(config->qmatrix_intra, quant_data, 64); |
558 |
memcpy(config->qmatrix_inter, quant_data+64, 64); |
memcpy(config->qmatrix_inter, quant_data+64, 64); |
559 |
quant_upload(hDlg, config); |
quant_upload(hDlg, config); |
560 |
} |
} |
561 |
} |
} |
|
|
|
562 |
CloseHandle(hFile); |
CloseHandle(hFile); |
563 |
} |
} |
564 |
} |
} |
565 |
} |
} |
566 |
|
|
567 |
|
/* quantization matrix dialog proc */ |
568 |
|
|
569 |
|
BOOL CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
570 |
|
{ |
571 |
|
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
572 |
|
|
573 |
|
switch (uMsg) |
574 |
|
{ |
575 |
|
case WM_INITDIALOG : |
576 |
|
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
577 |
|
config = (CONFIG*)lParam; |
578 |
|
quant_upload(hDlg, config); |
579 |
|
|
580 |
|
if (g_hTooltip) |
581 |
|
{ |
582 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
583 |
|
} |
584 |
|
break; |
585 |
|
|
586 |
|
case WM_COMMAND : |
587 |
|
|
588 |
|
if (HIWORD(wParam) == BN_CLICKED) { |
589 |
|
switch(LOWORD(wParam)) { |
590 |
|
case IDOK : |
591 |
|
quant_download(hDlg, config); |
592 |
|
EndDialog(hDlg, IDOK); |
593 |
|
break; |
594 |
|
|
595 |
|
case IDCANCEL : |
596 |
|
EndDialog(hDlg, IDCANCEL); |
597 |
|
break; |
598 |
|
|
599 |
|
case IDC_SAVE : |
600 |
|
quant_loadsave(hDlg, config, 1); |
601 |
|
break; |
602 |
|
|
603 |
|
case IDC_LOAD : |
604 |
|
quant_loadsave(hDlg, config, 0); |
605 |
break; |
break; |
606 |
|
|
607 |
default : |
default : |
608 |
return 0; |
return FALSE; |
609 |
} |
} |
610 |
|
break; |
611 |
|
} |
612 |
|
return FALSE; |
613 |
|
|
614 |
return 1; |
default : |
615 |
|
return FALSE; |
616 |
|
} |
617 |
|
|
618 |
|
return TRUE; |
619 |
} |
} |
620 |
|
|
621 |
|
|
632 |
case IDD_PROFILE : |
case IDD_PROFILE : |
633 |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
634 |
SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
635 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
636 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
637 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
638 |
|
|
639 |
|
break; |
640 |
|
case IDD_AR: |
641 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
642 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
643 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 NTSC"); |
644 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 PAL"); |
645 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 NTSC"); |
646 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Custom..."); |
647 |
break; |
break; |
648 |
|
|
649 |
case IDD_RC_2PASS2_ALT : |
case IDD_LEVEL : |
650 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low"); |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
651 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
652 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
break; |
653 |
|
|
654 |
|
case IDD_ZONE : |
655 |
|
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
656 |
break; |
break; |
657 |
|
|
658 |
case IDD_MOTION : |
case IDD_MOTION : |
671 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search"); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search"); |
672 |
break; |
break; |
673 |
|
|
|
case IDD_TOOLS : |
|
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
|
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
|
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
|
|
break; |
|
|
|
|
674 |
case IDD_DEBUG : |
case IDD_DEBUG : |
675 |
/* force threads disabled */ |
/* force threads disabled */ |
676 |
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
683 |
} |
} |
684 |
} |
} |
685 |
|
|
686 |
|
|
687 |
/* enable/disable controls based on encoder-mode or user selection */ |
/* enable/disable controls based on encoder-mode or user selection */ |
688 |
|
|
689 |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
690 |
{ |
{ |
691 |
int use_alt, use_alt_auto, use_alt_auto_bonus; |
int profile; |
692 |
|
int weight_en, quant_en; |
693 |
int cpu_force; |
int cpu_force; |
694 |
int bvops; |
int custom_quant, bvops; |
695 |
|
int ar_mode, ar_par, ar_select; |
696 |
|
|
697 |
switch(idd) { |
switch(idd) { |
698 |
case IDD_PROFILE : |
case IDD_PROFILE : |
699 |
CheckDlgButton(hDlg, IDC_PROFILE_BVOP, profiles[config->profile].flags&PROFILE_BVOP ? BST_CHECKED : BST_UNCHECKED); |
profile = SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_GETCURSEL, 0, 0); |
700 |
CheckDlgButton(hDlg, IDC_PROFILE_MPEGQUANT, profiles[config->profile].flags&PROFILE_MPEGQUANT ? BST_CHECKED : BST_UNCHECKED); |
EnableDlgWindow(hDlg, IDC_BVOP, profiles[profile].flags&PROFILE_BVOP); |
701 |
CheckDlgButton(hDlg, IDC_PROFILE_INTERLACE, profiles[config->profile].flags&PROFILE_INTERLACE ? BST_CHECKED : BST_UNCHECKED); |
|
702 |
CheckDlgButton(hDlg, IDC_PROFILE_QPEL, profiles[config->profile].flags&PROFILE_QPEL ? BST_CHECKED : BST_UNCHECKED); |
EnableDlgWindow(hDlg, IDC_QUANTTYPE_S, profiles[profile].flags&PROFILE_MPEGQUANT); |
703 |
CheckDlgButton(hDlg, IDC_PROFILE_GMC, profiles[config->profile].flags&PROFILE_GMC ? BST_CHECKED : BST_UNCHECKED); |
EnableDlgWindow(hDlg, IDC_QUANTTYPE_S, profiles[profile].flags&PROFILE_MPEGQUANT); |
704 |
CheckDlgButton(hDlg, IDC_PROFILE_REDUCED, profiles[config->profile].flags&PROFILE_REDUCED ? BST_CHECKED : BST_UNCHECKED); |
EnableDlgWindow(hDlg, IDC_QUANTTYPE, profiles[profile].flags&PROFILE_MPEGQUANT); |
705 |
break; |
custom_quant = (profiles[profile].flags&PROFILE_MPEGQUANT) && SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0)==QUANT_MODE_CUSTOM; |
706 |
|
EnableDlgWindow(hDlg, IDC_QUANTMATRIX, custom_quant); |
707 |
case IDD_RC_2PASS2_ALT : |
EnableDlgWindow(hDlg, IDC_LUMMASK, profiles[profile].flags&PROFILE_ADAPTQUANT); |
708 |
use_alt = IsDlgChecked(hDlg, IDC_USEALT); |
EnableDlgWindow(hDlg, IDC_INTERLACING, profiles[profile].flags&PROFILE_INTERLACE); |
709 |
use_alt_auto = IsDlgChecked(hDlg, IDC_USEAUTO); |
EnableDlgWindow(hDlg, IDC_QPEL, profiles[profile].flags&PROFILE_QPEL); |
710 |
use_alt_auto_bonus = IsDlgChecked(hDlg, IDC_USEAUTOBONUS); |
EnableDlgWindow(hDlg, IDC_GMC, profiles[profile].flags&PROFILE_GMC); |
711 |
EnableDlgWindow(hDlg, IDC_USEAUTO, use_alt); |
EnableDlgWindow(hDlg, IDC_REDUCED, profiles[profile].flags&PROFILE_REDUCED); |
|
EnableDlgWindow(hDlg, IDC_AUTOSTR, use_alt && use_alt_auto); |
|
|
EnableDlgWindow(hDlg, IDC_USEAUTOBONUS, use_alt); |
|
|
EnableDlgWindow(hDlg, IDC_BONUSBIAS, use_alt && !use_alt_auto_bonus); |
|
|
EnableDlgWindow(hDlg, IDC_CURVETYPE, use_alt); |
|
|
EnableDlgWindow(hDlg, IDC_ALTCURVEHIGH, use_alt); |
|
|
EnableDlgWindow(hDlg, IDC_ALTCURVELOW, use_alt); |
|
|
EnableDlgWindow(hDlg, IDC_MINQUAL, use_alt && !use_alt_auto); |
|
|
break; |
|
712 |
|
|
713 |
case IDD_TOOLS : |
bvops = (profiles[profile].flags&PROFILE_BVOP) && IsDlgChecked(hDlg, IDC_BVOP); |
|
bvops = IsDlgChecked(hDlg, IDC_BVOP); |
|
714 |
EnableDlgWindow(hDlg, IDC_MAXBFRAMES, bvops); |
EnableDlgWindow(hDlg, IDC_MAXBFRAMES, bvops); |
715 |
EnableDlgWindow(hDlg, IDC_BQUANTRATIO, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTRATIO, bvops); |
716 |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET, bvops); |
|
EnableDlgWindow(hDlg, IDC_BVOP_THRESHOLD, bvops); |
|
|
|
|
717 |
EnableDlgWindow(hDlg, IDC_MAXBFRAMES_S, bvops); |
EnableDlgWindow(hDlg, IDC_MAXBFRAMES_S, bvops); |
718 |
EnableDlgWindow(hDlg, IDC_BQUANTRATIO_S, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTRATIO_S, bvops); |
719 |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
|
EnableDlgWindow(hDlg, IDC_BVOP_THRESHOLD_S, bvops); |
|
|
|
|
720 |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
721 |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
722 |
break; |
break; |
723 |
|
|
724 |
|
case IDD_AR: |
725 |
|
ar_mode = IsDlgChecked(hDlg, IDC_PAR); |
726 |
|
EnableDlgWindow(hDlg, IDC_ASPECT_RATIO, ar_mode); |
727 |
|
|
728 |
|
ar_par = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
729 |
|
if (ar_par == 5) { /* custom par */ |
730 |
|
SetDlgItemInt(hDlg, IDC_PARY, config->par_y, FALSE); |
731 |
|
SetDlgItemInt(hDlg, IDC_PARX, config->par_x, FALSE); |
732 |
|
|
733 |
|
EnableDlgWindow(hDlg, IDC_PARX, ar_mode); |
734 |
|
EnableDlgWindow(hDlg, IDC_PARY, ar_mode); |
735 |
|
} else { |
736 |
|
SetDlgItemInt(hDlg, IDC_PARX, PARS[ar_par][0], FALSE); |
737 |
|
SetDlgItemInt(hDlg, IDC_PARY, PARS[ar_par][1], FALSE); |
738 |
|
EnableDlgWindow(hDlg, IDC_PARX, FALSE); |
739 |
|
EnableDlgWindow(hDlg, IDC_PARY, FALSE); |
740 |
|
} |
741 |
|
|
742 |
|
ar_mode = IsDlgChecked(hDlg, IDC_AR); |
743 |
|
|
744 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
745 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
746 |
|
|
747 |
|
EnableDlgWindow(hDlg, IDC_ARX, ar_mode); |
748 |
|
EnableDlgWindow(hDlg, IDC_ARY, ar_mode); |
749 |
|
break; |
750 |
|
|
751 |
|
case IDD_LEVEL : |
752 |
|
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
753 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_WIDTH, profiles[profile].width, FALSE); |
754 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_HEIGHT, profiles[profile].height, FALSE); |
755 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_FPS, profiles[profile].fps, FALSE); |
756 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_VMV, profiles[profile].max_vmv_buffer_sz, FALSE); |
757 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_VCV, profiles[profile].vcv_decoder_rate, FALSE); |
758 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_VBV, profiles[profile].max_vbv_size, FALSE); |
759 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
760 |
|
break; |
761 |
|
|
762 |
|
case IDD_ZONE : |
763 |
|
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
764 |
|
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
765 |
|
EnableDlgWindow(hDlg, IDC_ZONE_WEIGHT, weight_en); |
766 |
|
EnableDlgWindow(hDlg, IDC_ZONE_QUANT, quant_en); |
767 |
|
EnableDlgWindow(hDlg, IDC_ZONE_SLIDER, weight_en|quant_en); |
768 |
|
|
769 |
|
if (weight_en) { |
770 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(001,200)); |
771 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, 100)); |
772 |
|
SetDlgItemText(hDlg, IDC_ZONE_MIN, "0.01"); |
773 |
|
SetDlgItemText(hDlg, IDC_ZONE_MAX, "2.00"); |
774 |
|
}else if (quant_en) { |
775 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(100,3100)); |
776 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, get_dlgitem_float(hDlg, IDC_ZONE_QUANT, 100)); |
777 |
|
SetDlgItemText(hDlg, IDC_ZONE_MIN, "1"); |
778 |
|
SetDlgItemText(hDlg, IDC_ZONE_MAX, "31"); |
779 |
|
} |
780 |
|
|
781 |
|
bvops = (profiles[config->profile].flags&PROFILE_BVOP) && config->use_bvop; |
782 |
|
EnableDlgWindow(hDlg, IDC_ZONE_BVOPTHRESHOLD_S, bvops); |
783 |
|
EnableDlgWindow(hDlg, IDC_ZONE_BVOPTHRESHOLD, bvops); |
784 |
|
break; |
785 |
|
|
786 |
case IDD_DEBUG : |
case IDD_DEBUG : |
787 |
cpu_force = IsDlgChecked(hDlg, IDC_CPU_FORCE); |
cpu_force = IsDlgChecked(hDlg, IDC_CPU_FORCE); |
788 |
EnableDlgWindow(hDlg, IDC_CPU_MMX, cpu_force); |
EnableDlgWindow(hDlg, IDC_CPU_MMX, cpu_force); |
796 |
} |
} |
797 |
|
|
798 |
|
|
|
|
|
799 |
/* upload config data into dialog */ |
/* upload config data into dialog */ |
800 |
void adv_upload(HWND hDlg, int idd, CONFIG * config) |
void adv_upload(HWND hDlg, int idd, CONFIG * config) |
801 |
{ |
{ |
803 |
{ |
{ |
804 |
case IDD_PROFILE : |
case IDD_PROFILE : |
805 |
SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_SETCURSEL, config->profile, 0); |
806 |
SetDlgItemInt(hDlg, IDC_PROFILE_WIDTH, profiles[config->profile].width, FALSE); |
|
807 |
SetDlgItemInt(hDlg, IDC_PROFILE_HEIGHT, profiles[config->profile].height, FALSE); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
808 |
SetDlgItemInt(hDlg, IDC_PROFILE_FPS, profiles[config->profile].fps, FALSE); |
CheckDlg(hDlg, IDC_LUMMASK, config->lum_masking); |
809 |
SetDlgItemInt(hDlg, IDC_PROFILE_VMV, profiles[config->profile].max_vmv_buffer_sz, FALSE); |
CheckDlg(hDlg, IDC_INTERLACING, config->interlacing); |
810 |
SetDlgItemInt(hDlg, IDC_PROFILE_VCV, profiles[config->profile].vcv_decoder_rate, FALSE); |
CheckDlg(hDlg, IDC_QPEL, config->qpel); |
811 |
SetDlgItemInt(hDlg, IDC_PROFILE_VBV, profiles[config->profile].max_vbv_size, FALSE); |
CheckDlg(hDlg, IDC_GMC, config->gmc); |
812 |
SetDlgItemInt(hDlg, IDC_PROFILE_BITRATE, profiles[config->profile].max_bitrate, FALSE); |
CheckDlg(hDlg, IDC_REDUCED, config->reduced_resolution); |
813 |
|
CheckDlg(hDlg, IDC_BVOP, config->use_bvop); |
814 |
|
|
815 |
|
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, FALSE); |
816 |
|
set_dlgitem_float(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
817 |
|
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
818 |
|
CheckDlg(hDlg, IDC_PACKED, config->packed); |
819 |
|
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
820 |
|
|
821 |
|
break; |
822 |
|
case IDD_AR: |
823 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, config->ar_mode == 0 ? IDC_PAR : IDC_AR); |
824 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, (config->display_aspect_ratio), 0); |
825 |
|
SetDlgItemInt(hDlg, IDC_ARX, config->ar_x, FALSE); |
826 |
|
SetDlgItemInt(hDlg, IDC_ARY, config->ar_y, FALSE); |
827 |
|
break; |
828 |
|
|
829 |
|
case IDD_LEVEL : |
830 |
|
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_SETCURSEL, config->profile, 0); |
831 |
break; |
break; |
832 |
|
|
833 |
case IDD_RC_CBR : |
case IDD_RC_CBR : |
838 |
|
|
839 |
case IDD_RC_2PASS1 : |
case IDD_RC_2PASS1 : |
840 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
841 |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_DISCARD1PASS, config->discard1pass); |
842 |
break; |
break; |
843 |
|
|
844 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
845 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
846 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
|
847 |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
|
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
|
|
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
|
|
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
|
|
break; |
|
|
|
|
|
case IDD_RC_2PASS2_ALT : |
|
|
CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED); |
|
|
|
|
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); |
|
|
SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); |
|
|
|
|
|
CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED); |
|
|
SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); |
|
|
|
|
|
CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED); |
|
|
SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); |
|
848 |
|
|
849 |
SetDlgItemInt(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate / CONFIG_KBPS, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, config->overflow_control_strength, FALSE); |
850 |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
851 |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
|
break; |
|
|
|
|
852 |
|
|
853 |
case IDD_MOTION : |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
854 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
855 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->kfthreshold, FALSE); |
|
CheckDlgButton(hDlg, IDC_CHROMAME, config->chromame ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_GREYSCALE, config->greyscale ? BST_CHECKED : BST_UNCHECKED); |
|
856 |
break; |
break; |
857 |
|
|
858 |
case IDD_TOOLS : |
case IDD_ZONE : |
859 |
if (profiles[config->profile].flags & PROFILE_MPEGQUANT) { |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
|
EnableDlgWindow(hDlg, IDC_QUANTTYPE, TRUE); |
|
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
|
|
}else{ |
|
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, 0 /* h263 */, 0); |
|
|
EnableDlgWindow(hDlg, IDC_QUANTTYPE, FALSE); |
|
|
} |
|
|
|
|
|
if (profiles[config->profile].flags & PROFILE_INTERLACE) { |
|
|
EnableDlgWindow(hDlg, IDC_INTERLACING, TRUE); |
|
|
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
|
|
}else{ |
|
|
CheckDlgButton(hDlg, IDC_INTERLACING, BST_UNCHECKED); |
|
|
EnableDlgWindow(hDlg, IDC_INTERLACING, FALSE); |
|
|
} |
|
860 |
|
|
861 |
if (profiles[config->profile].flags & PROFILE_QPEL) { |
CheckDlgButton(hDlg, IDC_ZONE_MODE_WEIGHT, config->zones[config->cur_zone].mode == RC_ZONE_WEIGHT); |
862 |
EnableDlgWindow(hDlg, IDC_QPEL, TRUE); |
CheckDlgButton(hDlg, IDC_ZONE_MODE_QUANT, config->zones[config->cur_zone].mode == RC_ZONE_QUANT); |
|
CheckDlgButton(hDlg, IDC_QPEL, config->qpel ? BST_CHECKED : BST_UNCHECKED); |
|
|
}else{ |
|
|
CheckDlgButton(hDlg, IDC_QPEL, BST_UNCHECKED); |
|
|
EnableDlgWindow(hDlg, IDC_QPEL, FALSE); |
|
|
} |
|
|
|
|
|
if (profiles[config->profile].flags & PROFILE_GMC) { |
|
|
EnableDlgWindow(hDlg, IDC_GMC, TRUE); |
|
|
CheckDlgButton(hDlg, IDC_GMC, config->gmc ? BST_CHECKED : BST_UNCHECKED); |
|
|
}else{ |
|
|
CheckDlgButton(hDlg, IDC_GMC, BST_UNCHECKED); |
|
|
EnableDlgWindow(hDlg, IDC_GMC, FALSE); |
|
|
} |
|
863 |
|
|
864 |
if (profiles[config->profile].flags & PROFILE_REDUCED) { |
set_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
865 |
EnableDlgWindow(hDlg, IDC_REDUCED, TRUE); |
set_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
|
CheckDlgButton(hDlg, IDC_REDUCED, config->reduced_resolution ? BST_CHECKED : BST_UNCHECKED); |
|
|
}else{ |
|
|
CheckDlgButton(hDlg, IDC_REDUCED, BST_UNCHECKED); |
|
|
EnableDlgWindow(hDlg, IDC_REDUCED, FALSE); |
|
|
} |
|
866 |
|
|
867 |
if (profiles[config->profile].flags & PROFILE_BVOP) { |
CheckDlgButton(hDlg, IDC_ZONE_FORCEIVOP, config->zones[config->cur_zone].type==XVID_TYPE_IVOP); |
868 |
EnableDlgWindow(hDlg, IDC_BVOP, TRUE); |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
869 |
CheckDlgButton(hDlg, IDC_BVOP, config->use_bvop ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
|
}else{ |
|
|
EnableDlgWindow(hDlg, IDC_BVOP, FALSE); |
|
|
CheckDlgButton(hDlg, IDC_BVOP, BST_UNCHECKED); |
|
|
} |
|
|
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_BQUANTOFFSET, config->bquant_offset, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_BVOP_THRESHOLD, config->bvop_threshold, FALSE); |
|
|
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CLOSEDGOV, config->closed_gov ? BST_CHECKED : BST_UNCHECKED); |
|
870 |
|
|
871 |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
SetDlgItemInt(hDlg, IDC_ZONE_BVOPTHRESHOLD, config->zones[config->cur_zone].bvop_threshold, TRUE); |
872 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
break; |
|
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
|
873 |
|
|
874 |
|
case IDD_MOTION : |
875 |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
876 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
877 |
|
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
878 |
|
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
879 |
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
880 |
|
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
881 |
break; |
break; |
882 |
|
|
883 |
case IDD_QUANT : |
case IDD_QUANT : |
885 |
SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); |
886 |
SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); |
SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); |
887 |
SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); |
888 |
|
SetDlgItemInt(hDlg, IDC_MINBQUANT, config->min_bquant, FALSE); |
889 |
|
SetDlgItemInt(hDlg, IDC_MAXBQUANT, config->max_bquant, FALSE); |
890 |
|
CheckDlg(hDlg, IDC_TRELLISQUANT, config->trellis_quant); |
891 |
break; |
break; |
892 |
|
|
893 |
case IDD_DEBUG : |
case IDD_DEBUG : |
894 |
CheckDlgButton(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX)); |
895 |
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT)); |
896 |
CheckDlgButton(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE)); |
897 |
CheckDlgButton(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2)); |
898 |
CheckDlgButton(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW)); |
899 |
CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT)); |
900 |
|
|
901 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
902 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
903 |
|
|
904 |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
|
CheckDlgButton(hDlg, IDC_CHROMA_OPT, (config->chroma_opt) ? BST_CHECKED : BST_UNCHECKED); |
|
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
|
905 |
|
|
|
CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); |
|
906 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
907 |
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
908 |
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
909 |
|
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
910 |
break; |
break; |
|
|
|
|
case IDD_POSTPROC : |
|
|
// CheckDlgButton(hDlg, IDC_DEBLOCK_Y, config->deblock_y ? BST_CHECKED : BST_UNCHECKED); |
|
|
// CheckDlgButton(hDlg, IDC_DEBLOCK_UV, config->deblock_uv ? BST_CHECKED : BST_UNCHECKED); |
|
|
break; |
|
|
|
|
911 |
} |
} |
912 |
} |
} |
913 |
|
|
920 |
{ |
{ |
921 |
case IDD_PROFILE : |
case IDD_PROFILE : |
922 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_GETCURSEL, 0, 0); |
923 |
|
|
924 |
|
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
925 |
|
config->lum_masking = IsDlgChecked(hDlg, IDC_LUMMASK); |
926 |
|
config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING); |
927 |
|
config->qpel = IsDlgChecked(hDlg, IDC_QPEL); |
928 |
|
config->gmc = IsDlgChecked(hDlg, IDC_GMC); |
929 |
|
config->reduced_resolution = IsDlgChecked(hDlg, IDC_REDUCED); |
930 |
|
|
931 |
|
config->use_bvop = IsDlgChecked(hDlg, IDC_BVOP); |
932 |
|
config->max_bframes = config_get_uint(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
933 |
|
config->bquant_ratio = get_dlgitem_float(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
934 |
|
config->bquant_offset = get_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
935 |
|
config->packed = IsDlgChecked(hDlg, IDC_PACKED); |
936 |
|
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
937 |
|
break; |
938 |
|
|
939 |
|
case IDD_AR: |
940 |
|
config->ar_mode = IsDlgChecked(hDlg, IDC_PAR) ? 0:1; |
941 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
942 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
943 |
|
config->display_aspect_ratio = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
944 |
|
if (config->display_aspect_ratio == 5) { |
945 |
|
config->par_x = config_get_uint(hDlg, IDC_PARX, config->par_x); |
946 |
|
config->par_y = config_get_uint(hDlg, IDC_PARY, config->par_y); |
947 |
|
} |
948 |
|
break; |
949 |
|
|
950 |
|
case IDD_LEVEL : |
951 |
|
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
952 |
break; |
break; |
953 |
|
|
954 |
case IDD_RC_CBR : |
case IDD_RC_CBR : |
968 |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
969 |
|
|
970 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
|
971 |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
972 |
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
973 |
|
|
974 |
|
config->overflow_control_strength = GetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, NULL, FALSE); |
975 |
|
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
976 |
|
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
977 |
|
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
978 |
|
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
979 |
|
CONSTRAINVAL(config->overflow_control_strength, 0, 100); |
980 |
|
|
981 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
982 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
|
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
|
|
config->bitrate_payback_method = IsDlgChecked(hDlg, IDC_PAYBACKPROP); |
|
|
|
|
|
|
|
|
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
|
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
|
983 |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
984 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
985 |
|
|
986 |
|
config->kfthreshold = config_get_uint(hDlg, IDC_MINKEY, config->kfthreshold); |
987 |
|
|
988 |
break; |
break; |
989 |
|
|
990 |
case IDD_RC_2PASS2_ALT : |
case IDD_ZONE : |
991 |
config->use_alt_curve = IsDlgChecked(hDlg, IDC_USEALT); |
config->zones[config->cur_zone].frame = config_get_uint(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame); |
992 |
|
|
993 |
config->alt_curve_use_auto = IsDlgChecked(hDlg, IDC_USEAUTO); |
if (IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT)) { |
994 |
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
config->zones[config->cur_zone].mode = RC_ZONE_WEIGHT; |
995 |
|
}else if (IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT)) { |
996 |
|
config->zones[config->cur_zone].mode = RC_ZONE_QUANT; |
997 |
|
} |
998 |
|
|
999 |
config->alt_curve_use_auto_bonus_bias = IsDlgChecked(hDlg, IDC_USEAUTOBONUS); |
config->zones[config->cur_zone].weight = get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
1000 |
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
config->zones[config->cur_zone].quant = get_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
1001 |
|
|
1002 |
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
config->zones[config->cur_zone].type = IsDlgButtonChecked(hDlg, IDC_ZONE_FORCEIVOP)?XVID_TYPE_IVOP:XVID_TYPE_AUTO; |
1003 |
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
1004 |
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
|
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
|
|
|
|
|
config->twopass_max_bitrate /= CONFIG_KBPS; |
|
|
config->twopass_max_bitrate = config_get_uint(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
|
|
config->twopass_max_bitrate *= CONFIG_KBPS; |
|
|
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
|
|
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
|
1005 |
|
|
1006 |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
config->zones[config->cur_zone].bvop_threshold = config_get_int(hDlg, IDC_ZONE_BVOPTHRESHOLD, config->zones[config->cur_zone].bvop_threshold); |
|
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
|
1007 |
break; |
break; |
1008 |
|
|
1009 |
case IDD_MOTION : |
case IDD_MOTION : |
1010 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
1011 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
|
|
|
1012 |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
1013 |
config->greyscale = IsDlgChecked(hDlg, IDC_GREYSCALE); |
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
1014 |
|
|
|
config->chroma_opt = IsDlgChecked(hDlg, IDC_CHROMA_OPT); |
|
1015 |
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
|
break; |
|
|
|
|
|
case IDD_TOOLS : |
|
|
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
|
|
config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING); |
|
|
config->qpel = IsDlgChecked(hDlg, IDC_QPEL); |
|
|
config->gmc = IsDlgChecked(hDlg, IDC_GMC); |
|
|
config->reduced_resolution = IsDlgChecked(hDlg, IDC_REDUCED); |
|
1016 |
|
|
|
config->use_bvop = IsDlgChecked(hDlg, IDC_BVOP); |
|
|
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
|
|
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
|
|
config->bquant_offset = config_get_uint(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
|
|
config->bvop_threshold = config_get_uint(hDlg, IDC_BVOP_THRESHOLD, config->bvop_threshold); |
|
|
config->packed = IsDlgChecked(hDlg, IDC_PACKED); |
|
|
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
|
|
|
|
|
config->lum_masking = IsDlgChecked(hDlg, IDC_LUMMASK); |
|
1017 |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
|
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
|
1018 |
break; |
break; |
1019 |
|
|
1020 |
case IDD_QUANT : |
case IDD_QUANT : |
1022 |
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
1023 |
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
1024 |
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
1025 |
|
config->min_bquant = config_get_uint(hDlg, IDC_MINBQUANT, config->min_bquant); |
1026 |
|
config->max_bquant = config_get_uint(hDlg, IDC_MAXBQUANT, config->max_bquant); |
1027 |
|
|
1028 |
CONSTRAINVAL(config->min_iquant, 1, 31); |
CONSTRAINVAL(config->min_iquant, 1, 31); |
1029 |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
1030 |
CONSTRAINVAL(config->min_pquant, 1, 31); |
CONSTRAINVAL(config->min_pquant, 1, 31); |
1031 |
CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); |
CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); |
1032 |
|
CONSTRAINVAL(config->min_bquant, 1, 31); |
1033 |
|
CONSTRAINVAL(config->max_bquant, config->min_bquant, 31); |
1034 |
|
|
1035 |
|
config->trellis_quant = IsDlgChecked(hDlg, IDC_TRELLISQUANT); |
1036 |
break; |
break; |
1037 |
|
|
1038 |
case IDD_DEBUG : |
case IDD_DEBUG : |
1048 |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
1049 |
|
|
1050 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
1051 |
config->debug = IsDlgChecked(hDlg, IDC_DEBUG); |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
1052 |
break; |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1053 |
|
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
|
|
|
|
case IDD_POSTPROC : |
|
|
// config->deblock_y = IsDlgChecked(hDlg, IDC_DEBLOCK_Y); |
|
|
// config->deblock_uv = IsDlgChecked(hDlg, IDC_DEBLOCK_UV); |
|
1054 |
break; |
break; |
1055 |
} |
} |
1056 |
} |
} |
1075 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1076 |
|
|
1077 |
adv_init(hDlg, psi->idd, psi->config); |
adv_init(hDlg, psi->idd, psi->config); |
|
adv_upload(hDlg, psi->idd, psi->config); |
|
|
adv_mode(hDlg, psi->idd, psi->config); |
|
1078 |
break; |
break; |
1079 |
|
|
1080 |
case WM_COMMAND : |
case WM_COMMAND : |
1082 |
{ |
{ |
1083 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
1084 |
{ |
{ |
|
case IDC_PROFILE_MPEGQUANT : |
|
|
case IDC_PROFILE_INTERLACE : |
|
|
case IDC_PROFILE_QPEL : |
|
|
case IDC_PROFILE_GMC : |
|
|
case IDC_PROFILE_REDUCED : |
|
|
case IDC_PROFILE_BVOP : |
|
|
case IDC_USEALT : |
|
|
case IDC_USEAUTO : |
|
|
case IDC_USEAUTOBONUS : |
|
1085 |
case IDC_BVOP : |
case IDC_BVOP : |
1086 |
|
case IDC_ZONE_MODE_WEIGHT : |
1087 |
|
case IDC_ZONE_MODE_QUANT : |
1088 |
|
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
1089 |
case IDC_CPU_AUTO : |
case IDC_CPU_AUTO : |
1090 |
case IDC_CPU_FORCE : |
case IDC_CPU_FORCE : |
1091 |
|
case IDC_AR : |
1092 |
|
case IDC_PAR : |
1093 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1094 |
break; |
break; |
1095 |
|
|
1124 |
SetDlgItemText(hDlg, IDC_STATS, tmp); |
SetDlgItemText(hDlg, IDC_STATS, tmp); |
1125 |
} |
} |
1126 |
} |
} |
1127 |
|
|
1128 |
|
case IDC_ZONE_FETCH : |
1129 |
|
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
1130 |
|
break; |
1131 |
|
|
1132 |
|
case IDC_AR_DEFAULT: |
1133 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_PAR); |
1134 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, 0, 0); |
1135 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1136 |
|
break; |
1137 |
|
case IDC_AR_4_3: |
1138 |
|
SetDlgItemInt(hDlg, IDC_ARX, 4, FALSE); |
1139 |
|
SetDlgItemInt(hDlg, IDC_ARY, 3, FALSE); |
1140 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1141 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1142 |
|
break; |
1143 |
|
case IDC_AR_16_9: |
1144 |
|
SetDlgItemInt(hDlg, IDC_ARX, 16, FALSE); |
1145 |
|
SetDlgItemInt(hDlg, IDC_ARY, 9, FALSE); |
1146 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1147 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1148 |
|
break; |
1149 |
|
case IDC_AR_235_100: |
1150 |
|
SetDlgItemInt(hDlg, IDC_ARX, 235, FALSE); |
1151 |
|
SetDlgItemInt(hDlg, IDC_ARY, 100, FALSE); |
1152 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1153 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1154 |
|
break; |
1155 |
|
|
1156 |
|
default : |
1157 |
|
return TRUE; |
1158 |
} |
} |
1159 |
}else if (LOWORD(wParam) == IDC_PROFILE_PROFILE && HIWORD(wParam) == LBN_SELCHANGE) |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1160 |
|
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
1161 |
|
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
1162 |
|
LOWORD(wParam) == IDC_QUANTTYPE || |
1163 |
|
LOWORD(wParam) == IDC_ASPECT_RATIO)) |
1164 |
{ |
{ |
|
adv_download(hDlg, psi->idd, psi->config); |
|
|
adv_upload(hDlg, psi->idd, psi->config); |
|
1165 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1166 |
|
}else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_ZONE_WEIGHT || LOWORD(wParam)==IDC_ZONE_QUANT)) { |
1167 |
|
|
1168 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
1169 |
|
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
1170 |
|
} else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_PARX || LOWORD(wParam)==IDC_PARY)) { |
1171 |
|
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
1172 |
|
if(LOWORD(wParam)==IDC_PARX) |
1173 |
|
psi->config->par_x = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_x); |
1174 |
|
else |
1175 |
|
psi->config->par_y = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_y); |
1176 |
} |
} |
1177 |
|
} else |
1178 |
|
return 0; |
1179 |
|
break; |
1180 |
|
|
1181 |
|
case WM_HSCROLL : |
1182 |
|
if((HWND)lParam == GetDlgItem(hDlg, IDC_ZONE_SLIDER)) { |
1183 |
|
int idc = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT) ? IDC_ZONE_WEIGHT : IDC_ZONE_QUANT; |
1184 |
|
set_dlgitem_float(hDlg, idc, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0) ); |
1185 |
break; |
break; |
1186 |
|
} |
1187 |
|
return 0; |
1188 |
|
|
1189 |
|
|
1190 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1191 |
switch (((NMHDR *)lParam)->code) |
switch (((NMHDR *)lParam)->code) |
1192 |
{ |
{ |
1193 |
|
case PSN_SETACTIVE : |
1194 |
|
OutputDebugString("PSN_SET"); |
1195 |
|
adv_upload(hDlg, psi->idd, psi->config); |
1196 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1197 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1198 |
|
break; |
1199 |
|
|
1200 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1201 |
/* validate */ |
OutputDebugString("PSN_KILL"); |
1202 |
adv_download(hDlg, psi->idd, psi->config); |
adv_download(hDlg, psi->idd, psi->config); |
1203 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1204 |
break; |
break; |
1205 |
|
|
1206 |
case PSN_APPLY : |
case PSN_APPLY : |
1207 |
/* apply */ |
OutputDebugString("PSN_APPLY"); |
|
adv_download(hDlg, psi->idd, psi->config); |
|
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
|
1208 |
psi->config->save = TRUE; |
psi->config->save = TRUE; |
1209 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1210 |
break; |
break; |
1211 |
} |
} |
1212 |
break; |
break; |
1221 |
|
|
1222 |
|
|
1223 |
|
|
1224 |
/* load advanced options property sheet */ |
/* load advanced options property sheet |
1225 |
void adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) |
returns true, if the user accepted the changes |
1226 |
|
or fasle if changes were canceled. |
1227 |
|
|
1228 |
|
*/ |
1229 |
|
BOOL adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) |
1230 |
{ |
{ |
1231 |
PROPSHEETINFO psi[6]; |
PROPSHEETINFO psi[6]; |
1232 |
PROPSHEETPAGE psp[6]; |
PROPSHEETPAGE psp[6]; |
1263 |
PropertySheet(&psh); |
PropertySheet(&psh); |
1264 |
|
|
1265 |
if (temp.save) |
if (temp.save) |
|
{ |
|
1266 |
memcpy(config, &temp, sizeof(CONFIG)); |
memcpy(config, &temp, sizeof(CONFIG)); |
1267 |
} |
|
1268 |
|
return temp.save; |
1269 |
} |
} |
1270 |
|
|
1271 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
1273 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
1274 |
|
|
1275 |
|
|
1276 |
/* downloads data from main dialog */ |
void main_insert_zone(HWND hDlg, zone_t * s, int i, BOOL insert) |
|
|
|
|
void main_download(HWND hDlg, CONFIG * config) |
|
|
{ |
|
|
|
|
|
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
|
|
|
|
|
switch(config->mode) |
|
1277 |
{ |
{ |
1278 |
default : |
char tmp[32]; |
|
case RC_MODE_CBR : |
|
|
config->rc_bitrate = config_get_uint(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
|
|
break; |
|
1279 |
|
|
1280 |
/* case RC_MODE_VBR_QUAL : |
wsprintf(tmp,"%i",s->frame); |
|
config->quality = config_get_uint(hDlg, IDC_VALUE, config->quality); |
|
|
break; */ |
|
1281 |
|
|
1282 |
case RC_MODE_FIXED : |
if (insert) { |
1283 |
config->quant = config_get_uint(hDlg, IDC_VALUE, config->quant); |
LVITEM lvi; |
|
break; |
|
1284 |
|
|
1285 |
case RC_MODE_2PASS2_INT : |
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE; |
1286 |
config->desired_size = config_get_uint(hDlg, IDC_VALUE, config->desired_size); |
lvi.state = 0; |
1287 |
break; |
lvi.stateMask = 0; |
1288 |
|
lvi.iImage = 0; |
1289 |
|
lvi.pszText = tmp; |
1290 |
|
lvi.cchTextMax = strlen(tmp); |
1291 |
|
lvi.iItem = i; |
1292 |
|
lvi.iSubItem = 0; |
1293 |
|
ListView_InsertItem(hDlg, &lvi); |
1294 |
|
}else{ |
1295 |
|
ListView_SetItemText(hDlg, i, 0, tmp); |
1296 |
} |
} |
1297 |
|
|
1298 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
if (s->mode == RC_ZONE_WEIGHT) { |
1299 |
|
sprintf(tmp,"%.2f",(float)s->weight/100); |
1300 |
|
}else if (s->mode == RC_ZONE_QUANT) { |
1301 |
|
sprintf(tmp,"( %.2f )",(float)s->quant/100); |
1302 |
|
}else { |
1303 |
|
strcpy(tmp,"EXT"); |
1304 |
} |
} |
1305 |
|
ListView_SetItemText(hDlg, i, 1, tmp); |
1306 |
|
|
1307 |
|
tmp[0] = '\0'; |
1308 |
|
if (s->type==XVID_TYPE_IVOP) |
1309 |
|
strcat(tmp, "K "); |
1310 |
|
|
1311 |
/* updates the edit box */ |
if (s->greyscale) |
1312 |
|
strcat(tmp, "G "); |
1313 |
|
|
1314 |
void main_value(HWND hDlg, CONFIG* config) |
if (s->chroma_opt) |
1315 |
{ |
strcat(tmp, "C "); |
|
char* text; |
|
|
int value; |
|
|
int enabled = TRUE; |
|
1316 |
|
|
1317 |
switch (config->mode) |
ListView_SetItemText(hDlg, i, 2, tmp); |
1318 |
|
} |
1319 |
|
|
1320 |
|
static int g_use_bitrate = 1; |
1321 |
|
|
1322 |
|
void main_mode(HWND hDlg, CONFIG * config) |
1323 |
{ |
{ |
1324 |
default : |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1325 |
enabled = FALSE; |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1326 |
|
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1327 |
|
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1328 |
|
|
1329 |
case RC_MODE_CBR : |
char buf[16]; |
1330 |
text = "Bitrate (Kbps):"; |
int max; |
|
value = config->rc_bitrate / CONFIG_KBPS; |
|
|
break; |
|
1331 |
|
|
1332 |
/* case DLG_MODE_VBR_QUAL : |
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
|
text = "Quality:"; |
|
|
value = config->quality; |
|
|
break; */ |
|
1333 |
|
|
1334 |
case RC_MODE_FIXED : |
if (g_use_bitrate) { |
1335 |
text = "Quantizer:"; |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
|
value = config->quant; |
|
|
break; |
|
1336 |
|
|
1337 |
case RC_MODE_2PASS2_INT : |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
1338 |
text = "Desired size (Kbtyes):"; |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
|
value = config->desired_size; |
|
|
break; |
|
|
} |
|
1339 |
|
|
1340 |
SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); |
max = profiles[profile].max_bitrate; |
1341 |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
if (max == 0) max = DEFAULT_MAX_KBPS; |
1342 |
|
wsprintf(buf, "%i kbps", max); |
1343 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MAX, buf); |
1344 |
|
|
1345 |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(DEFAULT_MIN_KBPS, max)); |
1346 |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE), enabled); |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1347 |
|
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1348 |
|
|
|
if (config->mode == RC_MODE_CBR || config->mode == RC_MODE_2PASS1 || |
|
|
config->mode == RC_MODE_2PASS2_INT || config->mode == RC_MODE_2PASS2_EXT) { |
|
|
EnableWindow(GetDlgItem(hDlg, IDC_MODE_ADV), TRUE); |
|
1349 |
}else{ |
}else{ |
1350 |
EnableWindow(GetDlgItem(hDlg, IDC_MODE_ADV), FALSE); |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
|
} |
|
1351 |
} |
} |
1352 |
|
|
1353 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1354 |
|
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1355 |
|
|
1356 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
1357 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
1358 |
|
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
1359 |
|
} |
1360 |
|
|
|
/* updates the slider */ |
|
1361 |
|
|
|
void main_slider(HWND hDlg, CONFIG * config) |
|
|
{ |
|
|
char* text; |
|
|
long range; |
|
|
int pos; |
|
|
int enabled = TRUE; |
|
1362 |
|
|
1363 |
switch (config->mode) |
void main_upload(HWND hDlg, CONFIG * config) |
1364 |
{ |
{ |
1365 |
default : |
int i; |
|
enabled = FALSE; |
|
1366 |
|
|
1367 |
case RC_MODE_CBR : |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1368 |
text = "Bitrate (Kbps):"; |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
|
range = MAKELONG(0,10000); |
|
|
pos = config->rc_bitrate / CONFIG_KBPS; |
|
|
break; |
|
1369 |
|
|
1370 |
/* case RC_MODE_VBR_QUAL : |
if (g_use_bitrate) { |
1371 |
text = "Quality:"; |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1372 |
range = MAKELONG(0,100); |
}else{ |
1373 |
pos = config->quality; |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1374 |
break; */ |
} |
1375 |
|
|
1376 |
case RC_MODE_FIXED : |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1377 |
text = "Quantizer:"; |
for (i=0; i < config->num_zones; i++) { |
1378 |
range = MAKELONG(1,31); |
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
|
pos = config->quant; |
|
|
break; |
|
1379 |
} |
} |
1380 |
|
} |
1381 |
|
|
1382 |
|
|
1383 |
SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); |
/* downloads data from main dialog */ |
1384 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); |
void main_download(HWND hDlg, CONFIG * config) |
1385 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); |
{ |
1386 |
|
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1387 |
|
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1388 |
|
|
1389 |
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER_STATIC), enabled); |
if (g_use_bitrate) { |
1390 |
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER), enabled); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1391 |
|
}else{ |
1392 |
|
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1393 |
|
} |
1394 |
} |
} |
1395 |
|
|
1396 |
|
|
1397 |
/* main dialog proc */ |
/* main dialog proc */ |
1398 |
|
|
1399 |
|
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL, IDD_AR }; |
1400 |
|
static const int single_dlgs[] = { IDD_RC_CBR }; |
1401 |
|
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1402 |
|
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1403 |
|
static const int zone_dlgs[] = { IDD_ZONE }; |
1404 |
|
static const int bitrate_dlgs[] = { IDD_CALC }; |
1405 |
|
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1406 |
|
|
1407 |
|
|
1408 |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1409 |
{ |
{ |
1410 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
1414 |
{ |
{ |
1415 |
case WM_INITDIALOG : |
case WM_INITDIALOG : |
1416 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
|
|
|
1417 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
1418 |
|
|
1419 |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
1420 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
|
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
|
|
|
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
|
1421 |
|
|
1422 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Single pass"); |
1423 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Twopass - 1st pass"); |
1424 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Twopass - 2nd pass"); |
1425 |
|
#ifdef _DEBUG |
1426 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null test speed"); |
1427 |
|
#endif |
1428 |
|
|
1429 |
InitCommonControls(); |
InitCommonControls(); |
1430 |
|
|
1439 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1440 |
} |
} |
1441 |
|
|
1442 |
main_slider(hDlg, config); |
SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
|
main_value(hDlg, config); |
|
|
break; |
|
1443 |
|
|
|
case WM_HSCROLL : |
|
|
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) |
|
1444 |
{ |
{ |
1445 |
SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
1446 |
|
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
1447 |
|
ListView_SetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES), ext_style); |
1448 |
} |
} |
1449 |
else |
|
1450 |
{ |
{ |
1451 |
return 0; |
typedef struct { |
1452 |
|
char * name; |
1453 |
|
int value; |
1454 |
|
} char_int_t; |
1455 |
|
|
1456 |
|
const static char_int_t columns[] = { |
1457 |
|
{"Frame #", 64}, |
1458 |
|
{"Weight (Q)", 72}, |
1459 |
|
{"Modifiers", 120}}; |
1460 |
|
|
1461 |
|
LVCOLUMN lvc; |
1462 |
|
int i; |
1463 |
|
|
1464 |
|
/* Initialize the LVCOLUMN structure. */ |
1465 |
|
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
1466 |
|
lvc.fmt = LVCFMT_LEFT; |
1467 |
|
|
1468 |
|
/* Add the columns. */ |
1469 |
|
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
1470 |
|
lvc.pszText = (char*)columns[i].name; |
1471 |
|
lvc.cchTextMax = strlen(columns[i].name); |
1472 |
|
lvc.iSubItem = i; |
1473 |
|
lvc.cx = columns[i].value; /* column width, pixels */ |
1474 |
|
ListView_InsertColumn(GetDlgItem(hDlg,IDC_ZONES), i, &lvc); |
1475 |
} |
} |
1476 |
|
} |
1477 |
|
|
1478 |
|
/* XXX: main_mode needs RC_MODE_xxx, main_upload needs g_use_bitrate set correctly... */ |
1479 |
|
main_upload(hDlg, config); |
1480 |
|
main_mode(hDlg, config); |
1481 |
|
main_upload(hDlg, config); |
1482 |
break; |
break; |
1483 |
|
|
1484 |
case WM_COMMAND : |
case WM_NOTIFY : |
|
if (HIWORD(wParam) == LBN_SELCHANGE && (LOWORD(wParam) == IDC_PROFILE || LOWORD(wParam) == IDC_MODE)) |
|
1485 |
{ |
{ |
1486 |
|
NMHDR * n = (NMHDR*)lParam; |
1487 |
|
|
1488 |
|
if (n->code == NM_DBLCLK) { |
1489 |
|
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
1490 |
|
config->cur_zone = nmlv->iItem; |
1491 |
|
|
1492 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1493 |
main_slider(hDlg, config); |
if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1494 |
main_value(hDlg, config); |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
1495 |
|
} |
1496 |
|
break; |
1497 |
} |
} |
|
else if (LOWORD(wParam) == IDC_PROFILE_ADV && HIWORD(wParam) == BN_CLICKED) /* profile dlg */ |
|
|
{ |
|
|
static const int dlgs[] = { IDD_PROFILE }; |
|
1498 |
|
|
1499 |
adv_dialog(hDlg, config, dlgs, sizeof(dlgs)/sizeof(int)); |
if (n->code == NM_RCLICK) { |
1500 |
if (config->save) |
OutputDebugString("Right click"); |
|
{ |
|
|
config_reg_set(config); |
|
1501 |
} |
} |
1502 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
break; |
1503 |
} |
} |
1504 |
else if (LOWORD(wParam) == IDC_MODE_ADV && HIWORD(wParam) == BN_CLICKED) /* rate control dialog */ |
|
1505 |
{ |
case WM_COMMAND : |
1506 |
if (config->mode == RC_MODE_CBR) { |
if (HIWORD(wParam) == BN_CLICKED) { |
1507 |
static const int dlgs[] = { IDD_RC_CBR }; |
|
1508 |
adv_dialog(hDlg, config, dlgs, sizeof(dlgs)/sizeof(int)); |
switch(LOWORD(wParam)) { |
1509 |
|
case IDC_PROFILE_ADV : |
1510 |
|
main_download(hDlg, config); |
1511 |
|
adv_dialog(hDlg, config, profile_dlgs, sizeof(profile_dlgs)/sizeof(int)); |
1512 |
|
|
1513 |
|
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1514 |
|
main_mode(hDlg, config); |
1515 |
|
break; |
1516 |
|
|
1517 |
|
case IDC_MODE_ADV : |
1518 |
|
main_download(hDlg, config); |
1519 |
|
if (config->mode == RC_MODE_1PASS) { |
1520 |
|
adv_dialog(hDlg, config, single_dlgs, sizeof(single_dlgs)/sizeof(int)); |
1521 |
}else if (config->mode == RC_MODE_2PASS1) { |
}else if (config->mode == RC_MODE_2PASS1) { |
1522 |
static const int dlgs[] = { IDD_RC_2PASS1 }; |
adv_dialog(hDlg, config, pass1_dlgs, sizeof(pass1_dlgs)/sizeof(int)); |
1523 |
adv_dialog(hDlg, config, dlgs, sizeof(dlgs)/sizeof(int)); |
}else if (config->mode == RC_MODE_2PASS2) { |
1524 |
}else if (config->mode == RC_MODE_2PASS2_INT || config->mode == RC_MODE_2PASS2_EXT) { |
adv_dialog(hDlg, config, pass2_dlgs, sizeof(pass2_dlgs)/sizeof(int)); |
|
static const int dlgs[] = { IDD_RC_2PASS2, IDD_RC_2PASS2_ALT}; |
|
|
adv_dialog(hDlg, config, dlgs, sizeof(dlgs)/sizeof(int)); |
|
1525 |
} |
} |
1526 |
if (config->save) |
break; |
1527 |
|
|
1528 |
|
|
1529 |
|
case IDC_BITRATE_S : |
1530 |
|
/* alternate between bitrate/desired_length metrics */ |
1531 |
|
main_download(hDlg, config); |
1532 |
|
config->use_2pass_bitrate = !config->use_2pass_bitrate; |
1533 |
|
main_mode(hDlg, config); |
1534 |
|
main_upload(hDlg, config); |
1535 |
|
break; |
1536 |
|
|
1537 |
|
case IDC_BITRATE_CALC : |
1538 |
|
main_download(hDlg, config); |
1539 |
|
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1540 |
|
//SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1541 |
|
main_mode(hDlg, config); |
1542 |
|
break; |
1543 |
|
|
1544 |
|
case IDC_ADD : |
1545 |
{ |
{ |
1546 |
config_reg_set(config); |
int i, sel, new_frame; |
1547 |
} |
|
1548 |
|
if (config->num_zones >= MAX_ZONES) { |
1549 |
|
MessageBox(hDlg, "Exceeded maximum number of zones.\nIncrease config.h:MAX_ZONES and rebuild.", "Warning", 0); |
1550 |
|
break; |
1551 |
} |
} |
|
else if (LOWORD(wParam) == IDC_ADVANCED && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
static const int dlgs[] = { IDD_MOTION, IDD_TOOLS, IDD_QUANT, IDD_DEBUG}; |
|
|
adv_dialog(hDlg, config, dlgs, sizeof(dlgs)/sizeof(int)); |
|
1552 |
|
|
1553 |
if (config->save) |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1554 |
{ |
|
1555 |
config_reg_set(config); |
if (sel<0) { |
1556 |
|
if (config->ci_valid && config->ci.ciActiveFrame>0) { |
1557 |
|
for(sel=0; sel<config->num_zones-1 && config->zones[sel].frame<config->ci.ciActiveFrame; sel++) ; |
1558 |
|
sel--; |
1559 |
|
new_frame = config->ci.ciActiveFrame; |
1560 |
|
}else{ |
1561 |
|
sel = config->num_zones-1; |
1562 |
|
new_frame = sel<0 ? 0 : config->zones[sel].frame + 1; |
1563 |
} |
} |
1564 |
|
}else{ |
1565 |
|
new_frame = config->zones[sel].frame + 1; |
1566 |
} |
} |
|
else if (LOWORD(wParam) == IDC_DECODER && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
static const int dlgs[] = { IDD_POSTPROC }; |
|
|
adv_dialog(hDlg, config, dlgs, sizeof(dlgs)/sizeof(int)); |
|
1567 |
|
|
1568 |
if (config->save) |
for(i=config->num_zones-1; i>sel; i--) { |
1569 |
{ |
config->zones[i+1] = config->zones[i]; |
|
config_reg_set(config); |
|
1570 |
} |
} |
1571 |
|
config->num_zones++; |
1572 |
|
config->zones[sel+1].frame = new_frame; |
1573 |
|
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
1574 |
|
config->zones[sel+1].weight = 100; |
1575 |
|
config->zones[sel+1].quant = 500; |
1576 |
|
config->zones[sel+1].type = XVID_TYPE_AUTO; |
1577 |
|
config->zones[sel+1].greyscale = 0; |
1578 |
|
config->zones[sel+1].chroma_opt = 0; |
1579 |
|
config->zones[sel+1].bvop_threshold = 0; |
1580 |
|
|
1581 |
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
1582 |
|
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[sel+1], sel+1, TRUE); |
1583 |
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
1584 |
|
break; |
1585 |
} |
} |
|
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
config_reg_default(config); |
|
1586 |
|
|
1587 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
case IDC_REMOVE : |
1588 |
|
{ |
1589 |
|
int i, sel; |
1590 |
|
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1591 |
|
|
1592 |
main_slider(hDlg, config); |
if (sel == -1) { |
1593 |
main_value(hDlg, config); |
MessageBox(hDlg, "Nothing selected", "Warning", 0); |
1594 |
|
break; |
1595 |
} |
} |
|
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
|
|
{ |
|
|
int value = config_get_uint(hDlg, IDC_VALUE, 1); |
|
|
int max = 1; |
|
1596 |
|
|
1597 |
max = (config->mode == RC_MODE_CBR) ? 10000 : |
for (i=sel; i<config->num_zones-1; i++) { |
1598 |
/*((config->mode == DLG_MODE_VBR_QUAL) ? 100 :*/ |
config->zones[i] = config->zones[i+1]; |
1599 |
((config->mode == RC_MODE_FIXED) ? 31 : 1<<30) /*)*/; |
} |
1600 |
|
config->num_zones--; |
1601 |
|
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
1602 |
|
|
1603 |
if (value < 1) |
sel--; |
1604 |
{ |
if (sel==0 && config->num_zones>1) { |
1605 |
value = 1; |
sel=1; |
1606 |
} |
} |
1607 |
if (value > max) |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
1608 |
{ |
break; |
|
value = max; |
|
|
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
|
1609 |
} |
} |
1610 |
|
|
1611 |
if (config->mode != RC_MODE_2PASS2_INT) |
case IDC_EDIT : |
1612 |
{ |
main_download(hDlg, config); |
1613 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1614 |
} |
if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1615 |
|
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
1616 |
} |
} |
1617 |
else if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
break; |
1618 |
{ |
|
1619 |
|
case IDC_ADVANCED : |
1620 |
|
main_download(hDlg, config); |
1621 |
|
adv_dialog(hDlg, config, adv_dlgs, sizeof(adv_dlgs)/sizeof(int)); |
1622 |
|
break; |
1623 |
|
|
1624 |
|
case IDC_DEFAULTS : |
1625 |
|
config_reg_default(config); |
1626 |
|
main_upload(hDlg, config); |
1627 |
|
break; |
1628 |
|
|
1629 |
|
case IDOK : |
1630 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1631 |
config->save = TRUE; |
config->save = TRUE; |
1632 |
EndDialog(hDlg, IDOK); |
EndDialog(hDlg, IDOK); |
1633 |
} |
break; |
1634 |
else if (LOWORD(wParam) == IDCANCEL) |
|
1635 |
{ |
case IDCANCEL : |
1636 |
config->save = FALSE; |
config->save = FALSE; |
1637 |
EndDialog(hDlg, IDCANCEL); |
EndDialog(hDlg, IDCANCEL); |
1638 |
|
break; |
1639 |
} |
} |
1640 |
|
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1641 |
|
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
1642 |
|
|
1643 |
|
main_download(hDlg, config); |
1644 |
|
main_mode(hDlg, config); |
1645 |
|
main_upload(hDlg, config); |
1646 |
|
|
1647 |
|
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
1648 |
|
|
1649 |
|
if (g_use_bitrate) { |
1650 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1651 |
|
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1652 |
|
} |
1653 |
|
|
1654 |
|
}else { |
1655 |
|
return 0; |
1656 |
|
} |
1657 |
|
break; |
1658 |
|
|
1659 |
|
case WM_HSCROLL : |
1660 |
|
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
1661 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
1662 |
break; |
break; |
1663 |
|
} |
1664 |
|
return 0; |
1665 |
|
|
1666 |
default : |
default : |
1667 |
return 0; |
return 0; |
1694 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1695 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
1696 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
1697 |
XVID_MAJOR(info.actual_version), |
XVID_VERSION_MAJOR(info.actual_version), |
1698 |
XVID_MINOR(info.actual_version), |
XVID_VERSION_MINOR(info.actual_version), |
1699 |
XVID_PATCH(info.actual_version), |
XVID_VERSION_PATCH(info.actual_version), |
1700 |
info.build); |
info.build); |
1701 |
|
|
1702 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |
1703 |
|
|
1704 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1705 |
|
|
1706 |
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) |
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) { |
|
{ |
|
1707 |
lfData.lfUnderline = 1; |
lfData.lfUnderline = 1; |
1708 |
|
|
1709 |
hFont = CreateFontIndirect(&lfData); |
hFont = CreateFontIndirect(&lfData); |
1710 |
if (hFont) |
if (hFont) { |
|
{ |
|
1711 |
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
1712 |
} |
} |
1713 |
} |
} |