/**
    \fn getFrame
    \brief Get a processed frame
*/
bool rotateGl::getNextFrame(uint32_t *fn,ADMImage *image)
{
    // since we do nothing, just get the output of previous filter
    if(false==previousFilter->getNextFrame(fn,original))
    {
        ADM_warning("glRotate : Cannot get frame\n");
        return false;
    }
    widget->makeCurrent();
    glPushMatrix();
    // size is the last one...
    fboY->bind();

    glProgramY->setUniformValue("myTextureU", 1); 
    glProgramY->setUniformValue("myTextureV", 2); 
    glProgramY->setUniformValue("myTextureY", 0); 

    uploadAllPlanes(original);

    render(image,PLANAR_Y,fboY);

    downloadTextures(image,fboY);

    fboY->release();
    firstRun=false;
    glPopMatrix();
    widget->doneCurrent();
    image->copyInfo(original);
    return true;
}
/**
    \fn getFrame
    \brief Get a processed frame
*/
bool openGlSample::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);

    downloadTextures(image,fboY);

    fboY->release();
    firstRun=false;
    glPopMatrix();
    widget->doneCurrent();
    
    return true;
}
Exemple #3
0
/**
    \fn getFrame
    \brief Get a processed frame
*/
bool shaderLoader::getNextFrame(uint32_t *fn,ADMImage *image)
{
    // since we do nothing, just get the output of previous filter
    if(false==previousFilter->getNextFrame(fn,original))
    {
        ADM_warning("glRotate : Cannot get frame\n");
        return false;
    }
    if(!ready)
    {
        ADM_info("OpenGl shader not loaded (%s)\n",erString.c_str());
        image->duplicateFull(original);
        image->printString(2,2,"Shader not loaded");
        image->printString(2,2,erString.c_str());
        return true;
    }
    _parentQGL->makeCurrent();
    glPushMatrix();
    // size is the last one...
    fboY->bind();

    glProgramY->setUniformValue("myTextureU", 1);
    glProgramY->setUniformValue("myTextureV", 2);
    glProgramY->setUniformValue("myTextureY", 0);
    glProgramY->setUniformValue("myResolution", (GLfloat)info.width,(GLfloat)info.height);

    glProgramY->setUniformValue("pts", (GLfloat)original->Pts);

    uploadAllPlanes(original);

    render(image,PLANAR_Y,fboY);

    downloadTextures(image,fboY);

    fboY->release();
    firstRun=false;
    glPopMatrix();
    _parentQGL->doneCurrent();
    image->copyInfo(original);
    return true;
}
/**
    \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;
}