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

virtual void Impala::Core::VideoSet::CheckNrFrames::HandleNewFile ( VideoSet vs,
int  fileId,
Stream::RgbDataSrc src 
) [inline, virtual]

Arrived at given DB_FILE in a "normal" walk.

Reimplemented from Impala::Core::VideoSet::Listener.

Definition at line 44 of file CheckNrFrames.h.

References Impala::FileNameBase(), Impala::FileNameConcat(), Impala::Core::VideoSet::Segmentation::GetEnd(), Impala::Core::VideoSet::Segmentation::GetFirstShotVideo(), Impala::Core::VideoSet::Segmentation::GetNrFramesVideo(), Impala::Core::VideoSet::Segmentation::GetNrShotsVideo(), Impala::Core::VideoSet::Segmentation::GetStart(), ILOG_ERROR, ILOG_INFO, Impala::Core::Stream::RgbDataSrc::LastFrame(), mMargin, mSbDir, mSegmentation, and Impala::Persistency::File::ReadStrings().

00045     {
00046         if (!mSegmentation)
00047         {
00048             ILOG_ERROR("No segmentation given");
00049             return;
00050         }
00051         int srcNr = src->LastFrame() + 1;
00052         int segNr = mSegmentation->GetNrFramesVideo(fileId);
00053         int d = abs(srcNr - segNr);
00054         if (d > mMargin)
00055         {
00056             ILOG_ERROR("Frame difference is " << d << " for file " <<
00057                        vs->GetFile(fileId) << " (src says " << srcNr <<
00058                        ", segmentation says " << segNr << ")");
00059         }
00060         if ((d > 0) && (mMargin != 0))
00061             ILOG_INFO("Frame difference is " << d << " for file " <<
00062                        vs->GetFile(fileId) << " (src says " << srcNr <<
00063                        ", segmentation says " << segNr << ")");
00064 
00065         if (mSbDir.empty())
00066             return;
00067 
00068         String fName = FileNameBase(vs->GetFile(fileId)) + ".sb";
00069         fName = FileNameConcat(mSbDir, fName);
00070         Persistency::FileLocator fLoc(vs->GetLocator(), fName);
00071         typedef Persistency::RepositoryInFileSystem FS;
00072         Persistency::File file = FS::GetInstance().GetFile(fLoc, false, false);
00073         std::vector<String> sb;
00074         file.ReadStrings(sb);
00075         int nrShots = mSegmentation->GetNrShotsVideo(fileId);
00076         // First two lines in .sb file are "comments"
00077         if (nrShots != sb.size() - 2)
00078         {
00079             ILOG_ERROR("Different nrShots: segmentation=" << nrShots <<
00080                        ", sb=" << sb.size()-2);
00081             return;
00082         }
00083         int firstShot = mSegmentation->GetFirstShotVideo(fileId);
00084         for (int i=0 ; i<nrShots ; i++)
00085         {
00086             Util::StringParser p(sb[i+2]);
00087             int sbStart = p.GetInt(' ');
00088             int sbEnd = p.GetInt(' ');
00089 
00090             int start = mSegmentation->GetStart(firstShot + i);
00091             int d = abs(start - sbStart);
00092             if (d > mMargin)
00093                 ILOG_ERROR("Start differs: segmentation=" << start <<
00094                            ", sb=" << sbStart);
00095             if ((d > 0) && (mMargin != 0))
00096                 ILOG_INFO("Start differs: segmentation=" << start <<
00097                           ", sb=" << sbStart);
00098 
00099             int end = mSegmentation->GetEnd(firstShot + i);
00100             d = abs(end - sbEnd);
00101             if (d > mMargin)
00102                 ILOG_ERROR("End differs: segmentation=" << end <<
00103                            ", sb=" << sbEnd);
00104             if ((d > 0) && (mMargin != 0))
00105                 ILOG_INFO("End differs: segmentation=" << end <<
00106                           ", sb=" << sbEnd);
00107         }
00108     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:21:47 2011 for ImpalaSrc by  doxygen 1.5.1