roiFinder.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef EQ_ROI_FINDER_H
00018 #define EQ_ROI_FINDER_H
00019
00020 #include "roiEmptySpaceFinder.h"
00021 #include "roiTracker.h"
00022
00023 #include <eq/client/image.h>
00024
00025 #include <vector>
00026 #include <string>
00027
00028
00029 namespace eq
00030 {
00034 class ROIFinder
00035 {
00036 public:
00037 ROIFinder();
00038 virtual ~ROIFinder() {}
00039
00052 PixelViewportVector findRegions( const uint32_t buffers,
00053 const PixelViewport& pvp,
00054 const Zoom& zoom,
00055 const uint32_t stage,
00056 const uint32_t frameID,
00057 Window::ObjectManager* glObjects );
00058
00060 GLEWContext* glewGetContext() { return _glObjects->glewGetContext(); }
00061
00062 protected:
00063
00064 private:
00065 struct Area;
00066
00067 const void* _getInfoKey( ) const;
00068
00071 void _readbackInfo();
00072
00074 void _dumpDebug( const uint32_t stage = 0 );
00075
00078 void _init( );
00079
00081 void _fillWithColor( const PixelViewport& pvp, uint8_t* dst,
00082 const uint8_t val );
00083
00085 void _resize( const PixelViewport& pvp );
00086
00088 PixelViewport _getObjectPVP( const PixelViewport& pvp,
00089 const uint8_t* src );
00090
00092 uint8_t _splitArea( Area& area );
00093
00095 void _updateSubArea( const uint8_t type );
00096
00098 void _findAreas( PixelViewportVector& resultPVPs );
00099
00101 void _invalidateAreas( Area* areas, uint8_t num );
00102
00105 struct Dims
00106 {
00107 uint8_t x1, x2, x3;
00108 uint8_t y1, y2, y3;
00109 uint8_t w1, w2, w3, w4, w5, w6, w7, w8;
00110 uint8_t h1, h2, h3, h4, h5, h6, h7, h8;
00111 } _dim;
00112
00114 struct Area
00115 {
00116 Area(){};
00117 Area( PixelViewport pvp_ ) : emptySize( 0 ), pvp ( pvp_ ) {}
00118
00119 int32_t emptySize;
00120 PixelViewport pvp;
00121 PixelViewport hole;
00122
00123 bool valid;
00124 };
00125
00126 Area _tmpAreas[17];
00127 Area* _finalAreas[4];
00128
00129 std::vector< Area > _areasToCheck;
00130
00131 PixelViewport _pvp;
00132 PixelViewport _pvpOriginal;
00133
00134 ROIEmptySpaceFinder _emptyFinder;
00135
00136 int32_t _w;
00137 int32_t _h;
00138 int32_t _wh;
00139 int32_t _wb;
00140 int32_t _hb;
00141 int32_t _wbhb;
00142
00143 UByteVector _tmpMask;
00144 UByteVector _mask;
00145
00146 std::vector<float> _perBlockInfo;
00147
00148 uint8_t _histX[256];
00149 uint8_t _histY[256];
00150
00151 Image _tmpImg;
00152
00153 ROITracker _roiTracker;
00154
00156 Window::ObjectManager* _glObjects;
00157 };
00158 }
00159
00160 #endif // EQ_ROI_FINDER_H
00161