Ignore:
Timestamp:
02/07/07 17:43:56 (17 years ago)
Author:
mattausch
Message:

worked on pvs

Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/EvalStats/EvalStats.vcproj

    r1926 r2100  
    205205                        <Tool 
    206206                                Name="VCCLCompilerTool" 
    207                                 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 
    208                                 RuntimeLibrary="0" 
    209                                 UsePrecompiledHeader="3" 
    210                                 WarningLevel="3" 
    211                                 Detect64BitPortabilityProblems="TRUE" 
    212                                 DebugInformationFormat="3"/> 
    213                         <Tool 
    214                                 Name="VCCustomBuildTool"/> 
    215                         <Tool 
    216                                 Name="VCLinkerTool" 
    217                                 OutputFile="$(OutDir)/EvalStats.exe" 
    218                                 LinkIncremental="1" 
    219                                 GenerateDebugInformation="TRUE" 
    220                                 SubSystem="1" 
    221                                 OptimizeReferences="2" 
    222                                 EnableCOMDATFolding="2" 
     207                                Optimization="3" 
     208                                GlobalOptimizations="TRUE" 
     209                                InlineFunctionExpansion="2" 
     210                                EnableIntrinsicFunctions="TRUE" 
     211                                FavorSizeOrSpeed="1" 
     212                                OmitFramePointers="TRUE" 
     213                                EnableFiberSafeOptimizations="TRUE" 
     214                                OptimizeForProcessor="3" 
     215                                OptimizeForWindowsApplication="TRUE" 
     216                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 
     217                                RuntimeLibrary="0" 
     218                                UsePrecompiledHeader="3" 
     219                                WarningLevel="3" 
     220                                Detect64BitPortabilityProblems="TRUE" 
     221                                DebugInformationFormat="3"/> 
     222                        <Tool 
     223                                Name="VCCustomBuildTool"/> 
     224                        <Tool 
     225                                Name="VCLinkerTool" 
     226                                OutputFile="$(OutDir)/EvalStats.exe" 
     227                                LinkIncremental="1" 
     228                                GenerateDebugInformation="TRUE" 
     229                                SubSystem="1" 
     230                                OptimizeReferences="2" 
     231                                EnableCOMDATFolding="2" 
     232                                OptimizeForWindows98="1" 
    223233                                TargetMachine="1"/> 
    224234                        <Tool 
  • GTP/trunk/Lib/Vis/Preprocessing/src/OspTree.cpp

    r2017 r2100  
    392392        // This is important during the subdivision 
    393393 
    394 //MailablePvsData::NewMail(); 
     394        //MailablePvsData::NewMail(); 
    395395        UpdateViewCellsPvs(front, *frontData.mRays); 
    396396        UpdateViewCellsPvs(back, *backData.mRays); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj

    r2092 r2100  
    206206                <Configuration 
    207207                        Name="Release Internal|Win32" 
    208                         OutputDirectory="$(ConfigurationName)" 
    209                         IntermediateDirectory="$(ConfigurationName)" 
     208                        OutputDirectory="Release" 
     209                        IntermediateDirectory="Release" 
    210210                        ConfigurationType="4" 
    211211                        CharacterSet="2"> 
     
    419419                        </File> 
    420420                        <File 
     421                                RelativePath=".\DefaultPvs.h"> 
     422                        </File> 
     423                        <File 
    421424                                RelativePath="..\src\dual_depth.cg"> 
    422425                        </File> 
     
    482485                        </File> 
    483486                        <File 
     487                                RelativePath=".\HashPvs.h"> 
     488                        </File> 
     489                        <File 
    484490                                RelativePath=".\HierarchyManager.cpp"> 
    485491                        </File> 
     
    750756                        <File 
    751757                                RelativePath="..\src\Pvs.h"> 
     758                        </File> 
     759                        <File 
     760                                RelativePath=".\PvsBase.h"> 
    752761                        </File> 
    753762                        <File 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r2077 r2100  
    106106        } 
    107107 
    108         //////////////////////////// 
     108        /////////////// 
    109109        //  Mailing stuff 
    110110 
     
    172172{ 
    173173        template<typename T, typename S> 
    174         friend class PvsIterator; 
     174                friend class PvsIterator; 
    175175 
    176176public: 
    177    
     177 
    178178        Pvs(): mSamples(0), mEntries(), mLastSorted(0), mQueriesSinceSort(0) {} 
    179179 
    180180        /** creates pvs and initializes it with the given entries.  
    181                 Assumes that entries are sorted- 
     181        Assumes that entries are sorted- 
    182182        */ 
    183183        Pvs(const vector<PvsEntry<T, S> > &samples); 
     
    186186        /** Compresses PVS lossless or lossy. 
    187187        */ 
    188         int Compress() {return 0;} 
    189         int GetSize() const {return (int)mEntries.size();} 
    190         bool Empty() const {return mEntries.empty();} 
    191  
    192         void Reserve(const int n) { mEntries.reserve(n); } 
     188        int Compress()  
     189        { 
     190                return 0; 
     191        } 
     192         
     193        int GetSize() const  
     194        { 
     195                return (int)mEntries.size(); 
     196        } 
     197         
     198        bool Empty() const  
     199        { 
     200                return mEntries.empty(); 
     201        } 
     202 
     203        void Reserve(const int n)  
     204        {  
     205                mEntries.reserve(n);  
     206        } 
    193207 
    194208        /** Normalize the visibility of entries in order to get  
    195                 comparable results. 
     209        comparable results. 
    196210        */ 
    197211        void NormalizeMaximum(); 
    198212 
    199213        /** Merges pvs of a into this pvs. 
    200                 Warning: very slow! 
     214        Warning: very slow! 
    201215        */ 
    202216        void MergeInPlace(const Pvs<T, S> &a); 
    203217 
    204218        /** Difference of pvs to pvs b. 
    205                 @returns number of different entries. 
     219        @returns number of different entries. 
    206220        */ 
    207221        int Diff(const Pvs<T, S> &b); 
     
    209223        /** Finds sample in PVS. 
    210224                @param checkDirty if dirty part of the pvs should be checked for entry  
    211                         (warning: linear runtime in dirty part) 
     225                (warning: linear runtime in dirty part) 
    212226                @returns iterator on the sample if found, else the place where  
    213                         it would be added in the sorted vector. 
     227                it would be added in the sorted vector. 
    214228        */ 
    215229        bool Find(T sample, 
     
    239253        void Sort(); 
    240254 
    241   /** Sort pvs entries assume that the pvs contains unique entries 
    242    */ 
    243   void SimpleSort(); 
    244  
    245         /** Adds sample to PVS. Assumes that the pvs is sorted 
    246                 @returns contribution of sample (0 or 1) 
    247         */ 
    248         //float AddSamples(const vector<PvsEntry<T, S> > &samples); 
     255        /** Sort pvs entries assume that the pvs contains unique entries 
     256        */ 
     257        void SimpleSort(); 
    249258 
    250259        /** Adds sample to PVS. 
     
    269278 
    270279        /** Removes sample from PVS if reference count is zero. 
    271                 @param visibleSamples number of references to be removed 
     280        @param visibleSamples number of references to be removed 
    272281        */ 
    273282        bool RemoveSample(T sample, const float pdf); 
     
    293302 
    294303        static void Merge(Pvs<T, S> &mergedPvs, const Pvs<T, S> &a, const Pvs<T, S> &b); 
     304 
     305        int GetSamples() const 
     306        { 
     307                return mSamples; 
     308        } 
     309 
     310        bool IsDirty() const 
     311        { 
     312                return mLastSorted < mEntries.size(); 
     313        } 
     314 
     315        bool RequiresResort() const 
     316        { 
     317                // the last part should not be more than log of the sorted part. this 
     318                // way we can achieve logarithmic behaviour for insertion and find 
     319                const int n = mEntries.size(); 
     320                const int dirtySize = n - mLastSorted; 
     321 
     322#define LOG2E 1.442695040f 
     323 
     324                const float logN = log((float)max(1, n))/LOG2E; 
     325                const float logS = log((float)max(1, mLastSorted))/LOG2E; 
     326                const float logD = log((float)max(1, dirtySize))/LOG2E; 
     327 
     328                if (8*(n + 2*dirtySize*logD) < 
     329                        mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN))  
     330                { 
     331                                //              cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 
     332                        return true; 
     333                } 
     334                 
     335                return false; 
     336        } 
     337 
     338        bool RequiresResortLog() const 
     339        { 
     340                // the last part should not be more than log of the sorted part. this 
     341                // way we can achieve logarithmic behaviour for insertion and find 
     342                const int dirtySize = (int)mEntries.size() - mLastSorted; 
     343                return dirtySize > 4 * (int)(log((double)mEntries.size()) / log(2.0)); 
     344        } 
     345 
     346 
     347        int GetLastSorted() const 
     348        { 
     349                return mLastSorted; 
     350        } 
     351 
     352        typename PvsIterator<T, S> GetIterator() const; 
     353 
     354protected: 
    295355 
    296356        static void Merge(Pvs<T, S> &mergedPvs,  
     
    302362                                          const int bSamples); 
    303363 
    304         int GetSamples() const 
    305         { 
    306                 return mSamples; 
    307         } 
    308  
    309  
    310         bool IsDirty() const 
    311         { 
    312                 return mLastSorted < mEntries.size(); 
    313         } 
    314  
    315         bool RequiresResort() const 
    316         { 
    317           // the last part should not be more than log of the sorted part. this 
    318           // way we can achieve logarithmic behaviour for insertion and find 
    319           const int n = mEntries.size(); 
    320           const int dirtySize = n - mLastSorted; 
    321  
    322 #define LOG2E 1.442695040f 
    323            
    324           const float logN = log((float)max(1, n))/LOG2E; 
    325           const float logS = log((float)max(1, mLastSorted))/LOG2E; 
    326           const float logD = log((float)max(1, dirtySize))/LOG2E; 
    327            
    328           if (8*(n + 2*dirtySize*logD) < 
    329                   mQueriesSinceSort*((mLastSorted*logS + dirtySize*dirtySize/2)/n - logN)) { 
    330                 //              cout<<"Q="<<mQueriesSinceSort<<" N="<<n<<" D="<<dirtySize<<endl; 
    331                 return true; 
    332           } 
    333           return false; 
    334         } 
    335  
    336   bool RequiresResortLog() const 
    337   { 
    338         // the last part should not be more than log of the sorted part. this 
    339         // way we can achieve logarithmic behaviour for insertion and find 
    340         const int dirtySize = (int)mEntries.size() - mLastSorted; 
    341         return dirtySize > 4*(int)(log((double)mEntries.size()) / log(2.0)); 
    342   } 
    343    
    344    
    345         int GetLastSorted() const 
    346         { 
    347                 return mLastSorted; 
    348         } 
    349  
    350         typename PvsIterator<T, S> GetIterator() const; 
    351  
    352 protected: 
    353  
    354364        /// vector of PVS entries 
    355365        vector<PvsEntry<T, S> > mEntries;  
    356          
     366 
    357367        /// Number of samples used to create the PVS 
    358368        int mSamples; 
    359    
     369 
    360370        /// Last sorted entry in the pvs (important for find and merge) 
    361371        int mLastSorted; 
    362372 
    363   int mQueriesSinceSort; 
     373        int mQueriesSinceSort; 
    364374}; 
    365375 
     
    379389{ 
    380390        std::vector<PvsEntry<T, S> >::iterator it = mEntries.begin() + mLastSorted; 
    381         //std::vector<PvsEntry<T, S> >::const_iterator it = mEntries.begin() + mLastSorted; 
    382391        std::vector<PvsEntry<T, S> >::iterator it_end = mEntries.end(); 
    383392 
     
    385394        std::vector<PvsEntry<T, S> >::iterator newEnd = unique(it, it_end); 
    386395        sort(it, newEnd); 
    387         //sort(mEntries.begin(), mEntries.end()); 
    388396         
    389397        // now merge sorted ranges 
     
    452460                const float diff = bSumPdf - aSumPdf; 
    453461 
    454                 if (diff > 0.0f) { 
     462                if (diff > 0.0f)  
     463                { 
    455464                        pvsEnlargement += diff; 
    456                 } else { 
     465                }  
     466                else  
     467                { 
    457468                        pvsReduction += -diff; 
    458469                } 
    459470#else 
    460471                if (!entryFound) 
     472                { 
    461473                        pvsEnlargement += 1.0f; 
     474                } 
    462475#endif 
    463476        } 
     
    467480                float aSumPdf = (*it).mData.mSumPdf; 
    468481                float bSumPdf = 0.0f; 
    469                 if (aSumPdf < 0.0f) { 
    470                  
     482                if (aSumPdf < 0.0f)  
     483                { 
    471484                        // this entry was already accounted for! 
    472485                        // just revert it back 
    473486                        (*it).mData.mSumPdf = -aSumPdf; 
    474                 } else { 
     487                }  
     488                else  
     489                { 
    475490                        vector<PvsEntry<T, S> >::iterator oit; 
    476491                 
     
    592607                                mergedPvs.mEntries.push_back(*bit); 
    593608                        } 
    594                          
    595                         //bObjOld = bObj; 
    596609                } 
    597610 
     
    669682} 
    670683 
    671 /* 
    672 template <typename T, typename S>  
    673 bool Pvs<T, S>::Find(T sample, 
    674                                          typename vector<PvsEntry<T, S> >::iterator &it, 
    675                                          const bool checkDirty) 
    676 { 
    677         PvsEntry<T, S> dummy(sample, PvsData()); 
    678         mQueriesSinceSort++; 
    679  
    680         // only check clean part 
    681         vector<PvsEntry<T, S> >::iterator sorted_end = mEntries.begin() + mLastSorted; 
    682  
    683         // binary search 
    684         it = lower_bound(mEntries.begin(), sorted_end, dummy); 
    685  
    686         if ((it != mEntries.end()) && ((*it).mObject == sample)) 
    687                 return true; 
    688  
    689         // sample not found yet => search further in the unsorted part 
    690         if (checkDirty)  
    691         { 
    692                 for (it = sorted_end; (it != mEntries.end()) && ((*it).mObject != sample); ++ it); 
    693  
    694                 if (it != mEntries.end()) 
    695                         return true; 
    696         } 
    697  
    698         return false; 
    699 } 
    700 */ 
    701684 
    702685template <typename T, typename S> 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp

    r2071 r2100  
    11621162 
    11631163 
    1164 inline int AddedPvsSize(ObjectPvs pvs1, const ObjectPvs &pvs2) 
     1164inline int AddedPvsSize(const ObjectPvs &pvs1, const ObjectPvs &pvs2) 
    11651165{ 
    11661166        ObjectPvs interPvs; 
     
    22672267 
    22682268        int entriesInPvs = rootEntries; 
    2269     const int entryStorage = sizeof(PvsData) + sizeof(int); // one entry into the pvs 
     2269        // one entry into the pvs 
     2270    const int entryStorage = sizeof(PvsData) + sizeof(int);  
    22702271 
    22712272        storageFunction.push_back(rootEntries); 
     
    23192320        } 
    23202321} 
    2321  
    23222322 
    23232323 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2096 r2100  
    2727#include "PerfTimer.h" 
    2828 
     29#include "HashPvs.h" 
     30 
    2931 
    3032 
     
    15431545                 
    15441546                castSamples += samplesPerPass; 
     1547HashPvs<int> dummy; 
    15451548 
    15461549                Real timeDiff = TimeDiff(startTime, GetTime()); 
Note: See TracChangeset for help on using the changeset viewer.