1 /* 2 * Copyright (c) 2017, Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 //! 23 //! \file codec_def_decode_vp9.h 24 //! \brief Defines decode VP9 types and macros shared by CodecHal, MHW, and DDI layer 25 //! \details Applies to VP9 decode only. Should not contain any DDI specific code. 26 //! 27 #ifndef __CODEC_DEF_DECODE_VP9_H__ 28 #define __CODEC_DEF_DECODE_VP9_H__ 29 30 #include "codec_def_common.h" 31 #include "codec_def_common_vp9.h" 32 33 #define CODEC_VP9_MAX_SEGMENTS 8 34 #define CODECHAL_MAX_CUR_NUM_REF_FRAME_VP9 3 35 #define CODECHAL_DECODE_VP9_MAX_NUM_REF_FRAME 8 36 #define CODECHAL_VP9_NUM_MV_BUFFERS 2 37 #define VP9_CENC_PRIMITIVE_CMD_OFFSET_IN_DW 16 38 39 //! 40 //! \enum CODECHAL_DECODE_VP9_SEG_LVL_FEATURES 41 //! VP9 decode segment level 42 //! 43 typedef enum 44 { 45 CODECHAL_DECODE_VP9_SEG_LVL_ALT_Q = 0, //!< Use alternate Quantizer 46 CODECHAL_DECODE_VP9_SEG_LVL_ALT_LF = 1, //!< Use alternate loop filter value 47 CODECHAL_DECODE_VP9_SEG_LVL_REF_FRAME = 2, //!< Optional Segment reference frame 48 CODECHAL_DECODE_VP9_SEG_LVL_SKIP = 3, //!< Optional Segment (0,0) + skip mode 49 CODECHAL_DECODE_VP9_SEG_LVL_MAX = 4 //!< Number of features supported 50 } CODECHAL_DECODE_VP9_SEG_LVL_FEATURES; 51 52 //! 53 //! \enum CODECHAL_DECODE_VP9_MV_REFERENCE_FRAME 54 //! VP9 decode mv reference 55 //! 56 typedef enum 57 { 58 CODECHAL_DECODE_VP9_NONE = -1, 59 CODECHAL_DECODE_VP9_INTRA_FRAME = 0, 60 CODECHAL_DECODE_VP9_LAST_FRAME = 1, 61 CODECHAL_DECODE_VP9_GOLDEN_FRAME = 2, 62 CODECHAL_DECODE_VP9_ALTREF_FRAME = 3, 63 CODECHAL_DECODE_VP9_MAX_REF_FRAMES = 4 64 } CODECHAL_DECODE_VP9_MV_REFERENCE_FRAME; 65 66 // VP9 Decode Slice Parameter Buffer 67 typedef struct _CODEC_VP9_SLICE_PARAMS { 68 uint32_t BSNALunitDataLocation; 69 uint32_t SliceBytesInBuffer; 70 uint16_t wBadSliceChopping; 71 } CODEC_VP9_SLICE_PARAMS, *PCODEC_VP9_SLICE_PARAMS; 72 73 // VP9 Picture Parameters Buffer 74 typedef struct _CODEC_VP9_PIC_PARAMS 75 { 76 uint16_t FrameHeightMinus1; // [0..65535] 77 uint16_t FrameWidthMinus1; // [0..65535] 78 79 union 80 { 81 struct 82 { 83 uint32_t frame_type : 1; // [0..1] 84 uint32_t show_frame : 1; // [0..1] 85 uint32_t error_resilient_mode : 1; // [0..1] 86 uint32_t intra_only : 1; // [0..1] 87 uint32_t LastRefIdx : 3; // [0..7] 88 uint32_t LastRefSignBias : 1; // [0..1] 89 uint32_t GoldenRefIdx : 3; // [0..7] 90 uint32_t GoldenRefSignBias : 1; // [0..1] 91 uint32_t AltRefIdx : 3; // [0..7] 92 uint32_t AltRefSignBias : 1; // [0..1] 93 uint32_t allow_high_precision_mv : 1; // [0..1] 94 uint32_t mcomp_filter_type : 3; // [0..7] 95 uint32_t frame_parallel_decoding_mode : 1; // [0..1] 96 uint32_t segmentation_enabled : 1; // [0..1] 97 uint32_t segmentation_temporal_update : 1; // [0..1] 98 uint32_t segmentation_update_map : 1; // [0..1] 99 uint32_t reset_frame_context : 2; // [0..3] 100 uint32_t refresh_frame_context : 1; // [0..1] 101 uint32_t frame_context_idx : 2; // [0..3] 102 uint32_t LosslessFlag : 1; // [0..1] 103 uint32_t ReservedField : 2; // [0] 104 } fields; 105 uint32_t value; 106 } PicFlags; 107 108 CODEC_PICTURE RefFrameList[8]; // [0..127, 0xFF] 109 CODEC_PICTURE CurrPic; // [0..127] 110 uint8_t filter_level; // [0..63] 111 uint8_t sharpness_level; // [0..7] 112 uint8_t log2_tile_rows; // [0..2] 113 uint8_t log2_tile_columns; // [0..5] 114 uint8_t UncompressedHeaderLengthInBytes; // [0..255] 115 uint16_t FirstPartitionSize; // [0..65535] 116 uint8_t SegTreeProbs[7]; 117 uint8_t SegPredProbs[3]; 118 119 uint32_t BSBytesInBuffer; 120 121 uint32_t StatusReportFeedbackNumber; 122 123 uint8_t profile; // [0..3] 124 uint8_t BitDepthMinus8; // [0, 2, 4] 125 uint8_t subsampling_x; // [0..1] 126 uint8_t subsampling_y; // [0..1] 127 } CODEC_VP9_PIC_PARAMS, *PCODEC_VP9_PIC_PARAMS; 128 129 typedef struct _CODEC_VP9_SEGMENT_PARAMS 130 { 131 CODEC_VP9_SEG_PARAMS SegData[8]; 132 } CODEC_VP9_SEGMENT_PARAMS, *PCODEC_VP9_SEGMENT_PARAMS; 133 134 #endif 135