Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

ImageArchiveDiff.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_ImageArchiveDiff_h
00002 #define Impala_Core_Array_ImageArchiveDiff_h
00003 
00004 namespace Impala
00005 {
00006 namespace Core
00007 {
00008 namespace Array
00009 {
00010 
00011 
00012 template<class Archive1T, class Archive2T>
00013 inline int
00014 ImageArchiveDiff(Archive1T* ar1, Archive2T* ar2)
00015 {
00016     ILOG_VAR(Impala.Core.Array.ImageArchiveDiff);
00017 
00018     if (ar1->NrImages() != ar2->NrImages())
00019     {
00020         ILOG_ERROR("nrImages differs: " << ar1->NrImages() << " vs " <<
00021                    ar2->NrImages());
00022         return 1;
00023     }
00024     int nDiff = 0;
00025     for (int i=0 ; i<ar1->NrImages() ; i++)
00026     {
00027         size_t size1 = 0;
00028         UInt8* data1 = ar1->GetImageData(i, size1);
00029         size_t size2 = 1;
00030         UInt8* data2 = ar2->GetImageData(i, size2);
00031         if (size1 != size2)
00032         {
00033             ILOG_DEBUG("image " << i << " size differs " << size1 << " vs " <<
00034                        size2);
00035             nDiff++;
00036         }
00037         else
00038         {
00039             for (int j=0 ; j<size1 ; j++)
00040             {
00041                 if (data1[j] != data2[j])
00042                 {
00043                     ILOG_DEBUG("image " << i << " byte " << j << " differs");
00044                     nDiff++;
00045                     break;
00046                 }
00047             }
00048         }
00049         delete data1;
00050         delete data2;
00051     }
00052     if (nDiff > 0)
00053         ILOG_ERROR("Found " << nDiff << " differences");
00054     return nDiff;
00055 }
00056 
00057 } // namespace Array
00058 } // namespace Core
00059 } // namespace Impala
00060 
00061 #endif

Generated on Fri Mar 19 09:30:46 2010 for ImpalaSrc by  doxygen 1.5.1