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

void Impala::Samples::MonetTest::DoInsertSegmentation ( Connection *  conn  ) 

Definition at line 569 of file mainMonetTest.cpp.

References Impala::CmdOptions::GetArg(), Impala::Core::VideoSet::Segmentation::GetEnd(), Impala::Core::VideoSet::Segmentation::GetFirstShotVideo(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetInt(), Impala::Core::VideoSet::Segmentation::GetName(), Impala::CmdOptions::GetNrArg(), Impala::Core::VideoSet::Segmentation::GetNrFramesVideo(), Impala::Core::VideoSet::Segmentation::GetNrShots(), Impala::Core::VideoSet::Segmentation::GetNrShotsVideo(), Impala::Core::VideoSet::Segmentation::GetNrVideos(), Impala::Core::VideoSet::VideoSet::GetQuidVideo(), Impala::Core::VideoSet::Segmentation::GetStart(), Impala::Core::VideoSet::Segmentation::GetTotalNrFrames(), ILOG_ERROR, ILOG_INFO, ILOG_VAR, Impala::MakeString(), Impala::Core::VideoSet::MakeVideoSet(), and Impala::Timer::SplitTime().

Referenced by mainMonetTest().

00570 {
00571     ILOG_VAR(Impala.Samples.MonetTest.DoInsertSegmentation);
00572     CmdOptions& options = CmdOptions::GetInstance();
00573     if (options.GetNrArg() < 5)
00574     {
00575         ILOG_ERROR("Need more parameters");
00576         return;
00577     }
00578 
00579     String vidSetName = options.GetArg(4);
00580     VideoSet* vidSet = Core::VideoSet::MakeVideoSet(vidSetName);
00581 
00582     Segmentation segmentation(vidSet, "segmentation");
00583     ILOG_INFO("nrVideos = " << segmentation.GetNrVideos());
00584     ILOG_INFO("nrShots = " << segmentation.GetNrShots());
00585     ILOG_INFO("nrFrames = " << segmentation.GetTotalNrFrames());
00586     conn->Query("delete from i_bulk_fragment;", false, false);
00587     int startFile = options.GetInt("startFile");
00588     Timer timer;
00589     for (int v=startFile ; v<segmentation.GetNrVideos() ; v++)
00590     {
00591         ILOG_INFO("v = " << v);
00592         Quid vidQuid = vidSet->GetQuidVideo(v, true);
00593         int first = segmentation.GetFirstShotVideo(v);
00594         int nr = segmentation.GetNrShotsVideo(v);
00595         String q = "copy " + MakeString(nr) +
00596             " records into i_bulk_fragment from stdin using delimiters ' ';\n";
00597         for (int s=first ; s<first+nr ; s++)
00598         {
00599             int start = segmentation.GetStart(s);
00600             int len = segmentation.GetEnd(s) - start + 1;
00601             q += MakeString(vidQuid) + " " + MakeString(start) + " "
00602                 + MakeString(len) + " " + segmentation.GetName(s)
00603                 + " false false\n";
00604         }
00605         conn->Query(q, false, false);
00606 
00607         nr = segmentation.GetNrFramesVideo(v);
00608         q = "copy " + MakeString(nr) +
00609             " records into i_bulk_fragment from stdin using delimiters ' ';\n";
00610         for (int f=0 ; f<nr ; f++)
00611         {
00612             q += MakeString(vidQuid) + " " + MakeString(f) + " 1 frame"
00613                 + MakeString(f) + " false false\n";
00614         }
00615         conn->Query(q, false, false);
00616     }
00617     ILOG_INFO("Did bulk in " << timer.SplitTime());
00618     conn->Query("insert into fragment (media_id, fragment_start, \
00619                                        fragment_length, fragment_name, \
00620                                        keyframe, representative) \
00621                  select m.media_id, bf.fragment_start, bf.fragment_length, \
00622                         bf.fragment_name, bf.keyframe, bf.representative \
00623                  from i_bulk_fragment bf, media m \
00624                  where bf.quid = m.quid \
00625                  order by bf.quid, bf.fragment_start;", false, false);
00626     ILOG_INFO("Did insert select at " << timer.SplitTime());
00627     conn->Query("delete from i_bulk_fragment;", false, false);
00628 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:38:19 2010 for ImpalaSrc by  doxygen 1.5.1