78 |
HINSTANCE g_hInst; |
HINSTANCE g_hInst; |
79 |
HWND g_hTooltip; |
HWND g_hTooltip; |
80 |
|
|
81 |
|
static int g_use_bitrate = 1; |
82 |
int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */ |
int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */ |
83 |
|
|
84 |
/* enumerates child windows, assigns tooltips */ |
/* enumerates child windows, assigns tooltips */ |
158 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
159 |
{"desired_size", ®.desired_size, 570000}, |
{"desired_size", ®.desired_size, 570000}, |
160 |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
161 |
|
{"desired_quant", ®.desired_quant, DEFAULT_QUANT}, /* 100-base float */ |
162 |
|
|
163 |
/* profile */ |
/* profile */ |
164 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
194 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
195 |
|
|
196 |
/* 2pass2 */ |
/* 2pass2 */ |
197 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
{"keyframe_boost", ®.keyframe_boost, 10}, |
198 |
{"kfreduction", ®.kfreduction, 20}, |
{"kfreduction", ®.kfreduction, 20}, |
199 |
{"kfthreshold", ®.kfthreshold, 1}, |
{"kfthreshold", ®.kfthreshold, 1}, |
200 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
{"curve_compression_high", ®.curve_compression_high, 0}, |
236 |
}; |
}; |
237 |
|
|
238 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
239 |
{"profile", reg.profile_name, "(unrestricted)"}, |
{"profile", reg.profile_name, "AS @ L5"}, |
240 |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
241 |
}; |
}; |
242 |
|
|
1150 |
ofn.lStructSize = sizeof(OPENFILENAME); |
ofn.lStructSize = sizeof(OPENFILENAME); |
1151 |
|
|
1152 |
ofn.hwndOwner = hDlg; |
ofn.hwndOwner = hDlg; |
1153 |
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
ofn.lpstrFilter = "bitrate curve (*.pass)\0*.pass\0All files (*.*)\0*.*\0\0"; |
1154 |
ofn.lpstrFile = tmp; |
ofn.lpstrFile = tmp; |
1155 |
ofn.nMaxFile = MAX_PATH; |
ofn.nMaxFile = MAX_PATH; |
1156 |
ofn.Flags = OFN_PATHMUSTEXIST; |
ofn.Flags = OFN_PATHMUSTEXIST; |
1359 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1360 |
} |
} |
1361 |
|
|
|
static int g_use_bitrate = 1; |
|
|
|
|
1362 |
void main_mode(HWND hDlg, CONFIG * config) |
void main_mode(HWND hDlg, CONFIG * config) |
1363 |
{ |
{ |
1364 |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1365 |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1366 |
/* enable target rate/size control only for 1pass and 2pass modes*/ |
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1367 |
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1368 |
|
const int target_en_slider = rc_mode==RC_MODE_1PASS || |
1369 |
|
(rc_mode==RC_MODE_2PASS2 && config->use_2pass_bitrate); |
1370 |
|
|
1371 |
char buf[16]; |
char buf[16]; |
1372 |
int max; |
int max; |
1373 |
|
|
1374 |
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
g_use_bitrate = config->use_2pass_bitrate; |
1375 |
|
|
1376 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1377 |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1388 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1389 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1390 |
|
|
1391 |
}else{ |
} else if (rc_mode==RC_MODE_2PASS2) { |
1392 |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1393 |
|
} else if (rc_mode==RC_MODE_1PASS) { |
1394 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target quantizer:"); |
1395 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(100, 3100)); |
1396 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1397 |
|
get_dlgitem_float(hDlg, IDC_BITRATE, DEFAULT_QUANT )); |
1398 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MIN, "1 (maximum quality)"); |
1399 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MAX, "(smallest file) 31"); |
1400 |
|
|
1401 |
} |
} |
1402 |
|
|
1403 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1404 |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1405 |
|
|
1406 |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en_slider); |
1407 |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en_slider); |
1408 |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en_slider); |
1409 |
} |
} |
1410 |
|
|
1411 |
|
|
1416 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1417 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1418 |
|
|
1419 |
|
g_use_bitrate = config->use_2pass_bitrate; |
1420 |
|
|
1421 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1422 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1423 |
}else{ |
} else if (config->mode == RC_MODE_2PASS2) { |
1424 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1425 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1426 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1427 |
} |
} |
1428 |
|
|
1429 |
zones_update(hDlg, config);} |
zones_update(hDlg, config);} |
1437 |
|
|
1438 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1439 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1440 |
}else{ |
} else if (config->mode == RC_MODE_2PASS2) { |
1441 |
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1442 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1443 |
|
config->desired_quant = get_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1444 |
} |
} |
1445 |
} |
} |
1446 |
|
|
1668 |
|
|
1669 |
case IDC_DEFAULTS : |
case IDC_DEFAULTS : |
1670 |
config_reg_default(config); |
config_reg_default(config); |
1671 |
|
main_mode(hDlg, config); |
1672 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1673 |
break; |
break; |
1674 |
|
|
1686 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1687 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
1688 |
|
|
1689 |
main_download(hDlg, config); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1690 |
|
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1691 |
|
|
1692 |
|
if (!g_use_bitrate) { |
1693 |
|
if (config->mode == RC_MODE_1PASS) |
1694 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, config->desired_quant); |
1695 |
|
else if (config->mode == RC_MODE_2PASS2) |
1696 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1697 |
|
} |
1698 |
|
|
1699 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1700 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1701 |
|
|
1704 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1705 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1706 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1707 |
|
} else if (config->mode == RC_MODE_1PASS) { |
1708 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1709 |
|
get_dlgitem_float(hDlg, IDC_BITRATE, DEFAULT_QUANT) ); |
1710 |
} |
} |
1711 |
|
main_download(hDlg, config); |
1712 |
|
|
1713 |
}else { |
}else { |
1714 |
return 0; |
return 0; |
1717 |
|
|
1718 |
case WM_HSCROLL : |
case WM_HSCROLL : |
1719 |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
1720 |
|
if (config->mode == RC_MODE_2PASS2) |
1721 |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
1722 |
|
else |
1723 |
|
set_dlgitem_float(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0)); |
1724 |
|
|
1725 |
|
main_download(hDlg, config); |
1726 |
break; |
break; |
1727 |
} |
} |
1728 |
return 0; |
return 0; |
1819 |
return 1; |
return 1; |
1820 |
} |
} |
1821 |
|
|
1822 |
static void |
void |
1823 |
sort_zones(zone_t * zones, int zone_num, int * sel) |
sort_zones(zone_t * zones, int zone_num, int * sel) |
1824 |
{ |
{ |
1825 |
int i, j; |
int i, j; |