Exemplo n.º 1
0
MeshEditor::MeshEditor(SharedResources *shared, Editor *editor,
	QWidget *parent) : QWidget(parent)
{
	this->shared = shared;
	this->editor = editor;
	setFocusPolicy(Qt::StrongFocus);

	QVBoxLayout *columns = new QVBoxLayout(this);
	columns->setSizeConstraint(QLayout::SetMinimumSize);
	columns->setSpacing(0);
	columns->setMargin(0);

	QHBoxLayout *topRow = new QHBoxLayout();
	topRow->setSizeConstraint(QLayout::SetMinimumSize);
	topRow->setSpacing(0);
	topRow->setMargin(0);
	initTopRow(topRow);
	columns->addLayout(topRow);

	meshViewer = new MeshViewer(shared, this);
	columns->addWidget(meshViewer);

	QVBoxLayout *layout = new QVBoxLayout();
	layout->setMargin(10);
	layout->setSpacing(3);
	initFields(layout);
	columns->addLayout(layout);
	columns->addStretch(1);

	connect(this, SIGNAL(meshChanged(pg::Geometry)), meshViewer,
		SLOT(updateMesh(pg::Geometry)));
	connect(meshViewer, SIGNAL(ready()), this, SLOT(addMesh()));
}
Exemplo n.º 2
0
CCvProject::CCvProject(CSerialThread* serialThread, QWidget* parent) :
    CGenericProject(serialThread, parent)
{
    Q_ASSERT(serialThread);
    //Q_ASSERT(parent);

    initPlot();
    initFields();

    mp_serialThread = serialThread;
    updateTree();

    // testing
    /*quint16 t;
    union32_t x;
    union32_t y;
    t = 0;
    x.idFl = 0.5;
    y.idFl = 0.001;
    on_received_giveMeasChunkCv(t, x, y);

    t = 1;
    x.idFl = 1;
    y.idFl = 0.005;
    on_received_giveMeasChunkCv(t, x, y);

    t = 2;
    x.idFl = 0.7;
    y.idFl = 0.003;
    on_received_giveMeasChunkCv(t, x, y);

    insertLabels();*/
}
Exemplo n.º 3
0
MainForm::MainForm(QWidget* parent, Qt::WFlags flags) : QMainWindow(parent, flags)
{
    vrLut = 0;
    mprExaminer0 = 0;
    mprExaminer1 = 0;
    mprExaminer2 = 0;
    vrExaminer = 0;
    mprWindowLevelManip = 0;
    vrTexture = 0;
    vrSlicer = 0;

    isUpdatingGui_ = false;
	isDraggingWindow_ = false;

	setupUi(this);
    ViewerCore::get()->createPresetMixerForm(this);
    ViewerCore::get()->createDicomForm(this, ViewerCore::get()->getDicomElementList());

    setWindowFlags(Qt::CustomizeWindowHint);

	initFields();
    initControlValues();
	initConnections();
	initCallbacks();
    initPresets();
}
Exemplo n.º 4
0
 ParsedQuery::ParsedQuery( QueryMessage& qm ) :
     _ns( qm.ns ),
     _ntoskip( qm.ntoskip ),
     _ntoreturn( qm.ntoreturn ),
     _options( qm.queryOptions ) {
     init( qm.query );
     initFields( qm.fields );
 }
Exemplo n.º 5
0
FEMchunk::FEMchunk(FEM_Comm_t defaultComm_)
	:defaultComm(defaultComm_)
{
  default_read=-1;
  default_write=-1;
  checkMPI(MPI_Comm_rank((MPI_Comm)defaultComm,&thisIndex));
  initFields();
}
CertParser::CertParser(
	SecCertificateRef 	secCert)
{
	initFields();
	OSStatus ortn = initWithSecCert(secCert);
	if(ortn) {
		throw ((int)ortn);
	}
}
Exemplo n.º 7
0
RBoard::RBoard(  sf::Texture& boardTexture,sf::Texture& fieldTexture,   sf::Texture& fieldTextureOccupied)
	: hoveredField({42,42})
{
	boardShape.setTexture(&boardTexture);
	boardShape.setSize(sf::Vector2f(BOARD_WIDTH, BOARD_HEIGHT));
	sf::FloatRect bounds =  boardShape.getGlobalBounds();
	boardShape.setOrigin((bounds.left + bounds.width)/2.f, (bounds.top + bounds.height)/2.f);
	boardShape.setPosition(sf::Vector2f(BOARD_X_POS, BOARD_Y_POS));

	initFields(fieldTexture,fieldTextureOccupied);
}
CertParser::CertParser(
	CSSM_CL_HANDLE		clHand,
	const CSSM_DATA 	&certData)
{
	initFields();
	mClHand = clHand;
	CSSM_RETURN crtn = initWithData(certData);
	if(crtn) {
		throw ((int)crtn);
	}
}
Exemplo n.º 9
0
 ParsedQuery::ParsedQuery( const char* ns,
                           int ntoskip,
                           int ntoreturn,
                           int queryoptions,
                           const BSONObj& query,
                           const BSONObj& fields ) :
     _ns( ns ),
     _ntoskip( ntoskip ),
     _ntoreturn( ntoreturn ),
     _options( queryoptions ) {
     init( query );
     initFields( fields );
 }
Exemplo n.º 10
0
IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name )
    : QWidget( parent )
{
  setObjectName( name );
  QHBoxLayout *layout = new QHBoxLayout( this );
  layout->setSpacing( KDialog::spacingHint() );
  layout->setMargin( 2 );

  mSearchText = new KLineEdit( this );
  mSearchText->setClearButtonShown(true);
  mSearchText->setClickMessage( i18nc( "Search for contacts in the address book", "Search" ) );
  mSearchText->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
  mSearchText->setWhatsThis( i18n( "The incremental search<p>Enter some text here will start the search for the contact, which matches the search pattern best. The part of the contact, which will be used for matching, depends on the field selection.</p>" ) );
  layout->addWidget( mSearchText );

  QLabel *label = new QLabel( i18nc( "as in 'Search in:'", "&in:" ), this );
  label->setObjectName( "kde toolbar widget" );
  label->setAlignment( Qt::AlignVCenter | Qt::AlignRight );
  layout->addWidget( label );

  mFieldCombo = new KComboBox( this );
  mFieldCombo->setEditable( false );
  layout->addWidget( mFieldCombo );
  label->setBuddy(mFieldCombo);

  mFieldCombo->setToolTip( i18n( "Select incremental search field" ) );
  mFieldCombo->setWhatsThis( i18n( "Here you can choose the field, which shall be used for incremental search." ) );

  mInputTimer = new QTimer( this );
  mInputTimer->setSingleShot( true );

  connect( mInputTimer, SIGNAL( timeout() ),
           SLOT( timeout() ) );
  connect( mSearchText, SIGNAL( textChanged( const QString& ) ),
           SLOT( announceDoSearch() ) );
  connect( mSearchText, SIGNAL( returnPressed() ),
           SLOT( announceDoSearch() ) );
  connect( mFieldCombo, SIGNAL( activated( const QString& ) ),
           SLOT( announceDoSearch() ) );
  connect( mSearchText, SIGNAL( clearButtonClicked() ),
           SLOT( announceDoSearch() ) );

  initFields();

  mSearchText->installEventFilter( this );

  setFocusProxy( mSearchText );
}
Exemplo n.º 11
0
int configureMotionDetect(MotionDetect* md) {
  if (md->initialized != 1)
    return DS_ERROR;

  md->shakiness = DS_MIN(10,DS_MAX(1,md->shakiness));
  md->accuracy = DS_MIN(15,DS_MAX(1,md->accuracy));
  if (md->accuracy < md->shakiness / 2) {
    ds_log_info(md->modName, "Accuracy should not be lower than shakiness/2 -- fixed");
    md->accuracy = md->shakiness / 2;
  }
  if (md->accuracy > 9 && md->stepSize > 6) {
    ds_log_info(md->modName, "For high accuracy use lower stepsize  -- set to 6 now");
    md->stepSize = 6; // maybe 4
  }

  // shift: shakiness 1: height/40; 10: height/4
  int minDimension = DS_MIN(md->fi.width, md->fi.height);
  md->maxShift
    = DS_MAX(4,(minDimension*md->shakiness)/40);
  // size: shakiness 1: height/40; 10: height/6 (clipped)
  md->fieldSize
    = DS_MAX(4,DS_MIN(minDimension/6, (minDimension*md->shakiness)/40));

#if defined(USE_SSE2) || defined(USE_SSE2_ASM)
  md->fieldSize = (md->fieldSize / 16 + 1) * 16;
#endif

  ds_log_info(md->modName, "Fieldsize: %i, Maximal translation: %i pixel",
          md->fieldSize, md->maxShift);
  if (md->algo == 1) {
    // initialize measurement fields. field_num is set here.
    if (!initFields(md)) {
      return DS_ERROR;
    }
    md->maxFields = (md->accuracy) * md->fieldNum / 15;
    ds_log_info(md->modName, "Number of used measurement fields: %i out of %i",
        md->maxFields, md->fieldNum);
  }
  //  if (md->show)
  md->curr = ds_zalloc(md->fi.framesize);
  //  else
  //    md->currcopy=NULL;
  md->currtmp = ds_zalloc(md->fi.framesize);

  md->initialized = 2;
  return DS_OK;
}
Exemplo n.º 12
0
int Application::main(int argc,char *argv[])
  {
    // Process command line
    BOOM::CommandLine cmd(argc,argv,"");
    if(cmd.numArgs()!=5)
      throw BOOM::String(
"\ntrain-signal-peptide-model <*.gff> <*.fasta> <outfile>\n\
                           <start-codon.model> <field-lengths>\n\
   where <*.gff> contains items with the type \"signal_peptide\"\n\
         <window-len> = length in #codons\n\
         <start-codon.model> is a WMM\n\
         <field-lengths> is a comma-separate list of lengths (in acids)\n\
\n");
    BOOM::String gffFile=cmd.arg(0);
    BOOM::String fastaFile=cmd.arg(1);
    BOOM::String outfile=cmd.arg(2);
    BOOM::String startCodonModelFile=cmd.arg(3);
    BOOM::String lengths=cmd.arg(4);
    initFields(lengths);

    // Load signal peptide coordinates from GFF
    cerr<<"Loading signal peptide coordinates..."<<endl;
    loadSignalPeptideCoords(gffFile,fastaFile);

    // Load transcript coordinates from GFF
    cerr<<"Loading transcript coordinates..."<<endl;
    loadTranscriptCoords(gffFile);    
    
    // Study codon usage in transcripts
    cerr<<"Collecting codon usage statistics from transcripts..."<<endl;
    studyCodonUsage(fastaFile);
    
    // Study amino acid usage in signal peptides
    cerr<<"Collecting amino acid frequencies from signal peptides..."<<endl;
    studyAminoUsage();

    // Generate output
    cerr<<"Finishing model and writing output..."<<endl;
    generateModel(outfile,startCodonModelFile);

    return 0;
  }
Exemplo n.º 13
0
void testApp :: setup()
{
	ofSetFrameRate( 30 );
	ofSetVerticalSync( true );
	ofEnableSmoothing();
	ofEnableAlphaBlending();
	ofDisableArbTex();
	ofBackground( 150, 150, 150 );

	glEnable( GL_DEPTH_TEST );
	glDepthFunc( GL_LEQUAL );
	
	initRenderArea();
	initApp();
	initColorMap();
	initShereBg();
	initRibbons();
	initFields();
	initAudio();
}
Exemplo n.º 14
0
void testApp :: setup()
{
	ofSetFrameRate( 30 );
	ofSetVerticalSync( true );
	
	smoothing = false;
	
	initRenderArea();
	initFieldConfig();
	initFields();
	initVideo();
	initDebug();
	initBlendModes();
	initGui();
	initAudio();
	initTriggers();
	
	tileSaver.init( 10, 0, true );
	screenGrabUtil.setup( "movie/trigfield", &renderArea );
}
Exemplo n.º 15
0
bool ReflexiveContainerType::initialize(void)
{
    if(Inherited::initialize() == false)
    {
        _bReflexTypeInitialized = false;

        return _bReflexTypeInitialized;
    }

    if(_bReflexTypeInitialized == true)
        return _bReflexTypeInitialized;

    if(_descInsertFunc != NULL)
    {
        _descInsertFunc(this);
    }

    _bReflexTypeInitialized = initParentFields();

    if(_bReflexTypeInitialized == false)
        return _bReflexTypeInitialized;

    _bReflexTypeInitialized = initFields      ();

    if(_bReflexTypeInitialized == false)
        return _bReflexTypeInitialized;

    _bReflexTypeInitialized = initBaseType    ();
    
    PINFO << "init ReflexiveContainerType (" 
          << _bReflexTypeInitialized
          << ")" 
          << std::endl;

    return _bReflexTypeInitialized;
}
Exemplo n.º 16
0
Simulation3D::Simulation3D(double L_x, double L_y, double L_z,
			   double T,
			   unsigned int n_cells, unsigned int n_steps,
			   unsigned int procs_x, unsigned int procs_y, unsigned int procs_z,
			   unsigned int block_size,
			   std::string& dump_dir,
			   Simulation3DInitializer* init, mpi::communicator & world) :
  world(world),
  xLine(world.split(world.rank() / procs_x)),
  yLine(world.split(world.rank() % procs_x + (world.rank() / (procs_x*procs_y)) * procs_x)),
  zLine(world.split(world.rank() % (procs_x*procs_y))),
  nSteps(n_steps),
  currentStep(0),
  dx(L_x/n_cells),
  dy(L_y/n_cells),
  dz(L_z/n_cells),
  dt(T/n_steps),
  blockSize(block_size),
  preFactorX(LIGHTSPEED*dt/(2*dx)),
  preFactorY(LIGHTSPEED*dt/(2*dy)),
  preFactorZ(LIGHTSPEED*dt/(2*dz)),
  E(new double[3*blockSize*blockSize*blockSize]),
  B(new double[3*blockSize*blockSize*blockSize]),
  tmp_field(new double[3*blockSize*blockSize*blockSize]),
  rhsx(new double[blockSize*blockSize*blockSize]),
  rhsy(new double[blockSize*blockSize*blockSize]),
  rhsz(new double[blockSize*blockSize*blockSize]),
  rhs_ptrs_x(new double*[blockSize*blockSize]),
  rhs_ptrs_y(new double*[blockSize*blockSize]),
  rhs_ptrs_z(new double*[blockSize*blockSize]),
  dumpDir(dump_dir)
{
  procsX = xLine.size();
  procsY = yLine.size();
  procsZ = zLine.size();

  VacuumMatrixInitializer mat_init_x = VacuumMatrixInitializer(dx, dt, blockSize, determineBoundary(xLine));
  VacuumMatrixInitializer mat_init_y = VacuumMatrixInitializer(dy, dt, blockSize, determineBoundary(yLine));
  VacuumMatrixInitializer mat_init_z = VacuumMatrixInitializer(dz, dt, blockSize, determineBoundary(zLine));
  VacuumCouplingInitializer coupling_init_x = VacuumCouplingInitializer(& mat_init_x, blockSize, xLine);
  VacuumCouplingInitializer coupling_init_y = VacuumCouplingInitializer(& mat_init_y, blockSize, yLine);
  VacuumCouplingInitializer coupling_init_z = VacuumCouplingInitializer(& mat_init_z, blockSize, zLine);

  std::vector<AbstractMatrixInitializer*> mat_inits_x(blockSize*blockSize, & mat_init_x);
  std::vector<AbstractMatrixInitializer*> mat_inits_y(blockSize*blockSize, & mat_init_y);
  std::vector<AbstractMatrixInitializer*> mat_inits_z(blockSize*blockSize, & mat_init_z);
  std::vector<AbstractCouplingInitializer*> coupling_inits_x(blockSize*blockSize, & coupling_init_x);
  std::vector<AbstractCouplingInitializer*> coupling_inits_y(blockSize*blockSize, & coupling_init_y);
  std::vector<AbstractCouplingInitializer*> coupling_inits_z(blockSize*blockSize, & coupling_init_z);

  guardB = allocateGuardStorage();
  guardE = allocateGuardStorage();

  init->setOffsets(xLine, yLine, zLine);
  initFields(init);

  xUpdateRHSs = init->initCollection(mat_inits_x, coupling_inits_x, blockSize, xLine);
  yUpdateRHSs = init->initCollection(mat_inits_y, coupling_inits_y, blockSize, yLine);
  zUpdateRHSs = init->initCollection(mat_inits_z, coupling_inits_z, blockSize, zLine);

  guardSendbuf = new double[3*blockSize*blockSize];
}
Exemplo n.º 17
0
/**
 * Constructor.
 */
CodeClassField::CodeClassField (ClassifierCodeDocument * doc, UMLRole * role)
        : CodeParameter (doc, (UMLObject*) role)
{
    setParentUMLObject(role);
    initFields(true);
}
CertParser::CertParser(
	CSSM_CL_HANDLE		clHand)
{
	initFields();
	mClHand = clHand;
}
/* Construct with or without data - you can add the data later with 
 * initWithData() to parse without exceptions */
CertParser::CertParser()
{
	initFields();
}
Exemplo n.º 20
0
/**
 * Constructor.
 */
CodeClassField::CodeClassField (ClassifierCodeDocument * doc, UMLAttribute * attrib)
        : CodeParameter (doc, (UMLObject*) attrib)
{
    setParentUMLObject(attrib);
    initFields(true);
}
Exemplo n.º 21
0
static int initFields ()
{
    sfTxnSignature.notSigningField ();
    sfTxnSignatures.notSigningField ();
    sfSignature.notSigningField ();

    sfIndexes.setMeta (SField::sMD_Never);
    sfPreviousTxnID.setMeta (SField::sMD_DeleteFinal);
    sfPreviousTxnLgrSeq.setMeta (SField::sMD_DeleteFinal);
    sfLedgerEntryType.setMeta (SField::sMD_Never);
    sfRootIndex.setMeta (SField::sMD_Always);

    return 0;
}

static const int forceInitializionOfFields = initFields ();

SField::SField (SerializedTypeID tid, int fv)
        : fieldCode (FIELD_CODE (tid, fv)), fieldType (tid), fieldValue (fv),
          fieldMeta (sMD_Default),
          fieldNum (++num),
          signingField (true),
          jsonName (nullptr)
{
    // call with the map mutex
    fieldName = beast::lexicalCast <std::string> (tid) + "/" +
                beast::lexicalCast <std::string> (fv);
    unknownCodeToField[fieldCode] = this;
    rawJsonName = getName ();
    jsonName = Json::StaticString (rawJsonName.c_str ());
    assert ((fv != 1) || ((tid != STI_ARRAY) && (tid != STI_OBJECT)));
Exemplo n.º 22
0
FEMchunk::FEMchunk(CkMigrateMessage *msg)
{
  initFields();
}
Exemplo n.º 23
0
static long init_record(aSubRecord *prec, int pass)
{
    GENFUNCPTR     pfunc;
    long           status;
    int            i;

    status = 0;
    if (pass == 0) {
        /* Allocate memory for arrays */
        initFields(&prec->fta,  &prec->noa,  &prec->nea,  Ifldnames,
            &prec->a,    NULL);
        initFields(&prec->ftva, &prec->nova, &prec->neva, Ofldnames,
            &prec->vala, &prec->ovla);
        return 0;
    }

    /* Initialize the Subroutine Name Link */
    switch (prec->subl.type) {
    case CONSTANT:
        recGblInitConstantLink(&prec->subl, DBF_STRING, prec->snam);
        break;

    case PV_LINK:
    case DB_LINK:
    case CA_LINK:
        break;

    default:
        recGblRecordError(S_db_badField, (void *)prec,
            "aSubRecord(init_record) Bad SUBL link type");
        return S_db_badField;
    }

    /* Initialize Input Links */
    for (i = 0; i < NUM_ARGS; i++) {
        struct link *plink = &(&prec->inpa)[i];
        switch (plink->type) {
        case CONSTANT:
            if ((&prec->noa)[i] < 2) {
                if (recGblInitConstantLink(plink, (&prec->fta)[i], (&prec->a)[i])) {
                    prec->udf = FALSE;
                } else
                    prec->udf = TRUE;
            }
            break;

        case PV_LINK:
        case CA_LINK:
        case DB_LINK:
            break;

        default:
            recGblRecordError(S_db_badField, (void *)prec,
                "aSubRecord(init_record) Illegal INPUT LINK");
            status = S_db_badField;
            break;
        }
    }

    if (status)
        return status;

    /* Initialize Output Links */
    for (i = 0; i < NUM_ARGS; i++) {
        switch ((&prec->outa)[i].type) {
        case CONSTANT:
        case PV_LINK:
        case CA_LINK:
        case DB_LINK:
            break;

        default:
            recGblRecordError(S_db_badField, (void *)prec,
                "aSubRecord(init_record) Illegal OUTPUT LINK");
            status = S_db_badField;
        }
    }
    if (status)
        return status;

    /* Call the user initialization routine if there is one */
    if (prec->inam[0] != 0) {
        pfunc = (GENFUNCPTR)registryFunctionFind(prec->inam);
        if (pfunc) {
            pfunc(prec);
        } else {
            recGblRecordError(S_db_BadSub, (void *)prec,
                "aSubRecord::init_record - INAM subr not found");
            return S_db_BadSub;
        }
    }

    if (prec->lflg == aSubLFLG_IGNORE &&
        prec->snam[0] != 0) {
        pfunc = (GENFUNCPTR)registryFunctionFind(prec->snam);
        if (pfunc)
            prec->sadr = pfunc;
        else {
            recGblRecordError(S_db_BadSub, (void *)prec,
                "aSubRecord::init_record - SNAM subr not found");
            return S_db_BadSub;
        }
    }
    strcpy(prec->onam, prec->snam);
    prec->oval = prec->val;
    return 0;
}
Exemplo n.º 24
0
TextBlock::TextBlock ( CodeDocument * parent, const QString & text )
        : QObject ( (QObject *)parent, "textBlock")
{
    initFields(parent);
    setText(text);
}
Exemplo n.º 25
0
/**
 * Constructor for a code generator and then initialize it from an XMI element.
 * FIX: hmm. this should be pure virtual so that implemented in sub-class.
 * @param element   an element from an XMI document
 */
CodeGenerator::CodeGenerator(QDomElement & element)
    : QObject(UMLApp::app()->document())
{
    initFields();
    loadFromXMI(element);  // hmm. cannot call this here.. it is 'pure' virtual
}
Exemplo n.º 26
0
// Constructor
CodeParameter::CodeParameter ( ClassifierCodeDocument * parentDoc, UMLObject * parentObject )
        : QObject ( parentObject)
{
    setObjectName( "ACodeParam" );
    initFields( parentDoc, parentObject );
}
Exemplo n.º 27
0
void __fastcall TfrmAvailCategoryEdit::FormShow(TObject *Sender)
{
    //Инициализация полей начальными значениями
    initFields();
}
Exemplo n.º 28
0
static int initFields ()
{
    sfTxnSignature.notSigningField ();
    sfTxnSignatures.notSigningField ();
    sfSignature.notSigningField ();

    sfIndexes.setMeta (SField::sMD_Never);
    sfPreviousTxnID.setMeta (SField::sMD_DeleteFinal);
    sfPreviousTxnLgrSeq.setMeta (SField::sMD_DeleteFinal);
    sfLedgerEntryType.setMeta (SField::sMD_Never);
    sfRootIndex.setMeta (SField::sMD_Always);

    return 0;
}
static const int f = initFields ();


SField::SField (SerializedTypeID tid, int fv) : fieldCode (FIELD_CODE (tid, fv)), fieldType (tid), fieldValue (fv),
    fieldMeta (sMD_Default), fieldNum (++num), signingField (true), jsonName (nullptr)
{
    // call with the map mutex
    fieldName = beast::lexicalCast <std::string> (tid) + "/" +
                beast::lexicalCast <std::string> (fv);
    codeToField[fieldCode] = this;
    rawJsonName = getName ();
    jsonName = Json::StaticString (rawJsonName.c_str ());
    assert ((fv != 1) || ((tid != STI_ARRAY) && (tid != STI_OBJECT)));
}

SField::ref SField::getField (int code)
Exemplo n.º 29
0
int vsMotionDetectInit(VSMotionDetect* md, const VSMotionDetectConfig* conf, const VSFrameInfo* fi){
  assert(md && fi);
  md->conf = *conf;
  md->fi = *fi;

  if(fi->pFormat<=PF_NONE ||  fi->pFormat==PF_PACKED || fi->pFormat>=PF_NUMBER) {
    vs_log_warn(md->conf.modName, "unsupported Pixel Format (%i)\n",
                md->fi.pFormat);
    return VS_ERROR;
  }

#ifdef USE_OMP
  if(md->conf.numThreads==0)
    md->conf.numThreads=VS_MAX(omp_get_max_threads()*0.8,1);
  vs_log_info(md->conf.modName, "Multitheading: use %i threads\n",md->conf.numThreads);
#endif

  vsFrameAllocate(&md->prev, &md->fi);
  if (vsFrameIsNull(&md->prev)) {
    vs_log_error(md->conf.modName, "malloc failed");
    return VS_ERROR;
  }

  vsFrameNull(&md->curr);
  vsFrameNull(&md->currorig);
  vsFrameNull(&md->currtmp);
  md->hasSeenOneFrame = 0;
  md->frameNum = 0;

  // TODO: get rid of shakiness parameter in the long run
  md->conf.shakiness = VS_MIN(10,VS_MAX(1,md->conf.shakiness));
  md->conf.accuracy = VS_MIN(15,VS_MAX(1,md->conf.accuracy));
  if (md->conf.accuracy < md->conf.shakiness / 2) {
    vs_log_info(md->conf.modName, "Accuracy should not be lower than shakiness/2 -- fixed");
    md->conf.accuracy = md->conf.shakiness / 2;
  }
  if (md->conf.accuracy > 9 && md->conf.stepSize > 6) {
    vs_log_info(md->conf.modName, "For high accuracy use lower stepsize  -- set to 6 now");
    md->conf.stepSize = 6; // maybe 4
  }

  int minDimension = VS_MIN(md->fi.width, md->fi.height);
//  shift: shakiness 1: height/40; 10: height/4
//  md->maxShift = VS_MAX(4,(minDimension*md->conf.shakiness)/40);
//  size: shakiness 1: height/40; 10: height/6 (clipped)
//  md->fieldSize = VS_MAX(4,VS_MIN(minDimension/6, (minDimension*md->conf.shakiness)/40));

  // fixed size and shift now
  int maxShift      = VS_MAX(16, minDimension/7);
  int fieldSize     = VS_MAX(16, minDimension/10);
  int fieldSizeFine = VS_MAX(6, minDimension/60);
#if defined(USE_SSE2) || defined(USE_SSE2_ASM)
  fieldSize     = (fieldSize / 16 + 1) * 16;
  fieldSizeFine = (fieldSizeFine / 16 + 1) * 16;
#endif
  if (!initFields(md, &md->fieldscoarse, fieldSize, maxShift, md->conf.stepSize,
                  1, 0, md->conf.contrastThreshold)) {
    return VS_ERROR;
  }
  // for the fine check we use a smaller size and smaller maximal shift (=size)
  if (!initFields(md, &md->fieldsfine, fieldSizeFine, fieldSizeFine,
                  2, 1, fieldSizeFine, md->conf.contrastThreshold/2)) {
    return VS_ERROR;
  }

  vsFrameAllocate(&md->curr,&md->fi);
  vsFrameAllocate(&md->currtmp, &md->fi);

  md->initialized = 2;
  return VS_OK;
}
Exemplo n.º 30
0
/**
 * Constructor for a code generator.
 */
CodeGenerator::CodeGenerator()
    : QObject(UMLApp::app()->document())
{
    initFields();
}