Ejemplo n.º 1
0
inline virtual double operator()(const RenderItem * r1, const RenderItem * r2) const {
	if (supported(r1, r2))
		return computeDistance(dynamic_cast<const R1*>(r1), dynamic_cast<const R2*>(r2));
	else if (supported(r2,r1))
		return computeDistance(dynamic_cast<const R1*>(r2), dynamic_cast<const R2*>(r1));
	else
		return NOT_COMPARABLE_VALUE;
}
Ejemplo n.º 2
0
    result_t init(Port p, const Config &config)
    {
        if(false == supported(p))
        {
            return resNOK;
        }
        
        if(true == initialised(p))
        {
            return resOK;
        }
        
        s_config = config;
                        
        // init peripherals: adc1 and dma1
        MX_ADC1_Init();
        // dma is globally initted by stm32hal_bsp_init() because it hold all dma peripherals
        //MX_DMA_Init(); 
        

        // init internal variables        
        s_adc_isrunning = false;
        
        embot::binary::bit::set(initialisedmask, port2index(p));

        return resOK;
    }
Ejemplo n.º 3
0
void AmbientOcclusion::update
   (RenderDevice*                       rd,         
    const AmbientOcclusionSettings&     settings, 
    const shared_ptr<Camera>&           camera,               
    const shared_ptr<Texture>&          depthTexture,
    const shared_ptr<Texture>&          peeledDepthBuffer,   
    const shared_ptr<Texture>&          normalBuffer,
    const shared_ptr<Texture>&          ssVelocityBuffer,
    const Vector2int16                  guardBandSizev) {

    alwaysAssertM(guardBandSizev.x == guardBandSizev.y, "Guard band must be the same size in each dimension");
    const int guardBandSize = guardBandSizev.x;

    if (supported() && settings.enabled) {
        
        m_guardBandSize = guardBandSize;
        compute(rd, settings, depthTexture, camera, peeledDepthBuffer, normalBuffer, ssVelocityBuffer);
        if (settings.blurRadius != 0) {
            m_texture = m_resultBuffer;
        } else { // No blur passes, so pull out the raw buffer!
            m_texture = m_temporallyFilteredBuffer;
        }

    } else {

        m_texture = Texture::white();

    }
}
Ejemplo n.º 4
0
//***************************************************************************
bool Kwave::ID3_PropertyMap::containsProperty(
	const Kwave::FileProperty property) const
{
    foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
	if ((m.m_property == property) && supported(m.m_frame_id))
	    return true;
    }
    return false;
}
Ejemplo n.º 5
0
//***************************************************************************
ID3_FrameID Kwave::ID3_PropertyMap::findProperty(
    const Kwave::FileProperty property) const
{
    foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
	if ((m.m_property == property) && supported(m.m_frame_id))
	    return m.m_frame_id;
    }
    return ID3FID_NOFRAME;
}
Ejemplo n.º 6
0
//***************************************************************************
bool Kwave::ID3_PropertyMap::containsID(const ID3_FrameID id) const
{
    if (!supported(id))
	return false;

    foreach(const Kwave::ID3_PropertyMap::Mapping &m, m_list) {
	if (m.m_frame_id == id)
	    return true;
    }
    return false;
}
Ejemplo n.º 7
0
   void testSupportedAndRequiredFields()
   {
      SipUserAgent sipUA( 5090, 5090, 5091, 
                          NULL, NULL,   // default publicAddress and defaultUser
                         "127.0.0.1" ); 

      // Supported
      CPPUNIT_ASSERT( ! sipUA.isExtensionAllowed( "nope" ) );

      UtlString supported( "supported-1" );
      sipUA.allowExtension( supported );

      UtlString tmp;
      sipUA.getSupportedExtensions( tmp );
      CPPUNIT_ASSERT( supported == tmp );
      supported.toUpper();
      CPPUNIT_ASSERT( sipUA.isExtensionAllowed( supported ) );
      CPPUNIT_ASSERT( ! sipUA.isExtensionAllowed( "nope" ) );


      // Required
      CPPUNIT_ASSERT( ! sipUA.isExtensionRequired( "nope" ) );

      UtlString required( "required-1, required-2, required-3" );
      UtlString copy_required( required );
      copy_required += ',';
      ssize_t prev = 0;
      ssize_t index = copy_required.index( ',', prev );
      while( UTL_NOT_FOUND != index )
      {
         UtlString field = copy_required( prev, index - prev );
         field.strip( UtlString::both );
         sipUA.requireExtension( field );
         prev = index + 1;
         index = copy_required.index( ',', prev );
      }

      sipUA.getRequiredExtensions( tmp );
      CPPUNIT_ASSERT( required == tmp );
      index = copy_required.index( ',', prev );
      while( UTL_NOT_FOUND != index )
      {
         UtlString field = copy_required( prev, index - prev );
         field.strip( UtlString::both );
         field.toUpper();
         CPPUNIT_ASSERT( sipUA.isExtensionRequired( field ) );
         prev = index + 1;
         index = copy_required.index( ',', prev );
      }
      CPPUNIT_ASSERT( ! sipUA.isExtensionRequired( "nope" ) );
   }
DatabaseSink::DatabaseSink(AbstractRoutingEngine *engine, map<std::string, std::string> config)
	:AbstractSource(engine,config),thread(NULL),shared(NULL),playback(false),playbackShared(NULL), playbackMultiplier(1)
{
	databaseName = "storage";
	tablename = "data";
	tablecreate = "CREATE TABLE IF NOT EXISTS data (key TEXT, value BLOB, source TEXT, time REAL, sequence REAL)";

	if(config.find("databaseFile") != config.end())
	{
		setDatabaseFileName(config["databaseFile"]);
	}

	if(config.find("bufferLength") != config.end())
	{
		bufferLength = atoi(config["bufferLength"].c_str());
	}

	if(config.find("properties") != config.end())
	{
		parseConfig();
	}

	for(auto itr=propertiesToSubscribeTo.begin();itr!=propertiesToSubscribeTo.end();itr++)
	{
		engine->subscribeToProperty(*itr,this);
	}

	mSupported.push_back(DatabaseFile);
	mSupported.push_back(DatabaseLogging);
	mSupported.push_back(DatabasePlayback);

	routingEngine->setSupported(supported(), this);

	if(config.find("startOnLoad")!= config.end())
	{
		setLogging(true);
	}

	if(config.find("playbackMultiplier")!= config.end())
	{
		playbackMultiplier = boost::lexical_cast<uint>(config["playbackMultiplier"]);
	}

	if(config.find("playbackOnLoad")!= config.end())
	{
		setPlayback(true);
	}


}
void SkRasterPipelineBlitter::append_store(SkRasterPipeline* p) const {
    if (fDst.info().gammaCloseToSRGB()) {
        p->append(SkRasterPipeline::to_srgb);
    }
    if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
        p->append(SkRasterPipeline::swap_rb);
    }

    SkASSERT(supported(fDst.info()));
    switch (fDst.info().colorType()) {
        case kAlpha_8_SkColorType:   p->append(SkRasterPipeline::store_a8,   &fDstPtr); break;
        case kRGB_565_SkColorType:   p->append(SkRasterPipeline::store_565,  &fDstPtr); break;
        case kBGRA_8888_SkColorType:
        case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::store_8888, &fDstPtr); break;
        case kRGBA_F16_SkColorType:  p->append(SkRasterPipeline::store_f16,  &fDstPtr); break;
        default: break;
    }
}
Ejemplo n.º 10
0
Return<void> SampleDriverFloatSlow::getSupportedOperations_1_1(const V1_1::Model& model,
                                                               getSupportedOperations_1_1_cb cb) {
    VLOG(DRIVER) << "getSupportedOperations()";
    if (validateModel(model)) {
        const size_t count = model.operations.size();
        std::vector<bool> supported(count);
        for (size_t i = 0; i < count; i++) {
            const Operation& operation = model.operations[i];
            if (operation.inputs.size() > 0) {
                const Operand& firstOperand = model.operands[operation.inputs[0]];
                supported[i] = firstOperand.type == OperandType::TENSOR_FLOAT32;
            }
        }
        cb(ErrorStatus::NONE, supported);
    } else {
        std::vector<bool> supported;
        cb(ErrorStatus::INVALID_ARGUMENT, supported);
    }
    return Void();
}
void SkRasterPipelineBlitter::append_load_d(SkRasterPipeline* p) const {
    SkASSERT(supported(fDst.info()));

    p->append(SkRasterPipeline::move_src_dst);
    switch (fDst.info().colorType()) {
        case kAlpha_8_SkColorType:   p->append(SkRasterPipeline::load_a8,   &fDstPtr); break;
        case kRGB_565_SkColorType:   p->append(SkRasterPipeline::load_565,  &fDstPtr); break;
        case kBGRA_8888_SkColorType:
        case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::load_8888, &fDstPtr); break;
        case kRGBA_F16_SkColorType:  p->append(SkRasterPipeline::load_f16,  &fDstPtr); break;
        default: break;
    }
    if (fDst.info().colorType() == kBGRA_8888_SkColorType) {
        p->append(SkRasterPipeline::swap_rb);
    }
    if (fDst.info().gammaCloseToSRGB()) {
        p->append_from_srgb(fDst.info().alphaType());
    }
    p->append(SkRasterPipeline::swap);
}
Ejemplo n.º 12
0
bool QmlFeatureAdjDpi::setCurrentDpi(uint16_t new_dpi) {
	if (!supported()) {
		qWarning("Trying to set current dpi when no adj dpi is supported.");
		return false;
	}

	auto success = feature::set_sensor_dpi((Hidpp20Device*)_device->backendDevice(), 0, new_dpi);

	if (!success) {
		qWarning("Setting new dpi failed.");
		return false;
	}

	if (_current_dpi != new_dpi || !refreshed()) {
		_current_dpi = new_dpi;
		emit currentDpiChanged();
	}

	return true;
}
Ejemplo n.º 13
0
Reader::Reader() {
  if(open("snesreader")) {
    supported = sym("snesreader_supported");
    load = sym("snesreader_load");
  }

  if(!supported || !load) {
    supported = { &Reader::direct_supported, this };
    load = { &Reader::direct_load, this };
  }

  compressionList = supported();
  if(compressionList.length() > 0) compressionList = string() << " " << compressionList;

  if(opened()) {
    extensionList = string()
    << " *.smc *.swc *.fig"
    << " *.ufo *.gd3 *.gd7 *.dx2 *.mgd *.mgh"
    << " *.048 *.058 *.068 *.078 *.bin"
    << " *.usa *.eur *.jap *.aus *.bsx";
  }
}
OBD2Source::OBD2Source(AbstractRoutingEngine *re, map<string, string> config)
	: AbstractSource(re, config),obd2Connected(Obd2Connected,false)
{
	bool success = VehicleProperty::registerProperty(Obd2Connected,[](){ return new Obd2ConnectType(Obd2Connected,false); });

	if(!success)
	{
		///ERROR!
	}

	clientConnected = false;
	m_re = re;  

	m_threadLive = true;
	Obd2Amb obd2amb;
	obd = new obdLib();

	for(auto itr = obd2amb.supportedPidsList.begin(); itr != obd2amb.supportedPidsList.end(); itr++)
	{
		m_supportedProperties.push_back((*itr)->property);
	}

	m_supportedProperties.push_back(Obd2Connected);

	re->setSupported(supported(), this);
	/*if (openPort(std::string("/dev/pts/7"),115200))
	{
	  printf("Error opening OBD2 port\n");
	}*/
	statusQueue = g_async_queue_new();
	commandQueue = g_async_queue_new();
	subscriptionAddQueue = g_async_queue_new();
	subscriptionRemoveQueue = g_async_queue_new();
	responseQueue = g_async_queue_new();
	singleShotQueue = g_async_queue_new();

	setConfiguration(config);
}
Ejemplo n.º 15
0
framebufferobject::framebufferobject(class texture& attachedtex, bool withdepthbuffer)
	: id(0), depthbuf_id(0), mytex(attachedtex), bound(false)
{
	if (!supported())
		throw std::runtime_error("frame buffer objects are not supported!");

	// create and bind depth buffer if requested
	if (withdepthbuffer) {
		glGenRenderbuffersEXT(1, &depthbuf_id);
		glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthbuf_id);
		glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
					 mytex.get_gl_width(), mytex.get_gl_height());
	}

	// create and bind FBO
	glGenFramebuffersEXT(1, &id);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, id);
	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
				  GL_TEXTURE_2D, mytex.get_opengl_name(), 0);

	// attach depth buffer if requested
	if (withdepthbuffer) {
		glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
					     GL_RENDERBUFFER_EXT, depthbuf_id);
	}

	GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
	if(status != GL_FRAMEBUFFER_COMPLETE_EXT) {
		destroy();
		log_warning( "FBO initialization check failed: " << init_failure_reason( status ) );
		throw std::runtime_error("FBO initialization check failed");
	}
	// unbind for now
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
}
SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
                                           const SkPaint& paint,
                                           const SkMatrix& ctm,
                                           SkArenaAlloc* alloc) {
    auto blitter = alloc->make<SkRasterPipelineBlitter>(
            dst,
            paint.getBlendMode(),
            SkPM4f_from_SkColor(paint.getColor(), dst.colorSpace()));


    SkBlendMode*      blend       = &blitter->fBlend;
    SkPM4f*           paintColor  = &blitter->fPaintColor;
    SkRasterPipeline* pipeline    = &blitter->fShader;

    SkShader*      shader      = paint.getShader();
    SkColorFilter* colorFilter = paint.getColorFilter();

    // TODO: all temporary
    if (!supported(dst.info()) || !SkBlendMode_AppendStages(*blend)) {
        return nullptr;
    }

    bool is_opaque   = paintColor->a() == 1.0f,
         is_constant = true;
    if (shader) {
        pipeline->append(SkRasterPipeline::seed_shader, &blitter->fCurrentY);
        if (!shader->appendStages(pipeline, dst.colorSpace(), alloc, ctm, paint)) {
            return nullptr;
        }
        if (!is_opaque) {
            pipeline->append(SkRasterPipeline::scale_1_float,
                             &paintColor->fVec[SkPM4f::A]);
        }

        is_opaque   = is_opaque && shader->isOpaque();
        is_constant = shader->isConstant();
    } else {
        pipeline->append(SkRasterPipeline::constant_color, paintColor);
    }

    if (colorFilter) {
        if (!colorFilter->appendStages(pipeline, dst.colorSpace(), alloc, is_opaque)) {
            return nullptr;
        }
        is_opaque = is_opaque && (colorFilter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag);
    }

    if (is_constant) {
        pipeline->append(SkRasterPipeline::store_f32, &paintColor);
        pipeline->run(0,1);

        *pipeline = SkRasterPipeline();
        pipeline->append(SkRasterPipeline::constant_color, paintColor);

        is_opaque = paintColor->a() == 1.0f;
    }

    if (is_opaque && *blend == SkBlendMode::kSrcOver) {
        *blend = SkBlendMode::kSrc;
    }

    if (is_constant && *blend == SkBlendMode::kSrc) {
        SkRasterPipeline p;
        p.extend(*pipeline);
        blitter->fDstPtr = &blitter->fMemsetColor;
        blitter->append_store(&p);
        p.run(0,1);

        blitter->fCanMemsetInBlitH = true;
    }

    return blitter;
}
Ejemplo n.º 17
0
bool MInstrEffects::supported(const IRInstruction* inst) {
  return supported(inst->op());
}