73 |
#define CheckDlg(hwnd,idc,value) CheckDlgButton(hwnd,idc, value?BST_CHECKED:BST_UNCHECKED) |
#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 |
|
static void zones_update(HWND hDlg, CONFIG * config); |
77 |
|
|
78 |
HINSTANCE g_hInst; |
HINSTANCE g_hInst; |
79 |
HWND g_hTooltip; |
HWND g_hTooltip; |
80 |
|
|
81 |
|
int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */ |
82 |
|
|
83 |
/* enumerates child windows, assigns tooltips */ |
/* enumerates child windows, assigns tooltips */ |
84 |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
85 |
{ |
{ |
224 |
{"debug", ®.debug, 0x0}, |
{"debug", ®.debug, 0x0}, |
225 |
{"vop_debug", ®.vop_debug, 0}, |
{"vop_debug", ®.vop_debug, 0}, |
226 |
{"display_status", ®.display_status, 1}, |
{"display_status", ®.display_status, 1}, |
227 |
|
|
228 |
|
/* decoder, shared with dshow */ |
229 |
|
{"Deblock_Y", &pp_dy, 0}, |
230 |
|
{"Deblock_UV", &pp_duv, 0}, |
231 |
|
{"Dering", &pp_dr, 0}, |
232 |
|
{"FilmEffect", &pp_fe, 0}, |
233 |
|
|
234 |
}; |
}; |
235 |
|
|
236 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
277 |
|
|
278 |
#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)));} |
279 |
|
|
280 |
|
#define XVID_DLL_NAME "xvidcore.dll" |
281 |
|
|
282 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
283 |
{ |
{ |
284 |
char tmp[32]; |
char tmp[32]; |
286 |
DWORD size; |
DWORD size; |
287 |
int i,j; |
int i,j; |
288 |
xvid_gbl_info_t info; |
xvid_gbl_info_t info; |
289 |
|
HINSTANCE m_hdll; |
290 |
|
|
291 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
292 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
293 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
294 |
|
m_hdll = LoadLibrary(XVID_DLL_NAME); |
295 |
|
if (m_hdll != NULL) { |
296 |
|
|
297 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
298 |
|
(0, XVID_GBL_INFO, &info, NULL); |
299 |
|
|
300 |
|
FreeLibrary(m_hdll); |
301 |
|
} |
302 |
|
|
303 |
reg.cpu = info.cpu_flags; |
reg.cpu = info.cpu_flags; |
304 |
reg.num_threads = info.num_threads; |
reg.num_threads = info.num_threads; |
305 |
|
|
933 |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
934 |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
935 |
break; |
break; |
936 |
|
|
937 |
|
case IDD_DEC : |
938 |
|
CheckDlg(hDlg, IDC_DEC_DY, pp_dy); |
939 |
|
CheckDlg(hDlg, IDC_DEC_DUV, pp_duv); |
940 |
|
CheckDlg(hDlg, IDC_DEC_DR, pp_dr); |
941 |
|
CheckDlg(hDlg, IDC_DEC_FE, pp_fe); |
942 |
|
break; |
943 |
} |
} |
944 |
} |
} |
945 |
|
|
1085 |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1086 |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1087 |
break; |
break; |
1088 |
|
|
1089 |
|
case IDD_DEC : |
1090 |
|
pp_dy = IsDlgChecked(hDlg, IDC_DEC_DY); |
1091 |
|
pp_duv = IsDlgChecked(hDlg, IDC_DEC_DUV); |
1092 |
|
pp_dr = IsDlgChecked(hDlg, IDC_DEC_DR); |
1093 |
|
pp_fe = IsDlgChecked(hDlg, IDC_DEC_FE); |
1094 |
|
break; |
1095 |
} |
} |
1096 |
} |
} |
1097 |
|
|
1336 |
} |
} |
1337 |
|
|
1338 |
if (s->mode == RC_ZONE_WEIGHT) { |
if (s->mode == RC_ZONE_WEIGHT) { |
1339 |
sprintf(tmp,"%.2f",(float)s->weight/100); |
sprintf(tmp,"W %.2f",(float)s->weight/100); |
1340 |
}else if (s->mode == RC_ZONE_QUANT) { |
}else if (s->mode == RC_ZONE_QUANT) { |
1341 |
sprintf(tmp,"( %.2f )",(float)s->quant/100); |
sprintf(tmp,"Q %.2f",(float)s->quant/100); |
1342 |
}else { |
}else { |
1343 |
strcpy(tmp,"EXT"); |
strcpy(tmp,"EXT"); |
1344 |
} |
} |
1402 |
|
|
1403 |
void main_upload(HWND hDlg, CONFIG * config) |
void main_upload(HWND hDlg, CONFIG * config) |
1404 |
{ |
{ |
|
int i; |
|
1405 |
|
|
1406 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1407 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1412 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1413 |
} |
} |
1414 |
|
|
1415 |
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); |
|
|
} |
|
|
} |
|
1416 |
|
|
1417 |
|
|
1418 |
/* downloads data from main dialog */ |
/* downloads data from main dialog */ |
1436 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1437 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1438 |
static const int zone_dlgs[] = { IDD_ZONE }; |
static const int zone_dlgs[] = { IDD_ZONE }; |
1439 |
static const int bitrate_dlgs[] = { IDD_CALC }; |
static const int decoder_dlgs[] = { IDD_DEC }; |
1440 |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1441 |
|
|
1442 |
|
|
1490 |
|
|
1491 |
const static char_int_t columns[] = { |
const static char_int_t columns[] = { |
1492 |
{"Frame #", 64}, |
{"Frame #", 64}, |
1493 |
{"Weight (Q)", 72}, |
{"Weight/Quant", 82}, |
1494 |
{"Modifiers", 120}}; |
{"Modifiers", 120}}; |
1495 |
|
|
1496 |
LVCOLUMN lvc; |
LVCOLUMN lvc; |
1526 |
|
|
1527 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1528 |
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))) { |
1529 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1530 |
} |
} |
1531 |
break; |
break; |
1532 |
} |
} |
1569 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1570 |
break; |
break; |
1571 |
|
|
1572 |
case IDC_BITRATE_CALC : |
case IDC_DECODER : |
1573 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1574 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, decoder_dlgs, sizeof(decoder_dlgs)/sizeof(int)); |
|
//SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
|
1575 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1576 |
break; |
break; |
1577 |
|
|
1613 |
config->zones[sel+1].bvop_threshold = 0; |
config->zones[sel+1].bvop_threshold = 0; |
1614 |
|
|
1615 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
1616 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[sel+1], sel+1, TRUE); |
zones_update(hDlg, config); |
1617 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
1618 |
break; |
break; |
1619 |
} |
} |
1623 |
int i, sel; |
int i, sel; |
1624 |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1625 |
|
|
1626 |
if (sel == -1) { |
if (sel == -1 || config->num_zones < 1) { |
1627 |
MessageBox(hDlg, "Nothing selected", "Warning", 0); |
/*MessageBox(hDlg, "Nothing selected", "Warning", 0);*/ |
1628 |
break; |
break; |
1629 |
} |
} |
1630 |
|
|
1631 |
for (i=sel; i<config->num_zones-1; i++) { |
for (i=sel; i<config->num_zones-1; i++) |
1632 |
config->zones[i] = config->zones[i+1]; |
config->zones[i] = config->zones[i+1]; |
1633 |
} |
|
1634 |
config->num_zones--; |
config->num_zones--; |
|
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
|
1635 |
|
|
1636 |
sel--; |
zones_update(hDlg, config); |
|
if (sel==0 && config->num_zones>1) { |
|
|
sel=1; |
|
|
} |
|
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
|
1637 |
break; |
break; |
1638 |
} |
} |
1639 |
|
|
1641 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1642 |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1643 |
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))) { |
1644 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1645 |
} |
} |
1646 |
break; |
break; |
1647 |
|
|
1715 |
char core[100]; |
char core[100]; |
1716 |
HFONT hFont; |
HFONT hFont; |
1717 |
LOGFONT lfData; |
LOGFONT lfData; |
1718 |
|
HINSTANCE m_hdll; |
1719 |
|
|
1720 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1721 |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
1722 |
|
|
1723 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
1724 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1725 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
1726 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
1727 |
|
if (m_hdll != NULL) { |
1728 |
|
|
1729 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
1730 |
|
(0, XVID_GBL_INFO, &info, NULL); |
1731 |
|
|
1732 |
|
wsprintf(core, "xvidcore.dll version %d.%d.%d (\"%s\")", |
1733 |
XVID_VERSION_MAJOR(info.actual_version), |
XVID_VERSION_MAJOR(info.actual_version), |
1734 |
XVID_VERSION_MINOR(info.actual_version), |
XVID_VERSION_MINOR(info.actual_version), |
1735 |
XVID_VERSION_PATCH(info.actual_version), |
XVID_VERSION_PATCH(info.actual_version), |
1736 |
info.build); |
info.build); |
1737 |
|
|
1738 |
|
FreeLibrary(m_hdll); |
1739 |
|
} else { |
1740 |
|
wsprintf(core, "xvidcore.dll not found!"); |
1741 |
|
} |
1742 |
|
|
1743 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |
1744 |
|
|
1745 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1757 |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
1758 |
} |
} |
1759 |
break; |
break; |
|
|
|
1760 |
case WM_CTLCOLORSTATIC : |
case WM_CTLCOLORSTATIC : |
1761 |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
1762 |
{ |
{ |
1783 |
|
|
1784 |
return 1; |
return 1; |
1785 |
} |
} |
1786 |
|
|
1787 |
|
static void |
1788 |
|
sort_zones(zone_t * zones, int zone_num, int * sel) |
1789 |
|
{ |
1790 |
|
int i, j; |
1791 |
|
zone_t tmp; |
1792 |
|
for (i = 0; i < zone_num; i++) { |
1793 |
|
int cur = i; |
1794 |
|
int min_f = zones[i].frame; |
1795 |
|
for (j = i + 1; j < zone_num; j++) { |
1796 |
|
if (zones[j].frame < min_f) { |
1797 |
|
min_f = zones[j].frame; |
1798 |
|
cur = j; |
1799 |
|
} |
1800 |
|
} |
1801 |
|
if (cur != i) { |
1802 |
|
tmp = zones[i]; |
1803 |
|
zones[i] = zones[cur]; |
1804 |
|
zones[cur] = tmp; |
1805 |
|
if (i == *sel) *sel = cur; |
1806 |
|
else if (cur == *sel) *sel = i; |
1807 |
|
} |
1808 |
|
} |
1809 |
|
} |
1810 |
|
|
1811 |
|
|
1812 |
|
static void |
1813 |
|
zones_update(HWND hDlg, CONFIG * config) |
1814 |
|
{ |
1815 |
|
int i, sel; |
1816 |
|
|
1817 |
|
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1818 |
|
|
1819 |
|
sort_zones(config->zones, config->num_zones, &sel); |
1820 |
|
|
1821 |
|
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1822 |
|
|
1823 |
|
for (i = 0; i < config->num_zones; i++) |
1824 |
|
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
1825 |
|
|
1826 |
|
if (sel == -1 && config->num_zones > 0) sel = 0; |
1827 |
|
if (sel >= config->num_zones) sel = config->num_zones-1; |
1828 |
|
|
1829 |
|
config->cur_zone = sel; |
1830 |
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
1831 |
|
} |