/**
    \fn sendField
    \brief Process a field (top or bottom). If null the next param means there is no successor (next image)
*/
bool vdpauVideoFilterDeint::sendField(bool topField)
{
 // Call mixer...
    VdpVideoSurface in[3];
    bool r=true;
    // PREVIOUS
    for(int i=0;i<3;i++)
    {
        in[i]=slots[i].surface;
        aprintf("Mixing %d %d\n",i,(int)in[i]);
    }
    if(in[0]==VDP_INVALID_HANDLE)
            in[0]=in[1];
    //

#ifdef DO_BENCHMARK
    ADMBenchmark bmark;
    for(int i=0;i<NB_BENCH;i++)
    {
        bmark.start();
#endif
    
       
    // ---------- Top field ------------
    if(VDP_STATUS_OK!=admVdpau::mixerRenderFieldWithPastAndFuture(topField, 
                mixer,
                in,
                outputSurface, 
                getInfo()->width,getInfo()->height,
                previousFilter->getInfo()->width,previousFilter->getInfo()->height))

    {
        ADM_warning("[Vdpau] Cannot mixerRender\n");
        r= false;
    }   
                     
#ifdef DO_BENCHMARK
        bmark.end();
    }
    ADM_warning("Mixer Benchmark\n");
    bmark.printResult();
#endif 
    return r;
}
예제 #2
0
/**
    \fn getFrame
    \brief Get a processed frame
*/
bool openGlBenchmark::getNextFrame(uint32_t *fn,ADMImage *image)
{
    // since we do nothing, just get the output of previous filter
    if(false==previousFilter->getNextFrame(fn,image))
    {
        ADM_warning("FlipFilter : Cannot get frame\n");
        return false;
    }
    widget->makeCurrent();
    glPushMatrix();
    // size is the last one...
    fboY->bind();
    
    float angle=*fn;
    angle=angle/40;
    glProgramY->setUniformValue("teta", angle);     
    glProgramY->setUniformValue("myTextureU", 1); 
    glProgramY->setUniformValue("myTextureV", 2); 
    glProgramY->setUniformValue("myTextureY", 0); 
    glProgramY->setUniformValue("myWidth", (GLfloat)image->GetWidth(PLANAR_Y)); 
    glProgramY->setUniformValue("myHeight", (GLfloat)image->GetHeight(PLANAR_Y)); 

    uploadAllPlanes(image);

    render(image,PLANAR_Y,fboY);

    ADMBenchmark bench;

    for(int i=0;i<10;i++)
    {
        bench.start();
        downloadTexturesQt(image,fboY);
        bench.end();
    }
    ADMBenchmark bench2;
    for(int i=0;i<10;i++)
    {
        bench2.start();
        downloadTexturesDma(image,fboY);
        bench2.end();
    }
    printf("Qt4 Benchmark\n");
    bench.printResult();
    printf("PBO/FBO Benchmark\n");
    bench2.printResult();

    float avg1,avg2;
    int min1,min2,max1,max2;
    bench.getResult(avg1,min1,max1);
    bench2.getResult(avg2,min2,max2);

    char str1[81];
    char str2[81];

    snprintf(str1,80,"Qt  avg=%03.2f ms, min=%d max=%d ms",avg1,(int)min1,(int)max1);
    snprintf(str2,80,"DMA avg=%03.2f ms, min=%d max=%d ms",avg2,(int)min2,(int)max2);
    image->printString(2,4,str1);
    image->printString(2,8,str2);

    
    fboY->release();
    firstRun=false;
    glPopMatrix();
    widget->doneCurrent();
    
    return true;
}