LCOV - code coverage report
Current view: top level - eq/client - roiTracker.h (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 0 1 0.0 %
Date: 2014-06-18 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /* Copyright (c)      2009, Maxim Makhinya
       2             :  *               2010-2014, Stefan Eilemann <eile@eyescale.ch>
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #ifndef EQ_ROI_TRACKER_H
      19             : #define EQ_ROI_TRACKER_H
      20             : 
      21             : #include <eq/client/types.h>
      22             : #include <eq/fabric/pixelViewport.h> // member
      23             : 
      24             : #include <co/types.h>
      25             : #include <lunchbox/stdExt.h>          // member
      26             : 
      27             : #include <vector>
      28             : #include <string>
      29             : 
      30             : namespace eq
      31             : {
      32             : /** Tracks requested areas for ROI. Used to disable ROI when ROI fails. */
      33             : class ROITracker : public boost::noncopyable
      34             : {
      35             : public:
      36             :     ROITracker();
      37             :     virtual ~ROITracker();
      38             : 
      39             :     /**
      40             :      * Has to be called once before any ROI calculation. Tells wether ROIFinder
      41             :      * should be executed for a particular region or not.  If true is returned,
      42             :      * then updateDelay must be called once before any next useROIFinder
      43             :      * call. If false is returned, then updateDelay shouldn't be called.
      44             :      *
      45             :      * This function uses _prvFrame areas data to match with current pvp. If
      46             :      * good intersection with one of previous areas is found, it will use
      47             :      * information from that area form previous frame to decide wether it should
      48             :      * skip ROIFinder execution or not. If good intersection is not found area
      49             :      * cosidered new, and function returns true.
      50             :      *
      51             :      * @param  pvp      same viewport that will be specifyed for FOIFinder
      52             :      * @param  stage    current assembling stage
      53             :      * @param  frameID  should be different for different frames
      54             :      * @param  ticket   should be stored by caller and given to updateDelay
      55             :      *
      56             :      * @return true if ROIFinder should be called for given region.
      57             :      */
      58             :     bool useROIFinder( const PixelViewport&   pvp,
      59             :                        const uint32_t        stage,
      60             :                        const uint128_t&      frameID,
      61             :                        uint8_t*&       ticket );
      62             : 
      63             :     /**
      64             :      * Has to be called once after every positive result from useROIFinder.
      65             :      * Shouldn't be called otherwise
      66             :      *
      67             :      * It checks how much space ROIFinder was able to discard and if it is not
      68             :      * enough it will disable usage of ROIFinder for several next frames. If
      69             :      * ROIFinder was able to cut-off enought it will reset failure statistics
      70             :      * for that region.
      71             :      *
      72             :      * @param  pvps    result from ROIFinder
      73             :      * @param  ticket  value from useROIFinder
      74             :      */
      75             :     void updateDelay( const PixelViewports& pvps, const uint8_t* ticket );
      76             : 
      77             : private:
      78             :     /** Area of readback */
      79             :     struct Area
      80             :     {
      81             :         Area( const PixelViewport& pvp_,
      82             :               uint32_t       lastSkip_ = 0,
      83             :               uint32_t       skip_     = 0 );
      84             : 
      85             :         PixelViewport pvp;
      86             :         uint32_t      lastSkip; //!< Previousely skiped number of frames
      87             :         uint32_t      skip;     //!< Number of frames to skip ROIFinder
      88             :     };
      89             :     /** Set of readback areas per compositiong stage */
      90           0 :     struct Stage
      91             :     {
      92             :         std::vector< Area > areas;
      93             :     };
      94             :     /** Areas for different compositiong stages for current frame.
      95             :         This data if filled during useROIFinder calls, it uses
      96             :         useROIFinder parameters and _prvFrame data as refference */
      97             :     stde::hash_map< uint32_t, Stage >* _curFrame;
      98             : 
      99             :     /** Areas for different compositiong stages for previous frame. */
     100             :     stde::hash_map< uint32_t, Stage >* _prvFrame;
     101             : 
     102             :     uint8_t* _ticket;//!< returned on getDelay, should match on updateDelay
     103             :     bool     _needsUpdate;//!< true after getDelay, false after updateDelay
     104             :     uint128_t _lastFrameID;//!< used to determine new frames
     105             :     uint32_t _lastStage;  //!< used in updateDelay to find last added area
     106             : 
     107             :     bool _returnPositive( uint8_t*& ticket );
     108             : };
     109             : }
     110             : 
     111             : #endif //EQ_ROI_TRACKER_H
     112             : 

Generated by: LCOV version 1.10