Exemple #1
0
BOOL HistoInit()
/************************************************************************/
    {
    LPFRAME lpFrame;
    int x, y, i;
    LPTR lpLine;
    RGBS rgb;
    
    lpFrame = frame_set(NULL);
    if (!lpFrame)
        return(FALSE);
    lpRHisto = AllocPtr(256 * sizeof(long));
    lpGHisto = AllocPtr(256 * sizeof(long));
    lpBHisto = AllocPtr(256 * sizeof(long));
    if (!lpRHisto || !lpGHisto || !lpBHisto)
        {
        HistoDone();
        return(FALSE);
        }
    clr(lpRHisto, 256 * sizeof(long));
    clr(lpGHisto, 256 * sizeof(long));
    clr(lpBHisto, 256 * sizeof(long));
    
    AstralWaitCursor();
    for (y = 0; y < lpFrame->Ysize; ++y)
        {
        AstralClockCursor(y, lpFrame->Ysize, TRUE);
        lpLine = CachePtr(0, 0, y, NO);
        for (x = 0; x < lpFrame->Xsize; ++x, lpLine += DEPTH)
            {
            frame_getRGB( lpLine, &rgb );
            ++lpRHisto[rgb.red];
            ++lpGHisto[rgb.green];
            ++lpBHisto[rgb.blue];
            }
        }
    change_cursor(0);
    TotalHisto = (long)lpFrame->Ysize * (long)lpFrame->Xsize;
    MaxHisto = 0;
    for (i = 0; i < 256; ++i)
        {
        if (lpRHisto[i] > MaxHisto)
            MaxHisto = lpRHisto[i];
        if (lpGHisto[i] > MaxHisto)
            MaxHisto = lpGHisto[i];
        if (lpBHisto[i] > MaxHisto)
            MaxHisto = lpBHisto[i];
        }
    for (i = 0; i < 8; ++i)
        grayPat[i] = (i & 1) ? 0x55 : 0xAA;
        
    for (i = 0; i < QTONEPOINTS; ++i)
        QTone.QTmoved[i] = NO;
    MapInit();
    QTone.ActiveMark = 0;
    HistoValue = PNTX(QT(QTone.ActiveMark));
    
    return(TRUE);
    }
Exemple #2
0
AllocPtr CudaDevice::CreateDefaultAlloc() {
	// Create the allocator. Use a bucket allocator with a capacity limit at
	// 80% of free mem.
	intrusive_ptr<CudaAllocBuckets> alloc(new CudaAllocBuckets(this));
	size_t freeMem, totalMem;

	cudaMemGetInfo(&freeMem, &totalMem);
	alloc->SetCapacity((size_t)(.80 * freeMem));
	
	return AllocPtr(alloc.get());
}