Fix for Linux not detecting right CPU count didn't compile, fixed.

Started re-layouting the FexTracker config dialog.

Originally committed to SVN as r550.
This commit is contained in:
Niels Martin Hansen 2006-11-11 01:47:35 +00:00
parent 2251867890
commit 075caa6f33
2 changed files with 48 additions and 60 deletions

View File

@ -712,8 +712,7 @@ void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) {
int *data = new int[w*h*depth/32]; int *data = new int[w*h*depth/32];
////// START OF PARALLELISED CODE ////// ////// START OF PARALLELISED CODE //////
const int cpu_count = wxThread::GetCPUCount(); const int cpu_count = MAX(wxThread::GetCPUCount(), 1);
if (cpu_count < 1) cpu_count = 1;
std::vector<SpectrumRendererThread*> threads(cpu_count); std::vector<SpectrumRendererThread*> threads(cpu_count);
for (int i = 0; i < cpu_count; i++) { for (int i = 0; i < cpu_count; i++) {
// Ugh, way too many data to copy in // Ugh, way too many data to copy in

View File

@ -8,6 +8,8 @@
/////////// ///////////
// Headers // Headers
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/statbox.h>
#include <wx/sizer.h>
#include "dialog_fextracker.h" #include "dialog_fextracker.h"
#include "../FexTrackerSource/FexTracker.h" #include "../FexTrackerSource/FexTracker.h"
@ -20,71 +22,58 @@ DialogFexTracker::DialogFexTracker(wxWindow *parent, FexTrackerConfig *_cfg)
cfg = _cfg; cfg = _cfg;
cfg->FeatureNumber = 0; cfg->FeatureNumber = 0;
wxNotebook *MainNB = new wxNotebook(this,-1, wxDefaultPosition, wxSize(300,500), wxNO_BORDER ); FeatureNumber = new wxTextCtrl(this,-1,_T("250"));
MinDistanceSquare = new wxTextCtrl(this,-1,_T("100"));
SearchRange = new wxTextCtrl(this,-1,_T("15"));
MaxResidue = new wxTextCtrl(this,-1,_T("10"));
MaxIterations = new wxTextCtrl(this,-1,_T("10"));
wxWindow *StdWnd = new wxPanel(MainNB,-1); EdgeDetectSigma = new wxTextCtrl(this,-1,_T("1.0"));
wxWindow *AdvWnd = new wxPanel(MainNB,-1); WindowX = new wxTextCtrl(this,-1,_T("3"));
WindowY = new wxTextCtrl(this,-1,_T("3"));
MinDeterminant = new wxTextCtrl(this,-1,_T("0.01"));
MinDisplacement = new wxTextCtrl(this,-1,_T("0.1"));
FeatureNumber = new wxTextCtrl(StdWnd,-1,_T("250")); wxSizer *std_grid = new wxFlexGridSizer(2, 5, 10);
MinDistanceSquare = new wxTextCtrl(StdWnd,-1,_T("100")); wxSizer *adv_grid = new wxFlexGridSizer(2, 5, 10);
SearchRange = new wxTextCtrl(StdWnd,-1,_T("15"));
MaxResidue = new wxTextCtrl(StdWnd,-1,_T("10"));
MaxIterations = new wxTextCtrl(StdWnd,-1,_T("10"));
EdgeDetectSigma = new wxTextCtrl(AdvWnd,-1,_T("1.0")); std_grid->Add(new wxStaticText(this, -1, _("Number of points to track:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
WindowX = new wxTextCtrl(AdvWnd,-1,_T("3")); std_grid->Add(FeatureNumber, 1, wxALIGN_LEFT);
WindowY = new wxTextCtrl(AdvWnd,-1,_T("3")); std_grid->Add(new wxStaticText(this, -1, _("Minimal (squared) distance between two points:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
MinDeterminant = new wxTextCtrl(AdvWnd,-1,_T("0.01")); std_grid->Add(MinDistanceSquare, 1, wxALIGN_LEFT);
MinDisplacement = new wxTextCtrl(AdvWnd,-1,_T("0.1")); std_grid->Add(new wxStaticText(this,-1,_("Maximum feature movement:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
std_grid->Add(SearchRange, 1, wxALIGN_LEFT);
std_grid->Add(new wxStaticText(this,-1,_("Maximum feature appearance change:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
std_grid->Add(MaxResidue, 1, wxALIGN_LEFT);
std_grid->Add(new wxStaticText(this,-1,_("How much CPU per feature?")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
std_grid->Add(MaxIterations, 1, wxALIGN_LEFT);
wxSizer *Sizer = new wxBoxSizer(wxVERTICAL); adv_grid->Add(new wxStaticText(this,-1,_("Edge detect filter size:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
wxStaticText *Static; adv_grid->Add(EdgeDetectSigma, 1, wxALIGN_LEFT);
Static = new wxStaticText(StdWnd,-1,_("Number of points to track:")); adv_grid->Add(new wxStaticText(this,-1,_("Feature comparison width:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
Sizer->Add(Static,0,wxALIGN_LEFT,5); adv_grid->Add(WindowX, 1, wxALIGN_LEFT);
Sizer->Add(FeatureNumber,0,wxALIGN_LEFT,5); adv_grid->Add(new wxStaticText(this,-1,_("Feature comparison height:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
Static = new wxStaticText(StdWnd,-1,_("Minimal (squared) distance between two points: ")); adv_grid->Add(WindowY, 1, wxALIGN_LEFT);
Sizer->Add(Static,0,wxALIGN_LEFT,5); adv_grid->Add(new wxStaticText(this,-1,_("Minimal determinant:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
Sizer->Add(MinDistanceSquare,0,wxALIGN_LEFT,5); adv_grid->Add(MinDeterminant, 1, wxALIGN_LEFT);
Static = new wxStaticText(StdWnd,-1,_("Maximum feature movement:")); adv_grid->Add(new wxStaticText(this,-1,_("Minimal displacement per iteration:")), 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
Sizer->Add(Static,0,wxALIGN_LEFT,5); adv_grid->Add(MinDisplacement, 1, wxALIGN_LEFT);
Sizer->Add(SearchRange,0,wxALIGN_LEFT,5);
Static = new wxStaticText(StdWnd,-1,_("Maximum feature appearance change:"));
Sizer->Add(Static,0,wxALIGN_LEFT,5);
Sizer->Add(MaxResidue,0,wxALIGN_LEFT,5);
Static = new wxStaticText(StdWnd,-1,_("How much CPU per feature?"));
Sizer->Add(Static,0,wxALIGN_LEFT,5);
Sizer->Add(MaxIterations,0,wxALIGN_LEFT,5);
wxSizer *SizerAdd = new wxBoxSizer(wxVERTICAL); wxSizer *std_box = new wxStaticBoxSizer(new wxStaticBox(this, -1, _("Basic settings")), wxVERTICAL);
Static = new wxStaticText(AdvWnd,-1,_("Edge detect filter size:")); std_box->Add(std_grid, 0, wxALL, 5);
SizerAdd->Add(Static,0,wxALIGN_LEFT,5); wxSizer *adv_box = new wxStaticBoxSizer(new wxStaticBox(this, -1, _("Additional settings")), wxVERTICAL);
SizerAdd->Add(EdgeDetectSigma,0,wxALIGN_LEFT,5); adv_box->Add(adv_grid, 0, wxALL, 5);
Static = new wxStaticText(AdvWnd,-1,_("Feature comparison width:"));
SizerAdd->Add(Static,0,wxALIGN_LEFT,5);
SizerAdd->Add(WindowX,0,wxALIGN_LEFT,5);
Static = new wxStaticText(AdvWnd,-1,_("Feature comparison height:"));
SizerAdd->Add(Static,0,wxALIGN_LEFT,5);
SizerAdd->Add(WindowY,0,wxALIGN_LEFT,5);
Static = new wxStaticText(AdvWnd,-1,_("Minimal determinant:"));
SizerAdd->Add(Static,0,wxALIGN_LEFT,5);
SizerAdd->Add(MinDeterminant,0,wxALIGN_LEFT,5);
Static = new wxStaticText(AdvWnd,-1,_("Minimal displacement per iteration:"));
SizerAdd->Add(Static,0,wxALIGN_LEFT,5);
SizerAdd->Add(MinDisplacement,0,wxALIGN_LEFT,5);
StdWnd->SetSizer( Sizer ); wxStdDialogButtonSizer *buttons = new wxStdDialogButtonSizer();
StdWnd->SetAutoLayout( 1 ); buttons->AddButton(new wxButton(this,wxID_OK,_("Start")));
MainNB->AddPage( StdWnd, _("Standard Settings") ); buttons->AddButton(new wxButton(this, wxID_CANCEL));
buttons->Realize();
AdvWnd->SetSizer( SizerAdd );
AdvWnd->SetAutoLayout( 1 );
MainNB->AddPage( AdvWnd, _("Advanced Settings") );
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL); wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
MainSizer->Add(MainNB,1,wxEXPAND|wxALL,5);
MainSizer->AddSpacer(2); MainSizer->Add(std_box, 0, wxALL|wxEXPAND, 5);
wxButton *but = new wxButton(this,BUTTON_START,_("Go!")); MainSizer->Add(adv_box, 0, wxALL&~wxTOP|wxEXPAND, 5);
MainSizer->Add(but,0,wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER,5); MainSizer->Add(buttons, 0, wxALL&~wxTOP|wxEXPAND, 5);
MainSizer->SetSizeHints( this ); MainSizer->SetSizeHints( this );
SetSizer(MainSizer); SetSizer(MainSizer);
@ -96,7 +85,7 @@ DialogFexTracker::DialogFexTracker(wxWindow *parent, FexTrackerConfig *_cfg)
/////////////// ///////////////
// Event table // Event table
BEGIN_EVENT_TABLE(DialogFexTracker,wxDialog) BEGIN_EVENT_TABLE(DialogFexTracker,wxDialog)
EVT_BUTTON(BUTTON_START,DialogFexTracker::OnStart) EVT_BUTTON(wxID_OK,DialogFexTracker::OnStart)
END_EVENT_TABLE() END_EVENT_TABLE()