Esempio n. 1
0
void Wavefunction<Rank>::AllocateData()
{
	blitz::TinyVector<int, Rank> shape = Repr->GetInitialShape();

	int name = AllocateData(shape);
	SetActiveBuffer(name);
}
Esempio n. 2
0
/****************************************************************************
REMARKS:
Does a simple overlay buffer static video capture test. The overlay will
show what is coming in via the video capture engine.
****************************************************************************/
static int staticTest(
    GA_videoFuncs *video,
    GA_videoCaptureFuncs *capture,
    GA_captureInputTypes input,
    GA_captureStandardTypes standard,
    GA_VideoCaptureInf *captureInfo)
{
    int             key,x,y,width = DEF_WIDTH,height = DEF_HEIGHT;
    int             centerX, centerY;
    ibool           done = false,freezeInput = false,newFreezeInput = false;
    GA_captureBuf   *captureBuf = NULL;
    GA_buf          *primaryVideo = NULL;
    int             outputHead = init.GetActiveHead();
    char            str[80];

    /* Draw background for video overlay */
    SetActivePage(0);
    ClearPage(0);
    moire(defcolor);
    if (maxX >= 479)
        gmoveto(80,80);
    else
        gmoveto(8,40);
    gprintf("Video capture static test");  y += 16;
    displaymodeInfo();
    gprintf("Press any key to continue");
    if (EVT_getch() == 0x1B)
        return 0x1B;

    /* Use larger overlay window for higher resolutions */
    if (modeInfo.XResolution >= 1280) {
        width *= 2;
        height *= 2;
        }
    else if (modeInfo.XResolution <= DEF_WIDTH) {
        width /= 2;
        height /= 2;
        }

    /* Allocate the source video buffer */
    if ((captureBuf = capture->AllocCaptureBuffer(width,height,captureInfo->VideoFormat,1)) == NULL) {
        displayError("Unable to allocate video capture buffer!");
        return 0x1B;
        }
    primaryVideo = captureBuf->VideoBuffers;
    centerX = (maxX - primaryVideo->Width)/2;
    centerY = (maxY - primaryVideo->Height)/2;

    /* Set up for single buffer video overlay */
    SetActiveBuffer(primaryVideo);
    ClearVideoBuffer(primaryVideo);

    /* Set the video output window */
    x = centerX;
    y = centerY;
    if (!video->SetVideoOutput(0,outputHead,primaryVideo,
            0,0,primaryVideo->Width,primaryVideo->Height,
            x,y,primaryVideo->Width,primaryVideo->Height,0)) {
        displayError("Unable to set video output window!");
        return 0x1B;
        }

    /* Set up the video capture and start it */
    capture->SetVideoInput(captureBuf,input,standard,0,false);
    capture->StartLiveVideo(captureBuf);

    /* Now loop around and display the video capture */
    sprintf(str,"%d x %d %d bit %s overlay",primaryVideo->Width,primaryVideo->Height,
        primaryVideo->BitsPerPixel,displayFormat(primaryVideo->Format));
    if (width < DEF_WIDTH)
        WriteText(8,60,displayFormat(primaryVideo->Format),defcolor);
    else
        WriteText(8,80,str,defcolor);
    while (!done) {
        if (handleKeypress(&key,&newFreezeInput))
            break;
        if (freezeInput != newFreezeInput) {
            freezeInput = newFreezeInput;
            if (freezeInput)
                capture->FreezeLiveVideo(captureBuf,gaCaptureFieldAny);
            else
                capture->StartLiveVideo(captureBuf);
            }
        }
    SetActivePage(0);
    video->DisableVideoOutput(0);
    capture->FreeCaptureBuffer(captureBuf);
    return key;
}