//--------------------------------------------------------------------------- void File_Mpeg4_Descriptors::Descriptor_02() { //Parsing bool URL_Flag; BS_Begin(); Skip_S2(10, "ObjectDescriptorID"); Get_SB ( URL_Flag, "URL_Flag"); Skip_SB( "includeInlineProfileLevelFlag"); Skip_S1( 4, "reserved"); BS_End(); if (URL_Flag) { int8u URLlength; Get_B1 (URLlength, "URLlength"); Skip_UTF8(URLlength, "URLstring"); } Info_B1(ODProfileLevel, "ODProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_ODProfileLevelIndication(ODProfileLevel)); Info_B1(SceneProfileLevel, "sceneProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_SceneProfileLevelIndication(SceneProfileLevel)); Info_B1(AudioProfileLevel, "audioProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_AudioProfileLevelIndication(AudioProfileLevel)); Info_B1(VisualProfileLevel, "visualProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_VisualProfileLevelIndication(VisualProfileLevel)); Info_B1(GraphicsProfileLevel, "graphicsProfileLevelIndication"); Param_Info(Mpeg4_Descriptors_GraphicsProfileLevelIndication(GraphicsProfileLevel)); FILLING_BEGIN(); Element_ThisIsAList(); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Jpeg::COD() { //Parsing int16u Levels; int8u Style, Style2, MultipleComponentTransform; bool PrecinctUsed; Get_B1 (Style, "Scod - Style"); Get_Flags (Style, 0, PrecinctUsed, "Precinct used"); Skip_Flags(Style, 1, "Use SOP (start of packet)"); Skip_Flags(Style, 2, "Use EPH (end of packet header)"); Skip_B1( "Number of decomposition levels"); Skip_B1( "Progression order"); Get_B2 (Levels, "Number of layers"); Info_B1(DimX, "Code-blocks dimensions X (2^(n+2))"); Param_Info2(1<<(DimX+2), " pixels"); Info_B1(DimY, "Code-blocks dimensions Y (2^(n+2))"); Param_Info2(1<<(DimY+2), " pixels"); Get_B1 (Style2, "Style of the code-block coding passes"); Skip_Flags(Style, 0, "Selective arithmetic coding bypass"); Skip_Flags(Style, 1, "MQ states for all contexts"); Skip_Flags(Style, 2, "Regular termination"); Skip_Flags(Style, 3, "Vertically stripe-causal context formation"); Skip_Flags(Style, 4, "Error resilience info is embedded on MQ termination"); Skip_Flags(Style, 5, "Segmentation marker is to be inserted at the end of each normalization coding pass"); Skip_B1( "Transform"); Get_B1(MultipleComponentTransform, "Multiple component transform"); if (PrecinctUsed) { BS_Begin(); Skip_S1(4, "LL sub-band width"); Skip_S1(4, "LL sub-band height"); BS_End(); for (int16u Pos=0; Pos<Levels; Pos++) { Element_Begin1("Decomposition level"); BS_Begin(); Skip_S1(4, "decomposition level width"); Skip_S1(4, "decomposition level height"); BS_End(); Element_End0(); } } FILLING_BEGIN(); if (Frame_Count==0 && Field_Count==0) { switch (MultipleComponentTransform) { case 0x01 : Fill(StreamKind_Last, 0, "Compression_Mode", "Lossless"); break; case 0x02 : Fill(StreamKind_Last, 0, "Compression_Mode", "Lossy"); break; default : ; } } FILLING_END(); }
//--------------------------------------------------------------------------- void File_Dpx::IndustrySpecificHeader_Dpx() { Element_Name("Industry specific header"); //Parsing float32 FrameRate; Element_Begin1("Motion-picture film information"); Skip_String(2, "Film mfg. ID code"); Skip_String(2, "Film type"); Skip_String(2, "Offset in perfs"); Skip_String(6, "Prefix"); Skip_String(4, "Count"); Skip_String(32, "Format - e.g. Academy"); Skip_B4( "Frame position in sequence"); Skip_B4( "Sequence length (frames)"); Skip_B4( "Held count (1 = default)"); Get_BF4 (FrameRate, "Frame rate of original (frames/s)"); Skip_BF4( "Shutter angle of camera in degrees"); Skip_UTF8(32, "Frame identification - e.g. keyframe"); Skip_UTF8(100, "Slate information"); Skip_XX(56, "Reserved for future use"); Element_End0(); Element_Begin1("Television information"); Skip_B4( "SMPTE time code"); Skip_B4( "SMPTE user bits"); Info_B1(Interlace, "Interlace");Param_Info1((Interlace==0?"noninterlaced":"2:1 interlace")); Skip_B1( "Field number"); Info_B1(VideoSignalStandard, "Video signal standard");Param_Info1(DPX_VideoSignalStandard(VideoSignalStandard)); Skip_B1( "Zero"); Skip_BF4( "Horizontal sampling rate (Hz)"); Skip_BF4( "Vertical sampling rate (Hz)"); Skip_BF4( "Temporal sampling rate or frame rate (Hz)"); Skip_BF4( "Time offset from sync to first pixel (ms)"); Skip_BF4( "Gamma"); Skip_BF4( "Black level code value"); Skip_BF4( "Black gain"); Skip_BF4( "Breakpoint"); Skip_BF4( "Reference white level code value"); Skip_BF4( "Integration time (s)"); Skip_XX(76, "Reserved for future use"); Element_End0(); FILLING_BEGIN(); if (FrameRate) Fill(StreamKind_Last, StreamPos_Last, "FrameRate", FrameRate); FILLING_END(); }
//--------------------------------------------------------------------------- void File_Ibi::UInteger_Info() { switch (Element_Size) { case 1 : { Info_B1(Data, "Data"); Element_Info(Data); return; } case 2 : { Info_B2(Data, "Data"); Element_Info(Data); return; } case 3 : { Info_B3(Data, "Data"); Element_Info(Data); return; } case 4 : { Info_B4(Data, "Data"); Element_Info(Data); return; } case 5 : { Info_B5(Data, "Data"); Element_Info(Data); return; } case 6 : { Info_B6(Data, "Data"); Element_Info(Data); return; } case 7 : { Info_B7(Data, "Data"); Element_Info(Data); return; } case 8 : { Info_B8(Data, "Data"); Element_Info(Data); return; } case 16: { Info_B16(Data, "Data"); Element_Info(Data); return; } default : Skip_XX(Element_Size, "Data"); } }
//--------------------------------------------------------------------------- void File_Jpeg::SOF_() { //Parsing vector<Jpeg_samplingfactor> SamplingFactors; int16u Height, Width; int8u Resolution, Count; Get_B1 (Resolution, "P - Sample precision"); Get_B2 (Height, "Y - Number of lines"); Get_B2 (Width, "X - Number of samples per line"); Get_B1 (Count, "Nf - Number of image components in frame"); for (int8u Pos=0; Pos<Count; Pos++) { Jpeg_samplingfactor SamplingFactor; Element_Begin1("Component"); Info_B1(Ci, "Ci - Component identifier"); Element_Info1(Ci); BS_Begin(); Get_S1 (4, SamplingFactor.Hi, "Hi - Horizontal sampling factor"); Element_Info1(SamplingFactor.Hi); Get_S1 (4, SamplingFactor.Vi, "Vi - Vertical sampling factor"); Element_Info1(SamplingFactor.Vi); BS_End(); Skip_B1( "Tqi - Quantization table destination selector"); Element_End0(); //Filling list of HiVi SamplingFactors.push_back(SamplingFactor); } FILLING_BEGIN_PRECISE(); if (Frame_Count==0 && Field_Count==0) { Accept("JPEG"); if (Count_Get(StreamKind_Last)==0) Stream_Prepare(StreamKind_Last); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Format), "JPEG"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_Codec), "JPEG"); if (StreamKind_Last==Stream_Image) Fill(Stream_Image, 0, Image_Codec_String, "JPEG", Unlimited, true, true); //To Avoid automatic filling if (StreamKind_Last==Stream_Video) Fill(Stream_Video, 0, Video_InternetMediaType, "video/JPEG", Unlimited, true, true); Fill(StreamKind_Last, 0, "ColorSpace", "YUV"); Fill(StreamKind_Last, 0, Fill_Parameter(StreamKind_Last, Generic_BitDepth), Resolution); Fill(StreamKind_Last, 0, "Height", Height*(Interlaced?2:1)); Fill(StreamKind_Last, 0, "Width", Width); //Chroma subsampling if (SamplingFactors.size()==3 && SamplingFactors[1].Hi==1 && SamplingFactors[2].Hi==1 && SamplingFactors[1].Vi==1 && SamplingFactors[2].Vi==1) { string ChromaSubsampling; switch (SamplingFactors[0].Hi) { case 1 : switch (SamplingFactors[0].Vi) { case 1 : ChromaSubsampling="4:4:4"; break; default: ; } break; case 2 : switch (SamplingFactors[0].Vi) { case 1 : ChromaSubsampling="4:2:2"; break; case 2 : ChromaSubsampling="4:2:0"; break; default: ; } break; case 4 : switch (SamplingFactors[0].Vi) { case 1 : ChromaSubsampling="4:1:1"; break; default: ; } break; default: ; } if (!ChromaSubsampling.empty()) Fill(StreamKind_Last, 0, "ChromaSubsampling", ChromaSubsampling); } } FILLING_END(); }
//--------------------------------------------------------------------------- void File_Dpx::GenericSectionHeader_Cineon() { Element_Name("Generic section header"); //Parsing Element_Begin1("File information"); Ztring CreationDate, CreationTime; string Version; int32u Size_Header, Size_Total, Size_Generic, Size_Industry, Size_User; Skip_B4( "Magic number"); Get_X4 (Size_Header, "Offset to image data"); Get_X4 (Size_Generic, "Generic section header length"); Get_X4 (Size_Industry, "Industry specific header length"); Get_X4 (Size_User, "User-defined header length"); Get_X4 (Size_Total, "Total image file size"); Get_String(8, Version, "Version number of header format"); Skip_UTF8 (100, "FileName"); Get_UTF8 (12, CreationDate, "Creation Date"); Get_UTF8 (12, CreationTime, "Creation Time"); Skip_XX(36, "Reserved for future use"); Element_End0(); Element_Begin1("Image information"); int8u ImageElements; Info_B1(ImageOrientation, "Image orientation"); Param_Info1(DPX_Orientation[ImageOrientation>8?8:ImageOrientation]); Get_B1 (ImageElements, "Number of image elements"); Skip_B2( "Unused"); if (ImageElements>8) ImageElements=8; for(int8u ImageElement=0; ImageElement<ImageElements; ImageElement++) GenericSectionHeader_Cineon_ImageElement(); if (ImageElements!=8) Skip_XX((8-ImageElements)*28, "Padding"); Skip_BF4( "White point - x"); Skip_BF4( "White point - y"); Skip_BF4( "Red primary chromaticity - x"); Skip_BF4( "Red primary chromaticity - u"); Skip_BF4( "Green primary chromaticity - x"); Skip_BF4( "Green primary chromaticity - y"); Skip_BF4( "Blue primary chromaticity - x"); Skip_BF4( "Blue primary chromaticity - y"); Skip_UTF8(200, "Label text"); Skip_XX(28, "Reserved for future use"); Element_End0(); Element_Begin1("Image Data Format Information"); Skip_B1( "Data interleave"); Skip_B1( "Packing"); Skip_B1( "Data signed or unsigned"); Skip_B1( "Image sense"); Skip_B4( "End of line padding"); Skip_B4( "End of channel padding"); Skip_XX(20, "Reserved for future use"); Element_Begin1("Image Origination Information"); Skip_B4( "X offset"); Skip_B4( "Y offset"); Skip_UTF8 (100, "FileName"); Get_UTF8 (12, CreationDate, "Creation Date"); Get_UTF8 (12, CreationTime, "Creation Time"); Skip_UTF8(64, "Input device"); Skip_UTF8(32, "Input device model number"); Skip_UTF8(32, "Input device serial number"); Skip_BF4( "X input device pitch"); Skip_BF4( "Y input device pitch"); Skip_BF4( "Image gamma of capture device"); Skip_XX(40, "Reserved for future use"); Element_End0(); FILLING_BEGIN(); //Coherency tests if (File_Offset+Buffer_Offset+Size_Total>=Config->File_Current_Size) Size_Total=(int32u)(Config->File_Current_Size-(File_Offset+Buffer_Offset)); //The total size is bigger than the real size if (Size_Generic+Size_Industry+Size_User>Size_Header || Size_Header>Size_Total) { Reject(); return; } //Filling sizes Sizes.push_back(Size_Header); Sizes.push_back(Size_Industry); Sizes.push_back(Size_User); Sizes.push_back(Size_Header-(Size_Generic+Size_Industry+Size_User)); //Size of padding Sizes.push_back(Size_Total-Size_Header); //Size of image //Filling meta if (Frame_Count==0) { Fill(Stream_General, 0, General_Encoded_Date, CreationDate+__T(' ')+CreationTime); //ToDo: transform it in UTC Fill(StreamKind_Last, StreamPos_Last, "Encoded_Date", CreationDate+__T(' ')+CreationTime); //ToDo: transform it in UTC Fill(StreamKind_Last, StreamPos_Last, "Format", "Cineom"); if (Version.size()>2 && Version[0]=='V' && Version[1]>='0' && Version[2]<='9') Version.insert(1, "ersion "); Fill(StreamKind_Last, StreamPos_Last, "Format_Version", Version); Fill(Stream_General, 0, General_Format_Version, Version); } FILLING_END(); }