コード例 #1
0
ファイル: swscale-example.c プロジェクト: w-spencer/sagetv
int main(int argc, char **argv){
    uint8_t *rgb_data = malloc (W*H*4);
    uint8_t *rgb_src[3]= {rgb_data, NULL, NULL};
    int rgb_stride[3]={4*W, 0, 0};
    uint8_t *data = malloc (3*W*H);
    uint8_t *src[3]= {data, data+W*H, data+W*H*2};
    int stride[3]={W, W, W};
    int x, y;
    struct SwsContext *sws;

    sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUV420P, 2, NULL, NULL, NULL);

    for (y=0; y<H; y++){
        for (x=0; x<W*4; x++){
            rgb_data[ x + y*4*W]= random();
        }
    }
#if defined(ARCH_X86)
    sws_rgb2rgb_init(SWS_CPU_CAPS_MMX*0);
#else
    sws_rgb2rgb_init(0);
#endif
    sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride);

#if defined(ARCH_X86)
    asm volatile ("emms\n\t");
#endif

    selfTest(src, stride, W, H);

    return 123;
}
コード例 #2
0
ファイル: Crypto.cpp プロジェクト: GulBroz/keepassx
bool Crypto::init()
{
    if (m_initalized) {
        qWarning("Crypto::init: already initalized");
        return true;
    }

    // libgcrypt >= 1.6 doesn't allow custom thread callbacks anymore.
#if !defined(GCRYPT_VERSION_NUMBER) || (GCRYPT_VERSION_NUMBER < 0x010600)
    gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_qt);
#endif
    gcry_check_version(0);
    gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);

    if (!checkAlgorithms()) {
        return false;
    }

    // has to be set before testing Crypto classes
    m_initalized = true;

    if (!selfTest()) {
        m_initalized = false;
        return false;
    }

    return true;
}
コード例 #3
0
int main(int argc, char **argv){
    uint8_t *rgb_data = malloc (W*H*4);
    uint8_t *rgb_src[3]= {rgb_data, NULL, NULL};
    int rgb_stride[3]={4*W, 0, 0};
    uint8_t *data = malloc (4*W*H);
    uint8_t *src[4]= {data, data+W*H, data+W*H*2, data+W*H*3};
    int stride[4]={W, W, W, W};
    int x, y;
    struct SwsContext *sws;
    AVLFG rand;

    sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUVA420P, 2, NULL, NULL, NULL);

    av_lfg_init(&rand, 1);

    for (y=0; y<H; y++){
        for (x=0; x<W*4; x++){
            rgb_data[ x + y*4*W]= av_lfg_get(&rand);
        }
    }
    sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride);

    selfTest(src, stride, W, H);

    return 123;
}
コード例 #4
0
ファイル: main.cpp プロジェクト: RC-MODULE/nmpp
int main()
{
     
	//return 123;
	
	#ifdef SPEEDTEST
		return speedTest();
	#else 
		return selfTest();
	#endif
	
}
コード例 #5
0
/*
 * Periodic event handler executed by strat's thread. Reschedules the event.
 */
void 
CacheStrategyUtility::_handlePeriodic()
{
    if (self_test) {
       selfTest();
    }
    _purgeCache();

   if (!periodicPurgeEvent->isScheduled() &&
        pollPeriodMs > 0) {
        periodicPurgeEvent->setTimeout(pollPeriodMs/(double)1000);
        getManager()->getKernel()->addEvent(periodicPurgeEvent);
   }
}
コード例 #6
0
ファイル: MyAllocator.cpp プロジェクト: romadidukh/interview
	void * alloc(size_t size)
	{
	    char * ptr = findPtrForSize(size);
	    if(ptr != NULL)
	    {
	    	splitBlock(blocks.at(ptr), size);
	    	markBlockBusy(blocks.at(ptr));
	    }

	    #ifdef SELFTEST
	    selfTest();
	    #endif

	    return static_cast<void *>(ptr);
	}
コード例 #7
0
ファイル: init.c プロジェクト: DayOperatingSystem/Kernel
void init (struct multiboot_info *mb_info, uint32_t kernel_esp)
{
	// Clear screen
	cls();
	
	// HAL-Services
	kprintln ("Booting up...");

	detect_cpu();

	InitSerial (115200, 0, 8);
	InitGlobalDescriptors (kernel_esp);
	InitInterruptDescriptors();
	InitPit (CLOCKS_PER_SEC);
	InitPmm (mb_info);

	InitVmm (mb_info);
	kinit_heap();

#ifdef SELF_TEST

	if (selfTest() != 0)
	{
		kprintln ("Will not start up because of self test errors!");

		while (1);
	}

#endif

	// Erstes Modul ist unsere RAM-Disk
	InitRamdisk ( ( (struct multiboot_module *) mb_info->mbs_mods_addr)->mod_start);
	
	InitMultitasking();

	// while(1);

	// kprintf((char*) ((struct multiboot_module*)
	// mb_info->mbs_mods_addr)->mod_start);
	

	InitBootDrivers();

	//int32_test();
	
	__asm ("sti");
	for (;;);
}
コード例 #8
0
ファイル: MyAllocator.cpp プロジェクト: romadidukh/interview
	void * realloc(void * ptr, size_t size)
	{
		char * charPtr = static_cast<char *>(ptr);
		Block & block = blocks.at(charPtr);
		Block & next = nextBlock(charPtr);

		/* There is enough place ahead of the current block */
		if(block.size == size)
		{

		}
		else if(block.size > size)
		{
			splitBlock(block, size);
			Block & rest = blocks.at(block.ptr + size);
			markBlockFree(rest);
			if(next.free)
			{
				resizeBlock(rest, rest.size + next.size);
				removeBlock(next);
			}
		}
		else if(next.free && block.size + next.size >= size)
		{
			splitBlock(next, size-block.size);
			removeBlock(next);
			resizeBlock(block, size);
		}
		else
		{	
			void * newPtr = alloc(size);
			if(newPtr != NULL)
			{
				memcpy(newPtr, ptr, block.size);
				free(ptr);
				ptr = newPtr;
			}
		}


		#ifdef SELFTEST
		selfTest();
		#endif

		return ptr;
	}
コード例 #9
0
ファイル: MyAllocator.cpp プロジェクト: romadidukh/interview
	void free(void * ptr)
	{
		char * charPtr = static_cast<char *>(ptr);
		Block & prev = prevBlock(charPtr);
		Block & next = nextBlock(charPtr);
		Block & block = blocks.at(charPtr);

		assert(block.free == false);
		assert(prev.ptr == NULL || prev.ptr + prev.size == block.ptr);
		assert(next.ptr == NULL || block.ptr + block.size == next.ptr);

		/* prev is busy and next is busy */
		/* just mark current block as free */
		if(!prev.free && !next.free)
		{	
			markBlockFree(block);
		}
		/* prev is free and next is busy */
		/* concat prev and curr block into one free block */
		else if(prev.free && !next.free)
		{
			resizeBlock(prev, prev.size + block.size);
			removeBlock(block);
		}
		/* prev is busy and next is free */
		/* concat curr and next block into one free block */
		else if(!prev.free && next.free)
		{
			resizeBlock(block, block.size + next.size);
			removeBlock(next);
			markBlockFree(block);
		}
		/* concat all three blocks into one block*/
		else if(prev.free && next.free)
		{
			resizeBlock(prev, prev.size + block.size + next.size);
			removeBlock(block);
			removeBlock(next);
		}
		#ifdef SELFTEST
		selfTest();
		#endif
	}
コード例 #10
0
ファイル: main.cpp プロジェクト: grappendorf/signal-tower
void setup() {
  EEPROM.setMemPool(0, EEPROM_SIZE);
  readEeprom();

  pinMode(PIN_GREEN, OUTPUT);
  pinMode(PIN_RED, OUTPUT);
  pinMode(PIN_YELLOW, OUTPUT);

  green = false;
  red = false;
  yellow = false;
  mute = false;
  contentLength = 0;

  selfTest();
  updateLeds();
  Serial.begin(57600);
  wdt_enable(WDTO_4S);
}
コード例 #11
0
ファイル: AppleMacIO.cpp プロジェクト: Algozjb/xnu
bool AppleMacIO::start( IOService * provider )
{
    IOPCIDevice *pciNub = (IOPCIDevice *)provider;

    if( !super::start( provider))
	return( false);

    // Make sure memory space is on.
    pciNub->setMemoryEnable(true);

    fNub = provider;
    fMemory = provider->mapDeviceMemoryWithIndex( 0 );
    if( 0 == fMemory)
	IOLog("%s: unexpected ranges\n", getName());
    else if( !selfTest())
	IOLog("Warning: AppleMacIO self test fails\n");
    PMinit();		// initialize for power management
    temporaryPowerClampOn();	// hold power on till we get children
    return( true);
}
コード例 #12
0
ファイル: Crypto.cpp プロジェクト: daniellandau/keepassx
bool Crypto::init()
{
    if (m_initalized) {
        qWarning("Crypto::init: already initalized");
        return true;
    }

    m_backendVersion = QString::fromLocal8Bit(gcry_check_version(0));
    gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);

    if (!checkAlgorithms()) {
        return false;
    }

    // has to be set before testing Crypto classes
    m_initalized = true;

    if (!selfTest()) {
        m_initalized = false;
        return false;
    }

    return true;
}
コード例 #13
0
ファイル: GPrimitive.C プロジェクト: hsundar/thesis.code
void Coordinates::update(void)
{
   Matrix M1, M2;
   
   selfTest();
   
   M1.loadIdentity(); M1.translate(On);
   M2.newUVN(Xn,Yn,Zn);
   mO2N = M1 * M2;//Old->New
  
   Vector XX(1,0,0),YY(0,1,0),ZZ(0,0,1);
   fPoint o(0,0,0);
   o = o * mO2N; 
   M1.loadIdentity(); M1.translate(o);
   XX = XX * mO2N; YY = YY * mO2N; ZZ = ZZ * mO2N;
     /*
     printf("\n------On------\n");o.outputs();
     printf("\n------XXn------\n");XX.outputs();
     printf("\n------YYn------\n");YY.outputs();
     printf("\n------ZZn------\n");ZZ.outputs();
     */
   M2.newUVN(XX,YY,ZZ);
   mN2O = M1 * M2;//New -> Old
}
コード例 #14
0
ファイル: main.cpp プロジェクト: RC-MODULE/nmpp
int main()
{
 	return selfTest();
}
コード例 #15
0
ファイル: main.cpp プロジェクト: matekatona/alkfejl-g7
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    qmlRegisterType<Graph>("Graph", 1, 0, "Graph");

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    app.setWindowIcon(QIcon(":/content/icon.png"));

    QMLHandlerCppSide alertLamp(engine.rootObjects()[0], "alertLamp");
    QMLHandlerCppSide lineSens(engine.rootObjects()[0], "lineSens");
    QMLHandlerCppSide textAccelX(engine.rootObjects()[0], "textAccelX");
    QMLHandlerCppSide textAccelY(engine.rootObjects()[0], "textAccelY");
    QMLHandlerCppSide textAccelZ(engine.rootObjects()[0], "textAccelZ");
    QMLHandlerCppSide textGyroX(engine.rootObjects()[0], "textGyroX");
    QMLHandlerCppSide textGyroY(engine.rootObjects()[0], "textGyroY");
    QMLHandlerCppSide textGyroZ(engine.rootObjects()[0], "textGyroZ");
    QMLHandlerCppSide textCurStatus(engine.rootObjects()[0], "textCurStatus");
    QMLHandlerCppSide comboSetStatus(engine.rootObjects()[0], "comboSetStatus");
    QMLHandlerCppSide textCurSpeed(engine.rootObjects()[0], "textCurSpeed");
    QMLHandlerCppSide editSetSpeed(engine.rootObjects()[0], "editSetSpeed");
    QMLHandlerCppSide wheels(engine.rootObjects()[0], "wheels");
    QMLHandlerCppSide carAccelY(engine.rootObjects()[0], "carAccelY");
    QMLHandlerCppSide carGyroX(engine.rootObjects()[0], "carGyroX");
    QMLHandlerCppSide carGyroY(engine.rootObjects()[0], "carGyroY");
    QMLHandlerCppSide carGyroZ(engine.rootObjects()[0], "carGyroZ");
    QMLHandlerCppSide statusHistory(engine.rootObjects()[0], "statusHistory");
    QMLHandlerCppSide speedGraph(engine.rootObjects()[0], "speedGraph");
    QMLHandlerCppSide buttonConDiscon(engine.rootObjects()[0], "buttonConDiscon");
    QMLHandlerCppSide buttonSendStatus(engine.rootObjects()[0], "buttonSendStatus");
    QMLHandlerCppSide buttonSendSpeed(engine.rootObjects()[0], "buttonSendSpeed");
    QMLHandlerCppSide buttonCarSelfTest(engine.rootObjects()[0], "buttonCarSelfTest");

    GuiHandler guihandle(&alertLamp, &lineSens, &textAccelX, &textAccelY, &textAccelZ, &textGyroX, &textGyroY, &textGyroZ, &textCurStatus, &comboSetStatus, &textCurSpeed, &editSetSpeed, &wheels, &carAccelY, &carGyroX, &carGyroY, &carGyroZ, &statusHistory, &speedGraph, &buttonConDiscon, &buttonSendStatus, &buttonSendSpeed, &buttonCarSelfTest);
    Robot mikrobi;

    QObject::connect(&guihandle, SIGNAL(buttonConClicked()), &mikrobi, SLOT(connect()));
    QObject::connect(&guihandle, SIGNAL(buttonDisClicked()), &mikrobi, SLOT(disconnect()));
    QObject::connect(&guihandle, SIGNAL(buttonCarSelfTestClicked()), &mikrobi, SLOT(selfTest()));
    QObject::connect(&guihandle, SIGNAL(buttonSendStatusClicked(QString)), &mikrobi, SLOT(status(QString)));
    QObject::connect(&guihandle, SIGNAL(buttonSendSpeedClicked(float)), &mikrobi, SLOT(speed(float)));

    QObject::connect(&mikrobi, SIGNAL(connected()), &guihandle, SLOT(robotConnected()));
    QObject::connect(&mikrobi, SIGNAL(setAlert(int)), &guihandle, SLOT(setAlert(int)));
    QObject::connect(&mikrobi, SIGNAL(disconnected()), &guihandle, SLOT(robotDisconnected()));

    QObject::connect(&mikrobi, SIGNAL(setLedStrip(QVarLengthArray<bool>)), &guihandle, SLOT(setLedStrip(QVarLengthArray<bool>)));
    QObject::connect(&mikrobi, SIGNAL(setTextAccelX(float)), &guihandle, SLOT(setTextAccelX(float)));
    QObject::connect(&mikrobi, SIGNAL(setTextAccelY(float)), &guihandle, SLOT(setTextAccelY(float)));
    QObject::connect(&mikrobi, SIGNAL(setTextAccelZ(float)), &guihandle, SLOT(setTextAccelZ(float)));
    QObject::connect(&mikrobi, SIGNAL(setTextGyroX(float)), &guihandle, SLOT(setTextGyroX(float)));
    QObject::connect(&mikrobi, SIGNAL(setTextGyroY(float)), &guihandle, SLOT(setTextGyroY(float)));
    QObject::connect(&mikrobi, SIGNAL(setTextGyroZ(float)), &guihandle, SLOT(setTextGyroZ(float)));
    QObject::connect(&mikrobi, SIGNAL(setTextStatus(QString)), &guihandle, SLOT(setTextStatus(QString)));
    QObject::connect(&mikrobi, SIGNAL(setTextSpeed(float)), &guihandle, SLOT(setTextSpeed(float)));
    QObject::connect(&mikrobi, SIGNAL(setWheels(QVarLengthArray<float>, const float)), &guihandle, SLOT(setWheels(QVarLengthArray<float>, const float)));
    QObject::connect(&mikrobi, SIGNAL(setCarAccelY(QVarLengthArray<float>, float)), &guihandle, SLOT(setCarAccelY(QVarLengthArray<float>, float)));
    QObject::connect(&mikrobi, SIGNAL(setCarGyroX(float)), &guihandle, SLOT(setCarGyroX(float)));
    QObject::connect(&mikrobi, SIGNAL(setCarGyroY(float)), &guihandle, SLOT(setCarGyroY(float)));
    QObject::connect(&mikrobi, SIGNAL(setCarGyroZ(float)), &guihandle, SLOT(setCarGyroZ(float)));
    QObject::connect(&mikrobi, SIGNAL(drawSpeedGraph(float)), &guihandle, SLOT(drawSpeedGraph(float)));
    QObject::connect(&mikrobi, SIGNAL(setTextStatus(QString)), &guihandle, SLOT(addStatusHistory(QString)));

    return app.exec();
}