int findNumberOfLIS(std::vector<int>& V) { int mod = 1e9+7; int n = V.size(); if (n <= 1) return n; std::vector<int> lens(n, 0); std::vector<int> cnts(n, 1); for (int i = 0; i < n; ++i) { for (int j = 0; j < i; ++j) { if (V[j] >= V[i]) continue; if (lens[j] >= lens[i]) { lens[i] = lens[j] + 1; cnts[i] = cnts[j]; } else if (lens[j]+1 == lens[i]) { cnts[i] = (cnts[i] + cnts[j]) % mod; } } } int maxlen = *std::max_element(lens.begin(), lens.end()); int rslt = 0; for (int i = 0; i < n; ++i) { if (lens[i] == maxlen) rslt = (rslt + cnts[i]) % mod; } return rslt; }
Floats Triangle3D::get_edge_lengths()const { Floats lens(3); lens[0]=algebra::get_distance(p_[0],p_[1]); lens[1]=algebra::get_distance(p_[0],p_[2]); lens[2]=algebra::get_distance(p_[1],p_[2]); return lens; }
void receive_ctxt(int socket, const FHEPubKey &pk, std::vector<Ctxt> &ctxts) { std::stringstream sstream; MDL::Timer timer; char *buf; nn_recv(socket, &buf, NN_MSG, 0); // recv lens nn_send(socket, NULL, 0, 0); // send ok MDL::net::msg_header *hdr = (MDL::net::msg_header *)buf; std::vector<size_t> lens(hdr->msg_ele_sze, hdr->msg_ele_sze + hdr->msg_ele_nr); printf("vec size %zd\n", lens.size()); timer.start(); struct nn_msghdr nn_hdr; MDL::net::make_nn_header(&nn_hdr, lens); printf("%zd\n", nn_hdr.msg_iovlen); nn_recvmsg(socket, &nn_hdr, 0); // recv data timer.end(); Ctxt c(pk); for (size_t i = 0; i < nn_hdr.msg_iovlen; i++) { sstream.str((char *)nn_hdr.msg_iov[i].iov_base); sstream >> c; ctxts.push_back(c); } nn_freemsg(buf); nn_send(socket, NULL, 0, 0); printf("receive %zd ciphers %fs\n", ctxts.size(), timer.second()); }
inline bool OmniStereoGraphicsRenderer::onFrame() { FPS::onFrame(); // if running on a laptop? // nav().step(); onAnimate(dt); Viewport vp(width(), height()); if (bOmniEnable) { mOmni.onFrame(*this, lens(), pose, vp); } else { mOmni.onFrameFront(*this, lens(), pose, vp); } return true; }
inline bool OmniApp::onFrame() { FPS::onFrame(); while(oscRecv().recv()) {} nav().step(); onAnimate(dt); Viewport vp(width(), height()); if (bOmniEnable) { mOmni.onFrame(*this, lens(), nav(), vp); } else { mOmni.onFrameFront(*this, lens(), nav(), vp); } return true; }
inline OmniStereoGraphicsRenderer::OmniStereoGraphicsRenderer() : mNavControl(mNav), mOSCSend(12001) { bOmniEnable = true; mHostName = Socket::hostName(); lens().near(0.01).far(40).eyeSep(0.03); nav().smooth(0.8); initWindow(); initOmni(); Window::append(mStdControls); Window::append(mNavControl); mOmniControls.o = this; Window::append(mOmniControls); }
int main() { srand(time(0)); size_t dim, num_vec, num_inc; float in_inc, mul_val; num_inc=1000; in_inc=.1; mul_val=3.14159*.7; dim=6; num_vec=500; std::vector<float> lens(dim, 2*3.14159); size_t d_vals = 5; float min_int = 0.25; hasher hh(15, 10000, lens, d_vals, min_int); rmf vvals(rmf::Zero(num_vec, dim)); for(size_t g =0; g < num_inc; g++){ //copy most recent row into beginning float cur_inc=in_inc; for(size_t j = 0; j < dim; j++){ vvals(0, j) = fmod(vvals(num_vec-1, j)+cur_inc, lens[j]); cur_inc *= mul_val; } //create the matrix of search vectors for(size_t i = 1; i < num_vec; i++){ cur_inc = in_inc; for(size_t j = 0; j < dim; j++){ vvals(i, j) = fmod(vvals(i-1, j)+cur_inc, lens[j]); cur_inc *= mul_val; } } hh.add_vecs(vvals); cout << "getting_scores" << endl; vector<float> scores = hh.get_cur_scores(); cout << scores[0] << endl; } hh.get_cur_scores(); }
int ri_inter (void) { /* This is the shortest version of the interpreter, containing only those RASL operators which * are produced by the REFAL compiler. */ /* July, 27, 1985. D.T. */ /* Some macros have been expanded because the PC compiler can't handle too many macros. (its stack overflows.) * DT July 1 1986. */ /* Some other macros have been replaced by functions to reduce the size of object module. March 7 1987. DT. */ register short n; int error; char c, ins = 0; long mdig, bifnum; char *arg; /* short m;*/ error = 0; restart: while (error == 0) { ins = *p; # if MDEBUG if (dump_toggle) printf ("%lx: %d\n", p, ins); # endif switch (ins) { case ACT1: ASGN_CHARP (++p, arg); p += sizeof (char *); act1 (arg); curk ++; break; case BL: p++; bl; break; case BLR: p++; ri_blr (); break; case BR: p++; br; break; case CL: p++; cl; break; case SYM: c = (unsigned char) * ++p; p++; sym (c); break; case SYMR: c = (unsigned char) * ++p; p++; symr (c); break; case EMP: p++; emp; break; case EST: curk --; est; p = break0; break; case MULE: /* n = * ++p; ++p; mule ((int) n); */ ASGN_LONG (++p, mdig); p += sizeof (long); mule (mdig); break; case MULS: /*n = * ++p; muls (n); p++; break;*/ ASGN_LONG (++p, mdig); p += sizeof (long); muls (mdig); break; case PLEN: p++; plen; p++; break; case PLENS: p++; plens; break; case PLENP: p++; plenp; break; case PS: ++p; ps; break; case PSR: ++p; psr; break; case OEXP: n = (unsigned char) * ++p; ++p; oexp (n); break; case OEXPR: n = (unsigned char) * ++p; ++p; oexpr (n); break; case OVSYM: n = (unsigned char) * ++p; ovsym (n); ++p; break; case OVSYMR: n = (unsigned char) * ++p; ovsymr (n); p++; break; case TERM: p++; term; break; case TERMR: p++; termr; break; case RDY: n = (unsigned char) * ++p; ++p; rdy (n); break; case SETB: /* n = (unsigned char) * ++p; m = (unsigned char) * ++p; ++p; setb (n,m); break; */ { long l_n, l_m; ASGN_LONG (++p, l_n); p += sizeof (long); ASGN_LONG (p, l_m); p += sizeof (long); setb (l_n, l_m); } break; case LEN: p++; len; break; case LENS: c = (unsigned char) *++p; p++; lens (c); break; case LENP: ++p; lenp; break; case SYMS: n = (unsigned char) * ++p; p++; syms (n); break; case SYMSR: n = (unsigned char) * ++p; p++; symsr (n) break; case TEXT: n = (unsigned char) * ++p; p++; text (n); break; case NS: c = (unsigned char) * ++p; ++p; ns (c); break; case TPLE: /* n = * ++p; p++; tple (n); break; */ ASGN_LONG (++p, mdig); p += sizeof (long); tple (mdig); break; case TPLS: /* n = * ++p; p++; tpls (n); break; */ ASGN_LONG (++p, mdig); p += sizeof (long); tpls (mdig); break; case TRAN: ASGN_CHARP (++p, arg); p += sizeof (char *); tran (arg); break; case VSYM: p++; vsym; break; case VSYMR: ++p; vsymr; break; case OUTEST: curk --; out (2); est; p = break0; break; case ECOND: if (tel - te + nel + 100 >= size_table_element) { if (fp_debugInfo != NULL) ri_print_error_code(fp_debugInfo,13); ri_error (13); } ASGN_CHARP (++p, arg); b = st[sp].b1; b = st[sp].b1; act1 (arg); tel += (teoff = nel); est; p = break0; break; case POPVF: ++p; tel -= teoff; nel = teoff + 3; sp = stoff-1; teoff = st[sp].nel; stoff = (long) st[sp].b2; break; case PUSHVF: if (sp + 20 >= size_local_stack) { if (fp_debugInfo != NULL) ri_print_error_code(fp_debugInfo,14); ri_error (14); } ++p; b = tbel (2) -> prec; blr; pushst (b->prec,b,NULL,NULL); sp++; pushst (b,stoff,teoff, IMP_); b = b -> prec; stoff = sp + 1; break; case STLEN: ++p; sp = stoff; break; case CSYM: ASGN_CHARP (++p, arg); p += sizeof (char *); csym (arg); break; case CSYMR: ASGN_CHARP (++p, arg); p += sizeof (char *); csymr (arg); break; case NSYM: ASGN_LONG (++p, mdig); p += sizeof (long); nsym (mdig); break; case NSYMR: ASGN_LONG (++p, mdig); p += sizeof (long); nsymr (mdig); break; case NCS: ASGN_CHARP (++p, arg); p += sizeof (char *); ncs (arg); break; case NNS: ASGN_LONG (++p, mdig); p += sizeof (long); nns (mdig); break; /* builtin functions: R.N. - 20 Jul 85 */ case BUILT_IN: /* a call to a built in function no arguments. */ curk --; ASGN_LONG (p+1, bifnum); error = ri_bif (bifnum,NULL); p = break0; break; /* builtin functions with one argument: D.T. - July 27, 1985. */ case BUILT_IN1: /* a call to a function with one argument. */ /* Arguments are stored before function address. */ curk --; ASGN_CHARP(++p, arg); ASGN_LONG (p + (sizeof (char *)), bifnum); error = ri_bif (bifnum, arg); p = break0; break; default: ri_default (ins, &error); break; } } if (error != 0) { fprintf (stderr,"RASL instruction: %4d at address: %lx\n", *p, (unsigned long) p); if (fp_debugInfo != NULL) fprintf (fp_debugInfo,"RASL instruction: %4d at address: %lx\n", *p, (unsigned long) p); ri_error(4); } return 0; }
/// This should still be called via ProtoApp::onAnimate(dt) if overridden virtual void onAnimate(double dt){ lens().fovy(cnFOV.getValue()); }
real_t MLTPerturbationPathMutation::mutate(const Path &X, Path &Y) { const unsigned n = X.length(); PERTURBATION_TYPE type; Path lens(m_renderer); Y = X; { // delete current lens subpath Y.pop_back(); // pop previous sensor vertex if (!Y.back().bsdf->isSpecular() && Y.length() >= 2 && Y[Y.length() - 2].bsdf->isSpecular()) { // path has suffix SDE type = PERTURBATION_TYPE_CAUSTIC; Y.pop_back(); // pop diffuse vertex while(Y.back().bsdf->isSpecular()) { Y.pop_back(); // pop zero or more specular vertices if (Y.empty()) return 0; // mutation failed } } else { type = PERTURBATION_TYPE_LENS; while(Y.back().bsdf->isSpecular()) { Y.pop_back(); // pop zero or more specular vertices if (Y.empty()) return 0; // mutation failed } Y.pop_back(); // pop diffuse vertex while(Y.length() >= 2 && Y.back().bsdf->isSpecular()) { // path has suffix SDS*E and is a multi-chain candidate type = PERTURBATION_TYPE_MULTI_CHAIN; do { // remove one or more specular vertices Y.pop_back(); if (Y.empty()) return 0; // mutation failed } while(Y.back().bsdf->isSpecular()); Y.pop_back(); // pop diffuse vertex } if (type == PERTURBATION_TYPE_LENS && !Y.empty() && Y.back().bsdf->isSpecular()) { return 0; // mutation failed } } } const unsigned s = Y.length(); if (type == PERTURBATION_TYPE_LENS || type == PERTURBATION_TYPE_MULTI_CHAIN) { { // determine new point on image plane const Viewport &viewport = m_renderer->getOutput()->getViewport(); const real_t pA = viewport.getInvWidth() * viewport.getInvHeight(); Point2 filmPt(X.back().pt->uv.u, X.back().pt->uv.v); /*const real_t theta = Random::sample(0, 2 * M_PI); const real_t r = m_r2 * exp(-log(m_r2 / m_r1) * Random::sample(0, 1)); filmPt[0] += r * cos(theta); filmPt[1] += r * sin(theta);*/ filmPt[0] += Random::sample(-5, 5) * viewport.getInvWidth (); filmPt[1] += Random::sample(-5, 5) * viewport.getInvHeight(); filmPt[0] = CLAMP(filmPt[0], 0, 1); filmPt[1] = CLAMP(filmPt[1], 0, 1); SurfacePoint *pt = new SurfacePoint(); m_renderer->getCamera()->getPoint(*pt, UV(filmPt)); if (!lens.prepend(PathVertex(pt, 1, pA))) return 0; // mutation failed } // prepend vertices until we reach a non-specular vertex do { if (!lens.prepend(false, false)) return 0; // mutation failed if (lens.length() > n) return 0; // mutation failed if (lens.front().pt->shape->getMaterial() != X[n - lens.length()].pt->shape->getMaterial()) { return 0; // mutation failed } lens.front().bsdf->setWi(lens.front().wi); lens.front().event = lens.front().bsdf->sample(X[n - lens.length()].event); } while(lens.front().bsdf->isSpecular()); if (type == PERTURBATION_TYPE_MULTI_CHAIN) { do { // add one or more DS+ chains const unsigned t = n - lens.length(); if (t == 0 || Y.length() + lens.length() >= n) break; //#warning "" //#warning "" // WARNING: "trying multi-chain not perturbing interior vertices" (current; commented out for windows) //#warning "" //#warning "" Vector3 wo = (X[t - 1].pt->position - X[t].pt->position).getNormalized(); _perturbVector(wo); PathVertex &v = lens.front(); v.event = Event(wo, v.event); do { // add DS+ if (!lens.prepend(false, false)) return 0; // mutation failed if (lens.length() > n) return 0; // mutation failed if (lens.front().pt->shape->getMaterial() != X[n - lens.length()].pt->shape->getMaterial()) { return 0; // mutation failed } lens.front().bsdf->setWi(lens.front().wi); lens.front().event = lens.front().bsdf->sample(X[n - lens.length()].event); } while(lens.front().bsdf->isSpecular()); } while(lens.length() + Y.length() < n); } } else { ASSERT(type == PERTURBATION_TYPE_CAUSTIC); ASSERT(X[s - 1].pt->position == Y.back().pt->position); ASSERT(X[s].bsdf->isSpecular()); ASSERT(!Y.back().bsdf->isSpecular()); /*real_t t = (X[n - 1].pt->position - X[n - 2].pt->position).getNormalized(); for(unsigned i = s; i < n - 1; ++i) t /= (X[i].pt->position - X[i - 1].pt->position).getNormalized();*/ Vector3 wo = (X[s].pt->position - X[s - 1].pt->position).getNormalized(); _perturbVector(wo); PathVertex &v = Y.back(); v.event = Event(wo, v.event); do { if (!Y.append(false, false)) return 0; // mutation failed if (Y.back().pt->shape->getMaterial() != X[Y.length() - 1].pt->shape->getMaterial()) return 0; // mutation failed if (Y.length() >= n - 1) break; Y.back().bsdf->setWi(Y.back().wi); Y.back().event = Y.back().bsdf->sample(X[Y.length() - 1].event); } while(1); { // determine new point on image plane const Viewport &viewport = m_renderer->getOutput()->getViewport(); const real_t pA = viewport.getInvWidth() * viewport.getInvHeight(); Point2 filmPt = m_renderer->getCamera()->getProjection(Y.back().pt->position); filmPt[0] = CLAMP(filmPt[0], 0, 1); filmPt[1] = CLAMP(filmPt[1], 0, 1); Point2 orig(X.back().pt->uv.u, X.back().pt->uv.v); //cerr << filmPt << " vs " << orig << endl; SurfacePoint *pt = new SurfacePoint(); m_renderer->getCamera()->getPoint(*pt, UV(filmPt)); if (!lens.prepend(PathVertex(pt, 1, pA))) return 0; // mutation failed } } { // attempt to join old subpath with new lens subpath if (!Y.append(lens)) return 0; // mutation failed if (!Y.front().isEmitter() || !Y.back().isSensor()) return 0; // mutation failed } real_t Txy = 1, Tyx = 1; switch(type) { case PERTURBATION_TYPE_CAUSTIC: Txy = Y[Y.length() - 1].pL; Tyx = X[X.length() - 1].pL; break; case PERTURBATION_TYPE_LENS: case PERTURBATION_TYPE_MULTI_CHAIN: default: Txy = Y[s].pE; Tyx = X[s].pE; break; } const real_t Fx = X.getRadiance().getRGB().luminance(); const real_t den = Txy * Fx; if (den == 0) return 0; // mutation failed // TODO: #warning "TESTING" const real_t a = ((Y.getRadiance()/X.getRadiance()).getRGB()).luminance() * (Tyx/Txy); return MIN(1.0, a); const real_t Fy = Y.getRadiance().getRGB().luminance(); const real_t alpha = MIN(1.0, (Fy * Tyx) / den); /*if (type == PERTURBATION_TYPE_MULTI_CHAIN) cerr << "multi-chain " << "alpha: " << alpha << endl; else if (type == PERTURBATION_TYPE_LENS) cerr << "lens " << "alpha: " << alpha << endl; else cerr << "caustic " << "alpha: " << alpha << endl;*/ return alpha; }
std::ostream& Nikon3MakerNote::print0x0098(std::ostream& os, const Value& value) { #ifdef EXV_HAVE_LENSDATA //# List of AF F-Mount lenses - version 1.19 //#----------------------------------------- //# created by Robert Rottmerhusen 2005 //# for use in non-commercial, GPL or open source software only! //# please contact me for adding lenses or use in commercial software. //# //#"data from TAG 0x98" "ltyp""manuf" "lens name from manuf"; //# struct {unsigned char lid,stps,focs,focl,aps,apl,lfw, ltype; char *manuf, *lensname;} fmountlens[] = { {0x01,0x58,0x50,0x50,0x14,0x14,0x02,0x00, "Nikon", "AF Nikkor 50mm f/1.8"}, {0x02,0x42,0x44,0x5C,0x2A,0x34,0x02,0x00, "Nikon", "AF Zoom-Nikkor 35-70mm f/3.3-4.5"}, {0x02,0x42,0x44,0x5C,0x2A,0x34,0x08,0x00, "Nikon", "AF Zoom-Nikkor 35-70mm f/3.3-4.5"}, {0x04,0x48,0x3C,0x3C,0x24,0x24,0x03,0x00, "Nikon", "AF Nikkor 28mm f/2.8"}, {0x05,0x54,0x50,0x50,0x0C,0x0C,0x04,0x00, "Nikon", "AF Nikkor 50mm f/1.4"}, {0x06,0x54,0x53,0x53,0x24,0x24,0x06,0x00, "Nikon", "AF Micro-Nikkor 55mm f/2.8"}, {0x07,0x40,0x3C,0x62,0x2C,0x34,0x03,0x00, "Nikon", "AF Zoom-Nikkor 28-85mm f/3.5-4.5"}, {0x08,0x40,0x44,0x6A,0x2C,0x34,0x04,0x00, "Nikon", "AF Zoom-Nikkor 35-105mm f/3.5-4.5"}, {0x09,0x48,0x37,0x37,0x24,0x24,0x04,0x00, "Nikon", "AF Nikkor 24mm f/2.8"}, {0x0A,0x48,0x8E,0x8E,0x24,0x24,0x03,0x00, "Nikon", "AF Nikkor 300mm f/2.8 IF-ED"}, {0x0B,0x48,0x7C,0x7C,0x24,0x24,0x05,0x00, "Nikon", "AF Nikkor 180mm f/2.8 IF-ED"}, {0x0D,0x40,0x44,0x72,0x2C,0x34,0x07,0x00, "Nikon", "AF Zoom-Nikkor 35-135mm f/3.5-4.5"}, {0x0E,0x48,0x5C,0x81,0x30,0x30,0x05,0x00, "Nikon", "AF Zoom-Nikkor 70-210mm f/4"}, {0x0F,0x58,0x50,0x50,0x14,0x14,0x05,0x00, "Nikon", "AF Nikkor 50mm f/1.8 N"}, {0x10,0x48,0x8E,0x8E,0x30,0x30,0x08,0x00, "Nikon", "AF Nikkor 300mm f/4 IF-ED"}, {0x11,0x48,0x44,0x5C,0x24,0x24,0x08,0x00, "Nikon", "AF Zoom-Nikkor 35-70mm f/2.8"}, {0x12,0x48,0x5C,0x81,0x30,0x3C,0x09,0x00, "Nikon", "AF Nikkor 70-210mm f/4-5.6"}, {0x13,0x42,0x37,0x50,0x2A,0x34,0x0B,0x00, "Nikon", "AF Zoom-Nikkor 24-50mm f/3.3-4.5"}, {0x14,0x48,0x60,0x80,0x24,0x24,0x0B,0x00, "Nikon", "AF Zoom-Nikkor 80-200mm f/2.8 ED"}, {0x15,0x4C,0x62,0x62,0x14,0x14,0x0C,0x00, "Nikon", "AF Nikkor 85mm f/1.8"}, {0x17,0x3C,0xA0,0xA0,0x30,0x30,0x11,0x00, "Nikon", "Nikkor 500mm f/4 P"}, {0x18,0x40,0x44,0x72,0x2C,0x34,0x0E,0x00, "Nikon", "AF Zoom-Nikkor 35-135mm f/3.5-4.5 N"}, {0x1B,0x44,0x5E,0x8E,0x34,0x3C,0x10,0x00, "Nikon", "AF Zoom-Nikkor 75-300mm f/4.5-5.6"}, {0x1C,0x48,0x30,0x30,0x24,0x24,0x12,0x00, "Nikon", "AF Nikkor 20mm f/2.8"}, {0x1D,0x42,0x44,0x5C,0x2A,0x34,0x12,0x00, "Nikon", "AF Zoom-Nikkor 35-70mm f/3.3-4.5 N"}, {0x1E,0x54,0x56,0x56,0x24,0x24,0x13,0x00, "Nikon", "AF Micro-Nikkor 60mm f/2.8"}, {0x24,0x48,0x60,0x80,0x24,0x24,0x1A,0x02, "Nikon", "AF Zoom-Nikkor ED 80-200mm f/2.8D"}, {0x25,0x48,0x44,0x5c,0x24,0x24,0x1B,0x02, "Nikon", "AF Zoom-Nikkor 35-70mm f/2.8D"}, {0x25,0x48,0x44,0x5c,0x24,0x24,0x52,0x02, "Nikon", "AF Zoom-Nikkor 35-70mm f/2.8D N"}, {0x27,0x48,0x8E,0x8E,0x24,0x24,0xF2,0x02, "Nikon", "AF-I Nikkor 300mm f/2.8D IF-ED"}, {0x2A,0x54,0x3C,0x3C,0x0C,0x0C,0x26,0x02, "Nikon", "AF Nikkor 28mm f/1.4D"}, {0x2C,0x48,0x6A,0x6A,0x18,0x18,0x27,0x02, "Nikon", "AF DC-Nikkor 105mm f/2D"}, {0x2D,0x48,0x80,0x80,0x30,0x30,0x21,0x02, "Nikon", "AF Micro-Nikkor 200mm f/4D IF-ED"}, {0x2E,0x48,0x5C,0x82,0x30,0x3C,0x28,0x02, "Nikon", "AF Nikkor 70-210mm f/4-5.6D"}, {0x31,0x54,0x56,0x56,0x24,0x24,0x25,0x02, "Nikon", "AF Micro-Nikkor 60mm f/2.8D"}, {0x32,0x54,0x6A,0x6A,0x24,0x24,0x35,0x02, "Nikon", "AF Micro-Nikkor 105mm f/2.8D"}, {0x33,0x48,0x2D,0x2D,0x24,0x24,0x31,0x02, "Nikon", "AF Nikkor 18mm f/2.8D"}, {0x36,0x48,0x37,0x37,0x24,0x24,0x34,0x02, "Nikon", "AF Nikkor 24mm f/2.8D"}, {0x37,0x48,0x30,0x30,0x24,0x24,0x36,0x02, "Nikon", "AF Nikkor 20mm f/2.8D"}, {0x38,0x4C,0x62,0x62,0x14,0x14,0x37,0x02, "Nikon", "AF Nikkor 85mm f/1.8D"}, {0x3B,0x48,0x44,0x5C,0x24,0x24,0x3A,0x02, "Nikon", "AF Zoom-Nikkor 35-70mm f/2.8D N"}, {0x3E,0x48,0x3C,0x3C,0x24,0x24,0x3D,0x02, "Nikon", "AF Nikkor 28mm f/2.8D"}, {0x41,0x48,0x7c,0x7c,0x24,0x24,0x43,0x02, "Nikon", "AF Nikkor 180mm f/2.8D IF-ED"}, {0x42,0x54,0x44,0x44,0x18,0x18,0x44,0x02, "Nikon", "AF Nikkor 35mm f/2D"}, {0x43,0x54,0x50,0x50,0x0C,0x0C,0x46,0x02, "Nikon", "AF Nikkor 50mm f/1.4D"}, {0x46,0x3C,0x44,0x60,0x30,0x3C,0x49,0x02, "Nikon", "AF Zoom-Nikkor 35-80mm f/4-5.6D"}, {0x48,0x48,0x8E,0x8E,0x24,0x24,0x4B,0x02, "Nikon", "AF-S Nikkor 300mm f/2.8D IF-ED"}, {0x4A,0x54,0x62,0x62,0x0C,0x0C,0x4D,0x02, "Nikon", "AF Nikkor 85mm f/1.4D IF"}, {0x4C,0x40,0x37,0x6E,0x2C,0x3C,0x4F,0x02, "Nikon", "AF Zoom-Nikkor 24-120mm f/3.5-5.6D IF"}, {0x4D,0x40,0x3C,0x80,0x2C,0x3C,0x62,0x02, "Nikon", "AF Zoom-Nikkor 28-200mm f/3.5-5.6D IF"}, {0x4E,0x48,0x72,0x72,0x18,0x18,0x51,0x02, "Nikon", "AF DC-Nikkor 135mm f/2D"}, {0x4F,0x40,0x37,0x5C,0x2C,0x3C,0x53,0x06, "Nikon", "IX-Nikkor 24-70mm f/3.5-5.6"}, {0x53,0x48,0x60,0x80,0x24,0x24,0x60,0x02, "Nikon", "AF Zoom-Nikkor 80-200mm f/2.8D ED"}, {0x54,0x44,0x5C,0x7C,0x34,0x3C,0x58,0x02, "Nikon", "AF Zoom-Micro Nikkor 70-180mm f/4.5-5.6D ED"}, {0x56,0x48,0x5C,0x8E,0x30,0x3C,0x5A,0x02, "Nikon", "AF Zoom-Nikkor 70-300mm f/4-5.6D ED"}, {0x59,0x48,0x98,0x98,0x24,0x24,0x5D,0x02, "Nikon", "AF-S Nikkor 400mm f/2.8D IF-ED"}, {0x5A,0x3C,0x3E,0x56,0x30,0x3C,0x5E,0x06, "Nikon", "IX-Nikkor 30-60mm f/4-5.6"}, {0x5D,0x48,0x3C,0x5C,0x24,0x24,0x63,0x02, "Nikon", "AF-S Zoom-Nikkor 28-70mm f/2.8D IF-ED"}, {0x5E,0x48,0x60,0x80,0x24,0x24,0x64,0x02, "Nikon", "AF-S Zoom-Nikkor 80-200mm f/2.8D IF-ED"}, {0x5F,0x40,0x3C,0x6A,0x2C,0x34,0x65,0x02, "Nikon", "AF Zoom-Nikkor 28-105mm f/3.5-4.5D IF"}, {0x61,0x44,0x5E,0x86,0x34,0x3C,0x67,0x02, "Nikon", "AF Zoom-Nikkor 75-240mm f/4.5-5.6D"}, {0x63,0x48,0x2B,0x44,0x24,0x24,0x68,0x02, "Nikon", "AF-S Nikkor 17-35mm f/2.8D IF-ED"}, {0x64,0x00,0x62,0x62,0x24,0x24,0x6A,0x02, "Nikon", "PC Micro-Nikkor 85mm f/2.8D"}, {0x65,0x44,0x60,0x98,0x34,0x3C,0x6B,0x0A, "Nikon", "AF VR Zoom-Nikkor 80-400mm f/4.5-5.6D ED"}, {0x66,0x40,0x2D,0x44,0x2C,0x34,0x6C,0x02, "Nikon", "AF Zoom-Nikkor 18-35mm f/3.5-4.5D IF-ED"}, {0x67,0x48,0x37,0x62,0x24,0x30,0x6D,0x02, "Nikon", "AF Zoom-Nikkor 24-85mm f/2.8-4D IF"}, {0x68,0x42,0x3C,0x60,0x2A,0x3C,0x6E,0x06, "Nikon", "AF Zoom-Nikkor 28-80mm f/3.3-5.6G"}, {0x69,0x48,0x5C,0x8E,0x30,0x3C,0x6F,0x06, "Nikon", "AF Zoom-Nikkor 70-300mm f/4-5.6G"}, {0x6A,0x48,0x8E,0x8E,0x30,0x30,0x70,0x02, "Nikon", "AF-S Nikkor 300mm f/4D IF-ED"}, {0x6D,0x48,0x8E,0x8E,0x24,0x24,0x73,0x02, "Nikon", "AF-S Nikkor 300mm f/2.8D IF-ED II"}, {0x6E,0x48,0x98,0x98,0x24,0x24,0x74,0x02, "Nikon", "AF-S Nikkor 400mm f/2.8D IF-ED II"}, {0x6F,0x3C,0xA0,0xA0,0x30,0x30,0x75,0x02, "Nikon", "AF-S Nikkor 500mm f/4D IF-ED"}, {0x70,0x3C,0xA6,0xA6,0x30,0x30,0x76,0x02, "Nikon", "AF-S Nikkor 600mm f/4D IF-ED"}, {0x72,0x48,0x4C,0x4C,0x24,0x24,0x77,0x00, "Nikon", "Nikkor 45mm f/2.8 P"}, {0x74,0x40,0x37,0x62,0x2C,0x34,0x78,0x06, "Nikon", "AF-S Zoom-Nikkor 24-85mm f/3.5-4.5G IF-ED"}, {0x75,0x40,0x3C,0x68,0x2C,0x3C,0x79,0x06, "Nikon", "AF Zoom-Nikkor 28-100mm f/3.5-5.6G"}, {0x76,0x58,0x50,0x50,0x14,0x14,0x7A,0x02, "Nikon", "AF Nikkor 50mm f/1.8D"}, {0x77,0x48,0x5C,0x80,0x24,0x24,0x7B,0x0E, "Nikon", "AF-S VR Zoom-Nikkor 70-200mm f/2.8G IF-ED"}, {0x78,0x40,0x37,0x6E,0x2C,0x3C,0x7C,0x0E, "Nikon", "AF-S VR Zoom-Nikkor 24-120mm f/3.5-5.6G IF-ED"}, {0x79,0x40,0x3C,0x80,0x2C,0x3C,0x7F,0x06, "Nikon", "AF Zoom-Nikkor 28-200mm f/3.5-5.6G IF-ED"}, {0x7A,0x3C,0x1F,0x37,0x30,0x30,0x7E,0x06, "Nikon", "AF-S DX Zoom-Nikkor 12-24mm f/4G IF-ED"}, {0x7B,0x48,0x80,0x98,0x30,0x30,0x80,0x0E, "Nikon", "AF-S VR Zoom-Nikkor 200-400mm f/4G IF-ED"}, {0x7D,0x48,0x2B,0x53,0x24,0x24,0x82,0x06, "Nikon", "AF-S DX Zoom-Nikkor 17-55mm f/2.8G IF-ED"}, {0x7F,0x40,0x2D,0x5C,0x2C,0x34,0x84,0x06, "Nikon", "AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED"}, {0x80,0x48,0x1A,0x1A,0x24,0x24,0x85,0x06, "Nikon", "AF DX Fisheye-Nikkor 10.5mm f/2.8G ED"}, {0x81,0x54,0x80,0x80,0x18,0x18,0x86,0x0E, "Nikon", "AF-S VR Nikkor 200mm f/2G IF-ED"}, {0x82,0x48,0x8E,0x8E,0x24,0x24,0x87,0x0E, "Nikon", "AF-S VR Nikkor 300mm f/2.8G IF-ED"}, {0x89,0x3C,0x53,0x80,0x30,0x3C,0x8B,0x06, "Nikon", "AF-S DX Zoom-Nikkor 55-200mm f/4-5.6G ED"}, {0x8C,0x40,0x2D,0x53,0x2C,0x3C,0x8E,0x06, "Nikon", "AF-S DX Zoom-Nikkor 18-55mm f/3.5-5.6G ED"}, //# {0x06,0x3F,0x68,0x68,0x2C,0x2C,0x06,0x00, "Cosina", "100mm F/3.5 Macro"}, //# {0x26,0x48,0x11,0x11,0x30,0x30,0x1C,0x02, "Sigma", "8mm F4 EX Circular Fisheye"}, {0x48,0x38,0x1F,0x37,0x34,0x3C,0x4B,0x06, "Sigma", "12-24mm F4.5-5.6 EX Aspherical DG HSM"}, {0x02,0x3F,0x24,0x24,0x2C,0x2C,0x02,0x00, "Sigma", "14mm F3.5"}, {0x26,0x48,0x27,0x27,0x24,0x24,0x1C,0x02, "Sigma", "15mm F2.8 EX Diagonal Fish-Eye"}, {0x26,0x40,0x27,0x3F,0x2C,0x34,0x1C,0x02, "Sigma", "15-30mm F3.5-4.5 EX Aspherical DG DF"}, {0x48,0x48,0x2B,0x44,0x24,0x30,0x4B,0x06, "Sigma", "17-35mm F2.8-4 EX DG Aspherical HSM"}, {0x26,0x48,0x2D,0x50,0x24,0x24,0x1C,0x06, "Sigma", "18-50mm F2.8 EX DC"}, {0x26,0x40,0x2D,0x50,0x2C,0x3C,0x1C,0x06, "Sigma", "18-50mm F3.5-5.6 DC"}, {0x26,0x40,0x2D,0x70,0x2B,0x3C,0x1C,0x06, "Sigma", "18-125mm F3.5-5.6 DC"}, {0x26,0x40,0x2D,0x80,0x2C,0x40,0x1C,0x06, "Sigma", "18-200mm F3.5-6.3 DC"}, {0x26,0x58,0x31,0x31,0x14,0x14,0x1C,0x02, "Sigma", "20mm F1.8 EX Aspherical DG DF RF"}, {0x26,0x58,0x37,0x37,0x14,0x14,0x1C,0x02, "Sigma", "24mm F1.8 EX Aspherical DG DF MACRO"}, {0x02,0x46,0x37,0x37,0x25,0x25,0x02,0x00, "Sigma", "24mm F2.8 Macro"}, {0x26,0x54,0x37,0x5C,0x24,0x24,0x1C,0x02, "Sigma", "24-70mm F2.8 EX DG Macro"}, {0x02,0x3F,0x3C,0x5C,0x2D,0x35,0x02,0x00, "Sigma", "28-70mm F3.5-4.5 UC"}, {0x26,0x40,0x3C,0x8E,0x2C,0x40,0x1C,0x02, "Sigma", "28-300mm F3.5-6.3 Macro"}, {0x26,0x40,0x3C,0x80,0x2B,0x3C,0x1C,0x02, "Sigma", "28-200mm F3.5-5.6 Compact Aspherical Hyperzoom Macro"}, {0x26,0x40,0x3C,0x60,0x2C,0x3C,0x1C,0x02, "Sigma", "28-80mm F3.5-5.6 Mini Zoom Macro II Aspherical"}, {0x02,0x40,0x44,0x73,0x2B,0x36,0x02,0x00, "Sigma", "35-135mm F3.5-4.5 a"}, {0x32,0x54,0x50,0x50,0x24,0x24,0x35,0x02, "Sigma", "50mm F2.8 EX DG Macro"}, {0x48,0x3C,0x50,0xA0,0x30,0x40,0x4B,0x02, "Sigma", "50-500mmF4-6.3 EX APO RF HSM"}, {0x26,0x3C,0x54,0x80,0x30,0x3C,0x1C,0x06, "Sigma", "55-200mm F4-5.6 DC"}, {0x48,0x54,0x5C,0x80,0x24,0x24,0x4B,0x02, "Sigma", "70-200mm F2.8 EX APO IF HSM"}, {0x56,0x3C,0x5C,0x8E,0x30,0x3C,0x1C,0x02, "Sigma", "70-300mm F4-5.6 APO Macro Super II"}, {0x02,0x37,0x5E,0x8E,0x35,0x3D,0x02,0x00, "Sigma", "75-300mm F4.5-5.6 APO"}, {0x02,0x48,0x65,0x65,0x24,0x24,0x02,0x00, "Sigma", "90mm F2.8 Macro"}, {0x77,0x44,0x61,0x98,0x34,0x3C,0x7B,0x0E, "Sigma", "80-400mm f4.5-5.6 EX OS"}, {0x48,0x48,0x68,0x8E,0x30,0x30,0x4B,0x02, "Sigma", "100-300mm F4 EX IF HSM"}, {0x26,0x44,0x73,0x98,0x34,0x3C,0x1C,0x02, "Sigma", "135-400mm F4.5-5.6 APO Aspherical"}, {0x48,0x48,0x76,0x76,0x24,0x24,0x4B,0x06, "Sigma", "150mm F2.8 EX DG APO Macro HSM"}, {0x02,0x2F,0x98,0x98,0x3D,0x3D,0x02,0x00, "Sigma", "400mm F5.6 APO"}, //# {0x03,0x43,0x5C,0x81,0x35,0x35,0x02,0x00, "Soligor", "AF C/D ZOOM UMCS 70-210mm 1:4.5"}, //# {0x00,0x3C,0x1F,0x37,0x30,0x30,0x00,0x06, "Tokina", "AT-X 124 AF PRO DX - AF 12-24mm f/4"}, {0x00,0x40,0x2B,0x2B,0x2C,0x2C,0x00,0x02, "Tokina", "AT-X 17 AF PRO - AF 17mm f/3.5"}, {0x00,0x54,0x68,0x68,0x24,0x24,0x00,0x02, "Tokina", "AT-X M100 PRO D - 100mm F2.8"}, //# {0x00,0x36,0x1C,0x2D,0x34,0x3C,0x00,0x06, "Tamron", "SP AF11-18mm F/4.5-5.6 Di II LD Aspherical (IF)"}, {0x07,0x46,0x2B,0x44,0x24,0x30,0x03,0x02, "Tamron", "SP AF17-35mm F/2.8-4 Di LD Aspherical (IF)"}, {0x00,0x3F,0x2D,0x80,0x2B,0x40,0x00,0x06, "Tamron", "AF18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF)"}, {0x00,0x3F,0x2D,0x80,0x2C,0x40,0x00,0x06, "Tamron", "AF18-200mm f/3.5-6.3 XR Di II LD Aspherical (IF) MACRO"}, {0x00,0x48,0x3C,0x6A,0x24,0x24,0x00,0x02, "Tamron", "SP AF28-105mm f/2.8"}, {0x4D,0x41,0x3C,0x8E,0x2B,0x40,0x62,0x02, "Tamron", "AF28-300mm f/3.5-6.3 XR Di LD Aspherical (IF)"}, {0x32,0x53,0x64,0x64,0x24,0x24,0x35,0x02, "Tamron", "SP AF90mm f/2.8 Di 1:1 Macro"}, {0x20,0x3C,0x80,0x98,0x3D,0x3D,0x1E,0x02, "Tamron", "AF200-400mm f/5.6 LD IF"}, {0x00,0x3E,0x80,0xA0,0x38,0x3F,0x00,0x02, "Tamron", "SP AF200-500mm f/5-6.3 Di LD (IF)"}, //# {0x4D,0x41,0x3C,0x8E,0x2C,0x40,0x62,0x02, "Unknown", "28-300mm F/3.5-6.3 D"}, {0x1E,0x5D,0x64,0x64,0x20,0x20,0x13,0x00, "Unknown", "90mm F/2.5"}, {0x2F,0x40,0x30,0x44,0x2C,0x34,0x29,0x02, "Unknown", "20-35mm F/3.5-4.5D"}, {0x0B,0x3E,0x3D,0x7F,0x2F,0x3D,0x0E,0x00, "Unknown", "29-195mm F/3.8-5.6"}, //# {0,0,0,0,0,0,0,0, NULL, NULL} }; if (value.typeId() != undefined) return os << value; DataBuf lens(value.size()); // ByteOrder is only to satisfy the interface value.copy(lens.pData_, invalidByteOrder); int idx = 0; if (0 == memcmp(lens.pData_, "0100", 4)) { idx = 6; } else if (0 == memcmp(lens.pData_, "0101", 4)) { idx = 11; } else if (0 == memcmp(lens.pData_, "0201", 4)) { // Here we should decrypt(lens.pData_ + 4, lens.size_ - 4); // however, the decrypt algorithm requires access to serial number // and shutter count tags but print functions are static... idx = 11; } if (idx == 0 || lens.size_ < idx + 7) { // Unknown version or not enough data return os << value; } for (int i = 0; fmountlens[i].lensname != NULL; ++i) { if ( lens.pData_[idx] == fmountlens[i].lid && lens.pData_[idx+1] == fmountlens[i].stps && lens.pData_[idx+2] == fmountlens[i].focs && lens.pData_[idx+3] == fmountlens[i].focl && lens.pData_[idx+4] == fmountlens[i].aps && lens.pData_[idx+5] == fmountlens[i].apl && lens.pData_[idx+6] == fmountlens[i].lfw) { // Lens found in database return os << fmountlens[i].manuf << " " << fmountlens[i].lensname; } } // Lens not found in database return os << value; #else return os << value; #endif // EXV_HAVE_LENSDATA }
void bi::InputNetCDFBuffer::map() { int ncDim, ncVar; Var* var; std::string name; VarType type; int i, k, id; /* ns dimension */ nsDim = nc_inq_dimid(ncid, "ns"); if (nsDim >= 0) { BI_ERROR_MSG(ns < (int )nc_inq_dimlen(ncid, nsDim), "Given index " << ns << " outside range of ns dimension"); } /* np dimension */ npDim = nc_inq_dimid(ncid, "np"); if (npDim >= 0) { BI_ERROR_MSG(np < 0 || np < (int )nc_inq_dimlen(ncid, npDim), "Given index " << np << " outside range of np dimension"); } /* record dimensions, time and coordinate variables */ int nvars = nc_inq_nvars(ncid); for (i = 0; i < nvars; ++i) { ncVar = i; name = nc_inq_varname(ncid, i); if (name.find("time") == 0) { /* is a time variable */ ncDim = mapTimeDim(ncVar); if (ncDim >= 0) { BOOST_AUTO(iter, std::find(recDims.begin(), recDims.end(), ncDim)); if (iter == recDims.end()) { /* newly encountered record dimension */ recDims.push_back(ncDim); timeVars.push_back(ncVar); coordVars.push_back(-1); } else { /* record dimension encountered before */ k = std::distance(recDims.begin(), iter); BI_ASSERT_MSG(timeVars[k] < 0, "Time variables " << nc_inq_varname(ncid, timeVars[k]) << " and " << name << " cannot share the same record dimension " << nc_inq_dimname(ncid, *iter)); timeVars[k] = ncVar; } } } else if (name.find("coord") == 0) { /* is a coordinate variable */ ncDim = mapCoordDim(ncVar); if (ncDim >= 0) { BOOST_AUTO(iter, std::find(recDims.begin(), recDims.end(), ncDim)); if (iter == recDims.end()) { /* newly encountered record dimension */ recDims.push_back(ncDim); timeVars.push_back(-1); coordVars.push_back(ncVar); } else { /* record dimension encountered before */ k = std::distance(recDims.begin(), iter); BI_ASSERT_MSG(coordVars[k] < 0, "Coordinate variables " << nc_inq_varname(ncid, coordVars[k]) << " and " << name << " cannot share the same record dimension " << nc_inq_dimname(ncid, *iter)); coordVars[k] = ncVar; } } } } /* model variables */ for (i = 0; i < NUM_VAR_TYPES; ++i) { type = static_cast<VarType>(i); /* initialise NetCDF variables for this type */ vars[type].resize(m.getNumVars(type), -1); /* map model variables */ for (id = 0; id < m.getNumVars(type); ++id) { var = m.getVar(type, id); if (var->hasInput()) { BOOST_AUTO(pair, mapVarDim(var)); k = pair.first; ncVar = pair.second; if (ncVar >= 0) { vars[type][id] = ncVar; } modelVars.insert(std::make_pair(k, var)); } } } /* preload random access tables */ std::multimap<real,int> seq; std::vector<size_t> starts(recDims.size(), 0), lens(recDims.size(), 0); real tnxt; for (k = 0; k < int(recDims.size()); ++k) { if (timeVars[k] >= 0 && modelVars.count(k) > 0) { /* ^ ignores record dimensions with no associated time or model * variables */ readTime(timeVars[k], starts[k], &lens[k], &tnxt); seq.insert(std::make_pair(tnxt, k)); } } while (!seq.empty()) { /* next in time */ tnxt = seq.begin()->first; k = seq.begin()->second; seq.erase(seq.begin()); ncDim = recDims[k]; ncVar = timeVars[k]; if (times.empty() || times.back() != tnxt) { times.push_back(tnxt); recStarts.push_back(std::vector < size_t > (recDims.size(), 0)); recLens.push_back(std::vector < size_t > (recDims.size(), 0)); } recStarts.back()[k] = starts[k]; recLens.back()[k] = lens[k]; /* read next time and range for this time variable */ starts[k] += lens[k]; if (starts[k] < nc_inq_dimlen(ncid, ncDim)) { /* more to come on this record dimension */ readTime(ncVar, starts[k], &lens[k], &tnxt); seq.insert(std::make_pair(tnxt, k)); } } }
/// This should still be called via ProtoApp::onAnimate(dt) if overridden virtual void onAnimate(double dt) { lens() .near(cnNear.getValue()) .far(cnFar.getValue()) .fovy(cnFOV.getValue()); }