202 |
{"vhq_mode", ®.vhq_mode, 1}, |
{"vhq_mode", ®.vhq_mode, 1}, |
203 |
{"chromame", ®.chromame, 1}, |
{"chromame", ®.chromame, 1}, |
204 |
{"cartoon_mode", ®.cartoon_mode, 0}, |
{"cartoon_mode", ®.cartoon_mode, 0}, |
205 |
|
{"turbo", ®.turbo, 0}, |
206 |
{"max_key_interval", ®.max_key_interval, 300}, |
{"max_key_interval", ®.max_key_interval, 300}, |
207 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
208 |
|
|
266 |
|
|
267 |
#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)));} |
268 |
|
|
269 |
|
#define XVID_DLL_NAME "xvidcore.dll" |
270 |
|
|
271 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
272 |
{ |
{ |
273 |
char tmp[32]; |
char tmp[32]; |
275 |
DWORD size; |
DWORD size; |
276 |
int i,j; |
int i,j; |
277 |
xvid_gbl_info_t info; |
xvid_gbl_info_t info; |
278 |
|
HINSTANCE m_hdll; |
279 |
|
|
280 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
281 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
282 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
283 |
|
m_hdll = LoadLibrary(XVID_DLL_NAME); |
284 |
|
if (m_hdll != NULL) { |
285 |
|
|
286 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
287 |
|
(0, XVID_GBL_INFO, &info, NULL); |
288 |
|
|
289 |
|
FreeLibrary(m_hdll); |
290 |
|
} |
291 |
|
|
292 |
reg.cpu = info.cpu_flags; |
reg.cpu = info.cpu_flags; |
293 |
reg.num_threads = info.num_threads; |
reg.num_threads = info.num_threads; |
294 |
|
|
705 |
int weight_en, quant_en; |
int weight_en, quant_en; |
706 |
int cpu_force; |
int cpu_force; |
707 |
int custom_quant, bvops; |
int custom_quant, bvops; |
708 |
int ar_mode, ar_par, ar_select; |
int ar_mode, ar_par; |
709 |
|
|
710 |
switch(idd) { |
switch(idd) { |
711 |
case IDD_PROFILE : |
case IDD_PROFILE : |
889 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
890 |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
891 |
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
892 |
|
CheckDlg(hDlg, IDC_TURBO, config->turbo); |
893 |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
894 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
895 |
break; |
break; |
1025 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
1026 |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
1027 |
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
1028 |
|
config->turbo = IsDlgChecked(hDlg, IDC_TURBO); |
1029 |
|
|
1030 |
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); |
1031 |
|
|
1311 |
} |
} |
1312 |
|
|
1313 |
if (s->mode == RC_ZONE_WEIGHT) { |
if (s->mode == RC_ZONE_WEIGHT) { |
1314 |
sprintf(tmp,"%.2f",(float)s->weight/100); |
sprintf(tmp,"W %.2f",(float)s->weight/100); |
1315 |
}else if (s->mode == RC_ZONE_QUANT) { |
}else if (s->mode == RC_ZONE_QUANT) { |
1316 |
sprintf(tmp,"( %.2f )",(float)s->quant/100); |
sprintf(tmp,"Q %.2f",(float)s->quant/100); |
1317 |
}else { |
}else { |
1318 |
strcpy(tmp,"EXT"); |
strcpy(tmp,"EXT"); |
1319 |
} |
} |
1377 |
|
|
1378 |
void main_upload(HWND hDlg, CONFIG * config) |
void main_upload(HWND hDlg, CONFIG * config) |
1379 |
{ |
{ |
|
int i; |
|
1380 |
|
|
1381 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1382 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1387 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1388 |
} |
} |
1389 |
|
|
1390 |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
zones_update(hDlg, config);} |
|
for (i=0; i < config->num_zones; i++) { |
|
|
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
|
|
} |
|
|
} |
|
1391 |
|
|
1392 |
|
|
1393 |
/* downloads data from main dialog */ |
/* downloads data from main dialog */ |
1465 |
|
|
1466 |
const static char_int_t columns[] = { |
const static char_int_t columns[] = { |
1467 |
{"Frame #", 64}, |
{"Frame #", 64}, |
1468 |
{"Weight (Q)", 72}, |
{"Weight/Quant", 82}, |
1469 |
{"Modifiers", 120}}; |
{"Modifiers", 120}}; |
1470 |
|
|
1471 |
LVCOLUMN lvc; |
LVCOLUMN lvc; |
1501 |
|
|
1502 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1503 |
if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1504 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1505 |
} |
} |
1506 |
break; |
break; |
1507 |
} |
} |
1589 |
config->zones[sel+1].bvop_threshold = 0; |
config->zones[sel+1].bvop_threshold = 0; |
1590 |
|
|
1591 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
1592 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[sel+1], sel+1, TRUE); |
zones_update(hDlg, config); |
1593 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
1594 |
break; |
break; |
1595 |
} |
} |
1599 |
int i, sel; |
int i, sel; |
1600 |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1601 |
|
|
1602 |
if (sel == -1) { |
if (sel == -1 || config->num_zones < 1) { |
1603 |
MessageBox(hDlg, "Nothing selected", "Warning", 0); |
/*MessageBox(hDlg, "Nothing selected", "Warning", 0);*/ |
1604 |
break; |
break; |
1605 |
} |
} |
1606 |
|
|
1607 |
for (i=sel; i<config->num_zones-1; i++) { |
for (i=sel; i<config->num_zones-1; i++) |
1608 |
config->zones[i] = config->zones[i+1]; |
config->zones[i] = config->zones[i+1]; |
1609 |
} |
|
1610 |
config->num_zones--; |
config->num_zones--; |
|
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
|
1611 |
|
|
1612 |
sel--; |
zones_update(hDlg, config); |
|
if (sel==0 && config->num_zones>1) { |
|
|
sel=1; |
|
|
} |
|
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
|
1613 |
break; |
break; |
1614 |
} |
} |
1615 |
|
|
1617 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1618 |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1619 |
if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1620 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1621 |
} |
} |
1622 |
break; |
break; |
1623 |
|
|
1691 |
char core[100]; |
char core[100]; |
1692 |
HFONT hFont; |
HFONT hFont; |
1693 |
LOGFONT lfData; |
LOGFONT lfData; |
1694 |
|
HINSTANCE m_hdll; |
1695 |
|
|
1696 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1697 |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
1698 |
|
|
1699 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
1700 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1701 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
1702 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
1703 |
|
if (m_hdll != NULL) { |
1704 |
|
|
1705 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
1706 |
|
(0, XVID_GBL_INFO, &info, NULL); |
1707 |
|
|
1708 |
|
wsprintf(core, "xvidcore.dll version %d.%d.%d (\"%s\")", |
1709 |
XVID_VERSION_MAJOR(info.actual_version), |
XVID_VERSION_MAJOR(info.actual_version), |
1710 |
XVID_VERSION_MINOR(info.actual_version), |
XVID_VERSION_MINOR(info.actual_version), |
1711 |
XVID_VERSION_PATCH(info.actual_version), |
XVID_VERSION_PATCH(info.actual_version), |
1712 |
info.build); |
info.build); |
1713 |
|
|
1714 |
|
FreeLibrary(m_hdll); |
1715 |
|
} else { |
1716 |
|
wsprintf(core, "xvidcore.dll not found!"); |
1717 |
|
} |
1718 |
|
|
1719 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |
1720 |
|
|
1721 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1733 |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
1734 |
} |
} |
1735 |
break; |
break; |
|
|
|
1736 |
case WM_CTLCOLORSTATIC : |
case WM_CTLCOLORSTATIC : |
1737 |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
1738 |
{ |
{ |
1759 |
|
|
1760 |
return 1; |
return 1; |
1761 |
} |
} |
1762 |
|
|
1763 |
|
static void |
1764 |
|
sort_zones(zone_t * zones, int zone_num, int * sel) |
1765 |
|
{ |
1766 |
|
int i, j; |
1767 |
|
zone_t tmp; |
1768 |
|
for (i = 0; i < zone_num; i++) { |
1769 |
|
int cur = i; |
1770 |
|
int min_f = zones[i].frame; |
1771 |
|
for (j = i + 1; j < zone_num; j++) { |
1772 |
|
if (zones[j].frame < min_f) { |
1773 |
|
min_f = zones[j].frame; |
1774 |
|
cur = j; |
1775 |
|
} |
1776 |
|
} |
1777 |
|
if (cur != i) { |
1778 |
|
tmp = zones[i]; |
1779 |
|
zones[i] = zones[cur]; |
1780 |
|
zones[cur] = tmp; |
1781 |
|
if (i == *sel) *sel = cur; |
1782 |
|
else if (cur == *sel) *sel = i; |
1783 |
|
} |
1784 |
|
} |
1785 |
|
} |
1786 |
|
|
1787 |
|
|
1788 |
|
static void |
1789 |
|
zones_update(HWND hDlg, CONFIG * config) |
1790 |
|
{ |
1791 |
|
int i, sel; |
1792 |
|
|
1793 |
|
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1794 |
|
|
1795 |
|
sort_zones(config->zones, config->num_zones, &sel); |
1796 |
|
|
1797 |
|
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1798 |
|
|
1799 |
|
for (i = 0; i < config->num_zones; i++) |
1800 |
|
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
1801 |
|
|
1802 |
|
if (sel == -1 && config->num_zones > 0) sel = 0; |
1803 |
|
if (sel >= config->num_zones) sel = config->num_zones-1; |
1804 |
|
|
1805 |
|
config->cur_zone = sel; |
1806 |
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
1807 |
|
} |