1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Constants and structs specific to AVC. See the DevVideo specs for more details.
18 #ifndef __DEVVIDEO_AVC_H__
19 #define __DEVVIDEO_AVC_H__
24 Specifies the picture type.
31 INTRA picture, a picture consisted of at least one I slice and zero or more SI slices
33 EAvcPictureTypeI = 0x01,
36 INTER picture, a picture consisted of at least one P slice and zero or more I, SI and SP slices
38 EAvcPictureTypeP = 0x02,
41 Bi-predictive picture, a picture consisted of at least one B slice and zero or more I, P, SI,
44 EAvcPictureTypeB = 0x04,
47 SI picture or switching I picture, a picture consisted of SI slices
49 EAvcPictureTypeSI = 0x08,
52 SP picture or switching P picture, a picture consisted of at least one SP slice and zero or more
55 EAvcPictureTypeSP = 0x10
60 These enumerations can be used in codec capability indication and/or bitstream property indication.
61 When used as part of an encoder capability indication, a signaled value indicates the capability
62 of an encoder to produce such Supplemental Enhancement Information (SEI) to the bitstream and the
63 additional meanings as specified below. When used as part of a decoder capability indication, a
64 signalled value indicates the capability of a decoder to react to such information in a way as
65 specified below. If a decoder does not have such capability, it shall be able to parse and discard
66 the information. When used as part of a bitstream property indication, a non-signalled value
67 indicates the absence of such information in the bitstream and a signalled value indicates the
68 possibility of having such information in the bitstream.
72 enum TAvcSupplementalInformation
75 encoder capability: no meaning
76 decoder capability: capability to initialize Hypothetical Reference Decoder (HRD) as specified
77 in AVC Annex C at any buffering period SEI message
78 bitstream property: existence of Network Abstraction Layer (NAL) units with nal_unit_type equal
79 to 6 and the SEI payload type (payloadType) equal to 0
81 EAvcSeiBufferingPeriod = 0x00000001,
84 encoder capability: no meaning
85 decoder capability: capability to operate HRD and decode/display video streams according to the
86 provided timing information
87 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
90 EAvcSeiPictureTiming = 0x00000002,
93 encoder capability: no meaning
94 decoder capability: capability to crop after decoding and to display the specified rectangular
96 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
99 EAvcSeiPanScanRectangle = 0x00000004,
102 encoder capability: no meaning
103 decoder capability: no meaning
104 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
107 EAvcSeiFillerPayload = 0x00000008,
110 encoder capability: no meaning
111 decoder capability: no meaning
112 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
115 EAvcSeiUserDataRegisteredByITUTRecT35 = 0x00000010,
118 encoder capability: no meaning
119 decoder capability: no meaning
120 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
123 EAvcSeiUserDataUnRegistered = 0x00000020,
126 encoder capability: no meaning
127 decoder capability: capability to start decoding from any access unit with a recovery point SEI
129 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
132 EAvcSeiRecoveryPoint = 0x00000040,
135 encoder capability: capability to repeat the decoded reference picture marking syntax structure
136 as specified in subclauses 7.3.3.3 and 7.4.3.3 of the AVC specification.
137 decoder capability: capability to recover the decoded reference picture marking process due to
138 losses of reference pictures with decoded reference picture marking syntax
139 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
142 EAvcSeiDecodedReferencePictureMarkingRepetition = 0x00000080,
145 encoder capability: capability to analyze video pictures for creation of spare picture information
146 decoder capability: capability to utilize the spare picture information to enhance video decoding
147 in case there is loss of reference pictures
148 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
151 EAvcSeiSparePicture = 0x00000100,
154 encoder capability: no meaning
155 decoder capability: capability to utilize the scene information to enhance error concealment
156 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
159 EAvcSeiSceneInformation = 0x00000200,
162 encoder capability: no meaning
163 decoder capability: capability to utilize the sub-sequence information to achieve temporal
165 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType
168 EAvcSeiSubsequenceInformation = 0x00000400,
171 encoder capability: no meaning
172 decoder capability: capability to utilize the sub-sequence information and the sub-sequence
173 layer characteristics to achieve temporal scalability
174 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType
175 equal to 11 (if sub-sequence layer characteristics SEI message is present,
176 sub-sequence information SEI message must be present)
178 EAvcSeiSubsequenceLayerCharacteristics = 0x00000800,
181 encoder capability: no meaning
182 decoder capability: capability to utilize the sub-sequence information and the sub-sequence
183 characteristics to achieve temporal scalability
184 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
185 to 12 (if sub-sequence characteristics SEI message is present, sub-sequence
186 information SEI message must be present)
188 EAvcSeiSubsequenceCharacteristics = 0x00001000,
191 encoder capability: no meaning
192 decoder capability: capability to freeze displayed picture according to AVC Annex D.2.14.
193 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
196 EAvcSeiFullFrameFreeze = 0x00002000,
199 encoder capability: no meaning
200 decoder capability: capability to release frozen displayed picture according to AVC Annex D.2.15
201 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType
204 EAvcSeiFullFrameFreezeRelease = 0x00004000,
207 encoder capability: no meaning
208 decoder capability: no meaning
209 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType
212 EAvcSeiFullFrameSnapshot = 0x00008000,
215 encoder capability: no meaning
216 decoder capability: no meaning
217 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType
220 EAvcSeiProgressiveRefinementSegmentStrat = 0x00010000,
223 encoder capability: no meaning
224 decoder capability: no meaning
225 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType
228 EAvcSeiProgressiveRefinementSegmentEnd = 0x00020000,
231 encoder capability: capability to constrain the inter prediction process according to
233 decoder capability: capability to decode only part of the pictures covered by the motion-
234 constrained slice group set
235 bitstream property: existence of NAL units with nal_unit_type equal to 6 and payloadType equal
238 EAvcSeiMotionConstrainedSliceGroupSet = 0x00040000
247 class TAvcPictureHeader
251 Equal to ETrue indicates that the bitstream obeys all constraints specified in subclause A.2.1
252 of the AVC specification, equal to EFalse indicates that the bitstream may or may not obey the
253 constraints. The value is equal to ETrue (EFalse) if the syntax element constraint_set0_flag is
256 TBool iBaselineProfileConstraintSet;
259 Equal to ETrue indicates that the bitstream obeys all constraints specified in subclause A.2.2
260 of the AVC specification, equal to EFalse indicates that the bitstream may or may not obey the
261 constraints. The value is equal to ETrue (EFalse) if the syntax element constraint_set1_flag is
264 TBool iMainProfileConstraintSet;
267 Equal to ETrue indicates that the bitstream obeys all constraints specified in subclause A.2.3
268 of the AVC specification, equal to EFalse indicates that the bitstream may or may not obey the
269 constraints. The value is equal to ETrue (EFalse) if the syntax element constraint_set2_flag is
272 TBool iExtendedProfileConstraintSet;
275 Indicates the picture type. iPictureType is set as one of the values defined in TAvcPictureType.
277 TAvcPictureType iPictureType;
280 iLongTermPicture equal to ETrue indicates that the picture is a long-term picture, i.e., it has
281 been marked as "used for long-term reference" according to the decoded reference picture marking
282 process as specified in subclause 8.2.5 of the AVC specification. Otherwise the picture is not a
285 TBool iLongTermPicture;
288 Indicates whether the picture is a frame or a field. iFrame is equal to ETrue if the picture is
289 a frame (field_pic_flag is equal to 0), EFalse if the picture is a field (field_pic_flag is equal
295 Valid only if iFrame is equal to EFalse. Indicates whether the field picture is a top field or a
296 bottom field. iTopField is equal to ETrue if the picture is a top field (bottom_field_flag is
297 equal to 0), EFalse if the picture is a bottom field (bottom_field_flag is equal to 0).
302 Indicates the picture order count of the top field of a frame, the top field of a complementary
303 field pair, or a top field. iTopFieldOrderCount is equal to the value of TopFieldOrderCnt as
304 specified in subclause 8.2.1 of the AVC specification.
306 TUint iTopFieldOrderCount;
309 Indicates the picture order count of the bottom field of a frame, the bottom field of a
310 complementary field pair, or a bottom field. iBottomFieldOrderCount is equal to the value of
311 BottomFieldOrderCnt as specified in subclause 8.2.1 of the AVC specification.
313 TUint iBottomFieldOrderCount;
316 Equal to ETrue indicates that the picture is an Instantaneous Decoding Refresh (IDR) picture;
317 otherwise the picture is not an IDR picture. The value of nal_unit_type of all the Video Coding
318 Layer (VCL) NAL units of the primary coded picture of an IDR picture shall be equal to 5.
323 Indicates the initial value of the quantization parameter. If iPictureType is equal to
324 EAvcPictureTypeSI or EavcPictureTypeSP, iPQY is equal to pic_init_qs_minus26 + 26; otherwise
325 iPQY is equal to pic_init_qp_minus26 + 26.
330 Pixel aspect ratio numerator. The pixel aspect ratio is defined as
331 iAspectRatioNum/iAspectRatioDenom, where the values are positive integers and relatively prime.
332 When aspect_ratio_idc is equal to 0 or sar_width is equal to 0 or sar_height is equal to 0, the
333 sample aspect ratio shall be considered unspecified, and iAspectRatioNum and iAspectRationDenom
334 are set to 0. When aspect_ratio_idc is equal to any of the value from 1 to 13, inclusive,
335 iAspectRatioNum and iAspectRatioDenom are set according to Table E-1 of the AVC specification.
336 When aspect_ratio_idc is equal to 255 (Extended_SAR), iAspectRatioNum is set to sar_width and
337 iAspectRatioDenom is set to sar_height.
339 TUint iAspectRatioNum;
342 Pixel aspect ratio denominator. The pixel aspect ratio is defined as
343 iAspectRatioNum/iAspectRatioDenom, where the values are positive integers and relatively prime.
344 When aspect_ratio_idc is equal to 0 or sar_width is equal to 0 or sar_height is equal to 0, the
345 sample aspect ratio shall be considered unspecified, and iAspectRatioNum and iAspectRationDenom
346 are set to 0. When aspect_ratio_idc is equal to any of the value from 1 to 13, inclusive,
347 iAspectRatioNum and iAspectRatioDenom are set according to Table E-1 of the AVC specification.
348 When aspect_ratio_idc is equal to 255 (Extended_SAR), iAspectRatioNum is set to sar_width and
349 iAspectRatioDenom is set to sar_height.
351 TUint iAspectRatioDenom;
354 Indicates the frame cropping rectangle as specified in subclause 7.4.2.1 of the AVC specification.
356 TRect iFrameCropRect;
359 Equal to 0 indicates that the cropped (according to the frame cropping rectangle) decoded
360 pictures output contain visually important information in the entire region out to the edges of
361 the cropping rectangle of the picture, such that the cropped decoded pictures output should not
362 be displayed using overscan. Instead, they should be displayed using either an exact match
363 between the display area and the cropping rectangle, or using underscan. Equal to 1 indicates
364 that the cropped decoded picture output is suitable for display using overscan. Otherwise, it is
365 unspecified whether the cropped decoded picture output is suitable for display using overscan or
371 Indicates the representation of the pictures as specified in Table E-2 of the AVC specification,
377 Indicates whether a picture should be displayed as a frame or one or more fields, according to
378 Table D-1. iPictureStructure is equal to the syntax element pic_struct.
380 TUint iPictureStructure;
383 Each picture has up to NumClockTS sets of clock timestamp information. The value of NumClockTS
384 is as specified in Table D-1 of the AVC specification, with a maximum value equal to 3. Each
385 instance of iClockTimestamp[i] indicates a time of origin, capture, or alternative ideal display,
386 in units of microseconds. iClockTimestamp[i] is equal to
387 (clockTimestamp[i] / time_scale * 1000000), where clockTimestamp[i] is the i-th set of clock
388 timestamp information as specified in subclause D.2.2 of the AVC specification.
389 iClockTimestamp[i] where i is larger than NumClockTS-1 is invalid. When picture timing
390 information is not available, NumClockTS is set to zero.
392 TTimeIntervalMicroSeconds iClockTimestamp[3];
396 This class is used to signal decoder or encoder capabilities or bitstream properties.
400 class TAvcVideoCapability
404 When used as part of a codec capability indication, iProfileLevel[ProfileIdc] indicates the
405 maximum processing level that a decoder or an encoder supports for a particular profile set
406 indicated by ProfileIdc (the indication is described below). A negative value indicates that
407 the profile set is not supported. When used as part of a stream property indication,
408 iProfileLevel[ProfileIdc] indicates the maximum processing level that is present in the stream
409 for a particular profile set indicated by ProfileIdc. A negative value indicates that the stream
410 does not contain data coded according to the indicated profile set.
412 ProfileIdc equal to 0 indicates that all of constraint_set0_flag, constraint_set1_flag and
413 constraint_set2_flag are equal to 1, and profile_idc may indicate any of the profiles (baseline,
414 main or extended). ProfileIdc equal to 1 indicates that constraint_set0_flag and
415 constraint_set2_flag are equal to 1 while constraint_set1_flag is equal to 0, and
416 profile_idc may indicate either the baseline or extended profile. ProfileIdc equal to 2
417 indicates that constraint_set1_flag and constraint_set2_flag are equal to 1 while
418 constraint_set0_flag is equal to 0, and profile_idc may indicate either the main or extended
419 profile. ProfileIdc equal to 3 indicates that constraint_set1_flag is equal to 1 while the other
420 two flags are equal to 0, and profile_idc indicates the main profile. ProfileIdc equal to 4
421 indicates that constraint_set2_flag is equal to 1 while the other two flags are equal to 0, and
422 profile_idc indicates the extended profile.
424 TInt iProfileLevel[5];
427 iSupplementalInformationCap indicates the supported supplemental enhancement functions. The
428 value is a binary OR of values from TAvcSupplementalInformation.
430 TUint32 iSupplementalInformationCap;
435 This class is used to set the encoder operation mode.
443 Specifies the picture types allowed in the bitstream. The value is a binary OR of values from
444 TAvcPictureType. Signaled picture types that are not included in the prevailing coding profile
447 TUint32 iAllowedPictureTypes;
450 Specifies whether Flexible Macroblock Order (FMO) is allowed. Equal to ETrue indicates that
451 num_slice_groups_minus1 is in the range of 0 to 7, inclusive, i.e. FMO is allowed. Equal to
452 EFalse indicates that num_slice_groups_minus1 shall be equal to 0 only, i.e., FMO is not allowed.
454 TBool iFlexibleMacroblockOrder;
457 Specifies whether redundant pictures may be encoded. Equal to ETrue indicates that
458 redundant_pic_cnt_present_flag can be equal to either 0 or 1 (i.e., redundant pictures may be
459 encoded), while Equal to EFalse indicates that redundant_pic_cnt_present_flag shall be equal to
460 0 only (i.e., redundant pictures cannot be encoded).
462 TBool iRedundantPictures;
465 Specifies whether data partitioning is in use. When equal to ETrue, data partitioning is in use,
466 i.e., NAL unit streams can contain nal_unit_type values in the range of 2 to 4, inclusive. When
467 equal to EFalse, data partitioning is not in use, i.e., NAL unit streams shall not contain
468 nal_unit_type values in the range of 2 to 4, inclusive. If data partitioning is in use, the
469 SetErrorProtectionLevelsL method, if used, should set the number of unequal error protection
470 levels to be larger than one.
472 TBool iDataPartitioning;
475 iFrameMBsOnly equal to ETrue specifies that every coded picture of the coded video sequence is a
476 coded frame containing only frame macroblocks. Equal to EFalse specifies that coded pictures of
477 the coded video sequence may either be coded fields or coded frames.
482 iMBAFFCoding equal to EFalse specifies no switching between frame and field
483 macroblocks within a picture. Equal to ETrue specifies the possible use of switching between
484 frame and field macroblocks within frames. Valid only when iFrameMBsOnly is equal to EFalse.
489 Specifies the entropy decoding method to be applied for the syntax elements for which two
490 descriptors appear in the syntax tables. Equal to EFalse indicates that Exp-Golomb codes or
491 CAVLC (Context-based Adaptive Variable Length Coding), as described in subclause 9.1 or 9.2 of
492 the AVC specification, is applied. Otherwise, CABAC (Context-based Adaptive Binary Arithmetic
493 Coding) as described in subclause 9.3 of the AVC specification is applied.
495 TBool iEntropyCodingCABAC;
498 Equal to EFalse specifies that weighted prediction shall not be applied to P and SP slices.
499 Equal to ETrue specifies that weighted prediction may be applied to P and SP slices.
501 TBool iWeightedPPrediction;
504 Equal to 0 specifies that the default weighted prediction is applied to B slices. Equal to 1
505 specifies that explicit weighted prediction is applied to B slices. Equal to 2 specifies that
506 implicit weighted prediction is applied to B slices.
508 TUint iWeightedBipredicitonMode;
511 Specifies the method used in the derivation process for luma motion vectors for B_Skip,
512 B_Direct_16x16 and B_Direct_8x8 as specified in subclause 8.4.1.2 of the AVC specification. When
513 iFrameMBsOnly is equal to EFalse, iDirect8x8Inference shall be equal to ETrue.
515 TBool iDirect8x8Inference;
519 TAvcHrdParams specifies a set of AVC-specific HRD parameters. All pointers included in the objects
520 have the same lifetime as the objects themselves, and the memory is allocated and deallocated by
521 the same instance that creates and owns the object.
532 Specifies the delay for a CPB between the time of arrival in the CPB of the first bit of the
533 coded data associated with the access unit associated with the buffering period SEI message
534 and the time of removal from the CPB of the coded data associated with the same access unit,
535 for the first buffering period after HRD initialisation. It is in units of a 90 kHz clock.
536 The value is equal to the corresponding initinal_cpb_removal_delay of the NAL HRD parameters
537 if the current parameter is for the NAL HRD or of the VCL HRD parameters if the current
538 parameter is for the VCL HRD.
540 TUint iInitialCpbRemovalDelay;
543 This parameter is used for a CPB in combination with the cpb_removal_delay to specify the
544 initial delivery time of coded access units to the CPB. It is in units of a 90 kHz clock.
545 The value is equal to the corresponding initinal_cpb_removal_delay_offset of the NAL HRD
546 parameters if the current parameter is for the NAL HRD or of the VCL HRD parameters if the
547 current parameter is for the VCL HRD.
549 Note: Over the entire coded video sequence, the sum of iInitialCpbRemovalDelay and the
550 corresponding iInitialCpbRemovalDelayOffset shall be constant for either the NAL HRD
551 parameters or the VCL HRD parameters.
553 TUint iInitialCpbRemovalDelayOffset;
556 Equal to EFalse specifies that to decode this bitstream by the HRD using the CPB
557 specification, the hypothetical stream scheduler (HSS) operates in an intermittent bit
558 rate mode. Equal to 1 specifies that the HSS operates in a constant bit rate (CBR) mode.
563 Specifies the maximum input bit rate, in bits per second, of a CPB. The value is equal to
564 Bitrate as specified in subclause E.2.2 of the AVC specification.
569 Specifies the size, in bytes, of a CPB. The value is equal to CpbSize/8, where CpbSize is as
570 specified in subclause E.2.2 of the AVC specification.
576 Specifies the required size of the decoded picture buffer (DPB) in unit of bytes. The value is
577 equal to max_dec_frame_buffering* PicWidthInSamplesL*FrameHeightInMbs*2, where PicWidthInSamplesL
578 and FrameHeightInMbs are specified in subclause 7.4.2.1 of the AVC specification amd the syntax
579 element max_dec_frame_buffering as specified in subclause E.2.1 of the AVC specification.
584 Specifies the HRD operational mode as specified in Annex C of the AVC specification. The value
585 of LowDelayHrd is equal to ETrue if the syntax element low_delay_hrd_flag is equal to 1, and
586 EFalse otherwise. This parameter is valid only if at least one of iNalCpbCount and iVclCpbCount
592 Specifies the number of alternative coded picture buffer (CPB) specifications for NAL HRD
593 parameters in the bitstream. The value of iNalCpbCount is equal to cpb_cnt_minus1 + 1 in the
594 NAL HRD parameters, if present. iNalCpbCount equal to 0 means that NAL HRD parameters are not
600 Valid only if iNalCpbCount is larger than zero. iNalCpbParams is a pointer to an object of
601 TCpbParams, which contains the parameters of an alternative CPB.
603 TCpbParams* iNalCpbParams;
606 Specifies the number of alternative coded picture buffer (CPB) specifications for VCL HRD
607 parameters in the bitstream. The value of iVclCpbCount is equal to cpb_cnt_minus1 + 1 in the
608 VCL HRD parameters, if present. iVclCpbCount equal to 0 means that VCL HRD parameters are not
614 Valid only if iVclCpbCount is larger than zero. iVclCpbParams is a pointer to an object of
615 TCpbParams, which contains the parameters of an alternative CPB.
617 TCpbParams* iVclCpbParams;