void EN ( const SparseMatrix<Real>& A, const Matrix<Real>& b, Real lambda1, Real lambda2, Matrix<Real>& x, const qp::affine::Ctrl<Real>& ctrl ) { EL_DEBUG_CSE const Int m = A.Height(); const Int n = A.Width(); const Range<Int> uInd(0,n), vInd(n,2*n), rInd(2*n,2*n+m); SparseMatrix<Real> Q, AHat, G; Matrix<Real> c, h; // Q := | 2*lambda_2 0 0 | // | 0 2*lambda_2 0 | // | 0 0 2 | // ================================ Zeros( Q, 2*n+m, 2*n+m ); Q.Reserve( 2*n+m ); for( Int e=0; e<2*n; ++e ) Q.QueueUpdate( e, e, 2*lambda2 ); for( Int e=0; e<m; ++e ) Q.QueueUpdate( 2*n+e, 2*n+e, Real(1) ); Q.ProcessQueues(); // c := lambda_1*[1;1;0] // ===================== Zeros( c, 2*n+m, 1 ); auto cuv = c( IR(0,2*n), ALL ); Fill( cuv, lambda1 ); // \hat A := [A, -A, I] // ==================== const Int numEntriesA = A.NumEntries(); Zeros( AHat, m, 2*n+m ); AHat.Reserve( 2*numEntriesA+m ); for( Int e=0; e<numEntriesA; ++e ) { AHat.QueueUpdate( A.Row(e), A.Col(e), A.Value(e) ); AHat.QueueUpdate( A.Row(e), A.Col(e)+n, -A.Value(e) ); } for( Int e=0; e<m; ++e ) AHat.QueueUpdate( e, e+2*n, Real(1) ); AHat.ProcessQueues(); // G := | -I 0 0 | // | 0 -I 0 | // ================ Zeros( G, 2*n, 2*n+m ); G.Reserve( 2*m ); for( Int e=0; e<2*m; ++e ) G.QueueUpdate( e, e, Real(-1) ); G.ProcessQueues(); // h := 0 // ====== Zeros( h, 2*n, 1 ); // Solve the affine QP // =================== Matrix<Real> xHat, y, z, s; QP( Q, AHat, G, b, c, h, xHat, y, z, s, ctrl ); // x := u - v // ========== x = xHat( uInd, ALL ); x -= xHat( vInd, ALL ); }
Rectangle(Point const & edge, double width, double height, Fill const & fill = Fill(), Stroke const & stroke = Stroke()) : Shape(fill, stroke), edge(edge), width(width), height(height) { }
Polyline(Fill const & fill = Fill(), Stroke const & stroke = Stroke()) : Shape(fill, stroke) { }
void Fill(const ProtectedAirspaceWarningManager &awm) { const ProtectedAirspaceWarningManager::Lease lease(awm); Fill(lease); }
Shape(Fill const & fill = Fill(), Stroke const & stroke = Stroke()) : fill(fill), stroke(stroke) { }
void CChunkRenderNSF::StoreSample(const CDSample *pDSample) { // Store sample and fill with zeros Store(pDSample->GetData(), pDSample->GetSize()); Fill(CCompiler::AdjustSampleAddress(GetAbsoluteAddr())); }
//--------------------------------------------------------------------------- bool File_Dxw::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; { XMLElement* Root=document.FirstChildElement("indexFile"); if (Root) { const char* Attribute=Root->Attribute("xmlns"); if (Attribute==NULL || Ztring().From_UTF8(Attribute)!=__T("urn:digimetrics-xml-wrapper")) { Reject("DXW"); return false; } Accept("DXW"); Fill(Stream_General, 0, General_Format, "DXW"); ReferenceFiles_Accept(this, Config); #if defined(MEDIAINFO_REFERENCES_YES) XMLElement* Track=Root->FirstChildElement(); while (Track) { if (string(Track->Value())=="clip") { sequence* Sequence=new sequence; Attribute=Track->Attribute("file"); if (Attribute) { Sequence->AddFileName(Ztring().From_UTF8(Attribute)); Attribute=Track->Attribute("type"); if (Attribute) { Ztring StreamKind; StreamKind.From_UTF8(Attribute); if (StreamKind==__T("video")) Sequence->StreamKind=Stream_Video; if (StreamKind==__T("audio")) Sequence->StreamKind=Stream_Audio; if (StreamKind==__T("data")) Sequence->StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing } Attribute=Track->Attribute("source"); if (Attribute) { Ztring StreamKind; StreamKind.From_UTF8(Attribute); if (StreamKind==__T("main")) Sequence->IsMain=true; } Attribute=Track->Attribute("default_timecode"); if (Attribute) { Sequence->Config["File_DefaultTimeCode"].From_UTF8(Attribute); } Sequence->StreamID=ReferenceFiles->Sequences_Size()+1; } Attribute=Track->Attribute("framerate"); if (Attribute) { Sequence->FrameRate_Set(Ztring().From_UTF8(Attribute).To_float64()); Attribute=Track->Attribute("type"); if (Attribute) { Ztring StreamKind; StreamKind.From_UTF8(Attribute); if (StreamKind==__T("video")) Sequence->StreamKind=Stream_Video; if (StreamKind==__T("audio")) Sequence->StreamKind=Stream_Audio; if (StreamKind==__T("data")) Sequence->StreamKind=Stream_Text; //Not sure this is a right mapping, but this is only used when file is missing } XMLElement* Frame=Track->FirstChildElement(); while (Frame) { if (string(Frame->Value())=="frame") { Attribute=Frame->Attribute("file"); if (Attribute) Sequence->AddFileName(Ztring().From_UTF8(Attribute)); } Frame=Frame->NextSiblingElement(); } } Sequence->StreamID=ReferenceFiles->Sequences_Size()+1; ReferenceFiles->AddSequence(Sequence); } Track=Track->NextSiblingElement(); } #endif //MEDIAINFO_REFERENCES_YES } else { Reject("DXW"); return false; } } Element_Offset=File_Size; //All should be OK... return true; }
//--------------------------------------------------------------------------- void File_Ivf::FileHeader_Parse() { //Parsing int32u frame_rate_num, frame_rate_den, frame_count, fourcc; int16u version, header_size, width, height; Skip_C4 ( "Signature"); Get_L2 (version, "Version"); if (version==0) { Get_L2 (header_size, "Header Size"); if (header_size>=32) { Get_C4 (fourcc, "Fourcc"); Get_L2 (width, "Width"); Get_L2 (height, "Height"); Get_L4 (frame_rate_num, "FrameRate Numerator"); Get_L4 (frame_rate_den, "FrameRate Denominator"); Get_L4 (frame_count, "Frame Count"); Skip_L4( "Unused"); if (header_size-32) Skip_XX(header_size-32, "Unknown"); } else { fourcc=0x00000000; width=0; height=0; frame_rate_num=0; frame_rate_den=0; frame_count=0; } } else { header_size=0; fourcc=0x00000000; width=0; height=0; frame_rate_num=0; frame_rate_den=0; frame_count=0; } FILLING_BEGIN(); Accept("IVF"); Fill(Stream_General, 0, General_Format, "IVF"); if (version==0 && header_size>=32) { Stream_Prepare(Stream_Video); CodecID_Fill(Ztring().From_CC4(fourcc), Stream_Video, 0, InfoCodecID_Format_Riff); Fill(Stream_Video, 0, Video_FrameRate, (float)frame_rate_num / frame_rate_den); Fill(Stream_Video, 0, Video_FrameCount, frame_count); Fill(Stream_Video, 0, Video_Width, width); Fill(Stream_Video, 0, Video_Height, height); Fill(Stream_Video, 0, Video_StreamSize, File_Size-header_size-12*frame_count); //Overhead is 12 byte per frame } //No more need data Finish("IVF"); FILLING_END(); }
/**************************************************************************** @Function Fill @Input pOb Object to fill with @Return int -1 if the block if the best option is already full @Description Note: Ask Aaron ****************************************************************************/ int CBlock::Fill( CObject * const pOb) { SVtx *pVtx; int i; SMesh *pMesh; /* Build blocks from the large meshes */ if(!pOb->m_vMeshLg.empty()) { pMesh = &pOb->m_vMeshLg.back(); // _RPT1(_CRT_WARN, "Fill() using large with %d vtx\n", pMesh->nVtxNum); // Find the vertex with the fewest unused triangles for(i = 0; i < pMesh->nVtxNum; ++i) { pVtx = pMesh->ppVtx[i]; if(pVtx->nTriNumFree == 1) { if(FillFrom(pMesh, pVtx, pOb)) return Fill(pOb); } } if(m_sOptBest.IsEmpty()) { // Just start from any old vertex for(i = 0; i < pMesh->nVtxNum; ++i) { pVtx = pMesh->ppVtx[i]; if(pVtx->nTriNumFree) { if(FillFrom(pMesh, pVtx, pOb)) return Fill(pOb); break; } } if(m_sOptBest.IsEmpty()) { pOb->m_vMeshLg.pop_back(); // Delete the mesh from the list return Fill(pOb); } } if(m_sOptBest.IsFull()) return -1; } /* Match together the small meshes into blocks */ _ASSERT(m_sOptBest.IsEmpty()); i = m_nVtxLimit - m_sOptBest.nVtxNum - 3; // _RPT0(_CRT_WARN, "Fill() grouping small "); // Starting with the largest meshes, lump them into this block while(i >= 0 && (m_nVtxLimit - m_sOptBest.nVtxNum) >= 3) { if(pOb->m_pvMesh[i].empty()) { --i; continue; } pMesh = &pOb->m_pvMesh[i].back(); m_sOptBest.Add(pMesh); // _RPT1(_CRT_WARN, "+%d", pMesh->nVtxNum); pOb->m_pvMesh[i].pop_back(); i = PVRT_MIN(i, m_nVtxLimit - m_sOptBest.nVtxNum - 3); } // If there's any space left in this block (and clearly there are no blocks // just the right size to fit) then take SOME of the largest block available. if(!m_sOptBest.IsFull()) { m_sOpt.Copy(&m_sOptBest); // Note: This loop purposely does not check m_pvMesh[0] - any block // which is looking to grab more geometry would have already sucked // up those meshes for(i = (m_nVtxLimit-3); i; --i) { if(!pOb->m_pvMesh[i].empty()) { pMesh = &pOb->m_pvMesh[i].back(); _ASSERT(pMesh->ppVtx[0]->nTriNumFree); _ASSERT(!m_sOpt.UsingVertex(pMesh->ppVtx[0])); m_sOpt.AddVertex(pMesh->ppVtx[0]); // _RPT1(_CRT_WARN, "(+%d)\n", pMesh->nVtxNum); AddBestTriangles(pOb); m_sOptBest.Copy(&m_sOpt); _ASSERT(m_sOptBest.IsFull()); return i; } } } // _RPT0(_CRT_WARN, "\n"); return -1; }
//--------------------------------------------------------------------------- bool File_Hls::FileHeader_Begin() { //Element_Size if (File_Size>1024*1024 || File_Size<10) { Reject("HLS"); return false; //HLS files are not big } if (Buffer_Size<File_Size) return false; //Wait for complete file Ztring Document; Document.From_UTF8((char*)Buffer, Buffer_Size); ZtringList Lines; size_t LinesSeparator_Pos=Document.find_first_of(__T("\r\n")); if (LinesSeparator_Pos>File_Size-1) { Reject("HLS"); return false; } Ztring LinesSeparator; if (Document[LinesSeparator_Pos]==__T('\r') && LinesSeparator_Pos+1<Document.size() && Document[LinesSeparator_Pos+1]==__T('\n')) LinesSeparator=__T("\r\n"); else if (Document[LinesSeparator_Pos]==__T('\r')) LinesSeparator=__T("\r"); else if (Document[LinesSeparator_Pos]==__T('\n')) LinesSeparator=__T("\n"); else { Reject("HLS"); return false; } Lines.Separator_Set(0, LinesSeparator); Lines.Write(Document); if (Lines(0)!=__T("#EXTM3U")) { Reject("HLS"); return false; } Accept("HLS"); Fill(Stream_General, 0, General_Format, "HLS"); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); if (!IsSub) ReferenceFiles->ContainerHasNoId=true; File__ReferenceFilesHelper::reference ReferenceFile; bool IsGroup=false; for (size_t Line=0; Line<Lines.size(); Line++) { if (!Lines[Line].empty()) { if (Lines[Line].find(__T("#EXT-X-KEY:"))==0) { ZtringListList List; List.Separator_Set(0, __T(",")); List.Separator_Set(1, __T("=")); List.Write(Lines[Line].substr(11, string::npos)); for (size_t Pos=0; Pos<List.size(); ++Pos) { if (List[Pos](0)==__T("METHOD")) { if (List[Pos](1).find(__T("AES-128"))==0) { Fill(Stream_General, 0, General_Encryption_Format, "AES"); Fill(Stream_General, 0, General_Encryption_Length, "128"); Fill(Stream_General, 0, General_Encryption_Method, "Segment"); Fill(Stream_General, 0, General_Encryption_Mode, "CBC"); Fill(Stream_General, 0, General_Encryption_Padding, "PKCS7"); Fill(Stream_General, 0, General_Encryption_InitializationVector, "Sequence number"); #if MEDIAINFO_AES //Trying to get the key from FileName.FileExt.key if (Config->Encryption_Key_Get().empty()) { File KeyFile; if (KeyFile.Open(File_Name+__T(".key"))) { if (KeyFile.Size_Get()==16) { int8u Key[16]; if (KeyFile.Read(Key, 16)==16) Config->Encryption_Key_Set(Key, 16); } else Fill(Stream_General, 0, "Encryption_Key_Problem", KeyFile.Size_Get()); } } #endif } Fill(Stream_General, 0, General_Encryption, List[Pos](1)); } } } else if (Lines[Line].find(__T("#EXT-X-STREAM-INF:"))==0) { IsGroup=true; } else if (Lines[Line][0]==__T('#')) ; else { if (IsGroup) { ReferenceFile.FileNames.push_back(Lines[Line]); ReferenceFile.StreamID=ReferenceFiles->References.size()+1; ReferenceFiles->References.push_back(ReferenceFile); IsGroup=false; ReferenceFile=File__ReferenceFilesHelper::reference(); #if MEDIAINFO_EVENTS ParserIDs[0]=MediaInfo_Parser_HlsIndex; StreamIDs_Width[0]=sizeof(size_t); #endif //MEDIAINFO_EVENTS } else ReferenceFile.FileNames.push_back(Lines[Line]); } } } if (!ReferenceFile.FileNames.empty()) { ReferenceFiles->References.push_back(ReferenceFile); Fill(Stream_General, 0, General_Format_Profile, "Media"); } else { Fill(Stream_General, 0, General_Format_Profile, "Master"); } Element_Offset=File_Size; //All should be OK... return true; }
void checktracks(TString inputfile, TString outputfile) { //"HiForest_Centrality_Unpacker_Hydjet_Quenched_MinBias_5020GeV_750_RECODEBUG_v0_merged_forest_0.root"; TFile *_file0 = new TFile(inputfile); TTreeReader readerTrack("anaTrack/trackTree",_file0); TTreeReaderValue<int> ntrk(readerTrack, "nTrk"); TTreeReaderArray<float> trkDxyError1(readerTrack, "trkDxyError1"); TTreeReaderArray<float> trkDxy1(readerTrack, "trkDxy1"); TTreeReaderArray<float> trkPt(readerTrack, "trkPt"); TTreeReaderArray<float> trkPhi(readerTrack, "trkPhi"); TTreeReaderArray<float> trkEta(readerTrack, "trkEta"); TTreeReaderArray<float> trkMVA(readerTrack, "trkMVA"); TTreeReaderArray<float> trkChi2(readerTrack, "trkChi2"); TTreeReaderArray<float> trkDz1(readerTrack, "trkDz1"); TTreeReaderArray<float> trkDzError1(readerTrack, "trkDzError1"); TTreeReaderArray<bool> highPurity(readerTrack, "highPurity"); #ifdef Run2011 TTreeReaderArray<int> trkNhit(readerTrack, "trkNHit"); TTreeReaderArray<int> trkAlgo(readerTrack, "trkAlgo"); TTreeReaderArray<int> trkOriginalAlgo(readerTrack, "trkOriginalAlgo"); TTreeReaderArray<float> trkNdof(readerTrack, "trkNdof"); #else TTreeReaderArray<unsigned char> trkNhit(readerTrack, "trkNHit"); TTreeReaderArray<unsigned char> trkAlgo(readerTrack, "trkAlgo"); TTreeReaderArray<unsigned char> trkOriginalAlgo(readerTrack, "trkOriginalAlgo"); TTreeReaderArray<unsigned char> trkNdof(readerTrack, "trkNdof"); #endif float ptmax = 20; auto hpt = getH("hpt",50,0,ptmax); auto hpt4 = getH("hpt4",50,0,ptmax); auto hpt5 = getH("hpt5",50,0,2); auto hpt6 = getH("hpt6",50,0,ptmax); auto hpt7 = getH("hpt7",50,0,ptmax); auto hphi = getH("hphi",30,-3.2,3.2); auto heta = getH("heta",30,-3,3); auto hnhit = getH("hnhit",26,5,30); auto hnTrk = getH("hnTrk",50,0,7000); auto hchi2n = getH("hchi2n",50,0,6); auto hIPsign = getH("hIPsign",50,-50,50); auto hZsign = getH("hZsign",50,-50,50); auto hmva4 = getH("hmva4",50,-1,1); auto hmva5 = getH("hmva5",50,-1,1); auto hmva6 = getH("hmva6",50,-1,1); auto hmva7 = getH("hmva7",50,-1,1); auto halgos = new TH2F("halgos","halgos",8,4,12,8,4,12); int onep = readerTrack.GetEntries(true)/100; int counter = 0; while(readerTrack.Next()) { // while(readerTrack.Next() && counter<1000) { counter++; if (counter%onep == 0) std::cout<<counter/onep<<"\%"<<std::endl; hnTrk->Fill(*ntrk); for (int i=0;i<*ntrk;i++) { if (highPurity[i]) hIPsign->Fill(trkDxy1[i]/trkDxyError1[i]); hZsign->Fill(trkDz1[i]/trkDzError1[i]); hchi2n->Fill(trkChi2[i]/trkNdof[i]); if (trkAlgo[i]==4) {hmva4->Fill(trkMVA[i]);hpt4->Fill(trkPt[i]); } if (trkAlgo[i]==5) {hmva5->Fill(trkMVA[i]);hpt5->Fill(trkPt[i]); } if (trkAlgo[i]==6) {hmva6->Fill(trkMVA[i]);hpt6->Fill(trkPt[i]); } if (trkAlgo[i]==7) {hmva7->Fill(trkMVA[i]);hpt7->Fill(trkPt[i]); } hphi->Fill(trkPhi[i]); heta->Fill(trkEta[i]); hnhit->Fill(trkNhit[i]); hpt->Fill(trkPt[i]); halgos->Fill(trkAlgo[i],trkOriginalAlgo[i]); } } std::cout<<counter<<std::endl; TFile *fout = new TFile(outputfile,"recreate"); hpt->Write(); hpt4->Write(); hpt5->Write(); hpt6->Write(); hpt7->Write(); hIPsign->Write(); hmva4->Write(); hmva5->Write(); hmva6->Write(); hmva7->Write(); halgos->Write(); hphi->Write(); heta->Write(); hchi2n->Write(); hZsign->Write(); hnTrk->Write(); hnhit->Write(); }
//--------------------------------------------------------------------------- void File_Lagarith::Read_Buffer_Continue() { //Parsing int8u version; Get_L1 (version, "version"); Skip_XX(Element_Size-Element_Offset, "data"); FILLING_BEGIN(); Accept(); Fill(); switch (version) { case 0x02 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; case 0x03 : Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:2"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; case 0x04 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; case 0x05 : Fill(Stream_Video, 0, Video_ColorSpace, "Grey"); break; case 0x06 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); break; case 0x07 : Fill(Stream_Video, 0, Video_ColorSpace, "RGB"); break; case 0x08 : Fill(Stream_Video, 0, Video_ColorSpace, "RGBA"); break; case 0x09 : Fill(Stream_Video, 0, Video_ColorSpace, "RGBA"); break; case 0x0A : Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:0"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; case 0x0B : Fill(Stream_Video, 0, Video_ColorSpace, "YUV"); Fill(Stream_Video, 0, Video_ChromaSubsampling, "4:2:0"); Fill(Stream_Video, 0, Video_BitDepth, 8); break; default : ; } FILLING_END(); Finish(); }
//--------------------------------------------------------------------------- void File_Lagarith::Streams_Fill() { Stream_Prepare(Stream_Video); Fill(Stream_Video, 0, Video_Format, "Lagarith"); }
void EN ( const Matrix<Real>& A, const Matrix<Real>& b, Real lambda1, Real lambda2, Matrix<Real>& x, const qp::affine::Ctrl<Real>& ctrl ) { EL_DEBUG_CSE const Int m = A.Height(); const Int n = A.Width(); const Range<Int> uInd(0,n), vInd(n,2*n), rInd(2*n,2*n+m); Matrix<Real> Q, c, AHat, G, h; // Q := | 2*lambda_2 0 0 | // | 0 2*lambda_2 0 | // | 0 0 2 | // ================================ Zeros( Q, 2*n+m, 2*n+m ); auto QTL = Q( IR(0,2*n), IR(0,2*n) ); FillDiagonal( QTL, 2*lambda2 ); auto Qrr = Q( rInd, rInd ); FillDiagonal( Qrr, Real(1) ); // c := lambda_1*[1;1;0] // ===================== Zeros( c, 2*n+m, 1 ); auto cuv = c( IR(0,2*n), ALL ); Fill( cuv, lambda1 ); // \hat A := [A, -A, I] // ==================== Zeros( AHat, m, 2*n+m ); auto AHatu = AHat( ALL, uInd ); auto AHatv = AHat( ALL, vInd ); auto AHatr = AHat( ALL, rInd ); AHatu = A; AHatv -= A; FillDiagonal( AHatr, Real(1) ); // G := | -I 0 0 | // | 0 -I 0 | // ================ Zeros( G, 2*n, 2*n+m ); FillDiagonal( G, Real(-1) ); // h := 0 // ====== Zeros( h, 2*n, 1 ); // Solve the affine QP // =================== Matrix<Real> xHat, y, z, s; QP( Q, AHat, G, b, c, h, xHat, y, z, s, ctrl ); // x := u - v // ========== x = xHat( uInd, ALL ); x -= xHat( vInd, ALL ); }
//--------------------------------------------------------------------------- bool File_Xmp::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; std::string NameSpace; XMLElement* XmpMeta=document.FirstChildElement("xmpmeta"); if (XmpMeta==NULL) { NameSpace="x:"; XmpMeta=document.FirstChildElement((NameSpace+"xmpmeta").c_str()); } if (!XmpMeta) { Reject("XMP"); return false; } XMLElement* Rdf=XmpMeta->FirstChildElement("RDF"); if (Rdf==NULL) { NameSpace="rdf:"; Rdf=XmpMeta->FirstChildElement((NameSpace+"RDF").c_str()); } if (!Rdf) { Reject("XMP"); return false; } Accept("XMP"); for (XMLElement* Rdf_Item=Rdf->FirstChildElement(); Rdf_Item; Rdf_Item=Rdf_Item->NextSiblingElement()) { //RDF item if (!strcmp(Rdf_Item->Value(), (NameSpace+"Description").c_str())) { const char* Attribute; Attribute=Rdf_Item->Attribute("xmlns:pdfaid"); if (Attribute) { string Profile; if (strcmp(Attribute, "http://www.aiim.org/pdfa/ns/id/")) Profile=Attribute; else { Profile+="A"; Attribute=Rdf_Item->Attribute("pdfaid:part"); if (Attribute) { Profile+='-'; Profile+=Attribute; Attribute=Rdf_Item->Attribute("pdfaid:conformance"); if (Attribute) { string Conformance(Attribute); if (Conformance.size()==1 && Conformance[0]>='A' && Conformance[0]<='Z') Conformance[0]+=0x20; // From "A" to "a" Profile+=Conformance; } } } Fill(Stream_General, 0, General_Format_Profile, Profile); } } } Finish(); return true; }
//--------------------------------------------------------------------------- void File_ImpulseTracker::Read_Buffer_Continue() { //Parsing Ztring SongName; int16u OrdNum, InsNum, SmpNum, PatNum, Flags, Special; int8u VersionMajor, VersionMinor, SoftwareVersionMajor, SoftwareVersionMinor, IS, TS; bool Stereo; Skip_B4( "Signature"); Get_Local(26, SongName, "Song name"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Get_L2 (OrdNum, "Orders count"); Get_L2 (InsNum, "Instruments count"); Get_L2 (SmpNum, "Samples count"); Get_L2 (PatNum, "Paterns count"); Get_L1 (SoftwareVersionMinor, "Cwt/v (Minor)"); Get_L1 (SoftwareVersionMajor, "Cwt/v (Major)"); Get_L1 (VersionMinor, "Cwt (Minor)"); Get_L1 (VersionMajor, "Cwt (Major)"); Get_L2 (Flags, "Flags"); Get_Flags (Flags, 0, Stereo, "Stereo"); Skip_Flags(Flags, 1, "Vol0MixOptimizations"); Skip_Flags(Flags, 2, "Use instruments/Samples"); Skip_Flags(Flags, 3, "Linear/Amiga slides"); Skip_Flags(Flags, 4, "Old/IT Effects"); Get_L2 (Special, "Special"); Skip_Flags(Special, 0, "Song Message attached"); Skip_L1( "Global volume"); Skip_L1( "Mix volume"); Get_L1 (IS, "Initial Speed"); Get_L1 (TS, "Initial Temp"); Skip_L1( "Panning separation between channels"); Skip_L1( "0"); Skip_L2( "Message Length"); Skip_L4( "Message Offset"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_L1( "Unknown"); Skip_XX(64, "Chnl Pan"); Skip_XX(64, "Chnl Vol"); Skip_XX(OrdNum, "Orders"); Skip_XX(InsNum*4, "Instruments"); Skip_XX(SmpNum*4, "Samples"); Skip_XX(PatNum*4, "Patterns"); FILLING_BEGIN(); Accept("Impulse Tracker"); Fill(Stream_General, 0, General_Format, "Impulse Tracker"); Fill(Stream_General, 0, General_Format_Version, Ztring(__T("Version "))+Ztring::ToZtring(VersionMajor)+__T(".")+Ztring::ToZtring(VersionMinor/16)+Ztring::ToZtring(VersionMinor%16)); Fill(Stream_General, 0, General_Track, SongName); Fill(Stream_General, 0, General_Encoded_Application, Ztring(__T("Impulse Tracker ")+Ztring::ToZtring(SoftwareVersionMajor)+__T(".")+Ztring::ToZtring(SoftwareVersionMinor/16)+Ztring::ToZtring(SoftwareVersionMinor%16))); Fill(Stream_General, 0, "BPM", TS); Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, Stereo?2:1); //No more need data Finish("Impulse Tracker"); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Mz::Read_Buffer_Continue() { //Parsing int32u lfanew; Element_Begin("MZ"); Skip_C2( "magic"); Skip_L2( "cblp"); Skip_L2( "cp"); Skip_L2( "crlc"); Skip_L2( "cparhdr"); Skip_L2( "minalloc"); Skip_L2( "maxalloc"); Skip_L2( "ss"); Skip_L2( "sp"); Skip_L2( "csum"); Skip_L2( "ip"); Skip_L2( "cs"); Skip_L2( "lsarlc"); Skip_L2( "ovno"); Skip_L2( "res"); Skip_L2( "res"); Skip_L2( "res"); Skip_L2( "res"); Skip_L2( "oemid"); Skip_L2( "oeminfo"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Skip_L2( "res2"); Get_L4 (lfanew, "lfanew"); //Computing if (lfanew>Element_Offset) { Skip_XX(lfanew-Element_Offset, "MZ data"); Element_End(); } if (Element_Offset>lfanew) { Element_End(); Element_Offset=lfanew; //Multi usage off the first bytes } //Parsing int32u Signature, TimeDateStamp=0; int16u Machine=0, Characteristics=0; Peek_B4(Signature); if (Signature==0x50450000) //"PE" { Element_Begin("PE"); Skip_C4( "Header"); Get_L2 (Machine, "Machine"); Param_Info(Mz_Machine(Machine)); Skip_L2( "NumberOfSections"); Get_L4 (TimeDateStamp, "TimeDateStamp"); Param_Info(Ztring().Date_From_Seconds_1970(TimeDateStamp)); Skip_L4( "PointerToSymbolTable"); Skip_L4( "NumberOfSymbols"); Skip_L2( "SizeOfOptionalHeader"); Get_L2 (Characteristics, "Characteristics"); Element_End("PE"); } FILLING_BEGIN(); Accept("MZ"); Fill(Stream_General, 0, General_Format, "MZ"); if (Characteristics&0x2000) Fill(Stream_General, 0, General_Format_Profile, "DLL"); else if (Characteristics&0x0002) Fill(Stream_General, 0, General_Format_Profile, "Executable"); Fill(Stream_General, 0, General_Format_Profile, Mz_Machine(Machine)); if (TimeDateStamp) Fill(Stream_General, 0, General_Encoded_Date, Ztring().Date_From_Seconds_1970(TimeDateStamp)); //No more need data Finish("MZ"); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Id3::Read_Buffer_Continue() { //Buffer size if (Buffer_Size<128) return; int32u Magic; Peek_B4(Magic); Ztring TitleAddition; Ztring ArtistAddition; Ztring AlbumAddition; Ztring GenreAddition; if (Magic==0x5441472B) { if (Buffer_Size<227+128) return; Skip_C4 ( "ID"); Get_Local (60, TitleAddition, "Title"); Get_Local (60, ArtistAddition, "Artist"); Get_Local (60, AlbumAddition, "Album"); Skip_B1 ( "Speed"); Get_Local (30, GenreAddition, "Genre"); Skip_Local(6, "Start time"); //mmm:ss Skip_Local(6, "End time"); //mmm:ss TitleAddition.TrimRight(); ArtistAddition.TrimRight(); AlbumAddition.TrimRight(); GenreAddition.TrimRight(); } //Parsing Ztring Title, Artist, Album, Year, Comment; int8u Track=0, Genre; Skip_C3 ( "ID"); Get_Local (30, Title, "Title"); Get_Local (30, Artist, "Artist"); Get_Local (30, Album, "Album"); Get_Local ( 4, Year, "Year"); Get_Local (30, Comment, "Comment"); if (Comment.size()<29) //Id3v1.1 specifications : Track number addition { Element_Offset-=2; int8u Zero; Peek_B1(Zero); if (Zero==0) { Skip_B1( "Zero"); Get_B1 (Track, "Track"); } else Element_Offset+=2; } Get_B1 (Genre, "Genre"); FILLING_BEGIN(); if (TitleAddition.empty()) Title.TrimRight(); if (ArtistAddition.empty()) Artist.TrimRight(); if (AlbumAddition.empty()) Album.TrimRight(); Year.TrimRight(); Comment.TrimRight(); Accept("Id3"); Stream_Prepare(Stream_General); Fill(Stream_General, 0, General_Album, Album+AlbumAddition); Fill(Stream_General, 0, General_Track, Title+TitleAddition); Fill(Stream_General, 0, General_Performer, Artist+ArtistAddition); Fill(Stream_General, 0, General_Comment, Comment); Fill(Stream_General, 0, General_Recorded_Date, Year); if (GenreAddition.empty()) Fill(Stream_General, 0, General_Genre, GenreAddition); if (Genre && Genre!=(int8u)-1) Fill(Stream_General, 0, General_Genre, Genre); if (Track) Fill(Stream_General, 0, General_Track_Position, Track); Finish("Id3"); FILLING_END(); }
void CChunkRenderNSF::AllocateNewBank() { // Get new NSF bank int Remaining = GetRemainingSize(); Fill(Remaining); }
Starfield::Starfield(unsigned long seed) { Init(); Fill(seed); }
//--------------------------------------------------------------------------- void File_Pcm_M2ts::Streams_Fill() { Stream_Prepare(Stream_Audio); Fill(Stream_Audio, 0, Audio_Format, "PCM"); Fill(Stream_Audio, 0, Audio_Codec, "PCM"); Fill(Stream_Audio, 0, Audio_Codec_Family, "PCM"); Fill(Stream_Audio, 0, Audio_MuxingMode, "Blu-ray"); Fill(Stream_Audio, 0, Audio_BitRate_Mode, "CBR"); int8u Channels=Pcm_M2TS_channel_assignment[channel_assignment]; if (Channels) { if (Pcm_M2TS_sampling_frequency[sampling_frequency]) Fill(Stream_Audio, 0, Audio_SamplingRate, Pcm_M2TS_sampling_frequency[sampling_frequency]); if (Pcm_M2TS_bits_per_sample[bits_per_sample]) Fill(Stream_Audio, 0, Audio_BitDepth, Pcm_M2TS_bits_per_sample[bits_per_sample]); Fill(Stream_Audio, 0, Audio_Channel_s_, Channels); Fill(Stream_Audio, 0, Audio_ChannelPositions, Pcm_VOB_ChannelsPositions(channel_assignment)); Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, Pcm_VOB_ChannelsPositions2(channel_assignment)); if (Pcm_M2TS_sampling_frequency[sampling_frequency] && Pcm_M2TS_bits_per_sample[bits_per_sample]) { if (Channels%2) Fill(Stream_Audio, 0, Audio_BitRate_Encoded, Pcm_M2TS_sampling_frequency[sampling_frequency]*(Channels+1)*Pcm_M2TS_bits_per_sample[bits_per_sample]); //Always by pair Fill(Stream_Audio, 0, Audio_BitRate, Pcm_M2TS_sampling_frequency[sampling_frequency]*Channels*Pcm_M2TS_bits_per_sample[bits_per_sample]); } } Fill(Stream_Audio, 0, Audio_Format_Settings, "Big"); Fill(Stream_Audio, 0, Audio_Format_Settings_Endianness, "Big"); Fill(Stream_Audio, 0, Audio_Codec_Settings, "Big"); Fill(Stream_Audio, 0, Audio_Codec_Settings_Endianness, "Big"); Fill(Stream_Audio, 0, Audio_Format_Settings, "Signed"); Fill(Stream_Audio, 0, Audio_Format_Settings_Sign, "Signed"); Fill(Stream_Audio, 0, Audio_Codec_Settings, "Signed"); Fill(Stream_Audio, 0, Audio_Codec_Settings_Sign, "Signed"); }
//--------------------------------------------------------------------------- void File_Vp8::Streams_Fill() { Fill(Stream_Video, 0, Video_Format, "VP8"); Fill(Stream_Video, 0, Video_Codec, "VP8"); }
/** * Process a particle. * * @param p Particle to process */ virtual Bool_t ProcessParticle(const TParticle* p) { Fill(p->Y()); return true; }
//--------------------------------------------------------------------------- void File_DtvccTransport::Read_Buffer_Continue() { //Parsing Element_Begin(Format==Format_DVD?"DVD Captions":"DTVCC Transport"); int8u cc_count; bool process_cc_data_flag, additional_data_flag; BS_Begin(); if (Format==Format_DVD) { //Modified DTVCC Transport from DVD Skip_SB( "field 1 then field 2"); Get_S1 (7, cc_count, "cc_count"); process_cc_data_flag=true; additional_data_flag=false; } else { //Normal DTVCC Transport bool process_em_data_flag; Get_SB (process_em_data_flag, "process_em_data_flag"); Get_SB (process_cc_data_flag, "process_cc_data_flag"); Get_SB (additional_data_flag, "additional_data_flag"); Get_S1 (5, cc_count, "cc_count"); Skip_S1(8, process_em_data_flag?"em_data":"reserved"); //Emergency message } BS_End(); if (process_cc_data_flag) { for (int8u Pos=0; Pos<cc_count; Pos++) { Element_Begin("cc"); int8u cc_type; bool cc_valid; BS_Begin(); Mark_1(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); if (Format==Format_DVD) { //Modified DTVCC Transport from DVD Mark_1(); Mark_1(); Get_S1 (1, cc_type, "cc_type"); Param_Info(DtvccTransport_cc_type(cc_type)); cc_valid=true; } else { //Normal DTVCC Transport Get_SB ( cc_valid, "cc_valid"); Get_S1 (2, cc_type, "cc_type"); Param_Info(DtvccTransport_cc_type(cc_type)); } BS_End(); if (cc_valid) { Element_Begin("cc_data"); //Calculating the parser position int8u Parser_Pos=cc_type==3?2:cc_type; //cc_type 2 and 3 are for the same text //Parsing #if MEDIAINFO_DEMUX Element_Code=Parser_Pos; #endif //MEDIAINFO_DEMUX if (Streams[Parser_Pos]==NULL) Streams[Parser_Pos]=new stream; if (Streams[Parser_Pos]->Parser==NULL) { if (cc_type<2) { #if defined(MEDIAINFO_EIA608_YES) Streams[Parser_Pos]->Parser=new File_Eia608(); #else Streams[Parser_Pos]->Parser=new File__Analyze(); #endif } else { #if defined(MEDIAINFO_EIA708_YES) Streams[Parser_Pos]->Parser=new File_Eia708(); #else Streams[Parser_Pos]->Parser=new File__Analyze(); #endif } Open_Buffer_Init(Streams[Parser_Pos]->Parser); } Demux(Buffer+(size_t)(Buffer_Offset+Element_Offset), 2, ContentType_MainStream); if (!Streams[Parser_Pos]->Parser->Status[IsFinished]) { //Parsing if (Streams[Parser_Pos]->Parser->PTS_DTS_Needed) { Streams[Parser_Pos]->Parser->FrameInfo.PCR=FrameInfo.PCR; Streams[Parser_Pos]->Parser->FrameInfo.PTS=FrameInfo.PTS; Streams[Parser_Pos]->Parser->FrameInfo.DTS=FrameInfo.DTS; } if (Parser_Pos==2) { #if defined(MEDIAINFO_EIA708_YES) ((File_Eia708*)Streams[2]->Parser)->cc_type=cc_type; ((File_Eia708*)Streams[2]->Parser)->AspectRatio=AspectRatio; #endif if (cc_type==3) Streams[2]->Parser->Open_Buffer_Unsynch(); } else { } Open_Buffer_Continue(Streams[Parser_Pos]->Parser, Buffer+(size_t)(Buffer_Offset+Element_Offset), 2); Element_Show(); Element_Offset+=2; //Filled if (!Streams[Parser_Pos]->IsFilled && Streams[Parser_Pos]->Parser->Status[IsFilled]) { if (Count_Get(Stream_General)==0) Accept("DTVCC Transport"); Streams_Count++; if (Streams_Count==3) Fill("DTVCC Transport"); Streams[Parser_Pos]->IsFilled=true; } } else Skip_XX(2, "Data"); Element_End(); } else Skip_XX(2, "Junk"); Element_End(); } } else Skip_XX(cc_count*2, "Junk"); if (Format==Format_A53_4_GA94_03) { //Normal DTVCC Transport BS_Begin(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); Mark_1_NoTrustError(); BS_End(); if (additional_data_flag) { Skip_XX(Element_Size-Element_Offset, "additional_user_data"); } while (Element_Offset<Element_Size) { Skip_B1( "Zero"); //TODO: test Zero } } Element_End(); }
Elipse(Point const & center, double width, double height, Fill const & fill = Fill(), Stroke const & stroke = Stroke()) : Shape(fill, stroke), center(center), radius_width(width / 2), radius_height(height / 2) { }
void LEDMatrix::Clear() { Fill(Color(0, 0, 0)); }
Line(Point const & start_point, Point const & end_point, Stroke const & stroke = Stroke()) : Shape(Fill(), stroke), start_point(start_point), end_point(end_point) { }
//--------------------------------------------------------------------------- void File_Aac::ALSSpecificConfig() { //Not in spec, but something weird in the example I have int32u Junk; while (Data_BS_Remain()) { Peek_S4(32, Junk); if (Junk!=0x414C5300) { Skip_SB( "Unknown"); } else break; } if (Data_BS_Remain()==0) return; //There is a problem Element_Begin1("ALSSpecificConfig"); bool chan_config,chan_sort,crc_enabled,aux_data_enabled; int32u samp_freq, samples; int16u channels,frame_length; int8u ra_flag,random_access, file_type; Skip_BS(32,"als_id"); Get_BS (32, samp_freq, "samp_freq"); Get_BS (32, samples, "samples"); Get_S2 (16, channels, "channels"); Param_Info2(channels+1, " channel(s)"); Get_S1 (3, file_type, "file_type"); Skip_S1(3,"resolution"); Skip_SB("floating"); Skip_SB("msb_first"); Get_S2 (16,frame_length,"frame_length"); Get_S1 (8,random_access,"random_access"); Get_S1 (2,ra_flag,"ra_flag"); Skip_SB("adapt_order"); Skip_S1(2,"coef_table"); Skip_SB("long_term_prediction"); Skip_S2(10,"max_order"); Skip_S1(2,"block_switching"); Skip_SB("bgmc_mode"); Skip_SB("sb_part"); Skip_SB("joint_stereo"); Skip_SB("mc_coding"); Get_SB (chan_config,"chan_config"); Get_SB (chan_sort,"chan_sort"); Get_SB (crc_enabled,"crc_enabled"); Skip_SB("RLSLMS"); Skip_BS(5,"(reserved)"); Get_SB (aux_data_enabled,"aux_data_enabled"); if (chan_config) Skip_S2(16,"chan_config_info"); if (chan_sort) { int16u ChBits=(int16u)ceil(log((double)(channels+1))/log((double)2)); for (int8u c=0; c<=channels; c++) Skip_BS(ChBits, "chan_pos[c]"); } if(Data_BS_Remain()%8) Skip_S1(Data_BS_Remain()%8, "byte_align"); BS_End(); int32u header_size,trailer_size; Get_B4(header_size, "header_size"); Get_B4(trailer_size, "trailer_size"); #ifdef MEDIAINFO_RIFF_YES if (file_type==1) //WAVE file { Element_Begin1("orig_header"); File_Riff MI; Open_Buffer_Init(&MI); Open_Buffer_Continue(&MI, Buffer+Buffer_Offset+(size_t)Element_Offset, header_size); Element_Offset+=header_size; File__Analyze::Finish(&MI); //No merge of data, only for trace information, because this is the data about the decoded stream, not the encoded stream Element_End0(); } else #endif //MEDIAINFO_RIFF_YES Skip_XX(header_size, "orig_header[]"); Skip_XX(trailer_size, "orig_trailer[]"); if (crc_enabled) Skip_B4( "crc"); if ((ra_flag == 2) && (random_access > 0)) for (int32u f=0; f<((samples-1)/(frame_length+1))+1; f++) Skip_B4( "ra_unit_size[f]"); if (aux_data_enabled) { int32u aux_size; Get_B4(aux_size, "aux_size"); Skip_XX(aux_size, "aux_data[]"); } Element_End0(); BS_Begin(); //To be in sync with other objectTypes FILLING_BEGIN(); //Filling File__Analyze::Stream_Prepare(Stream_Audio); Fill(Stream_Audio, StreamPos_Last, Audio_Channel_s_, channels+1); //Forcing default confignuration (something weird in the example I have) channelConfiguration=0; sampling_frequency_index=(int8u)-1; sampling_frequency=samp_freq; FILLING_END(); }
Polyline(std::vector<Point> const & points, Fill const & fill = Fill(), Stroke const & stroke = Stroke()) : Shape(fill, stroke), points(points) { }
void EN ( const AbstractDistMatrix<Real>& A, const AbstractDistMatrix<Real>& b, Real lambda1, Real lambda2, AbstractDistMatrix<Real>& xPre, const qp::affine::Ctrl<Real>& ctrl ) { EL_DEBUG_CSE DistMatrixWriteProxy<Real,Real,MC,MR> xProx( xPre ); auto& x = xProx.Get(); const Int m = A.Height(); const Int n = A.Width(); const Grid& g = A.Grid(); const Range<Int> uInd(0,n), vInd(n,2*n), rInd(2*n,2*n+m); DistMatrix<Real> Q(g), c(g), AHat(g), G(g), h(g); // Q := | 2*lambda_2 0 0 | // | 0 2*lambda_2 0 | // | 0 0 2 | // ================================ Zeros( Q, 2*n+m, 2*n+m ); auto QTL = Q( IR(0,2*n), IR(0,2*n) ); FillDiagonal( QTL, 2*lambda2 ); auto Qrr = Q( rInd, rInd ); FillDiagonal( Qrr, Real(1) ); // c := lambda_1*[1;1;0] // ===================== Zeros( c, 2*n+m, 1 ); auto cuv = c( IR(0,2*n), ALL ); Fill( cuv, lambda1 ); // \hat A := [A, -A, I] // ==================== Zeros( AHat, m, 2*n+m ); auto AHatu = AHat( ALL, uInd ); auto AHatv = AHat( ALL, vInd ); auto AHatr = AHat( ALL, rInd ); AHatu = A; AHatv -= A; FillDiagonal( AHatr, Real(1) ); // G := | -I 0 0 | // | 0 -I 0 | // ================ Zeros( G, 2*n, 2*n+m ); FillDiagonal( G, Real(-1) ); // h := 0 // ====== Zeros( h, 2*n, 1 ); // Solve the affine QP // =================== DistMatrix<Real> xHat(g), y(g), z(g), s(g); QP( Q, AHat, G, b, c, h, xHat, y, z, s, ctrl ); // x := u - v // ========== x = xHat( uInd, ALL ); x -= xHat( vInd, ALL ); }