Esempio n. 1
0
void SgdUpdaterWithCpuAverager::apply() {
  // backup gpu value
  for (auto& para : parameters_) {
    SetDevice setDevice(para->getDeviceId());
    para->getBuf(PARAMETER_GRADIENT)
        ->copyFrom(*para->getBuf(PARAMETER_VALUE), kHostToDeviceStream);
  }

  // apply on cpu parameter
  if (auto callback = averager_->apply()) {
    for (auto para : cpuParameters_) {
      callback(para->getBufs(), para->getConfig(), -1LU);
    }
  }

  // copy to gpu value
  for (auto& para : parameters_) {
    SetDevice setDevice(para->getDeviceId());
    size_t pid = nonStaticParaIDMap_[para->getID()];
    Parameter* cpuPara = cpuParameters_[pid].get();
    if (parameters_[pid]->useGpu()) {
      para->getBuf(PARAMETER_VALUE)
          ->copyFrom(*cpuPara->getBuf(PARAMETER_APPLY), kHostToDeviceStream);
    }
  }
  hl_stream_synchronize(kHostToDeviceStream);
  for (auto& para : parameters_) {
    para->setValueUpdated();
  }
}
Esempio n. 2
0
void KIso::prepareDevice(const QString & filename,
                         const QString & mimetype, bool forced)
{
    KISOFUNC;
    KISODEBUG("Preparing: " << filename << " - type: " << mimetype << " - using the force: " << forced);
    /* 'hack' for Qt's false assumption that only S_ISREG is seekable */
    if ("inode/blockdevice" == mimetype)
        setDevice(new QFileHack(filename));
    else {
        if ("application/x-gzip" == mimetype
                || "application/x-bzip2" == mimetype)
            forced = true;


        KCompressionDevice *device;
        if(mimetype.isEmpty()) {
            device = new KFilterDev(filename);
        } else {
            device = new KCompressionDevice(filename, KFilterDev::compressionTypeForMimeType(mimetype));
        }
        if (device->compressionType() == KCompressionDevice::None && forced) {
            delete device;
        } else {
            setDevice(device);
        }
    }

}
void LEDControl::detectPath()
{
    qDebug() << "detectPath called";

    // get the name of this hardware from the /etc/hw-release file
    QSettings hwFile("/etc/hw-release", QSettings::IniFormat);
    QString name = hwFile.value("NAME").toString();
    qDebug() << "Name detected from /etc/hw-release is: " << name;

    // Use the name from /etc/hw-release to look up the control file location in controlfile.conf
    QSettings controlFileSettings("/usr/share/harbour-hammerhead-torch/controlfile.conf",QSettings::IniFormat);

    // Difficult to replace /usr/share/ with a variable, because QStandardPaths doesn't support an option that resolves to /usr/share/<APPNAME> yet
    //qDebug() << QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); //QStandardPaths::AppDataLocation and QStandardPaths::AppLocalDataLocation added in Qt 5.4

    if ( controlFileSettings.contains(name) ) {
        setDevice( name );
        setPath( controlFileSettings.value(name).toString() );
    } else {
        qDebug() << "Hardware not recognised";
        setDevice("Unknown");
        setPath("Unknown");
    }

    // Use the name from /etc/hw-release to look up the brightness in brightness.conf
    QSettings brightnessSettings("/usr/share/harbour-hammerhead-torch/brightness.conf",QSettings::IniFormat);

    if ( brightnessSettings.contains(name) ) {
        setBrightness( brightnessSettings.value(name).toString() );
    } else {
        setBrightness(QString::number(1));
    }

}
Esempio n. 4
0
void ConfigLabel::mousePressEvent(QMouseEvent *ev)
{
	if (QGuiApplication::mouseButtons() == Qt::RightButton)
	{
		QRect rect = this->rect();
		auto CIDlg = new ConfigInfoDlg(this, DevThr);
		int ret = CIDlg->exec();
		setDevice(Last_StoreData.DeviceType);
	}
	else if (QGuiApplication::mouseButtons() == Qt::LeftButton)
	{
		QMenu *ChooseMenu = new QMenu(this);
		QAction *Choose801Action = new QAction("TR801", this);
		QAction *Choose802Action = new QAction("TR802", this);
		QAction *Choose805Action = new QAction("TR805", this);
		connect(Choose801Action, &QAction::triggered, [&](){
			setDevice(TR801, true);
		});
		connect(Choose802Action, &QAction::triggered, [&](){
			setDevice(TR802, true);
		});
		connect(Choose805Action, &QAction::triggered, [&](){
			setDevice(TR805, true);
		});
		QFont font;
		font.setPointSize(10);
		ChooseMenu->setFont(font);
		ChooseMenu->addAction(Choose801Action);
		ChooseMenu->addAction(Choose802Action);
		ChooseMenu->addAction(Choose805Action);
		ChooseMenu->exec(QCursor::pos());
	}
}
Esempio n. 5
0
bool
GtkOvgGlue::init(int /*argc*/, char ** /*argv*/[])
{
    GNASH_REPORT_FUNCTION;
    
    bool egl = false;
    bool rawfb = false;
    bool dfb = false;
    bool x11 = false;
    
    // Probe to see what display devices we have that could be used.
    boost::shared_array<renderer::GnashDevice::dtype_t> devs = probeDevices();
    if (devs) {
        int i = 0;
        while (devs[i] != renderer::GnashDevice::NODEV) {
            switch (devs[i++]) {
              case renderer::GnashDevice::EGL:
                  log_debug(_("Probing found an EGL display device"));
                  egl = true;
                  break;
              case renderer::GnashDevice::RAWFB:
                  log_debug(_("Probing found a raw Framebuffer display device"));
                  rawfb = true;
                  break;
              case renderer::GnashDevice::X11:
                  log_debug(_("Probing found an X11 display device"));
                  x11 = true;
                  break;
              case renderer::GnashDevice::DIRECTFB:
                  log_debug(_("Probing found a DirectFB display device"));
                  dfb = true;
                  break;
              case renderer::GnashDevice::NODEV:
              default:
                  log_error(_("No display devices found by probing!"));
                  break;
            }
        }

        // Now that we know what exists, we have to decide which one to
        // use, as OpenVG can work with anything. We can only have one
        // display device operating at a time.
        if (egl) {
            setDevice(renderer::GnashDevice::EGL);
        } else if (rawfb) {
            setDevice(renderer::GnashDevice::RAWFB);
        } else if (dfb) {
            setDevice(renderer::GnashDevice::DIRECTFB);
        } else if (x11) {
            setDevice(renderer::GnashDevice::X11);
        }        
    }

    // Initialize the display device
    _device->initDevice(0, 0);

    return true;
}
Esempio n. 6
0
void setDeviceWithFallback(AudioDeviceID newDeviceID, AudioDeviceID fallbackDeviceID, ASDeviceType typeRequested) {
	UInt32 propertySize = sizeof(UInt32);

	if (getCurrentlySelectedDeviceID(typeRequested) == newDeviceID) {
      setDevice(fallbackDeviceID, typeRequested);
	} else {
	  setDevice(newDeviceID, typeRequested);
	}
}
Esempio n. 7
0
void check_ressource(PCtrlBlock_t* new_running_process) {

	if (new_running_process != ptrIdleTask) {
		virtual_dev_t* virtual_dev = NULL;

		hashmap_get(pid_to_virt_dev_map, new_running_process->pid, &virtual_dev);

		if (new_running_process == foreground_process) {

			setDevice(0);
			if (virtual_dev != NULL) {
				virtual_dev->current_device_type = virtual_dev->requested_device_type;
			}

			if (foreground_changed == 1) {
				foreground_changed = 0;

				//			setBackgroundColor(BLACK);
				//			setColor(WHITE);
				//			rectangle(0,0, GLCD_RIGHT, GLCD_BOTTOM);
				//			gotoXY(0,0);
			}
		} else {
			if (virtual_dev != NULL) {
				virtual_dev->current_device_type = dev_null;
			}
			setDevice(1);
		}

	}



//
//	virtual_dev_t* virtual_dev = NULL;
//
//	hashmap_get(pid_to_virt_dev_map,new_running_process->pid, &virtual_dev);
//
////	}else{
////		while(1){}
////	}
//
//	if(new_running_process == foreground_process){
//		if(virtual_dev!= NULL){
//			virtual_dev->current_device_type = virtual_dev->requested_device_type;
//		}
//		setDevice(0);
//	}else{
//		if(virtual_dev!= NULL){
//			virtual_dev->current_device_type = dev_null;
//		}
//		setDevice(1);
//	}


}
Esempio n. 8
0
bool GeoWriter::write(QIODevice* device, const GeoNode *feature)
{
    setDevice( device );
    setAutoFormatting( true );
    writeStartDocument();

    //FIXME: write the starting tags. Possibly register a tag handler to do this
    // with a null string as the object name?
    
    GeoTagWriter::QualifiedName name( "", m_documentType );
    const GeoTagWriter* writer = GeoTagWriter::recognizes(name);
    if( writer ) {
        //FIXME is this too much of a hack?
        //geodataobject is never used in this context
        GeoNode node;
        writer->write( &node, *this );
    } else {
        mDebug() << "There is no GeoWriter registered for: " << name;
        return false;
    }
    
    if( ! writeElement( feature ) ) {
        return false;
    }
    
    //close the document
    writeEndElement();
    return true;
}
Esempio n. 9
0
GHOST_NDOFManagerUnix::GHOST_NDOFManagerUnix(GHOST_System& sys)
    : GHOST_NDOFManager(sys),
      m_available(false)
{
	if (spnav_open() != -1) {
		m_available = true;

		/* determine exactly which device (if any) is plugged in */

#define MAX_LINE_LENGTH 100

		/* look for USB devices with Logitech or 3Dconnexion's vendor ID */
		FILE *command_output = popen("lsusb | grep '046d:\\|256f:'", "r");
		if (command_output) {
			char line[MAX_LINE_LENGTH] = {0};
			while (fgets(line, MAX_LINE_LENGTH, command_output)) {
				unsigned short vendor_id = 0, product_id = 0;
				if (sscanf(line, "Bus %*d Device %*d: ID %hx:%hx", &vendor_id, &product_id) == 2)
					if (setDevice(vendor_id, product_id)) {
						break; /* stop looking once the first 3D mouse is found */
					}
			}
			pclose(command_output);
		}
	}
	else {
#ifdef DEBUG
		/* annoying for official builds, just adds noise and most people don't own these */
		puts("ndof: spacenavd not found");
		/* This isn't a hard error, just means the user doesn't have a 3D mouse. */
#endif
	}
}
Esempio n. 10
0
mUPnP::DeviceData::DeviceData()  {
  setDevice(NULL);
  setSSDPPacket(NULL);
  advertiser = NULL;
  leaseTime = Device::DEFAULT_LEASE_TIME;
  httpPort = Device::HTTP_DEFAULT_PORT;
}
Esempio n. 11
0
bool PdmlReader::read(QIODevice *device, PcapFileFormat *pcap, bool *stop)
{
    setDevice(device);
    pcap_ = pcap;
    stop_ = stop;

    while (!atEnd())
    {
        readNext();
        if (isStartElement())
        {
            if (name() == "pdml")
                readPdml();
            else
                raiseError("Not a pdml file!");
        }
    }

    if (error() && (errorString() != "USER-CANCEL"))
    {
        qDebug("Line %lld", lineNumber());
        qDebug("Col %lld", columnNumber());
        qDebug("%s", errorString().toAscii().constData());
        return false;
    }
    return true;
}
Esempio n. 12
0
void BbAccelerometer::applyAccelerationMode()
{
    const QAccelerometer * const accelerometer = qobject_cast<QAccelerometer *>(sensor());
    if (accelerometer) {
        QString fileName;
        sensor_type_e sensorType;
        switch (accelerometer->accelerationMode()) {
        case QAccelerometer::Gravity:
            fileName = QLatin1String("/dev/sensor/gravity");
            sensorType = SENSOR_TYPE_GRAVITY;
            break;
        case QAccelerometer::User:
            fileName = QLatin1String("/dev/sensor/linAccel");
            sensorType = SENSOR_TYPE_LINEAR_ACCEL;
            break;
        default:
        case QAccelerometer::Combined:
            fileName = devicePath();
            sensorType = SENSOR_TYPE_ACCELEROMETER;
            break;
        }

        setDevice(fileName, sensorType);
    }
}
void
myGPUUnstructuredGridVolumeRayCastMapper::setArgumentsMemory (void)
{
    setDevice ();

    // Scalar
    long long scalarMemSize =
        this->Scalars->GetDataSize () * this->Scalars->GetDataTypeSize ();
    CUDA_SAFECALL (cudaMalloc ((void **) &dScalar, scalarMemSize));
    dMemUsageArgs += scalarMemSize;

    MEMCPY_H_to_D (dScalar, this->Scalars->GetVoidPointer (0), scalarMemSize);
    hBunykRayCastArg.scalar = dScalar;
    hBunykRayCastArg.scalarNumComponent =
        this->Scalars->GetNumberOfComponents ();
    hBunykRayCastArg.scalarNumOfTuples = this->Scalars->GetNumberOfTuples ();

    hBunykRayCastArg.CellScalar = this->CellScalars;

    //
    dMemAlloc < dBunykRayCastArguments > (&dBunykRayCastArg, 1, &dMemUsageArgs,
                                          deviceID);
    printf ("[GPU BunykRayCast] %.2f MB was allocated for arguments.\n",
            dMemUsageArgs / (_1M_));

    dMemUsage += dMemUsageArgs;
}
Esempio n. 14
0
bool SystemFile::open( void ) {
      QString Prefix = getenv( "NS2OUTPUTTO" );

      if( Prefix != "stderr" /* && Name != "interfaces" */ ) {
        // generate files where the need to be
        if( F ) {
          F->close();
          delete F;
        }

        F = new QFile( Prefix + Path + ((InAppend)?"":"bup") );
        Log(( "Open systemfile %s\n", F->name().latin1() ));
        if( ! F->open( ((InAppend)?IO_Append : 0 ) | IO_WriteOnly ) ) {
          return 0;
        }
      } else {
        if( ! F ) {
          odebug << "!!!!!!!!!!!!!!!!!! " << oendl;
          odebug << "!!!! TESTMODE !!!!" << oendl;
          odebug << "!!!!!!!!!!!!!!!!!! " << oendl;
          odebug << "!!!!" << oendl;
          odebug << "!!!! GENERATE " << Path << oendl;
          if( InAppend ) {
            odebug << "!!!! In APPEND mode" << oendl;
          }
          odebug << "!!!!" << oendl;
          odebug << "!!!!!!!!!!!!!!!!!!" << oendl;

          F = new QFile();
          F->open( IO_WriteOnly, stderr );
        }
      }
      setDevice( F );
      return 1;
}
Esempio n. 15
0
PERF_TEST_P(DevInfo, StereoBeliefPropagation, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat img_l_host = readImage("gpu/stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
    Mat img_r_host = readImage("gpu/stereobm/aloe-R.png", CV_LOAD_IMAGE_GRAYSCALE);

    ASSERT_FALSE(img_l_host.empty());
    ASSERT_FALSE(img_r_host.empty());

    GpuMat img_l(img_l_host);
    GpuMat img_r(img_r_host);

    GpuMat dst;

    StereoBeliefPropagation bp(128);

    declare.time(10.0);

    SIMPLE_TEST_CYCLE()
    {
        bp(img_l, img_r, dst);
    }

    Mat dst_host(dst);
    
    SANITY_CHECK(dst_host);
}
Esempio n. 16
0
int CVesselContainer::parseQVCT( const QDomElement& _rqDomElement )
{
  COverlayVisibility::setVisibility( _rqDomElement.attribute( "visibility", "3" ).toInt() );
  QTreeWidgetItem::setCheckState( CVesselOverlay::VISIBLE, bVisible ? Qt::Checked : Qt::Unchecked );
  qsType = _rqDomElement.attribute( "type" );
  qsUrl = _rqDomElement.attribute( "url" );
  qsDescription = _rqDomElement.firstChildElement( "Description" ).text();
  qsComment = _rqDomElement.firstChildElement( "Comment" ).text();
  QDomElement __qDomElement = _rqDomElement.firstChildElement( "Device" );
  if( !__qDomElement.isNull() )
  {
    CVesselContainerDevice* __poVesselContainerDevice = new CVesselContainerDevice( __qDomElement.attribute( "name" ) );
    __poVesselContainerDevice->parseQVCT( __qDomElement );
    setDevice( __poVesselContainerDevice );
    return 0;
  }
  int __iCount = 0;
  for( QDomElement __qDomElement = _rqDomElement.firstChildElement( "Vessel" );
       !__qDomElement.isNull();
       __qDomElement = __qDomElement.nextSiblingElement( "Vessel" ) )
  {
    __iCount++;
    QString __qsName = __qDomElement.attribute( "name" );
    if( __qsName.isEmpty() ) COverlayObject::newChildName( tr("Vessel"), 1, __iCount );
    CVesselPoint* __poVesselPoint = new CVesselPoint( __qsName );
    __poVesselPoint->parseQVCT( __qDomElement );
    addChild( __poVesselPoint );
  }
  return __iCount;
}
Esempio n. 17
0
void SequenceEditor::init()
{
  // Set an icon
  QString dir;
  _app->settings()->get(KEY_SYSTEM_DIR, dir);
  dir += QString("/") + PIXMAPPATH + QString("/");
  setIcon(QPixmap(dir + QString("chaser.xpm")));

  m_insert->setPixmap(QPixmap(dir + "/add.xpm"));
  m_remove->setPixmap(QPixmap(dir + "/remove.xpm"));

  m_raise->setPixmap(QPixmap(dir + "/up.xpm"));
  m_lower->setPixmap(QPixmap(dir + "/down.xpm"));

  m_sliders->setPixmap(QPixmap(dir + "/console.xpm"));

  m_list->setVScrollBarMode(QScrollView::AlwaysOn);
  m_list->header()->setClickEnabled(false);
  m_list->header()->setMovingEnabled(false);
  m_list->header()->setResizeEnabled(false);

  setDevice(m_sequence->device());
  setSequence(m_sequence);

  m_name->setText(m_sequence->name());
}
Esempio n. 18
0
V4L2WebcamInfo * Webcam::openAndGatherInfoFrom(const QString &fname)
{
   setDevice(fname);
   if( !open_device() )
     return NULL;
   return deviceInfo();
}
void PA_AudioIO::initialise(){
    try{
        Pa_Initialize();
        m_PaParams.device = setDevice(m_DevInd); //Pa_GetDefaultOutputDevice();
        if(m_PaParams.device == paNoDevice) throw Pa_NoDeviceException();
        m_PaParams.channelCount = m_numChans;
        m_PaParams.sampleFormat = PA_SAMPLE_TYPE;
        m_PaParams.suggestedLatency = Pa_GetDeviceInfo( m_PaParams.device )->defaultLowOutputLatency;
        m_PaParams.hostApiSpecificStreamInfo = NULL; // Takes a void pointer. Can be used for passing other data to stream.

        PaError err = Pa_OpenStream(&m_Stream, NULL, &m_PaParams, m_sampleRate,
                  m_frameSize, paClipOff, NULL, NULL );
        if(err != paNoError)
            Pa_ErrorOccurred(err);
     }
    catch(Pa_StreamException paEx){
        if( Pa_IsStreamActive(m_Stream) ) Pa_StopStream(m_Stream);
        std::cerr << "An error occured while using the portaudio stream" << std::endl;
        std::cerr << "Error message: " << paEx.what() << std::endl;
        Pa_Terminate();
        throw;
    }
    catch(Pa_Exception paEx){
        if( Pa_IsStreamActive(m_Stream) ) Pa_StopStream(m_Stream);
        std::cerr << "An error occurred while initializing the Audio IO" << std::endl;
        std::cerr << "Error message: " << paEx.what() << std::endl;
        Pa_Terminate();
        throw;
    }
    catch(...){
        std::cerr << "Exception occurred during AudioIO object construction." <<std::endl;
    }
}
DeviceSettingsItem::DeviceSettingsItem(const Device *device) :
    SettingsItem(),
    m_device(device),
    m_titleLabel(new NormalLabel),
    m_tipLabel(new NormalLabel),
    m_loadingIndicator(new LoadingIndicator),
    m_nextButton(new NextButton)
{
    setFixedHeight(36);

    m_titleLabel->setObjectName("DeviceTitle");
    m_tipLabel->setObjectName("DeviceState");

    m_loadingIndicator->setTheme("dark");
    m_loadingIndicator->setFixedSize(24, 24);
    m_loadingIndicator->hide();

    QHBoxLayout *layout = new QHBoxLayout;
    layout->setSpacing(0);
    layout->setMargin(0);

    layout->addSpacing(20);
    layout->addWidget(m_titleLabel);
    layout->addStretch();
    layout->addWidget(m_tipLabel);
    layout->addWidget(m_loadingIndicator);
    layout->addSpacing(4);
    layout->addWidget(m_nextButton);
    layout->addSpacing(10);
    setLayout(layout);

    setDevice(device);

    connect(m_nextButton, &widgets::NextButton::clicked, [this] { Q_EMIT requestShowDetail(m_device); });
}
Esempio n. 21
0
PERF_TEST_P(DevInfo, StereoConstantSpaceBP, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat img_l_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    Mat img_r_host = readImage("gpu/perf/aloeR.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    ASSERT_FALSE(img_l_host.empty());
    ASSERT_FALSE(img_r_host.empty());

    GpuMat img_l(img_l_host);
    GpuMat img_r(img_r_host);

    GpuMat dst;

    StereoConstantSpaceBP bp(128);

    declare.time(10.0);

    SIMPLE_TEST_CYCLE()
    {
        bp(img_l, img_r, dst);
    }

    Mat dst_host(dst);
    
    SANITY_CHECK(dst_host);
}
void
myGPUUnstructuredGridVolumeRayCastMapper::initMemoryForThreads (void)
{
    setDevice ();
    if (dLocalBuffers == NULL)
        setMemoryForThreads ();
}
Esempio n. 23
0
//
//
//	Most GUI specific things for the initialization are here
void	RadioInterface::init_your_gui (void) {
#ifdef	GUI_3
	ficBlocks		= 0;
	ficSuccess		= 0;

/**
  *	we now handle the settings as saved by previous incarnations.
  */
	QString h		=
	           dabSettings -> value ("device", "no device"). toString ();
	if (h == "no device")	// no autostart here
	   autoStart = false;
    //setDevice 		("dabstick");
    //setDevice 		("rtl_tcp");
    setDevice 		(h);

	h		= dabSettings -> value ("channel", "12C"). toString ();
	
//	display the version
	QString v = "sdr-j DAB-rpi(+)  " ;
	v. append (CURRENT_VERSION);

    dabSettings->endGroup();
#endif
}
Esempio n. 24
0
PERF_TEST_P(DevInfo, DisparityBilateralFilter, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat img_host = readImage("gpu/stereobm/aloe-L.png", CV_LOAD_IMAGE_GRAYSCALE);
    Mat disp_host = readImage("gpu/stereobm/aloe-disp.png", CV_LOAD_IMAGE_GRAYSCALE);

    ASSERT_FALSE(img_host.empty());
    ASSERT_FALSE(disp_host.empty());

    GpuMat img(img_host);
    GpuMat disp(disp_host);

    GpuMat dst;

    DisparityBilateralFilter f(128);

    declare.time(0.5).iterations(100);

    SIMPLE_TEST_CYCLE()
    {
        f(disp, img, dst);
    }

    Mat dst_host(dst);
    
    SANITY_CHECK(dst_host);
}
Esempio n. 25
0
CDeck::CDeck(ID3D10Device* pD3D10Device, bool bFull)
{
	int i;

	setDevice(pD3D10Device);

	for (i=0;i<NUM_CARD_VIEWS;i++) {
		m_cardGraphics[i].pShaderResource = NULL;
		m_cardGraphics[i].lpFileName[0] = '\0';
		m_cardGraphics[i].lpCardDesc[0] = '\0';
		m_cardGraphics[i].ID = 0;
	}

	resetDeck(bFull);

#if defined(_DEBUG)
	////////////////////////////////
	// Testing
	// Bang on the list swap functions
	////////////////////////////////
	{
		bool bTestResult = true;
		//bTestResult = m_deck.testDriveSwap();
		if (!bTestResult) {
			std::cout << "ERROR in testDriveSwap()!!\n" << std::flush;
		}
	}
#endif // _DEBUG

	InitSprite(getDevice(), bFull);

	return;
}
Esempio n. 26
0
PERF_TEST_P(DevInfo, StereoBM, testing::ValuesIn(devices()))
{
    DeviceInfo devInfo = GetParam();

    setDevice(devInfo.deviceID());

    Mat img_l_host = readImage("gpu/perf/aloe.jpg", CV_LOAD_IMAGE_GRAYSCALE);
    Mat img_r_host = readImage("gpu/perf/aloeR.jpg", CV_LOAD_IMAGE_GRAYSCALE);

    ASSERT_FALSE(img_l_host.empty());
    ASSERT_FALSE(img_r_host.empty());

    GpuMat img_l(img_l_host);
    GpuMat img_r(img_r_host);

    GpuMat dst;

    StereoBM_GPU bm(0, 256);

    declare.time(0.5).iterations(100);

    SIMPLE_TEST_CYCLE()
    {
        bm(img_l, img_r, dst);
    }

    Mat dst_host(dst);
    
    SANITY_CHECK(dst_host);
}
Esempio n. 27
0
void AddUPnPServerDlg::onUPnPDeviceDiscovered(const std::shared_ptr<upnp::Device>& device)
{
    const Gtk::TreeNodeChildren& children = m_TreeModel->children();
    for (Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++iter)
    {
        const std::string& deviceId = (*iter)[m_Columns.deviceId];
        if (deviceId == device->m_UDN)
        {
            //ignore duplicate devices
            return;
        }
    }

    Gtk::TreeModel::iterator iter = m_TreeModel->append();

    const Gtk::TreeModel::Row& row = *iter;
    row[m_Columns.name]         = device->m_FriendlyName;
    row[m_Columns.id]           = upnp::MediaServer::rootId;
    row[m_Columns.deviceId]     = device->m_UDN;

    auto server = std::make_shared<upnp::MediaServer>(*m_pClient);
    server->setDevice(device);
    m_ServerMap[device->m_UDN] = server;

    m_BrowseThreads.push_back(std::thread(&AddUPnPServerDlg::fetchDeviceTreeThread, this, server));
}
Esempio n. 28
0
void InstanceParser::read()
{
    m_sizes.clear();
    m_mkpItems.clear();
    m_binItems.clear();

    QFile file(m_path);
    if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        qDebug() << "Cannot open file";
        return;
    }

    setDevice(&file);

    while(!atEnd()) {
        readNext();

        if(isStartElement()) {
            if(name() == "problem")
                readProblem();
            else
                raiseError("This file is not valid");
        }
    }
}
Esempio n. 29
0
/************************************InfoXMLParser类部分***********************************************/
InfoXMLParser::InfoXMLParser(QString path)
{
    QFile file(path);
    if (!file.open(QIODevice::ReadOnly))
    {
        qDebug() << "Open file failed in InfoXMLParser.";
        return;
    }
    this->currentPath = path;

    setDevice(&file);
    //int count = 0;

    while(!atEnd())
    {
        readNext();

        if (isStartElement())
        {
            if (name() == "category")
            {
                this->readXMLDocument();
            }
        }//这里不需要判断结束标签,需要读取全文内容
    }
}
Esempio n. 30
0
PERF_TEST_P(DevInfo_Size_MatType, transpose, testing::Combine(testing::ValuesIn(devices()), 
                                                              testing::Values(GPU_TYPICAL_MAT_SIZES), 
                                                              testing::Values(CV_8UC1, CV_32SC1, CV_64FC1)))
{
    DeviceInfo devInfo = std::tr1::get<0>(GetParam());
    Size size = std::tr1::get<1>(GetParam());
    int type = std::tr1::get<2>(GetParam());

    setDevice(devInfo.deviceID());

    Mat src_host(size, type);

    declare.in(src_host, WARMUP_RNG);

    GpuMat src(src_host);
    GpuMat dst(size.width, size.height, type);

    declare.time(0.5).iterations(100);

    SIMPLE_TEST_CYCLE()
    {
        transpose(src, dst);
    }

    Mat dst_host(dst);

    SANITY_CHECK(dst_host);
}