static void comm_read_block( PIA *pi, char * buf, int count ) { int i, l, h; switch (pi->mode) { case 0: w0(0x48); P1; for(i=0;i<count;i++) { w0(0); w2(6); l = r1(); w0(0x80); h = r1(); w2(4); buf[i] = j44(l,h); } break; case 1: w0(0x68); P1; w0(0); for(i=0;i<count;i++) { w2(0x26); buf[i] = r0(); w2(0x24); } w2(4); break; case 2: w3(0x68); r1(); w2(0x24); for (i=0;i<count;i++) buf[i] = r4(); w2(4); break; case 3: w3(0x68); r1(); w2(0x24); for (i=0;i<count/2;i++) ((u16 *)buf)[i] = r4w(); w2(4); break; case 4: w3(0x68); r1(); w2(0x24); for (i=0;i<count/4;i++) ((u32 *)buf)[i] = r4l(); w2(4); break; } }
static void fit3_read_block( PIA *pi, char * buf, int count ) { int k, a, b, c, d; switch (pi->mode) { case 0: w2(0xc); w0(0x10); w2(0x8); w2(0xc); for (k=0;k<count/2;k++) { w2(0xd); a = r1(); w2(0xf); b = r1(); w2(0xc); c = r1(); w2(0xe); d = r1(); buf[2*k ] = j44(a,b); buf[2*k+1] = j44(c,d); } w2(0xc); break; case 1: w2(0xc); w0(0x90); w2(0x8); w2(0xc); w2(0xec); w2(0xee); for (k=0;k<count/2;k++) { w2(0xef); a = r0(); w2(0xee); b = r0(); buf[2*k ] = a; buf[2*k+1] = b; } w2(0xec); w2(0xc); break; case 2: w2(0xc); w0(0x90); w2(0x8); w2(0xc); w2(0xec); for (k=0;k<count;k++) buf[k] = r4(); w2(0xc); break; } }
static void kbic_write_regr( PIA *pi, int cont, int regr, int val) { int s; s = cont_map[cont]; switch (pi->mode) { case 0: case 1: case 2: w0(regr|0x10|s); w2(4); w2(6); w2(4); w0(val); w2(5); w2(4); break; case 3: case 4: case 5: w0(0x20|s); w2(4); w2(6); w2(4); w3(regr); w4(val); w4(val); w2(4); w2(0); w2(4); break; } }
static void on26_write_block( PIA *pi, char * buf, int count ) { int k; switch (pi->mode) { case 0: case 1: w0(1); P1; w0(1); P2; w0(2); P1; w0(0x18+pi->mode); P2; w0(0); P1; udelay(10); for (k=0;k<count/2;k++) { w2(5); w0(buf[2*k]); w2(7); w0(buf[2*k+1]); } w2(5); w2(4); w0(2); P1; w0(8+pi->mode); P2; break; case 2: w3(1); w3(1); w2(5); w4(1); w2(4); w3(0); w3(0); w2(0xc5); udelay(10); for (k=0;k<count;k++) w4(buf[k]); w2(0xc4); break; case 3: w3(1); w3(1); w2(5); w4(1); w2(4); w3(0); w3(0); w2(0xc5); udelay(10); for (k=0;k<count/2;k++) w4w(((u16 *)buf)[k]); w2(0xc4); break; case 4: w3(1); w3(1); w2(5); w4(1); w2(4); w3(0); w3(0); w2(0xc5); udelay(10); for (k=0;k<count/4;k++) w4l(((u32 *)buf)[k]); w2(0xc4); break; } }
void Render::DragWindow(vec2 w,int id) { RenderingMethod*rm = GetCurRM(); vec2 w0(rm->min_level[id],rm->max_level[id]); SetWindow(w,id); vec2 w1(rm->min_level[id],rm->max_level[id]); for(int i=0;i<rm->tf_points[id].size();i++) { rm->tf_points[id][i].value = (w1.y-w1.x)*(rm->tf_points[id][i].value-w0.x)/(w0.y-w0.x)+w1.x; } rm->ApplyPoints(); }
// Use count void weak_2() { assert_ck(0, 0); { shared_test s0(test_behavior::init()); assert_ck(1, 0); weak_test w0(s0); assert_ck(1, 0); assert(w0.use_count() == 1); } assert_ck(1, 1); }
float ggx(Vec3f camPos, Vec3f source, Vec3f vertex, Vec3f * triangle, float L_w,float alpha,float f0,float k_d) { Vec3f w(source - vertex); Vec3f w0(camPos - vertex); w.normalize(); w0.normalize(); Vec3f n = getNormalwithRayComes(triangle, -w0); n.normalize(); float L_w0, f_s, f_d, f; f_s = brdf_GGX(w, w0, n, alpha, f0); f_d = f_Lambert(k_d); f = f_d + f_s; L_w0 = L_w * f * dot(n, w); return L_w0; }
// Uniqueness void weak_4() { assert_ck(0, 0); { shared_test s0(test_behavior::init()); assert_ck(1, 0); weak_test w0(s0); assert_ck(1, 0); assert(s0.unique()); assert(!w0.lock().unique()); } assert_ck(1, 1); }
// Weak from shared, check use count void weak_0() { assert_ck(0, 0); { auto h = test_behavior::init(); assert_ck(1, 0); shared_test s0(h); assert_ck(1, 0); weak_test w0(s0); assert_ck(1, 0); assert(!w0.expired()); assert(w0.use_count() == 1); assert(s0.use_count() == w0.use_count()); } assert_ck(1, 1); }
bool TestParserStmt::TestYieldStatement() { WithOpt w0(RuntimeOption::EnableHipHopSyntax); WithOpt w1(Option::EnableHipHopSyntax); V("<?php function foo() { yield break;}", "function ($" CONTINUATION_OBJECT_NAME ") {\n" "hphp_unpack_continuation();\n" "return;\n" "}\n" "function foo() {\n" "return hphp_create_continuation" "('', '3990978909_1', __FUNCTION__);\n" "}\n"); V("<?php function foo() { yield 123;}", "function ($" CONTINUATION_OBJECT_NAME ") {\n" "hphp_unpack_continuation();\n" "yield 123;\n" "}\n" "function foo() {\n" "return hphp_create_continuation" "('', '3990978909_1', __FUNCTION__);\n" "}\n"); V("<?php class bar { function foo() { yield 123; yield 456;} }", "class bar {\n" "public function foo() {\n" "return hphp_create_continuation" "(__CLASS__, '3990978909_1', __METHOD__);\n" "}\n" "public function ($" CONTINUATION_OBJECT_NAME ") {\n" "hphp_unpack_continuation();\n" "yield 123;\n" "yield 456;\n" "}\n" "}\n"); return true; }
// Swap test void weak_5() { assert_ck(0, 0); { shared_test s0(test_behavior::init()); assert_ck(1, 0); weak_test w0(s0); assert_ck(1, 0); shared_test s1(test_behavior::init()); assert_ck(2, 0); weak_test w1(s1); assert_ck(2, 0); auto old0(s0.get()); auto old1(s1.get()); assert_ck(2, 0); assert(w0.lock().get() == old0); assert(w1.lock().get() == old1); w0.swap(w1); assert_ck(2, 0); assert(w0.lock().get() == old1); assert(w1.lock().get() == old0); (void)old0; (void)old1; } assert_ck(2, 2); }
static void dstr_read_block( PIA *pi, char * buf, int count ) { int k, a, b; w0(0x81); P1; if (pi->mode) { w0(0x19); } else { w0(9); } P2; w0(0x82); P1; P3; w0(0x20); P1; switch (pi->mode) { case 0: for (k=0;k<count;k++) { w2(6); a = r1(); w2(4); w2(6); b = r1(); w2(4); buf[k] = j44(a,b); } break; case 1: w0(0); for (k=0;k<count;k++) { w2(0x26); buf[k] = r0(); w2(0x24); } w2(4); break; case 2: w2(0x24); for (k=0;k<count;k++) buf[k] = r4(); w2(4); break; case 3: w2(0x24); for (k=0;k<count/2;k++) ((u16 *)buf)[k] = r4w(); w2(4); break; case 4: w2(0x24); for (k=0;k<count/4;k++) ((u32 *)buf)[k] = r4l(); w2(4); break; } }
static void kbic_write_block( PIA *pi, char * buf, int count ) { int k; switch (pi->mode) { case 0: case 1: case 2: w0(0x90); w2(4); w2(6); w2(4); for(k=0;k<count/2;k++) { w0(buf[2*k+1]); w2(0); w2(4); w0(buf[2*k]); w2(5); w2(4); } break; case 3: w0(0xa0); w2(4); w2(6); w2(4); w3(0); for(k=0;k<count/2;k++) { w4(buf[2*k+1]); w4(buf[2*k]); } w2(4); w2(0); w2(4); break; case 4: w0(0xa0); w2(4); w2(6); w2(4); w3(0); for(k=0;k<count/2;k++) w4w(pi_swab16(buf,k)); w2(4); w2(0); w2(4); break; case 5: w0(0xa0); w2(4); w2(6); w2(4); w3(0); for(k=0;k<count/4;k++) w4l(pi_swab32(buf,k)); w2(4); w2(0); w2(4); break; } }
static void dstr_disconnect ( PIA *pi ) { CCP(0x30); w0(pi->saved_r0); w2(pi->saved_r2); }
static void dstr_connect ( PIA *pi ) { pi->saved_r0 = r0(); pi->saved_r2 = r2(); w2(4); CCP(0xe0); w0(0xff); }
code is adjusted accordingly */ #define u0(p) bytes2word(f2(p), p, p, f3(p)) #define u1(p) bytes2word(f3(p), f2(p), p, p) #define u2(p) bytes2word(p, f3(p), f2(p), p) #define u3(p) bytes2word(p, p, f3(p), f2(p)) #define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p)) #define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p)) #define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p)) #define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p)) const aes_32t rcon_tab[29] = { w0(0x01), w0(0x02), w0(0x04), w0(0x08), w0(0x10), w0(0x20), w0(0x40), w0(0x80), w0(0x1b), w0(0x36), w0(0x6c), w0(0xd8), w0(0xab), w0(0x4d), w0(0x9a), w0(0x2f), w0(0x5e), w0(0xbc), w0(0x63), w0(0xc6), w0(0x97), w0(0x35), w0(0x6a), w0(0xd4), w0(0xb3), w0(0x7d), w0(0xfa), w0(0xef), w0(0xc5) }; #ifdef SBX_SET const aes_08t s_box[256] = { sb_data(h0) }; #endif #ifdef ISB_SET const aes_08t inv_s_box[256] = { isb_data(h0) }; #endif
void SDTestObject::test<6>() // copy construction and assignment // checking for shared values after constr. or assignment // checking in both the same type and change of type case { SDCleanupCheck check; { LLSD v = 42; LLSD w0(v); ensureTypeAndValue("int constr.", w0, 42); LLSD w1(v); w1 = 13; ensureTypeAndValue("int constr. change case 1", w1, 13); ensureTypeAndValue("int constr. change case 2", v, 42); LLSD w2(v); v = 7; ensureTypeAndValue("int constr. change case 3", w2, 42); ensureTypeAndValue("int constr. change case 4", v, 7); } { LLSD v = 42; LLSD w1(v); w1 = "bob"; ensureTypeAndValue("string constr. change case 1", w1, "bob"); ensureTypeAndValue("string constr. change case 2", v, 42); LLSD w2(v); v = "amy"; ensureTypeAndValue("string constr. change case 3", w2, 42); ensureTypeAndValue("string constr. change case 4", v, "amy"); } { LLSD v = 42; LLSD w0; w0 = v; ensureTypeAndValue("int assign", w0, 42); LLSD w1; w1 = v; w1 = 13; ensureTypeAndValue("int assign change case 1", w1, 13); ensureTypeAndValue("int assign change case 2", v, 42); LLSD w2; w2 = v; v = 7; ensureTypeAndValue("int assign change case 3", w2, 42); ensureTypeAndValue("int assign change case 4", v, 7); } { LLSD v = 42; LLSD w1; w1 = v; w1 = "bob"; ensureTypeAndValue("string assign change case 1", w1, "bob"); ensureTypeAndValue("string assign change case 2", v, 42); LLSD w2; w2 = v; v = "amy"; ensureTypeAndValue("string assign change case 3", w2, 42); ensureTypeAndValue("string assign change case 4", v, "amy"); } }
static int kbic_read_regr( PIA *pi, int cont, int regr ) { int a, b, s; s = cont_map[cont]; switch (pi->mode) { case 0: w0(regr|0x18|s); w2(4); w2(6); w2(4); w2(1); w0(8); a = r1(); w0(0x28); b = r1(); w2(4); return j44(a,b); case 1: w0(regr|0x38|s); w2(4); w2(6); w2(4); w2(5); w0(8); a = r12w(); w2(4); return j53(a); case 2: w0(regr|0x08|s); w2(4); w2(6); w2(4); w2(0xa5); w2(0xa1); a = r0(); w2(4); return a; case 3: case 4: case 5: w0(0x20|s); w2(4); w2(6); w2(4); w3(regr); a = r4(); b = r4(); w2(4); w2(0); w2(4); return a; } return -1; }
static void kbic_read_block( PIA *pi, char * buf, int count ) { int k, a, b; switch (pi->mode) { case 0: w0(0x98); w2(4); w2(6); w2(4); for (k=0; k<count/2; k++) { w2(1); w0(8); a = r1(); w0(0x28); b = r1(); buf[2*k] = j44(a,b); w2(5); b = r1(); w0(8); a = r1(); buf[2*k+1] = j44(a,b); w2(4); } break; case 1: w0(0xb8); w2(4); w2(6); w2(4); for (k=0; k<count/4; k++) { w0(0xb8); w2(4); w2(5); w0(8); buf[4*k] = j53(r12w()); w0(0xb8); buf[4*k+1] = j53(r12w()); w2(4); w2(5); buf[4*k+3] = j53(r12w()); w0(8); buf[4*k+2] = j53(r12w()); } w2(4); break; case 2: w0(0x88); w2(4); w2(6); w2(4); for (k=0; k<count/2; k++) { w2(0xa0); w2(0xa1); buf[2*k] = r0(); w2(0xa5); buf[2*k+1] = r0(); } w2(4); break; case 3: w0(0xa0); w2(4); w2(6); w2(4); w3(0); for (k=0; k<count; k++) buf[k] = r4(); w2(4); w2(0); w2(4); break; case 4: w0(0xa0); w2(4); w2(6); w2(4); w3(0); for (k=0; k<count/2; k++) ((u16 *)buf)[k] = r4w(); w2(4); w2(0); w2(4); break; case 5: w0(0xa0); w2(4); w2(6); w2(4); w3(0); for (k=0; k<count/4; k++) ((u32 *)buf)[k] = r4l(); w2(4); w2(0); w2(4); break; } }
static void epat_read_block( PIA *pi, char * buf, int count ) { int k, ph, a, b; switch (pi->mode) { case 0: w0(7); w2(1); w2(3); w0(0xff); ph = 0; for(k=0;k<count;k++) { if (k == count-1) w0(0xfd); w2(6+ph); a = r1(); if (a & 8) b = a; else { w2(4+ph); b = r1(); } buf[k] = j44(a,b); ph = 1 - ph; } w0(0); w2(4); break; case 1: w0(0x47); w2(1); w2(5); w0(0xff); ph = 0; for(k=0;k<count;k++) { if (k == count-1) w0(0xfd); w2(4+ph); a = r1(); b = r2(); buf[k] = j53(a,b); ph = 1 - ph; } w0(0); w2(4); break; case 2: w0(0x27); w2(1); w2(0x25); w0(0); ph = 0; for(k=0;k<count-1;k++) { w2(0x24+ph); buf[k] = r0(); ph = 1 - ph; } w2(0x26); w2(0x27); buf[count-1] = r0(); w2(0x25); w2(4); break; case 3: w3(0x80); w2(0x24); for(k=0;k<count-1;k++) buf[k] = r4(); w2(4); w3(0xa0); w2(0x24); buf[count-1] = r4(); w2(4); break; case 4: w3(0x80); w2(0x24); for(k=0;k<(count/2)-1;k++) ((u16 *)buf)[k] = r4w(); buf[count-2] = r4(); w2(4); w3(0xa0); w2(0x24); buf[count-1] = r4(); w2(4); break; case 5: w3(0x80); w2(0x24); for(k=0;k<(count/4)-1;k++) ((u32 *)buf)[k] = r4l(); for(k=count-4;k<count-1;k++) buf[k] = r4(); w2(4); w3(0xa0); w2(0x24); buf[count-1] = r4(); w2(4); break; } }
template <class P> static void Apply( const GenericImage<P>& image, MultiscaleMedianTransform& T ) { InitializeStructures(); bool statusInitialized = false; StatusMonitor& status = (StatusMonitor&)image.Status(); try { if ( status.IsInitializationEnabled() ) { status.Initialize( String( T.m_medianWaveletTransform ? "Median-wavelet" : "Multiscale median" ) + " transform", image.NumberOfSelectedSamples()*T.m_numberOfLayers*(T.m_medianWaveletTransform ? 2 : 1) ); status.DisableInitialization(); statusInitialized = true; } GenericImage<P> cj0( image ); cj0.Status().Clear(); for ( int j = 1, j0 = 0; ; ++j, ++j0 ) { GenericImage<P> cj( cj0 ); cj.Status() = status; MedianFilterLayer( cj, T.FilterSize( j0 ), T.m_parallel, T.m_maxProcessors ); if ( T.m_medianWaveletTransform ) { GenericImage<P> w0( cj0 ); GenericImage<P> d0( cj0 ); d0 -= cj; for ( int c = 0; c < d0.NumberOfChannels(); ++c ) { w0.SelectChannel( c ); d0.SelectChannel( c ); cj.SelectChannel( c ); double t = T.m_medianWaveletThreshold*d0.MAD( d0.Median() )/0.6745; for ( typename GenericImage<P>::sample_iterator iw( w0 ), id( d0 ), ic( cj ); iw; ++iw, ++id, ++ic ) if ( Abs( *id ) > t ) *iw = *ic; } w0.ResetSelections(); cj.ResetSelections(); w0.Status() = cj.Status(); LinearFilterLayer( w0, T.FilterSize( j0 ), T.m_parallel, T.m_maxProcessors ); cj = w0; } status = cj.Status(); cj.Status().Clear(); if ( T.m_layerEnabled[j0] ) { cj0 -= cj; T.m_transform[j0] = Image( cj0 ); } if ( j == T.m_numberOfLayers ) { if ( T.m_layerEnabled[j] ) T.m_transform[j] = Image( cj ); break; } cj0 = cj; } if ( statusInitialized ) status.EnableInitialization(); } catch ( ... ) { T.DestroyLayers(); if ( statusInitialized ) status.EnableInitialization(); throw; } }
static void fit2_disconnect ( PIA *pi ) { w0(pi->saved_r0); w2(pi->saved_r2); }
void myChaccum(cv::Mat & A,vector<int>& radiusRange,int method,int objPolarity,double edgeThresh,cv::Mat & accumMatrix,cv::Mat & gradientImg){ double maxNumElemNHoodMat = 1e6; //Mat accumMatrix_2d(accumMatrix.size(),CV_64FC2); Mat Gx,Gy; //A gradientImg 都是32float imgradient(A,Gx,Gy,gradientImg); //cout<<gradientImg<<endl; vector<int> Ey,Ex,idxE; getEdgeM_PIxels( gradientImg,edgeThresh,Ey,Ex); mysub2ind(gradientImg.size(),Ey,Ex,idxE); vector<float> radiusfRange; float radius_tmp = radiusRange[0]; float steplength = 0.5; while(radius_tmp<=radiusRange[1]){ radiusfRange.push_back(radius_tmp); radius_tmp += steplength; } vector<float> RR; switch(objPolarity){ case bright: RR = radiusfRange; break; case dark: RR = radiusfRange ; for(int i=0;i<RR.size();i++){ RR.at(i) *= -1.0; } break; default: break; } // // vector<float> lnR; vector<float> phi; Mat Opca(cv::Size(radiusfRange.size(),1),CV_32FC2); Mat w0(cv::Size(radiusfRange.size(),1),CV_32FC2); float phi_t= 0.0; float opca_R = 0.0; float opca_I= 0.0; float w0_R = 0.0; float w0_I = 0.0; int i = 0; switch(method){ case twostage: for(i=0;i<radiusfRange.size();i++){ w0.at<cv::Vec2f>(0,i)[0] = 1/(2*M_PI*radiusfRange.at(i)); w0.at<cv::Vec2f>(0,i)[1] =0.0; } break; case phasecode: for(i=0;i<radiusfRange.size();i++){ float w_t = log(radiusfRange.at(i)); lnR.push_back(w_t); } for(int i=0;i<radiusfRange.size();i++){ phi_t = ((lnR.at(i) - lnR.at(0)) / ( lnR.at(radiusfRange.size()-1) - lnR.at(0))*2*M_PI)-M_PI; phi.push_back(phi_t); opca_R = cos(phi_t);//exp(sqrt(-1)*phi_t);//虚数 opca_I = sin(phi_t); Opca.at<cv::Vec2f>(0,i)[0] = opca_R; Opca.at<cv::Vec2f>(0,i)[1] = opca_I; w0_R = opca_R / (2*M_PI*radiusfRange.at(i)); w0_I = opca_I / (2*M_PI*radiusfRange.at(i)); w0.at<cv::Vec2f>(0,i)[0] = w0_R; w0.at<cv::Vec2f>(0,i)[1] = w0_I; } break; default: break; } //cout<<"radiusfRange : "<<radiusfRange.size()<<endl; int xcStep = floor(maxNumElemNHoodMat/RR.size()); // int lenE = Ex.size(); accumMatrix.setTo(Scalar::all(0)); //cout<<accumMatrix<<endl; vector<int> Ex_chunk; vector<int> Ey_chunk; vector<int> idxE_chunk; vector<bool> rows_to_keep; Mat xc; Mat yc; Mat w; Mat inside; Mat xc_new; Mat yc_new; Mat w_new; Mat inside_new; Mat m_yxc; Mat m_wval; vector<int> xc_vec,yc_vec; vector<float> w_vecR,w_vecI; for(int i =0;i<lenE;i += xcStep){ Ex_chunk.clear(); Ey_chunk.clear(); idxE_chunk.clear(); for(int j=i;j<min((i+xcStep-1),(lenE));j++){ Ex_chunk.push_back(Ex.at(j)); Ey_chunk.push_back(Ey.at(j)); idxE_chunk.push_back(idxE.at(j)); }//j xc.release(); yc.release(); w.release(); inside.release(); xc.create(cv::Size(RR.size(),Ex_chunk.size()),CV_32SC1); yc.create(cv::Size(RR.size(),Ex_chunk.size()),CV_32SC1); w.create(cv::Size(RR.size(),Ex_chunk.size()),CV_32FC2); inside.create(cv::Size(RR.size(),Ex_chunk.size()),CV_8UC1); int M = A.rows; int N = A.cols; for (int t=0;t<idxE_chunk.size();t++) { int x = idxE_chunk.at(t) / gradientImg.rows ; int y = idxE_chunk.at(t)%(gradientImg.rows ); //cout<<t<<": "<<Ex_chunk.at(t)<<endl; for (int j=0;j<xc.cols;j++) { //============================---------------------------------------------------=========== //============================================================ double fxc = (-1)*RR.at(j) * Gx.at<float>(y,x)/gradientImg.at<float>(y,x) + Ex_chunk.at(t); int txc = /*min*/(RoundEx(fxc)/*,479*/); //cout<<gradientImg<<endl; xc.at<int>(t,j) = txc; int tyc = /*min*/(RoundEx((-1)*RR.at(j) * Gy.at<float>(y,x)/gradientImg.at<float>(y,x) + Ey_chunk.at(t))/*,639*/); yc.at<int>(t,j) = tyc; w.at<cv::Vec2f>(t,j)[0] = w0.at<cv::Vec2f>(0,j)[0]; w.at<cv::Vec2f>(t,j)[1] = w0.at<cv::Vec2f>(0,j)[1]; //Determine which edge M_PIxel votes are wirhin the image domain bool inside_t = (xc.at<int>(t,j) >= 0) && (xc.at<int>(t,j)<N) && (yc.at<int>(t,j) >= 0) && (yc.at<int>(t,j) < M); inside.at<uchar>(t,j) = inside_t?1:0;// }//j }//t //cout<<xc<<endl; // //Keep rows that have at least one candidate position inside the domain int sum_ture = 0; rows_to_keep.clear(); for(int t=0;t<inside.rows;t++){ bool rows_to_keep_tmp = false; for (int j=0;j<inside.cols;j++){ if(inside.at<uchar>(t,j)>0){ rows_to_keep_tmp = true; sum_ture++; break; } }//j rows_to_keep.push_back(rows_to_keep_tmp); }//t xc_new.release(); yc_new.release(); w_new.release(); inside_new.release(); xc_new.create(cv::Size(xc.cols,sum_ture),CV_32SC1); yc_new.create(cv::Size(yc.cols,sum_ture),CV_32SC1); w_new.create(cv::Size(w.cols,sum_ture),w.type()); inside_new.create(cv::Size(inside.cols,sum_ture),inside.type()); for (int t=0,f=0;t<xc.rows;t++) { if(rows_to_keep.at(t)){ for (int j=0;j<xc.cols;j++) { xc_new.at<int>(f,j) = xc.at<int>(t,j); yc_new.at<int>(f,j) = yc.at<int>(t,j); w_new.at<cv::Vec2f>(f,j)[0] = w.at<cv::Vec2f>(t,j)[0]; w_new.at<cv::Vec2f>(f,j)[1] = w.at<cv::Vec2f>(t,j)[1]; inside_new.at<uchar>(f,j) = inside.at<uchar>(t,j); } f++; } }//t //accumulate the votes in the parameter plane //1.向量化 xc_vec.clear(); yc_vec.clear(); w_vecR.clear(); w_vecI.clear(); m_yxc.release(); m_wval.release(); for (int j=0;j<inside_new.cols;j++) { for (int t =0;t<inside_new.rows;t++) { if((inside_new.at<uchar>(t,j))==1){ xc_vec.push_back(xc_new.at<int>(t,j)); yc_vec.push_back(yc_new.at<int>(t,j)); w_vecR.push_back(w_new.at<cv::Vec2f>(t,j)[0]); w_vecI.push_back(w_new.at<cv::Vec2f>(t,j)[1]); } }//t }//j m_yxc.create(cv::Size(2,xc_vec.size()),CV_32SC1); m_wval.create(cv::Size(1,xc_vec.size()),CV_32FC2); for(int j=0;j<yc_vec.size();j++){ m_yxc.at<int>(j,0) = yc_vec.at(j); m_yxc.at<int>(j,1) = xc_vec.at(j); m_wval.at<cv::Vec2f>(j,0)[0] = w_vecR.at(j); m_wval.at<cv::Vec2f>(j,0)[1] = w_vecI.at(j); //cout<<w_vecR.at(j)<<","<<w_vecI.at(j)<<endl; } Mat_<cv::Vec2f> accumR; myaccumarray(m_yxc,m_wval,accumR,A.size()); //cout<<"accumR"<<endl; accumMatrix += accumR; //cout<<accumMatrix<<endl; } }
static int on26_test_port( PIA *pi) /* hard reset */ { int i, m, d, x, y; pi->saved_r0 = r0(); pi->saved_r2 = r2(); d = pi->delay; m = pi->mode; pi->delay = 5; pi->mode = 0; w2(0xc); CCP(0x30); CCP(0); w0(0xfe);w0(0xaa);w0(0x55);w0(0);w0(0xff); i = ((r1() & 0xf0) << 4); w0(0x87); i |= (r1() & 0xf0); w0(0x78); w0(0x20);w2(4);w2(5); i |= ((r1() & 0xf0) >> 4); w2(4);w0(0xff); if (i == 0xb5f) { w0(2); P1; w0(0); P2; w0(3); P1; w0(0); P2; w0(2); P1; w0(8); P2; udelay(100); w0(2); P1; w0(0xa); P2; udelay(100); w0(2); P1; w0(8); P2; udelay(1000); on26_write_regr(pi,0,6,0xa0); for (i=0;i<RESET_WAIT;i++) { on26_write_regr(pi,0,6,0xa0); x = on26_read_regr(pi,0,7); on26_write_regr(pi,0,6,0xb0); y = on26_read_regr(pi,0,7); if (!((x&0x80)||(y&0x80))) break; udelay(100000); } if (i == RESET_WAIT) printk("on26: Device reset failed (%x,%x)\n",x,y); w0(4); P1; w0(4); P1; } CCP(0x30); pi->delay = d; pi->mode = m; w0(pi->saved_r0); w2(pi->saved_r2); return 5; }
static void on26_read_block( PIA *pi, char * buf, int count ) { int k, a, b; switch (pi->mode) { case 0: w0(1); P1; w0(1); P2; w0(2); P1; w0(0x18); P2; w0(0); P1; udelay(10); for (k=0;k<count;k++) { w2(6); a = r1(); w2(4); b = r1(); buf[k] = j44(a,b); } w0(2); P1; w0(8); P2; break; case 1: w0(1); P1; w0(1); P2; w0(2); P1; w0(0x19); P2; w0(0); P1; udelay(10); for (k=0;k<count/2;k++) { w2(0x26); buf[2*k] = r0(); w2(0x24); buf[2*k+1] = r0(); } w0(2); P1; w0(9); P2; break; case 2: w3(1); w3(1); w2(5); w4(1); w2(4); w3(0); w3(0); w2(0x24); udelay(10); for (k=0;k<count;k++) buf[k] = r4(); w2(4); break; case 3: w3(1); w3(1); w2(5); w4(1); w2(4); w3(0); w3(0); w2(0x24); udelay(10); for (k=0;k<count/2;k++) ((u16 *)buf)[k] = r4w(); w2(4); break; case 4: w3(1); w3(1); w2(5); w4(1); w2(4); w3(0); w3(0); w2(0x24); udelay(10); for (k=0;k<count/4;k++) ((u32 *)buf)[k] = r4l(); w2(4); break; } }
static void on20_disconnect ( PIA *pi ) { w2(4);w0(7);w2(4);w2(0xc);w2(4); w0(pi->saved_r0); w2(pi->saved_r2); }
static void fit3_disconnect ( PIA *pi ) { w2(0xc); w0(0xa); w2(0x8); w2(0xc); w0(pi->saved_r0); w2(pi->saved_r2); }
static void comm_disconnect ( PIA *pi ) { w2(0); w2(0); w2(0); w2(4); w0(pi->saved_r0); w2(pi->saved_r2); }
static void fit2_write_regr( PIA *pi, int cont, int regr, int val) { if (cont == 1) return; w2(0xc); w0(regr); w2(4); w0(val); w2(5); w0(0); w2(4); }
static void epat_disconnect (PIA *pi) { CPP(0x30); w0(pi->saved_r0); w2(pi->saved_r2); }