1 /* 2 ** Copyright (c) 2019-2020 The Khronos Group Inc. 3 ** 4 ** SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 8 #define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 #include "vk_video/vulkan_video_codec_h264std.h" 15 16 // ************************************************* 17 // Video H.264 Decode related parameters: 18 // ************************************************* 19 20 #define STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE 15 21 22 typedef enum StdVideoDecodeH264FieldOrderCount { 23 STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0, 24 STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_BOTTOM = 1, 25 STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE = 2, 26 STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF 27 } StdVideoDecodeH264FieldOrderCnt; 28 29 typedef struct StdVideoDecodeH264PictureInfoFlags { 30 uint32_t field_pic_flag : 1; // Is field picture 31 uint32_t is_intra : 1; // Is intra picture 32 uint32_t IdrPicFlag : 1; // instantaneous decoding refresh (IDR) picture 33 uint32_t bottom_field_flag : 1; // bottom (true) or top (false) field if field_pic_flag is set. 34 uint32_t is_reference : 1; // This only applies to picture info, and not to the DPB lists. 35 uint32_t complementary_field_pair : 1; // complementary field pair, complementary non-reference field pair, complementary reference field pair 36 } StdVideoDecodeH264PictureInfoFlags; 37 38 typedef struct StdVideoDecodeH264PictureInfo { 39 uint8_t seq_parameter_set_id; // Selecting SPS from the Picture Parameters 40 uint8_t pic_parameter_set_id; // Selecting PPS from the Picture Parameters and the SPS 41 uint16_t reserved; // for structure members 32-bit packing/alignment 42 uint16_t frame_num; // 7.4.3 Slice header semantics 43 uint16_t idr_pic_id; // 7.4.3 Slice header semantics 44 // PicOrderCnt is based on TopFieldOrderCnt and BottomFieldOrderCnt. See 8.2.1 Decoding process for picture order count type 0 - 2 45 int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; // TopFieldOrderCnt and BottomFieldOrderCnt fields. 46 StdVideoDecodeH264PictureInfoFlags flags; 47 } StdVideoDecodeH264PictureInfo; 48 49 typedef struct StdVideoDecodeH264ReferenceInfoFlags { 50 uint32_t top_field_flag : 1; // Reference is used for top field reference. 51 uint32_t bottom_field_flag : 1; // Reference is used for bottom field reference. 52 uint32_t is_long_term : 1; // this is a long term reference 53 uint32_t is_non_existing : 1; // Must be handled in accordance with 8.2.5.2: Decoding process for gaps in frame_num 54 } StdVideoDecodeH264ReferenceInfoFlags; 55 56 typedef struct StdVideoDecodeH264ReferenceInfo { 57 // FrameNum = is_long_term ? long_term_frame_idx : frame_num 58 uint16_t FrameNum; // 7.4.3.3 Decoded reference picture marking semantics 59 uint16_t reserved; // for structure members 32-bit packing/alignment 60 int32_t PicOrderCnt[2]; // TopFieldOrderCnt and BottomFieldOrderCnt fields. 61 StdVideoDecodeH264ReferenceInfoFlags flags; 62 } StdVideoDecodeH264ReferenceInfo; 63 64 typedef struct StdVideoDecodeH264MvcElementFlags { 65 uint32_t non_idr : 1; 66 uint32_t anchor_pic : 1; 67 uint32_t inter_view : 1; 68 } StdVideoDecodeH264MvcElementFlags; 69 70 typedef struct StdVideoDecodeH264MvcElement { 71 StdVideoDecodeH264MvcElementFlags flags; 72 uint16_t viewOrderIndex; 73 uint16_t viewId; 74 uint16_t temporalId; // move out? 75 uint16_t priorityId; // move out? 76 uint16_t numOfAnchorRefsInL0; 77 uint16_t viewIdOfAnchorRefsInL0[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE]; 78 uint16_t numOfAnchorRefsInL1; 79 uint16_t viewIdOfAnchorRefsInL1[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE]; 80 uint16_t numOfNonAnchorRefsInL0; 81 uint16_t viewIdOfNonAnchorRefsInL0[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE]; 82 uint16_t numOfNonAnchorRefsInL1; 83 uint16_t viewIdOfNonAnchorRefsInL1[STD_VIDEO_DECODE_H264_MVC_REF_LIST_SIZE]; 84 } StdVideoDecodeH264MvcElement; 85 86 typedef struct StdVideoDecodeH264Mvc { 87 uint32_t viewId0; 88 uint32_t mvcElementCount; 89 StdVideoDecodeH264MvcElement* pMvcElements; 90 } StdVideoDecodeH264Mvc; 91 92 93 #ifdef __cplusplus 94 } 95 #endif 96 97 #endif // VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 98