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}, |
159 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
160 |
int i; |
int i; |
161 |
|
|
162 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = XVID_CPU_CHKONLY; |
163 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
164 |
config->cpu = init_param.cpu_flags; |
reg.cpu = init_param.cpu_flags; |
165 |
|
|
166 |
|
#ifdef _SMP |
167 |
|
reg.num_threads = pthread_num_processors_np(); |
168 |
|
#endif |
169 |
|
|
170 |
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); |
171 |
|
|
627 |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
628 |
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
629 |
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
630 |
|
CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); |
631 |
|
CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); |
632 |
#endif |
#endif |
633 |
break; |
break; |
634 |
|
|
714 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
715 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
716 |
|
|
717 |
|
#ifdef _SMP |
718 |
|
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
719 |
|
#endif |
720 |
|
|
721 |
|
#ifdef BFRAMES |
722 |
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
723 |
|
#endif |
724 |
|
|
725 |
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
726 |
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
727 |
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
752 |
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
753 |
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
754 |
config->packed = ISDLGSET(IDC_PACKED); |
config->packed = ISDLGSET(IDC_PACKED); |
755 |
|
config->dx50bvop = ISDLGSET(IDC_DX50BVOP); |
756 |
|
config->debug = ISDLGSET(IDC_DEBUG); |
757 |
#endif |
#endif |
758 |
break; |
break; |
759 |
|
|
867 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
868 |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
869 |
|
|
870 |
|
#ifdef _SMP |
871 |
|
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
872 |
|
#endif |
873 |
|
#ifdef BFRAMES |
874 |
|
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
875 |
|
#endif |
876 |
|
|
877 |
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); |
878 |
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); |
879 |
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); |
1098 |
EnableWindow(GetDlgItem(hDlg, IDC_MAXBFRAMES), FALSE); |
EnableWindow(GetDlgItem(hDlg, IDC_MAXBFRAMES), FALSE); |
1099 |
EnableWindow(GetDlgItem(hDlg, IDC_BQUANTRATIO), FALSE); |
EnableWindow(GetDlgItem(hDlg, IDC_BQUANTRATIO), FALSE); |
1100 |
EnableWindow(GetDlgItem(hDlg, IDC_PACKED), FALSE); |
EnableWindow(GetDlgItem(hDlg, IDC_PACKED), FALSE); |
1101 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DX50BVOP), FALSE); |
1102 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DEBUG), FALSE); |
1103 |
#endif |
#endif |
1104 |
} |
} |
1105 |
else if (psi->page == DLG_2PASSALT) |
else if (psi->page == DLG_2PASSALT) |
1108 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
1109 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
1110 |
} |
} |
1111 |
|
else if (psi->page == DLG_CPU) |
1112 |
|
{ |
1113 |
|
#ifndef _SMP |
1114 |
|
|
1115 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
1116 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
1117 |
|
#endif |
1118 |
|
#ifndef BFRAMES |
1119 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP_STATIC), FALSE); |
1120 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP), FALSE); |
1121 |
|
#endif |
1122 |
|
} |
1123 |
|
|
1124 |
if (hTooltip) |
if (hTooltip) |
1125 |
{ |
{ |
1352 |
|
|
1353 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1354 |
|
|
1355 |
|
init_param.cpu_flags = XVID_CPU_CHKONLY; |
1356 |
xvid_init(NULL, 0, &init_param, 0); |
xvid_init(NULL, 0, &init_param, 0); |
1357 |
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)); |
1358 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |