sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Constants and structs specific to Mpeg4 Visual. See the DevVideo specs for more details. sl@0: // sl@0: // sl@0: sl@0: #ifndef __DEVVIDEO_MPEG4VISUAL_H__ sl@0: #define __DEVVIDEO_MPEG4VISUAL_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: Specifies the picture type. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: enum TMPEG4VisualVOPType sl@0: { sl@0: /** sl@0: An Intra-coded (I) VOP is coded using information only from itself. sl@0: */ sl@0: EMPEG4VisualVOPTypeI = 0x01, sl@0: sl@0: /** sl@0: A Predictive-coded (P) VOP is a VOP which is coded using motion compensated prediction from a sl@0: past reference VOP. sl@0: */ sl@0: EMPEG4VisualVOPTypeP = 0x02, sl@0: sl@0: /** sl@0: A Bidirectionally predictive-coded (B) VOP is a VOP which is coded using motion compensated sl@0: prediction from a past and/or future reference VOP(s). sl@0: */ sl@0: EMPEG4VisualVOPTypeB = 0x04, sl@0: sl@0: /** sl@0: A sprite (S) VOP is a VOP for a sprite object or a VOP which is coded using prediction based on sl@0: global motion compensation from a past reference VOP. sl@0: */ sl@0: EMPEG4VisualVOPTypeS = 0x08 sl@0: }; sl@0: sl@0: /** sl@0: Specifies the MPEG-4 Visual header types. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: enum TMPEG4VisualHeaderType sl@0: { sl@0: /** sl@0: Visual Object Sequence Header. sl@0: */ sl@0: EMPEG4VisualHeaderSequence = 0x01, sl@0: sl@0: /** sl@0: Visual Object Header. sl@0: */ sl@0: EMPEG4VisualHeaderObject = 0x02, sl@0: sl@0: /** sl@0: Video Object Layer Header. sl@0: */ sl@0: EMPEG4VisualHeaderVOL = 0x04, sl@0: sl@0: /** sl@0: Group of Video Object Plane Header. sl@0: */ sl@0: EMPEG4VisualHeaderGOV = 0x08, sl@0: sl@0: /** sl@0: Video Object Plane Header. sl@0: */ sl@0: EMPEG4VisualHeaderVOP = 0x10 sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Object sequence header. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualObjectSequenceHeader sl@0: { sl@0: public: sl@0: /** sl@0: Used to signal the profile and level identification according to Table G-1 of MPEG-4 Visual. sl@0: */ sl@0: TUint iProfileLevel; sl@0: sl@0: /** sl@0: Contains the user_data bytes, if any, that are directly included in the VideoObjectSequence() sl@0: syntax structure (subclause 6.2.2 of MPEG-4 Visual), in bitstream order. The pointer must remain sl@0: valid as long as the object it belongs to is being processed by the client (for playback) or MSL sl@0: video subsystem (for recording). sl@0: */ sl@0: TPtrC8 iUserData; sl@0: }; sl@0: sl@0: /** sl@0: Object header. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualObjectHeader sl@0: { sl@0: public: sl@0: /** sl@0: Identifies the version number of the visual object as specified in the semantics of sl@0: visual_object_verid syntax element of MPEG-4 Visual. sl@0: */ sl@0: TUint iVisualObjectVerid; sl@0: sl@0: /** sl@0: Specifies the priority of the visual object as specified in the semantics of sl@0: visual_object_priority syntax element of MPEG-4 Visual. If the visual_object_priority syntax sl@0: element is not present in the bitstream, iVisualObjectPriority shall be equal to 0. sl@0: */ sl@0: TUint iVisualObjectPriority; sl@0: sl@0: /** sl@0: Identifies the type of the visual object as specified in the semantics of sl@0: visual_object_type syntax element of MPEG-4 Visual. HW devices according to this specification sl@0: are required to set iVisualObjectType to 1 (to indicate "video ID"). sl@0: */ sl@0: TUint iVisualObjectType; sl@0: sl@0: /** sl@0: Uniquely identifies the video object. The value of iVideoObjectId shall be the same as the sl@0: value of the video_object_id syntax element specified in MPEG-4 Visual. sl@0: */ sl@0: TUint iVideoObjectId; sl@0: sl@0: /** sl@0: Contains the user_data bytes, if any, that are directly included in the VideoObject() syntax sl@0: structure (subclause 6.2.2 of MPEG-4 Visual), in bitstream order. The pointer must remain valid sl@0: as long as the object it belongs to is being processed by the client (for playback) or MSL video sl@0: subsystem (for recording). sl@0: */ sl@0: TPtrC8 iUserData; sl@0: }; sl@0: sl@0: /** sl@0: Mpeg4 Visual VBV parameters. sl@0: sl@0: If the syntax elements that are used to derive the values of the class member variables are not sl@0: present in the bitstream, the variable values shall be set to default values as specified in sl@0: Annex D of MPEG-4 Visual. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualVbvParams sl@0: { sl@0: public: sl@0: /** sl@0: Specifies the instantaneous video object layer channel bit rate in bits per second. Shall be set sl@0: to ((first_half_bit_rate << 15) + latter_half_bit_rate) * 400, where the values of sl@0: first_half_bit_rate and latter_half_bit_rate are conveyed in the VideoObjectLayer syntax sl@0: structure of MPEG-4 Visual. sl@0: */ sl@0: TInt64 iBitRate; sl@0: sl@0: /** sl@0: Specifies the VBV buffer size in bytes. Shall be set to sl@0: ((first_half_vbv_buffer_size) << 3) + latter_half_vbv_buffer_size) * 2048, sl@0: where the values of first_half_vbv_buffer_size and latter_half_vbv_buffer_size are conveyed in sl@0: the VideoObjectLayer syntax structure of MPEG-4 Visual. sl@0: */ sl@0: TUint32 iVbvBufferSize; sl@0: sl@0: /** sl@0: Specifies VBV occupancy in bytes just before the removal of the first VOP following the VOL sl@0: header. The purpose for the quantity is to provide the initial condition for VBV buffer fullness. sl@0: Shall be set to ((first_half_vbv_occupancy) << 15) + latter_half_vbv_occupancy) * 2048, where sl@0: the values of first_half_vbv_occupancy and latter_half_vbv_occupancy are conveyed in the sl@0: VideoObjectLayer syntax structure of MPEG-4 Visual. sl@0: */ sl@0: TUint32 iVbvOccupancy; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Video object layer header. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualVOLHeader sl@0: { sl@0: public: sl@0: /** sl@0: Uniquely identifies the video object layer. The value of iVideoObjectLayerId shall be the same sl@0: as the value of the video_object_layer_id syntax element specified in MPEG-4 Visual. sl@0: */ sl@0: TUint iVideoObjectLayerId; sl@0: sl@0: /** sl@0: iShortVideoHeader equal to ETrue indicates that the associated elementary stream conforms to sl@0: ITU-T Recommendation H.263 (without optional coding modes). The value of iShortVideoHeader sl@0: shall be equal to the value of the short_video_header flag of MPEG-4 Visual. sl@0: */ sl@0: TBool iShortVideoHeader; sl@0: sl@0: /** sl@0: iRandomAccessibleVOL equal to ETrue indicates that every VOP in this VOL is individually sl@0: decodable. The value of iRandomAccessibleVOL shall be equal to the value of the sl@0: random_accessible_vol flag of MPEG-4 Visual. sl@0: */ sl@0: TBool iRandomAccessibleVOL; sl@0: sl@0: /** sl@0: Indicates the object type as specified in Table 6-10 of MPEG-4 Visual and constrains the sl@0: associated elementary stream to use tools from the indicated object type. HW devices according sl@0: to this specification are required to set iVideoObjectTypeIndication to 1 (to indicate Simple sl@0: Object Type). sl@0: */ sl@0: TUint iVideoObjectTypeIndication; sl@0: sl@0: /** sl@0: Identifies the version number of the video object layer as specified in the semantics of sl@0: video_object_layer_verid syntax element of MPEG-4 Visual. sl@0: */ sl@0: TUint iVideoObjectLayerVerid; sl@0: sl@0: /** sl@0: */ sl@0: TUint iVideoObjectLayerPriority; sl@0: sl@0: /** sl@0: Specifies the priority of the video object layer as specified in the semantics of sl@0: video_object_layer_priority syntax element of MPEG-4 Visual. If the video_object_layer_priority sl@0: syntax element is not present in the bitstream, iVideoObjectLayerPriority shall be equal to 0. sl@0: */ sl@0: TUint iAspectRatioNum; sl@0: sl@0: /** sl@0: Pixel aspect ratio numerator and denominator respectively. The pixel aspect ratio is defined as sl@0: iAspectRatioNum/iAspectRatioDenom, where the values are positive integers and relatively prime. sl@0: These values shall be set according to the value of aspect_ratio_info, par_width (if present), sl@0: and par_height (if present) syntax elements in the VideoObjectLayer() syntax structure of MPEG-4 sl@0: Visual. sl@0: */ sl@0: TUint iAspectRatioDenom; sl@0: sl@0: /** sl@0: Specifies the VBV parameters in use for the VOL. The values in iVbvParams are valid if sl@0: iShortVideoHeader equals to EFalse. If iShortVideoHeader equals to ETrue, the VBV operation and sl@0: parameters are specified in Annex D of MPEG-4 Visual. sl@0: */ sl@0: TMPEG4VisualVbvParams iVbvParams; sl@0: sl@0: /** sl@0: Indicates the number of evenly spaced subintervals, called ticks, within one modulo time. One sl@0: modulo time represents the fixed interval of one second. Shall be set equal to the value of sl@0: vop_time_increment_resolution of the VideoObjectLayer() syntax structure of MPEG-4 Visual. sl@0: */ sl@0: TUint16 iVOPTimeIncrementResolution; sl@0: sl@0: /** sl@0: iFixedVOPRate equal to ETrue indicates that all VOPs are coded with a fixed VOP rate. sl@0: iFixedVOPRate equal to EFalse indicates that some VOPs may not be coded with a fixed VOP rate. sl@0: Shall be set equal to the value of fixed_vop_rate of the VideoObjectLayer() syntax structure sl@0: of MPEG-4 Visual. sl@0: */ sl@0: TBool iFixedVOPRate; sl@0: sl@0: /** sl@0: The number of ticks between two successive VOPs in the display order. Valid only if sl@0: iFixedVOPRate is equal to ETrue. Shall be set equal to the value of fixed_vop_time_increment sl@0: of the VideoObjectLayer() syntax structure of MPEG-4 Visual. sl@0: */ sl@0: TUint16 iFixedVOPTimeIncrement; sl@0: sl@0: /** sl@0: iDataPartitioning equal to ETrue indicates that slices are organized in data partitions within sl@0: the associated elementary bitstream. Shall be set equal to the value of the data_partitioned sl@0: syntax element of the VideoObjectLayer() syntax structure of MPEG-4 Visual. sl@0: */ sl@0: TBool iDataPartitioning; sl@0: sl@0: /** sl@0: iReversibleVLC equal to ETrue indicates that the reversible variable length tables of MPEG-4 sl@0: Visual are in use in the associated elementary bistream. Shall be set equal to the value of the sl@0: reversible_vlc syntax element of the VideoObjectLayer() syntax structure of MPEG-4 Visual. If sl@0: reversible_vlc is not present in the bitstream, the value of iReversibleVLC shall be set to sl@0: EFalse. sl@0: */ sl@0: TBool iReversibleVLC; sl@0: sl@0: /** sl@0: Contains the user_data bytes, if any, that are directly included in the VideoObjectLayer() sl@0: syntax structure, in bitstream order. The pointer must remain valid as long as the object it sl@0: belongs to is being processed by the client (for playback) or MSL video subsystem (for sl@0: recording). sl@0: */ sl@0: TPtrC8 iUserData; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Mpeg4 visual GOV header. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualGOVHeader sl@0: { sl@0: public: sl@0: /** sl@0: iTimeCodeHours, iTimeCodeMinutes and iTimeCodeSeconds together specify the modulo part (i.e. the sl@0: full second units) of the time base for the first object plane (in display order) after the GOV sl@0: header according to the semantics of the time_code syntax element of MPEG-4 Visual. sl@0: */ sl@0: TUint iTimeCodeHours; sl@0: sl@0: /** sl@0: iTimeCodeHours, iTimeCodeMinutes and iTimeCodeSeconds together specify the modulo part (i.e. the sl@0: full second units) of the time base for the first object plane (in display order) after the GOV sl@0: header according to the semantics of the time_code syntax element of MPEG-4 Visual. sl@0: */ sl@0: TUint iTimeCodeMinutes; sl@0: sl@0: /** sl@0: iTimeCodeHours, iTimeCodeMinutes and iTimeCodeSeconds together specify the modulo part (i.e. the sl@0: full second units) of the time base for the first object plane (in display order) after the GOV sl@0: header according to the semantics of the time_code syntax element of MPEG-4 Visual. sl@0: */ sl@0: TUint iTimeCodeSeconds; sl@0: sl@0: /** sl@0: Indicates the nature of the predictions used in the first consecutive B-VOPs (if any) sl@0: immediately following the first coded I-VOP after the GOV header. iClosedGOV equal to ETrue sl@0: indicates that there are no such B-VOPs or that these B-VOPs have been encoded using only sl@0: backward prediction or intra coding. The value of iClosedGOV shall be set equal to the value of sl@0: closed_gov syntax element of MPEG-4 Visual. sl@0: */ sl@0: TBool iClosedGOV; sl@0: sl@0: /** sl@0: iBrokenLink equal to ETrue indicates that the first consecutive B-VOPs (if any) immediately sl@0: following the first coded I-VOP following the GOV header may not be correctly decoded because sl@0: the reference frame which is used for prediction is not available (e.g., due to result of sl@0: editing in compressed domain). A decoder may use this flag to avoid displaying frames that sl@0: cannot be correctly decoded. The value of iBrokenLink shall be set equal to the value of sl@0: broken_link syntax element of MPEG-4 Visual. sl@0: */ sl@0: TBool iBrokenLink; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Mpeg4 visual VOP header. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualVOPHeader sl@0: { sl@0: public: sl@0: /** sl@0: Indicates the coding type of the VOP. sl@0: */ sl@0: TMPEG4VisualVOPType iVOPCodingType; sl@0: sl@0: /** sl@0: Indicates the number of seconds elapsed since the previous GOV header or since the previous sl@0: picture in display order, whichever is closer in display order. The value of iModuloTimeBase sl@0: shall be set equal to the decoded value derived from a series of modulo_time_base fields as sl@0: specified in MPEG-4 Visual. sl@0: */ sl@0: TUint iModuloTimeBase; sl@0: sl@0: /** sl@0: VOP display time relative to iModuloTimeBase in clock ticks. The value of iVOPTimeIncrement sl@0: shall be set equal to the value of the vop_time_increment syntax element of MPEG-4 Visual. sl@0: */ sl@0: TUint16 iVOPTimeIncrement; sl@0: sl@0: /** sl@0: iVOPCoded equal to EFalse indicates that the VOP is a copy of the previous VOP in display order. sl@0: The value of iVOPCoded shall be set equal to the value of the vop_coded syntax element of MPEG-4 sl@0: Visual. sl@0: */ sl@0: TBool iVOPCoded; sl@0: sl@0: /** sl@0: Indicates the initial value of the quantization parameter. iVOPQuant shall be set equal to the sl@0: value of the vop_quant syntax element. sl@0: */ sl@0: TUint iVOPQuant; sl@0: sl@0: /** sl@0: Indicates the VOP ID. iVOPId shall be set equal to the value of the vop_id syntax element. Valid sl@0: only if the flag newpred_enable is equal to 1. sl@0: */ sl@0: TUint16 iVOPId; sl@0: sl@0: /** sl@0: When equal to ETrue indicates the following iVOPIdForPrediction is valid. Valid only if the flag sl@0: newpred_enable is equal to 1. sl@0: */ sl@0: TBool iVOPIdForPredictionValid; sl@0: sl@0: /** sl@0: Indicates VOP ID of the VOP that is used as the reference VOP for the current VOP. sl@0: iVOPIdForPrediction shall be set equal to the value of the vop_id_for_prediction if the syntax sl@0: element is present (i.e. the ). Valid only if iVOPIdForPredictionValid is equal to ETrue. sl@0: */ sl@0: TUint16 iVOPIdForPrediction; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: This class is used to convey information of Visual Object Sequence, Visual Object, VOL, GOV, and VOP sl@0: headers that are consecutive in decoding order without any intervening syntax structures. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualHeader sl@0: { sl@0: public: sl@0: /** sl@0: A binary OR of values specified in TMPEG4VisualHeaderType: sl@0: * EMPEG4VisualHeaderSequence - set if the visual object sequence header is present and sl@0: iVisualObjectSequenceHeader is set accordingly. Otherwise, iVisualObjectSequenceHeader sl@0: shall be set to NULL. sl@0: * EMPEG4VisualHeaderObject - set if the visual object header is present and sl@0: iVisualObjectHeader is set accordingly. Otherwise, iVisualObjectHeader shall be set sl@0: to NULL. sl@0: * EMPEG4VisualHeaderVOL - set if the VOL header is present and iVOLHeader is set accordingly. sl@0: Otherwise, iVOLHeader shall be set to NULL. sl@0: * EMPEG4VisualHeaderGOV - set if the GOV header is present and iGOVHeader is set accordingly. sl@0: Otherwise, iGOVHeader shall be set to NULL. sl@0: * EMPEG4VisualHeaderVOP - set if the VOP header is present and iVOPHeader is set accordingly. sl@0: Otherwise, iVOPHeader shall be set to NULL sl@0: */ sl@0: TUint32 iConsecutiveHeaders; sl@0: sl@0: /** sl@0: The visual object sequence header. sl@0: */ sl@0: const TMPEG4VisualObjectSequenceHeader* iVisualObjectSequenceHeader; sl@0: sl@0: /** sl@0: The visual object header. sl@0: */ sl@0: const TMPEG4VisualObjectHeader* iVisualObjectHeader; sl@0: sl@0: /** sl@0: The VOL header. sl@0: */ sl@0: const TMPEG4VisualVOLHeader* iVOLHeader; sl@0: sl@0: /** sl@0: The GOV header. sl@0: */ sl@0: const TMPEG4VisualGOVHeader* iGOVHeader; sl@0: sl@0: /** sl@0: The VOP header. sl@0: */ sl@0: const TMPEG4VisualVOPHeader* iVOPHeader; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: This class is used to signal decoder or encoder capabilities. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualCapability sl@0: { sl@0: public: sl@0: /* sl@0: iProfileLevel[ i ] indicates a supported combination of profile and level, i.e., sl@0: profile_and_level_indication, according to Table G-1 of MPEG-4 Visual. The values of i from 62 sl@0: to 255 are reserved (the MPEG-4 Visual standard referenced in the present document has 62 sl@0: combinations of profile and level). sl@0: */ sl@0: TUint8 iProfileLevel[256]; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: This class is used to set the encoder operation mode. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualNormalMPEG4Mode sl@0: { sl@0: public: sl@0: /** sl@0: Specifies the picture types allowed in the bitstream. The value is a binary OR of values from sl@0: TMPEG4VisualVOPType. Signaled picture types that are not included in the prevailing coding sl@0: profile are ignored. sl@0: */ sl@0: TMPEG4VisualVOPType iAllowedVOPTypes; sl@0: sl@0: /** sl@0: Specifies the number of consecutive video packet headers within a VOP, starting from the first sl@0: video packet header in decoding order, where the value of header_extension_code shall be set to 1. sl@0: */ sl@0: TUint iHeaderExtension; sl@0: sl@0: /** sl@0: Specifies whether data partitioning is in use. When equal to ETrue, data partitioning is in use. sl@0: When equal to EFalse, data partitioning is not in use. If data partitioning is in use, the sl@0: SetErrorProtectionLevelsL method, if used, should set the number of unequal error protection sl@0: levels to be larger than one. sl@0: */ sl@0: TBool iDataPartitioning; sl@0: sl@0: /** sl@0: Specifies whether reversible variable length coding is in use. When equal to ETrue, reversible sl@0: variable length coding is in use. When equal to EFalse, reversible variable length coding is sl@0: not in use. Valid only if iDataPartitioned is equal to ETrue. sl@0: */ sl@0: TBool iReversibleVLC; sl@0: sl@0: /** sl@0: Specifies which headers are included in the first output buffer of each intra VOP. (Note: Video sl@0: Object Sequence and Video Object Headers can be repeated for error resiliency. VOL Header sl@0: includes the initial buffer occupancy level. GOV header includes an update on display times.) sl@0: */ sl@0: TMPEG4VisualHeaderType iHeadersBeforeIntraVOP; sl@0: }; sl@0: sl@0: /** sl@0: This class is used to set the encoder operation mode. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TMPEG4VisualMode sl@0: { sl@0: public: sl@0: /** sl@0: Indicates whether the short header mode of MPEG-4 Visual is used. If iShortHeaderMode is sl@0: equal to ETrue, then iH263VideoMode is valid and all other parameter values are invalid. If sl@0: iShortHeaderMode is equal to EFalse, then iH263VideoMode is invalid and all other parameter sl@0: values are valid. sl@0: */ sl@0: TBool iShortHeaderMode; sl@0: sl@0: /** sl@0: Contains the encoding modes to use when iShortHeaderMode is EFalse. sl@0: */ sl@0: TMPEG4VisualNormalMPEG4Mode iMPEG4VisualNormalMPEG4Mode; sl@0: sl@0: /** sl@0: Contains the encoding modes to use when iShortHeaderMode is ETrue. sl@0: */ sl@0: TH263VideoMode iH263VideoMode; sl@0: }; sl@0: sl@0: sl@0: sl@0: #endif