Esempio n. 1
0
void *alloc( void *z )
{
    for( int i = 0; i < 1024; i++ ) {
        Test_t *t;
        t = almalloc( sizeof( Test_t ) );
        alfree( t );
    }

    return NULL;
}
Esempio n. 2
0
int hestSSE(float*   src,
            float*   dst,
            unsigned N,
            float    maxD,
            unsigned maxI,
            unsigned rConvg,
            double   cfd,
            unsigned minInl,
            float*   finalH){
	PROSAC_HEST  prosacState;
	PROSAC_HEST* p = &prosacState;
	
	p->src    = (Flt2DPt*)src;
	p->dst    = (Flt2DPt*)dst;
	p->N      = N;
	p->maxD   = maxD;
	p->maxI   = maxI;
	p->rConvg = rConvg;
	p->cfd    = cfd;
	p->minInl = minInl;
	p->finalH = finalH;
	
	
	p->phNum     = 4;
	p->phEndI    = 1;
	p->phEndFpI  = sacInitPEndFpI(p->rConvg, p->N, 4);
	p->phMax     = p->N;
	p->bestInl   = 0;
	p->inl       = 0;
	p->smpl      = almalloc(4*sizeof(*p->smpl));
	p->H         = almalloc(HSIZE);
	p->bestH     = almalloc(HSIZE);
	p->pkdPts    = almalloc(8*sizeof(*p->pkdPts));
	memset(p->bestH, 0, HSIZE);
	p->N_tested  = 0;
	p->good      = 1;
	p->t_M       = 25;
	p->m_S       = 1;
	p->epsilon   = 0.1;
	p->delta     = 0.01;
	sacDesignSPRTTest(p);
	
	
	/**
	 * PROSAC Loop
	 */
	
	for(p->i=0;p->i<p->maxI;p->i++){
		if(sacPhaseEndReached(p)){
			sacGoToNextPhase(p);
		}
		
		sacGetPROSACSample(p);
		if(sacIsSampleDegenerate(p)){
			continue;
		}
		
		sacGenerateModel(p);
		if(sacIsModelDegenerate(p)){
			continue;
		}
		
		sacEvaluateModelSPRT(p);
		sacUpdateSPRT(p);
		if(sacIsBestModel(p)){
			sacSaveModel(p);
			sacUpdateBounds(p);
		}
	}
	
	if(!sacIsBestModelGoodEnough(p)){
		memset(p->bestH, 0, HSIZE);
	}
	p->finalH && memcpy(p->finalH, p->bestH, HSIZE);
	
	alfree(p->smpl);
	alfree(p->H);
	alfree(p->bestH);
	alfree(p->pkdPts);
	return sacIsBestModelGoodEnough(p);
}