Ignore:
Timestamp:
04/28/08 18:59:58 (16 years ago)
Author:
mattausch
Message:

working on gvs pixel error evaluation bugfixing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2653 r2662  
    125125 
    126126#endif 
     127 
    127128        mFrame = 0; 
    128129        mWireFrame = false; 
     
    15331534                mPvsErrorBuffer[i].mError = -1.0f; 
    15341535        } 
    1535          
    1536          
    1537         // atlanta problematic frames: 325 525 691 1543 
    1538 #if 0 
    1539         if (mFrame != 325 && 
    1540                 mFrame != 525 && 
    1541                 mFrame != 691 && 
    1542                 mFrame != 1543) 
    1543           mPvsErrorBuffer[i] = -1; 
    1544         else { 
    1545           Debug<<"frame ="<<mFrame<<" vp="<<mViewPoint<<" vd="<<mViewDirection<<endl; 
    1546         } 
    1547 #endif 
    1548          
     1536 
    15491537 
    15501538        if (mPvsErrorBuffer[i].mError > 0.0f) { 
     
    16151603void GlRenderer::EvalPvsStat(const SimpleRayContainer &viewPoints) 
    16161604{ 
    1617   mPvsStat.Reset(); 
    1618  
    1619   SetupProjection(GetWidth(), GetHeight()); 
    1620    
    1621   cout << "mPvsStatFrames=" << viewPoints.size() << endl; 
    1622    
    1623   SimpleRayContainer::const_iterator sit, sit_end = viewPoints.end(); 
    1624   int i = 0; 
    1625    
    1626   for (sit = viewPoints.begin(); sit != sit_end; ++ sit, ++ i)  
    1627         { 
    1628           //cout << "\n\nvp: " << (*sit) << endl; 
    1629           SimpleRay sray = *sit; 
    1630            
    1631           // set frame id for saving the error buffer 
    1632           mFrame = i; 
    1633           mViewPoint = sray.mOrigin; 
    1634           mViewDirection = sray.mDirection; 
    1635  
    1636           // skip all frames which have already 0 pixel error 
    1637           // $$ Reverted back by JB for efficiency 
    1638           if (mPvsErrorBuffer[i].mError > 0.0f)  
    1639           { 
    1640                   int pvsSize; 
    1641  
    1642                   // compute the pixel error 
    1643                   float error = GetPixelError(pvsSize); 
    1644                    
    1645                   mPvsErrorBuffer[i].mError = error; 
    1646                   mPvsErrorBuffer[i].mPvsSize = pvsSize; 
    1647  
    1648                   cout << "(" << i << "," << mViewPoint << "," << mViewDirection << mPvsErrorBuffer[i].mError <<")"; 
    1649                   //              cout << "(vc: " << i << ", er: " << mPvsErrorBuffer[i].mError <<")" << endl; 
    1650           } 
    1651  
    1652           const float err = mPvsErrorBuffer[i].mError; 
    1653  
    1654           // do not account for the case that no PVS is rendered - hack for 08 rebuttal GVS evaluation 
    1655           // (correct would be >=0.0f) 
    1656           if (err >= 0.0f && err < 0.99999f)  
    1657           { 
    1658                   if (err > mPvsStat.maxError) 
    1659                   { 
    1660                           mPvsStat.maxError = err; 
    1661                           cout << "new max error: " << mPvsStat.maxError << endl; 
    1662                   } 
    1663  
    1664                   mPvsStat.sumError += err; 
    1665                   mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 
    1666  
    1667                   if (err == 0.0f) 
    1668                           ++ mPvsStat.errorFreeFrames; 
    1669  
    1670                   // $$ JB 
    1671                   // moved it back here not to count frames with negative err (backfacing triangle) 
    1672                   ++ mPvsStat.frames; 
    1673           } 
    1674            
    1675         } 
    1676    
    1677   glFinish(); 
    1678  
    1679    
    1680   cout << endl << flush; 
     1605        mPvsStat.Reset(); 
     1606 
     1607        SetupProjection(GetWidth(), GetHeight()); 
     1608 
     1609        cout << "mPvsStatFrames=" << viewPoints.size() << endl; 
     1610 
     1611        SimpleRayContainer::const_iterator sit, sit_end = viewPoints.end(); 
     1612 
     1613        int i = 0; 
     1614 
     1615        for (sit = viewPoints.begin(); sit != sit_end; ++ sit, ++ i)  
     1616        { 
     1617                //cout << "\n\nvp: " << (*sit) << endl; 
     1618                SimpleRay sray = *sit; 
     1619                int pvsSize = 0; 
     1620 
     1621                // set frame id for saving the error buffer 
     1622                mFrame = i; 
     1623                mViewPoint = sray.mOrigin; 
     1624                mViewDirection = sray.mDirection; 
     1625 
     1626                // skip all frames which have already 0 pixel error 
     1627                // $$ Reverted back by JB for efficiency 
     1628                if (mPvsErrorBuffer[i].mError > 0.0f)  
     1629                { 
     1630                        // compute the pixel error 
     1631                        float error = GetPixelError(pvsSize); 
     1632 
     1633                        mPvsErrorBuffer[i].mError = error; 
     1634                        mPvsErrorBuffer[i].mPvsSize = pvsSize; 
     1635 
     1636                        int pixelError = (int)mPvsErrorBuffer[i].mError * GetWidth() * GetHeight(); 
     1637 
     1638                        if (0 && (pixelError > 0) && (pvsSize > 0))  
     1639                        { 
     1640                                cout << "!err: " << i << "," << mViewPoint << "," << mViewDirection << " " << mPvsErrorBuffer[i].mError * GetWidth() * GetHeight() << endl; 
     1641                        } 
     1642                } 
     1643 
     1644                const float err = mPvsErrorBuffer[i].mError; 
     1645 
     1646                // hack: 
     1647                // do not account for the case that no PVS is rendered - hack for 08 rebuttal GVS evaluation 
     1648                // drop the first frame (for some reason, the first frame yields wrong pixel error) 
     1649                 
     1650                if ((mFrame > 0) && (err >= 0.0f) && (err < (1.0f - 1e-6f)) && (pvsSize > 0))  
     1651                { 
     1652                        if (err > mPvsStat.maxError) 
     1653                        { 
     1654                                mPvsStat.maxError = err; 
     1655 
     1656                                cout << "new max error: " << mPvsStat.maxError * GetWidth()*GetHeight()  << endl; 
     1657                        } 
     1658 
     1659                        mPvsStat.sumError += err; 
     1660                        mPvsStat.sumPvsSize += mPvsErrorBuffer[i].mPvsSize; 
     1661 
     1662                        if (err == 0.0f) 
     1663                                ++ mPvsStat.errorFreeFrames; 
     1664 
     1665                        // $$ JB 
     1666                        // moved it back here not to count frames with negative err (backfacing triangle) 
     1667                        ++ mPvsStat.frames; 
     1668                } 
     1669 
     1670        } 
     1671 
     1672        glFinish(); 
     1673 
     1674 
     1675        cout << endl << flush; 
    16811676} 
    16821677 
Note: See TracChangeset for help on using the changeset viewer.