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; |
90 |
{"min_key_interval", ®.min_key_interval, 1}, |
{"min_key_interval", ®.min_key_interval, 1}, |
91 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
92 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
93 |
|
//added by koepi for gruel's greyscale_mode |
94 |
|
{"greyscale", ®.greyscale, 0}, |
95 |
|
// end of koepi's additions |
96 |
#ifdef BFRAMES |
#ifdef BFRAMES |
97 |
{"max_bframes", ®.max_bframes, -1}, |
{"max_bframes", ®.max_bframes, -1}, |
98 |
{"bquant_ratio", ®.bquant_ratio, 200}, |
{"bquant_ratio", ®.bquant_ratio, 200}, |
99 |
{"packed", ®.packed, 0}, |
{"packed", ®.packed, 0}, |
100 |
{"dx50bvop", ®.dx50bvop, 0}, |
{"dx50bvop", ®.dx50bvop, 0}, |
101 |
{"debug", ®.debug, 0}, |
{"debug", ®.debug, 0}, |
102 |
#endif BFRAMES |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
103 |
|
#endif |
104 |
|
|
105 |
{"min_iquant", ®.min_iquant, 1}, |
{"min_iquant", ®.min_iquant, 1}, |
106 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
111 |
{"keyframe_boost", ®.keyframe_boost, 20}, |
{"keyframe_boost", ®.keyframe_boost, 20}, |
112 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
113 |
{"dummy2pass", ®.dummy2pass, 0}, |
{"dummy2pass", ®.dummy2pass, 0}, |
114 |
|
// added by koepi for new two-pass curve treatment |
115 |
|
{"kftreshold", ®.kftreshold, 10}, |
116 |
|
{"kfreduction", ®.kfreduction, 30}, |
117 |
|
// end of koepi's additions |
118 |
{"curve_compression_high", ®.curve_compression_high, 25}, |
{"curve_compression_high", ®.curve_compression_high, 25}, |
119 |
{"curve_compression_low", ®.curve_compression_low, 10}, |
{"curve_compression_low", ®.curve_compression_low, 10}, |
120 |
{"use_alt_curve", ®.use_alt_curve, 0}, |
{"use_alt_curve", ®.use_alt_curve, 0}, |
170 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
171 |
reg.cpu = init_param.cpu_flags; |
reg.cpu = init_param.cpu_flags; |
172 |
|
|
173 |
|
#ifdef _SMP |
174 |
|
reg.num_threads = pthread_num_processors_np(); |
175 |
|
#endif |
176 |
|
|
177 |
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); |
178 |
|
|
179 |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
495 |
// create arrays of controls to be disabled for each mode |
// create arrays of controls to be disabled for each mode |
496 |
const short twopass_disable[] = { |
const short twopass_disable[] = { |
497 |
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
498 |
|
// added by koepi for new curve treatment |
499 |
|
IDC_KFTRESHOLD, IDC_KFREDUCTION, |
500 |
|
//end of koepi's additions |
501 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
502 |
IDC_STATS2, IDC_STATS2_BROWSE, |
IDC_STATS2, IDC_STATS2_BROWSE, |
503 |
}; |
}; |
633 |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
634 |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
635 |
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
636 |
|
// added by koepi for gruel's greyscale_mode |
637 |
|
CheckDlgButton(hDlg, IDC_GREYSCALE, config->greyscale ? BST_CHECKED : BST_UNCHECKED); |
638 |
|
// end of koepi's addition |
639 |
#ifdef BFRAMES |
#ifdef BFRAMES |
640 |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
641 |
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
656 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
657 |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
658 |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
659 |
|
// added by koepi for new 2pass curve treatment |
660 |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
661 |
|
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
662 |
|
// end of koepi's additions |
663 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
664 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
665 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
730 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
731 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
732 |
|
|
733 |
|
#ifdef _SMP |
734 |
|
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
735 |
|
#endif |
736 |
|
|
737 |
|
#ifdef BFRAMES |
738 |
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
739 |
|
#endif |
740 |
|
|
741 |
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
742 |
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
743 |
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
764 |
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
765 |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
766 |
config->interlacing = ISDLGSET(IDC_INTERLACING); |
config->interlacing = ISDLGSET(IDC_INTERLACING); |
767 |
|
// added by koepi for gruel's greyscale_mode |
768 |
|
config->greyscale = ISDLGSET(IDC_GREYSCALE); |
769 |
|
// end of koepi's addition |
770 |
#ifdef BFRAMES |
#ifdef BFRAMES |
771 |
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
772 |
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
790 |
|
|
791 |
case DLG_2PASS : |
case DLG_2PASS : |
792 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
793 |
|
// added by koepi for the new 2pass curve treatment |
794 |
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
795 |
|
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
796 |
|
//end of koepi's additions |
797 |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
798 |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
799 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
890 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
891 |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
892 |
|
|
893 |
|
#ifdef _SMP |
894 |
|
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
895 |
|
#endif |
896 |
|
#ifdef BFRAMES |
897 |
|
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
898 |
|
#endif |
899 |
|
|
900 |
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); |
901 |
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); |
902 |
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); |
1131 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
1132 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
1133 |
} |
} |
1134 |
|
else if (psi->page == DLG_CPU) |
1135 |
|
{ |
1136 |
|
#ifndef _SMP |
1137 |
|
|
1138 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
1139 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
1140 |
|
#endif |
1141 |
|
#ifndef BFRAMES |
1142 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP_STATIC), FALSE); |
1143 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP), FALSE); |
1144 |
|
#endif |
1145 |
|
} |
1146 |
|
|
1147 |
if (hTooltip) |
if (hTooltip) |
1148 |
{ |
{ |