59 |
#include <commctrl.h> |
#include <commctrl.h> |
60 |
#include <shlobj.h> |
#include <shlobj.h> |
61 |
#include <prsht.h> |
#include <prsht.h> |
62 |
|
#ifdef _SMP |
63 |
|
#include <pthread.h> |
64 |
|
#endif |
65 |
|
|
66 |
#include "codec.h" |
#include "codec.h" |
67 |
#include "config.h" |
#include "config.h" |
69 |
#include "resource.h" |
#include "resource.h" |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
/* registry info structs */ |
/* registry info structs */ |
74 |
|
|
75 |
CONFIG reg; |
CONFIG reg; |
91 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
92 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
93 |
#ifdef BFRAMES |
#ifdef BFRAMES |
94 |
{"max_bframes", ®.max_bframes, 0}, |
{"max_bframes", ®.max_bframes, -1}, |
95 |
{"bquant_ratio", ®.bquant_ratio, 200}, |
{"bquant_ratio", ®.bquant_ratio, 200}, |
96 |
{"packed", ®.packed, 1}, |
{"packed", ®.packed, 0}, |
97 |
#endif BFRAMES |
{"dx50bvop", ®.dx50bvop, 0}, |
98 |
|
{"debug", ®.debug, 0}, |
99 |
|
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
100 |
|
#endif |
101 |
|
|
102 |
{"min_iquant", ®.min_iquant, 1}, |
{"min_iquant", ®.min_iquant, 1}, |
103 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
108 |
{"keyframe_boost", ®.keyframe_boost, 20}, |
{"keyframe_boost", ®.keyframe_boost, 20}, |
109 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
110 |
{"dummy2pass", ®.dummy2pass, 0}, |
{"dummy2pass", ®.dummy2pass, 0}, |
111 |
|
// added by koepi for new two-pass curve treatment |
112 |
|
{"kftreshold", ®.kftreshold, 10}, |
113 |
|
{"kfreduction", ®.kfreduction, 30}, |
114 |
|
// end of koepi's additions |
115 |
{"curve_compression_high", ®.curve_compression_high, 25}, |
{"curve_compression_high", ®.curve_compression_high, 25}, |
116 |
{"curve_compression_low", ®.curve_compression_low, 10}, |
{"curve_compression_low", ®.curve_compression_low, 10}, |
117 |
{"use_alt_curve", ®.use_alt_curve, 0}, |
{"use_alt_curve", ®.use_alt_curve, 0}, |
163 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
164 |
int i; |
int i; |
165 |
|
|
166 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = XVID_CPU_CHKONLY; |
167 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
168 |
config->cpu = init_param.cpu_flags; |
reg.cpu = init_param.cpu_flags; |
169 |
|
|
170 |
|
#ifdef _SMP |
171 |
|
reg.num_threads = pthread_num_processors_np(); |
172 |
|
#endif |
173 |
|
|
174 |
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); |
175 |
|
|
492 |
// create arrays of controls to be disabled for each mode |
// create arrays of controls to be disabled for each mode |
493 |
const short twopass_disable[] = { |
const short twopass_disable[] = { |
494 |
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
495 |
|
// added by koepi for new curve treatment |
496 |
|
IDC_KFTRESHOLD, IDC_KFREDUCTION, |
497 |
|
//end of koepi's additions |
498 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
499 |
IDC_STATS2, IDC_STATS2_BROWSE, |
IDC_STATS2, IDC_STATS2_BROWSE, |
500 |
}; |
}; |
634 |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
635 |
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
636 |
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
637 |
|
CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); |
638 |
|
CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); |
639 |
#endif |
#endif |
640 |
break; |
break; |
641 |
|
|
650 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
651 |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
652 |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
653 |
|
// added by koepi for new 2pass curve treatment |
654 |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
655 |
|
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
656 |
|
// end of koepi's additions |
657 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
658 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
659 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
724 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
725 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
726 |
|
|
727 |
|
#ifdef _SMP |
728 |
|
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
729 |
|
#endif |
730 |
|
|
731 |
|
#ifdef BFRAMES |
732 |
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
733 |
|
#endif |
734 |
|
|
735 |
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
736 |
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
737 |
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
762 |
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
763 |
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
764 |
config->packed = ISDLGSET(IDC_PACKED); |
config->packed = ISDLGSET(IDC_PACKED); |
765 |
|
config->dx50bvop = ISDLGSET(IDC_DX50BVOP); |
766 |
|
config->debug = ISDLGSET(IDC_DEBUG); |
767 |
#endif |
#endif |
768 |
break; |
break; |
769 |
|
|
781 |
|
|
782 |
case DLG_2PASS : |
case DLG_2PASS : |
783 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
784 |
|
// added by koepi for the new 2pass curve treatment |
785 |
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
786 |
|
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
787 |
|
//end of koepi's additions |
788 |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
789 |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
790 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
881 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
882 |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
883 |
|
|
884 |
|
#ifdef _SMP |
885 |
|
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
886 |
|
#endif |
887 |
|
#ifdef BFRAMES |
888 |
|
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
889 |
|
#endif |
890 |
|
|
891 |
config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
892 |
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
893 |
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
1112 |
EnableWindow(GetDlgItem(hDlg, IDC_MAXBFRAMES), FALSE); |
EnableWindow(GetDlgItem(hDlg, IDC_MAXBFRAMES), FALSE); |
1113 |
EnableWindow(GetDlgItem(hDlg, IDC_BQUANTRATIO), FALSE); |
EnableWindow(GetDlgItem(hDlg, IDC_BQUANTRATIO), FALSE); |
1114 |
EnableWindow(GetDlgItem(hDlg, IDC_PACKED), FALSE); |
EnableWindow(GetDlgItem(hDlg, IDC_PACKED), FALSE); |
1115 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DX50BVOP), FALSE); |
1116 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DEBUG), FALSE); |
1117 |
#endif |
#endif |
1118 |
} |
} |
1119 |
else if (psi->page == DLG_2PASSALT) |
else if (psi->page == DLG_2PASSALT) |
1122 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
1123 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
1124 |
} |
} |
1125 |
|
else if (psi->page == DLG_CPU) |
1126 |
|
{ |
1127 |
|
#ifndef _SMP |
1128 |
|
|
1129 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
1130 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
1131 |
|
#endif |
1132 |
|
#ifndef BFRAMES |
1133 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP_STATIC), FALSE); |
1134 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP), FALSE); |
1135 |
|
#endif |
1136 |
|
} |
1137 |
|
|
1138 |
if (hTooltip) |
if (hTooltip) |
1139 |
{ |
{ |
1366 |
|
|
1367 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1368 |
|
|
1369 |
|
init_param.cpu_flags = XVID_CPU_CHKONLY; |
1370 |
xvid_init(NULL, 0, &init_param, 0); |
xvid_init(NULL, 0, &init_param, 0); |
1371 |
wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); |
wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); |
1372 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |