64 |
#include <xvid.h> /* XviD API */ |
#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 |
|
|
108 |
{ |
{ |
109 |
/* name p@l, 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 |
{ "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100, 10*16368, 2048, 64, 0 }, |
{ "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 |
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */ |
112 |
/* if ac preidition is used, adaptive quantization must not be used */ |
/* 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 }, |
{ "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 }, |
{ "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 }, |
{ "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384, PROFILE_ADAPTQUANT }, |
124 |
{ "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
{ "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 }, |
{ "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 }, |
{ "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 }, |
{ "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 }, |
{ "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
130 |
|
|
149 |
static const REG_INT reg_ints[] = { |
static const REG_INT reg_ints[] = { |
150 |
{"mode", ®.mode, RC_MODE_1PASS}, |
{"mode", ®.mode, RC_MODE_1PASS}, |
151 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
152 |
/* {"desired_size", ®.desired_size, 570000}, not used */ |
{"desired_size", ®.desired_size, 570000}, |
153 |
|
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
154 |
|
|
155 |
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
/* profile */ |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
|
|
{"rc_buffer", ®.rc_buffer, 100}, |
|
|
|
|
|
{"motion_search", ®.motion_search, 6}, |
|
156 |
{"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}, |
|
157 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
158 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
159 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
160 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
161 |
{"chromame", ®.chromame, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
162 |
{"use_bvop", ®.use_bvop, 0}, |
{"use_bvop", ®.use_bvop, 0}, |
163 |
{"max_bframes", ®.max_bframes, 2}, |
{"max_bframes", ®.max_bframes, 2}, |
164 |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
165 |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
166 |
{"packed", ®.packed, 0}, |
{"packed", ®.packed, 0}, |
167 |
{"closed_gov", ®.closed_gov, 1}, |
{"closed_gov", ®.closed_gov, 1}, |
|
{"vop_debug", ®.vop_debug, 0}, |
|
|
{"debug", ®.debug, 0x0}, |
|
|
{"reduced_resolution", ®.reduced_resolution, 0}, |
|
|
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
|
168 |
|
|
169 |
{"min_iquant", ®.min_iquant, 2}, |
/* zones */ |
170 |
{"max_iquant", ®.max_iquant, 31}, |
{"num_zones", ®.num_zones, 1}, |
|
{"min_pquant", ®.min_pquant, 2}, |
|
|
{"max_pquant", ®.max_pquant, 31}, |
|
|
{"min_bquant", ®.min_bquant, 2}, |
|
|
{"max_bquant", ®.max_bquant, 31}, |
|
|
{"trellis_quant", ®.trellis_quant, 0}, |
|
171 |
|
|
172 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
/* single pass */ |
173 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
174 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
175 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
176 |
|
|
177 |
|
/* 2pass1 */ |
178 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
179 |
|
|
180 |
|
/* 2pass2 */ |
181 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
182 |
{"kftreshold", ®.kftreshold, 10}, |
{"kftreshold", ®.kftreshold, 10}, |
183 |
{"kfreduction", ®.kfreduction, 20}, |
{"kfreduction", ®.kfreduction, 20}, |
184 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
{"curve_compression_high", ®.curve_compression_high, 0}, |
188 |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
189 |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
190 |
|
|
191 |
{"num_zones", ®.num_zones, 1}, |
/* motion */ |
192 |
|
{"motion_search", ®.motion_search, 6}, |
193 |
|
{"vhq_mode", ®.vhq_mode, 0}, |
194 |
|
{"chromame", ®.chromame, 0}, |
195 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
196 |
|
{"min_key_interval", ®.min_key_interval, 1}, |
197 |
|
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
198 |
|
|
199 |
|
/* quant */ |
200 |
|
{"min_iquant", ®.min_iquant, 2}, |
201 |
|
{"max_iquant", ®.max_iquant, 31}, |
202 |
|
{"min_pquant", ®.min_pquant, 2}, |
203 |
|
{"max_pquant", ®.max_pquant, 31}, |
204 |
|
{"min_bquant", ®.min_bquant, 2}, |
205 |
|
{"max_bquant", ®.max_bquant, 31}, |
206 |
|
{"trellis_quant", ®.trellis_quant, 0}, |
207 |
|
|
208 |
|
/* debug */ |
209 |
|
{"fourcc_used", ®.fourcc_used, 0}, |
210 |
|
{"debug", ®.debug, 0x0}, |
211 |
|
{"vop_debug", ®.vop_debug, 0}, |
212 |
|
{"display_status", ®.display_status, 1}, |
213 |
}; |
}; |
214 |
|
|
215 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
224 |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
225 |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
226 |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
227 |
|
{"zone%i_type", &stmp.type, XVID_TYPE_AUTO}, |
228 |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
229 |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
230 |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
634 |
break; |
break; |
635 |
|
|
636 |
case IDD_ZONE : |
case IDD_ZONE : |
637 |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
|
config->cur_zone>0 && config->ci_valid && config->ci.ciActiveFrame>0); |
|
638 |
break; |
break; |
639 |
|
|
640 |
case IDD_MOTION : |
case IDD_MOTION : |
805 |
|
|
806 |
case IDD_ZONE : |
case IDD_ZONE : |
807 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
|
SendDlgItemMessage(hDlg, IDC_ZONE_FRAME, EM_SETREADONLY, config->cur_zone==0?TRUE:FALSE, 0); |
|
808 |
|
|
809 |
CheckDlgButton(hDlg, IDC_ZONE_MODE_WEIGHT, config->zones[config->cur_zone].mode == RC_ZONE_WEIGHT); |
CheckDlgButton(hDlg, IDC_ZONE_MODE_WEIGHT, config->zones[config->cur_zone].mode == RC_ZONE_WEIGHT); |
810 |
CheckDlgButton(hDlg, IDC_ZONE_MODE_QUANT, config->zones[config->cur_zone].mode == RC_ZONE_QUANT); |
CheckDlgButton(hDlg, IDC_ZONE_MODE_QUANT, config->zones[config->cur_zone].mode == RC_ZONE_QUANT); |
812 |
set_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
set_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
813 |
set_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
set_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
814 |
|
|
815 |
|
CheckDlgButton(hDlg, IDC_ZONE_FORCEIVOP, config->zones[config->cur_zone].type==XVID_TYPE_IVOP); |
816 |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
817 |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
818 |
|
|
851 |
|
|
852 |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
853 |
|
|
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
|
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
|
854 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
855 |
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
856 |
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
857 |
|
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
858 |
break; |
break; |
859 |
} |
} |
860 |
} |
} |
936 |
config->zones[config->cur_zone].weight = get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
config->zones[config->cur_zone].weight = get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
937 |
config->zones[config->cur_zone].quant = get_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
config->zones[config->cur_zone].quant = get_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
938 |
|
|
939 |
|
config->zones[config->cur_zone].type = IsDlgButtonChecked(hDlg, IDC_ZONE_FORCEIVOP)?XVID_TYPE_IVOP:XVID_TYPE_AUTO; |
940 |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
941 |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
942 |
|
|
985 |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
986 |
|
|
987 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
|
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
|
988 |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
989 |
|
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
990 |
|
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
991 |
break; |
break; |
992 |
} |
} |
993 |
} |
} |
1209 |
ListView_SetItemText(hDlg, i, 1, tmp); |
ListView_SetItemText(hDlg, i, 1, tmp); |
1210 |
|
|
1211 |
tmp[0] = '\0'; |
tmp[0] = '\0'; |
1212 |
|
if (s->type==XVID_TYPE_IVOP) |
1213 |
|
strcat(tmp, "K "); |
1214 |
|
|
1215 |
if (s->greyscale) |
if (s->greyscale) |
1216 |
strcat(tmp, "G "); |
strcat(tmp, "G "); |
1217 |
|
|
1221 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1222 |
} |
} |
1223 |
|
|
1224 |
|
static int g_use_bitrate = 1; |
1225 |
|
|
1226 |
void main_mode(HWND hDlg, CONFIG * config) |
void main_mode(HWND hDlg, CONFIG * config) |
1227 |
{ |
{ |
1228 |
|
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1229 |
|
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1230 |
|
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1231 |
|
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1232 |
|
|
1233 |
char buf[16]; |
char buf[16]; |
|
int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
|
|
int bitrate_en; |
|
1234 |
int max; |
int max; |
1235 |
|
|
1236 |
|
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
1237 |
|
|
1238 |
|
if (g_use_bitrate) { |
1239 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1240 |
|
|
1241 |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
1242 |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
1243 |
|
|
1250 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1251 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1252 |
|
|
1253 |
bitrate_en = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
}else{ |
1254 |
bitrate_en = bitrate_en==RC_MODE_1PASS || bitrate_en==RC_MODE_2PASS2; |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1255 |
|
} |
1256 |
|
|
1257 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1258 |
|
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1259 |
|
|
1260 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
1261 |
EnableDlgWindow(hDlg, IDC_BITRATE, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
1262 |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, bitrate_en); |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
|
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, bitrate_en); |
|
|
EnableDlgWindow(hDlg, IDC_SLIDER, bitrate_en); |
|
1263 |
} |
} |
1264 |
|
|
1265 |
|
|
1266 |
|
|
1267 |
void main_upload(HWND hDlg, CONFIG * config) |
void main_upload(HWND hDlg, CONFIG * config) |
1268 |
{ |
{ |
1269 |
int i; |
int i; |
1270 |
|
|
1271 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1272 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1273 |
|
|
1274 |
|
if (g_use_bitrate) { |
1275 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1276 |
|
}else{ |
1277 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1278 |
|
} |
1279 |
|
|
1280 |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1281 |
for (i=0; i < config->num_zones; i++) { |
for (i=0; i < config->num_zones; i++) { |
1289 |
{ |
{ |
1290 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1291 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1292 |
|
|
1293 |
|
if (g_use_bitrate) { |
1294 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1295 |
|
}else{ |
1296 |
|
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1297 |
|
} |
1298 |
} |
} |
|
|
|
|
|
|
1299 |
|
|
1300 |
|
|
1301 |
/* main dialog proc */ |
/* main dialog proc */ |
1332 |
|
|
1333 |
InitCommonControls(); |
InitCommonControls(); |
1334 |
|
|
|
|
|
1335 |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1336 |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1337 |
NULL, NULL, g_hInst, NULL))) |
NULL, NULL, g_hInst, NULL))) |
1343 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1344 |
} |
} |
1345 |
|
|
1346 |
|
SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
1347 |
|
|
1348 |
{ |
{ |
1349 |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
1350 |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
1379 |
} |
} |
1380 |
} |
} |
1381 |
|
|
1382 |
|
/* XXX: main_mode needs RC_MODE_xxx, main_upload needs g_use_bitrate set correctly... */ |
1383 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1384 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1385 |
|
main_upload(hDlg, config); |
1386 |
break; |
break; |
1387 |
|
|
1388 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1389 |
{ |
{ |
1390 |
NMHDR * n = (NMHDR*)lParam; |
NMHDR * n = (NMHDR*)lParam; |
|
int idc = (int)wParam; |
|
1391 |
|
|
1392 |
if (n->code == NM_DBLCLK) { |
if (n->code == NM_DBLCLK) { |
1393 |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
1429 |
} |
} |
1430 |
break; |
break; |
1431 |
|
|
1432 |
|
|
1433 |
|
case IDC_BITRATE_S : |
1434 |
|
/* alternate between bitrate/desired_length metrics */ |
1435 |
|
main_download(hDlg, config); |
1436 |
|
config->use_2pass_bitrate = !config->use_2pass_bitrate; |
1437 |
|
main_mode(hDlg, config); |
1438 |
|
main_upload(hDlg, config); |
1439 |
|
break; |
1440 |
|
|
1441 |
case IDC_BITRATE_CALC : |
case IDC_BITRATE_CALC : |
1442 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1443 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1450 |
int i, sel, new_frame; |
int i, sel, new_frame; |
1451 |
|
|
1452 |
if (config->num_zones >= MAX_ZONES) { |
if (config->num_zones >= MAX_ZONES) { |
1453 |
MessageBox(hDlg, "MAX_ZONES", "Warning", 0); |
MessageBox(hDlg, "Exceeded maximum number of zones.\nIncrease config.h:MAX_ZONES and rebuild.", "Warning", 0); |
1454 |
break; |
break; |
1455 |
} |
} |
1456 |
|
|
1463 |
new_frame = config->ci.ciActiveFrame; |
new_frame = config->ci.ciActiveFrame; |
1464 |
}else{ |
}else{ |
1465 |
sel = config->num_zones-1; |
sel = config->num_zones-1; |
1466 |
new_frame = config->zones[sel].frame + 1; |
new_frame = sel<0 ? 0 : config->zones[sel].frame + 1; |
1467 |
} |
} |
1468 |
}else{ |
}else{ |
1469 |
new_frame = config->zones[sel].frame + 1; |
new_frame = config->zones[sel].frame + 1; |
1470 |
} |
} |
1471 |
|
|
|
if (sel+1<config->num_zones && config->zones[sel+1].frame==new_frame) { |
|
|
MessageBox(hDlg, "CANT ADD HERE", "Warning", 0); |
|
|
break; |
|
|
} |
|
|
|
|
1472 |
for(i=config->num_zones-1; i>sel; i--) { |
for(i=config->num_zones-1; i>sel; i--) { |
1473 |
config->zones[i+1] = config->zones[i]; |
config->zones[i+1] = config->zones[i]; |
1474 |
} |
} |
1477 |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
1478 |
config->zones[sel+1].weight = 100; |
config->zones[sel+1].weight = 100; |
1479 |
config->zones[sel+1].quant = 500; |
config->zones[sel+1].quant = 500; |
1480 |
|
config->zones[sel+1].type = XVID_TYPE_AUTO; |
1481 |
config->zones[sel+1].greyscale = 0; |
config->zones[sel+1].greyscale = 0; |
1482 |
config->zones[sel+1].chroma_opt = 0; |
config->zones[sel+1].chroma_opt = 0; |
1483 |
config->zones[sel+1].bvop_threshold = 0; |
config->zones[sel+1].bvop_threshold = 0; |
1498 |
break; |
break; |
1499 |
} |
} |
1500 |
|
|
|
if (sel == 0) { |
|
|
MessageBox(hDlg, "Can't remove first zone", "Warning", 0); |
|
|
break; |
|
|
} |
|
|
|
|
1501 |
for (i=sel; i<config->num_zones-1; i++) { |
for (i=sel; i<config->num_zones-1; i++) { |
1502 |
config->zones[i] = config->zones[i+1]; |
config->zones[i] = config->zones[i+1]; |
1503 |
} |
} |
1504 |
config->num_zones--; |
config->num_zones--; |
1505 |
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
1506 |
|
|
|
|
|
1507 |
sel--; |
sel--; |
1508 |
if (sel==0 && config->num_zones>1) { |
if (sel==0 && config->num_zones>1) { |
1509 |
sel=1; |
sel=1; |
1543 |
} |
} |
1544 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1545 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
1546 |
|
|
1547 |
|
main_download(hDlg, config); |
1548 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1549 |
|
main_upload(hDlg, config); |
1550 |
|
|
1551 |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
1552 |
|
|
1553 |
|
if (g_use_bitrate) { |
1554 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1555 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1556 |
|
} |
1557 |
|
|
1558 |
}else { |
}else { |
1559 |
return 0; |
return 0; |
1560 |
} |
} |
1598 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1599 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
1600 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
1601 |
XVID_MAJOR(info.actual_version), |
XVID_VERSION_MAJOR(info.actual_version), |
1602 |
XVID_MINOR(info.actual_version), |
XVID_VERSION_MINOR(info.actual_version), |
1603 |
XVID_PATCH(info.actual_version), |
XVID_VERSION_PATCH(info.actual_version), |
1604 |
info.build); |
info.build); |
1605 |
|
|
1606 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |