Definition at line 726 of file mainMonetTest.cpp. References Impala::Util::Bin2Hex(), Impala::CmdOptions::GetArg(), Impala::Core::Database::RawDataSet::GetDatabase(), Impala::Core::Database::RawDataSet::GetFilePathFrames(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetInt(), Impala::CmdOptions::GetNrArg(), Impala::Core::VideoSet::VideoSet::GetQuidVideo(), ILOG_ERROR, ILOG_INFO, ILOG_NDC_POP, ILOG_NDC_PUSH, ILOG_VAR, Impala::MakeString(), Impala::Core::VideoSet::MakeVideoSet(), Impala::Core::Database::RawDataSet::NrFiles(), and Impala::Timer::SplitTime(). Referenced by mainMonetTest(). 00727 { 00728 ILOG_VAR(Impala.Samples.MonetTest.DoInsertFrameArchive); 00729 CmdOptions& options = CmdOptions::GetInstance(); 00730 if (options.GetNrArg() < 5) 00731 { 00732 ILOG_ERROR("Need more parameters"); 00733 return; 00734 } 00735 00736 String vidSetName = options.GetArg(4); 00737 VideoSet* vidSet = Core::VideoSet::MakeVideoSet(vidSetName); 00738 00739 conn->Query("delete from i_bulk_frame_image;", false, false); 00740 int startFile = options.GetInt("startFile"); 00741 Timer timer; 00742 for (int v=startFile ; v<vidSet->NrFiles() ; v++) 00743 { 00744 String path = vidSet->GetFilePathFrames(v, "images_jpg.raw", false, 00745 false); 00746 if (path.empty()) 00747 continue; 00748 ImageArchiveFile ar(path, false, vidSet->GetDatabase()); 00749 ILOG_INFO("vid " << v << " has " << ar.NrImages() << " images"); 00750 ILOG_NDC_PUSH("v=" << v); 00751 Quid vidQuid = vidSet->GetQuidVideo(v, true); 00752 00753 conn->Query("delete from i_bulk_frame_image;", false, false); 00754 int totalSize = ar.NrImages(); 00755 int bulkSize = 4000; 00756 Timer timer; 00757 00758 for (int i=0 ; i<totalSize ; i+=bulkSize) 00759 { 00760 int left = totalSize - i; 00761 int nr = (left > bulkSize) ? bulkSize : left; 00762 String q = "copy " + MakeString(nr) + 00763 " records into i_bulk_frame_image from stdin" + 00764 " using delimiters ' ';\n"; 00765 for (int j=i ; j<i+nr ; j++) 00766 { 00767 Array2dVec3UInt8* im = ar.ReadImage(j); 00768 size_t dataSize = 0; 00769 UInt8* data = ar.GetImageData(j, dataSize); 00770 String hexData = Util::Bin2Hex(data, dataSize); 00771 delete data; 00772 String name = "frame" + MakeString(j); 00773 String width = MakeString(im->CW()); 00774 String height = MakeString(im->CH()); 00775 q += MakeString(vidQuid) + " " + MakeString(j) + " " + name + " " 00776 + hexData + " " + width + " " + height + " image/jpg \n"; 00777 delete im; 00778 } 00779 conn->Query(q, false, false); 00780 ILOG_INFO("Did bulk " << i << " at " << timer.SplitTime()); 00781 00782 conn->Query("insert into frame_image (fragment_id, image, width, \ 00783 height, mime_type) \ 00784 select fr.fragment_id, bf.image, bf.width, bf.height, \ 00785 bf.mime_type \ 00786 from i_bulk_frame_image bf, file f, fragment fr \ 00787 where bf.quid = f.quid and \ 00788 f.media_id = fr.media_id and \ 00789 fr.fragment_start = bf.fragment_start and \ 00790 fr.fragment_length = 1 and \ 00791 fr.keyframe = false \ 00792 order by bf.quid, bf.fragment_start;", false, false); 00793 ILOG_INFO("Did insert select at " << timer.SplitTime()); 00794 conn->Query("delete from i_bulk_frame_image;", false, false); 00795 } 00796 ILOG_NDC_POP; 00797 } 00798 delete vidSet; 00799 }
Here is the call graph for this function:
|