--- trunk/vfw/src/config.c 2002/06/20 10:51:08 228 +++ trunk/vfw/src/config.c 2002/07/21 03:49:47 324 @@ -59,6 +59,9 @@ #include #include #include +#ifdef _SMP +#include +#endif #include "codec.h" #include "config.h" @@ -66,6 +69,7 @@ #include "resource.h" + /* registry info structs */ CONFIG reg; @@ -87,10 +91,13 @@ {"lum_masking", ®.lum_masking, 0}, {"interlacing", ®.interlacing, 0}, #ifdef BFRAMES - {"max_bframes", ®.max_bframes, 0}, + {"max_bframes", ®.max_bframes, -1}, {"bquant_ratio", ®.bquant_ratio, 200}, - {"packed", ®.packed, 1}, -#endif BFRAMES + {"packed", ®.packed, 0}, + {"dx50bvop", ®.dx50bvop, 0}, + {"debug", ®.debug, 0}, + {"frame_drop_ratio", ®.frame_drop_ratio, 0}, +#endif {"min_iquant", ®.min_iquant, 1}, {"max_iquant", ®.max_iquant, 31}, @@ -152,9 +159,13 @@ XVID_INIT_PARAM init_param; int i; - init_param.cpu_flags = 0; + init_param.cpu_flags = XVID_CPU_CHKONLY; xvid_init(0, 0, &init_param, NULL); - config->cpu = init_param.cpu_flags; + reg.cpu = init_param.cpu_flags; + +#ifdef _SMP + reg.num_threads = pthread_num_processors_np(); +#endif RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); @@ -616,6 +627,8 @@ SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); #endif break; @@ -701,6 +714,14 @@ CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); +#ifdef _SMP + SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); +#endif + +#ifdef BFRAMES + SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); +#endif + SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); @@ -731,6 +752,8 @@ config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); config->packed = ISDLGSET(IDC_PACKED); + config->dx50bvop = ISDLGSET(IDC_DX50BVOP); + config->debug = ISDLGSET(IDC_DEBUG); #endif break; @@ -844,6 +867,13 @@ config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; +#ifdef _SMP + config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); +#endif +#ifdef BFRAMES + config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); +#endif + config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); @@ -1068,6 +1098,8 @@ EnableWindow(GetDlgItem(hDlg, IDC_MAXBFRAMES), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_BQUANTRATIO), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_PACKED), FALSE); + EnableWindow(GetDlgItem(hDlg, IDC_DX50BVOP), FALSE); + EnableWindow(GetDlgItem(hDlg, IDC_DEBUG), FALSE); #endif } else if (psi->page == DLG_2PASSALT) @@ -1076,6 +1108,18 @@ SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); } + else if (psi->page == DLG_CPU) + { +#ifndef _SMP + + EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); + EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); +#endif +#ifndef BFRAMES + EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP_STATIC), FALSE); + EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP), FALSE); +#endif + } if (hTooltip) { @@ -1308,6 +1352,7 @@ SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); + init_param.cpu_flags = XVID_CPU_CHKONLY; xvid_init(NULL, 0, &init_param, 0); wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); SetDlgItemText(hDlg, IDC_CORE, core);