23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
26 |
|
* 15.06.2002 added bframes options |
27 |
* 21.04.2002 fixed custom matrix support, tried to get dll size down |
* 21.04.2002 fixed custom matrix support, tried to get dll size down |
28 |
* 17.04.2002 re-enabled lumi masking in 1st pass |
* 17.04.2002 re-enabled lumi masking in 1st pass |
29 |
* 15.04.2002 updated cbr support |
* 15.04.2002 updated cbr support |
86 |
{"min_key_interval", ®.min_key_interval, 1}, |
{"min_key_interval", ®.min_key_interval, 1}, |
87 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
88 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
89 |
|
#ifdef BFRAMES |
90 |
|
{"max_bframes", ®.max_bframes, -1}, |
91 |
|
{"bquant_ratio", ®.bquant_ratio, 200}, |
92 |
|
{"packed", ®.packed, 0}, |
93 |
|
{"dx50bvop", ®.dx50bvop, 0}, |
94 |
|
{"debug", ®.debug, 0}, |
95 |
|
#endif BFRAMES |
96 |
|
|
97 |
{"min_iquant", ®.min_iquant, 1}, |
{"min_iquant", ®.min_iquant, 1}, |
98 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
154 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
155 |
int i; |
int i; |
156 |
|
|
157 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = XVID_CPU_CHKONLY; |
158 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
159 |
config->cpu = init_param.cpu_flags; |
reg.cpu = init_param.cpu_flags; |
160 |
|
|
161 |
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); |
162 |
|
|
283 |
|
|
284 |
/* leaves current config value if dialog item is empty */ |
/* leaves current config value if dialog item is empty */ |
285 |
|
|
286 |
int config_get_int(HWND hDlg, UINT item, int config) |
int config_get_int(HWND hDlg, INT item, int config) |
287 |
|
{ |
288 |
|
BOOL success = FALSE; |
289 |
|
|
290 |
|
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
291 |
|
|
292 |
|
return (success) ? tmp : config; |
293 |
|
} |
294 |
|
|
295 |
|
|
296 |
|
int config_get_uint(HWND hDlg, UINT item, int config) |
297 |
{ |
{ |
298 |
BOOL success = FALSE; |
BOOL success = FALSE; |
299 |
|
|
311 |
{ |
{ |
312 |
default : |
default : |
313 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
314 |
config->rc_bitrate = config_get_int(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
config->rc_bitrate = config_get_uint(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
315 |
break; |
break; |
316 |
|
|
317 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
318 |
config->quality = config_get_int(hDlg, IDC_VALUE, config->quality); |
config->quality = config_get_uint(hDlg, IDC_VALUE, config->quality); |
319 |
break; |
break; |
320 |
|
|
321 |
case DLG_MODE_VBR_QUANT : |
case DLG_MODE_VBR_QUANT : |
322 |
config->quant = config_get_int(hDlg, IDC_VALUE, config->quant); |
config->quant = config_get_uint(hDlg, IDC_VALUE, config->quant); |
323 |
break; |
break; |
324 |
|
|
325 |
case DLG_MODE_2PASS_2_INT : |
case DLG_MODE_2PASS_2_INT : |
326 |
config->desired_size = config_get_int(hDlg, IDC_VALUE, config->desired_size); |
config->desired_size = config_get_uint(hDlg, IDC_VALUE, config->desired_size); |
327 |
break; |
break; |
328 |
} |
} |
329 |
|
|
614 |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
615 |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
616 |
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
617 |
|
#ifdef BFRAMES |
618 |
|
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
619 |
|
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
620 |
|
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
621 |
|
CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); |
622 |
|
CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); |
623 |
|
#endif |
624 |
break; |
break; |
625 |
|
|
626 |
case DLG_QUANT : |
case DLG_QUANT : |
727 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
728 |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
729 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
730 |
config->max_key_interval = config_get_int(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
731 |
config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->min_key_interval); |
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
732 |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
733 |
config->interlacing = ISDLGSET(IDC_INTERLACING); |
config->interlacing = ISDLGSET(IDC_INTERLACING); |
734 |
|
#ifdef BFRAMES |
735 |
|
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
736 |
|
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
737 |
|
config->packed = ISDLGSET(IDC_PACKED); |
738 |
|
config->dx50bvop = ISDLGSET(IDC_DX50BVOP); |
739 |
|
config->debug = ISDLGSET(IDC_DEBUG); |
740 |
|
#endif |
741 |
break; |
break; |
742 |
|
|
743 |
case DLG_QUANT : |
case DLG_QUANT : |
744 |
config->min_iquant = config_get_int(hDlg, IDC_MINIQUANT, config->min_iquant); |
config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
745 |
config->max_iquant = config_get_int(hDlg, IDC_MAXIQUANT, config->max_iquant); |
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
746 |
config->min_pquant = config_get_int(hDlg, IDC_MINPQUANT, config->min_pquant); |
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
747 |
config->max_pquant = config_get_int(hDlg, IDC_MAXPQUANT, config->max_pquant); |
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
748 |
|
|
749 |
CONSTRAINVAL(config->min_iquant, 1, 31); |
CONSTRAINVAL(config->min_iquant, 1, 31); |
750 |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
758 |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
759 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
760 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
761 |
config->bitrate_payback_delay = config_get_int(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
762 |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
763 |
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
764 |
|
|
785 |
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
786 |
|
|
787 |
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
788 |
config->alt_curve_auto_str = config_get_int(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
789 |
|
|
790 |
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
791 |
config->alt_curve_bonus_bias = config_get_int(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
792 |
|
|
793 |
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
794 |
config->alt_curve_high_dist = config_get_int(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
795 |
config->alt_curve_low_dist = config_get_int(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
796 |
config->alt_curve_min_rel_qual = config_get_int(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
797 |
|
|
798 |
config->twopass_max_bitrate /= CONFIG_KBPS; |
config->twopass_max_bitrate /= CONFIG_KBPS; |
799 |
config->twopass_max_bitrate = config_get_int(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
config->twopass_max_bitrate = config_get_uint(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
800 |
config->twopass_max_bitrate *= CONFIG_KBPS; |
config->twopass_max_bitrate *= CONFIG_KBPS; |
801 |
config->twopass_max_overflow_improvement = config_get_int(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
802 |
config->twopass_max_overflow_degradation = config_get_int(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
803 |
|
|
804 |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
805 |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
808 |
case DLG_CREDITS : |
case DLG_CREDITS : |
809 |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
810 |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
811 |
config->credits_start_end = config_get_int(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
config->credits_start_end = config_get_uint(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
812 |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
813 |
config->credits_end_begin = config_get_int(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
config->credits_end_begin = config_get_uint(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
814 |
config->credits_end_end = config_get_int(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
config->credits_end_end = config_get_uint(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
815 |
|
|
816 |
config->credits_rate = config_get_int(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
config->credits_rate = config_get_uint(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
817 |
config->credits_quant_i = config_get_int(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
config->credits_quant_i = config_get_uint(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
818 |
config->credits_quant_p = config_get_int(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
config->credits_quant_p = config_get_uint(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
819 |
config->credits_start_size = config_get_int(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
config->credits_start_size = config_get_uint(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
820 |
config->credits_end_size = config_get_int(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
config->credits_end_size = config_get_uint(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
821 |
|
|
822 |
config->credits_mode = 0; |
config->credits_mode = 0; |
823 |
config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; |
config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; |
850 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
851 |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
852 |
|
|
853 |
config->rc_reaction_delay_factor = config_get_int(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); |
854 |
config->rc_averaging_period = config_get_int(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
855 |
config->rc_buffer = config_get_int(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
856 |
break; |
break; |
857 |
} |
} |
858 |
} |
} |
878 |
{ |
{ |
879 |
int temp; |
int temp; |
880 |
|
|
881 |
temp = config_get_int(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
882 |
CONSTRAINVAL(temp, 1, 255); |
CONSTRAINVAL(temp, 1, 255); |
883 |
config->qmatrix_intra[i] = temp; |
config->qmatrix_intra[i] = temp; |
884 |
|
|
885 |
temp = config_get_int(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
temp = config_get_uint(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
886 |
CONSTRAINVAL(temp, 1, 255); |
CONSTRAINVAL(temp, 1, 255); |
887 |
config->qmatrix_inter[i] = temp; |
config->qmatrix_inter[i] = temp; |
888 |
} |
} |
990 |
} |
} |
991 |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
992 |
{ |
{ |
993 |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
int value = config_get_uint(hDlg, IDC_VALUE, 1); |
994 |
int max = 1; |
int max = 1; |
995 |
|
|
996 |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
1066 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
1067 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
1068 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
1069 |
|
|
1070 |
|
#ifndef BFRAMES |
1071 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC1), FALSE); |
1072 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC2), FALSE); |
1073 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC3), FALSE); |
1074 |
|
EnableWindow(GetDlgItem(hDlg, IDC_MAXBFRAMES), FALSE); |
1075 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BQUANTRATIO), FALSE); |
1076 |
|
EnableWindow(GetDlgItem(hDlg, IDC_PACKED), FALSE); |
1077 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DX50BVOP), FALSE); |
1078 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DEBUG), FALSE); |
1079 |
|
#endif |
1080 |
} |
} |
1081 |
else if (psi->page == DLG_2PASSALT) |
else if (psi->page == DLG_2PASSALT) |
1082 |
{ |
{ |
1316 |
|
|
1317 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1318 |
|
|
1319 |
|
init_param.cpu_flags = XVID_CPU_CHKONLY; |
1320 |
xvid_init(NULL, 0, &init_param, 0); |
xvid_init(NULL, 0, &init_param, 0); |
1321 |
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)); |
1322 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |