Debian Codegraph @

media_common/agnostic/common/codec/shared/codec_def_decode_vp9.h

raw
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 uint16_t LastFrameWidthMinus1; // [0..65535] - Width of last reference frame minus 1
79 uint16_t LastFrameHeightMinus1; // [0..65535] - Height of last reference frame minus 1
80 uint16_t GoldenFrameWidthMinus1; // [0..65535] - Width of golden reference frame minus 1
81 uint16_t GoldenFrameHeightMinus1; // [0..65535] - Height of golden reference frame minus 1
82 uint16_t AltFrameWidthMinus1; // [0..65535] - Width of alternate reference frame minus 1
83 uint16_t AltFrameHeightMinus1; // [0..65535] - Height of alternate reference frame minus 1
84
85 union
86 {
87 struct
88 {
89 uint32_t frame_type : 1; // [0..1]
90 uint32_t show_frame : 1; // [0..1]
91 uint32_t error_resilient_mode : 1; // [0..1]
92 uint32_t intra_only : 1; // [0..1]
93 uint32_t LastRefIdx : 3; // [0..7]
94 uint32_t LastRefSignBias : 1; // [0..1]
95 uint32_t GoldenRefIdx : 3; // [0..7]
96 uint32_t GoldenRefSignBias : 1; // [0..1]
97 uint32_t AltRefIdx : 3; // [0..7]
98 uint32_t AltRefSignBias : 1; // [0..1]
99 uint32_t allow_high_precision_mv : 1; // [0..1]
100 uint32_t mcomp_filter_type : 3; // [0..7]
101 uint32_t frame_parallel_decoding_mode : 1; // [0..1]
102 uint32_t segmentation_enabled : 1; // [0..1]
103 uint32_t segmentation_temporal_update : 1; // [0..1]
104 uint32_t segmentation_update_map : 1; // [0..1]
105 uint32_t reset_frame_context : 2; // [0..3]
106 uint32_t refresh_frame_context : 1; // [0..1]
107 uint32_t frame_context_idx : 2; // [0..3]
108 uint32_t LosslessFlag : 1; // [0..1]
109 uint32_t usePrevInFindMvReferences : 1; // [0..1] - Use previous frame in MV reference search
110 uint32_t ReservedField : 1; // [0] - Reserved for future use
111 } fields;
112 uint32_t value;
113 } PicFlags;
114
115 CODEC_PICTURE RefFrameList[8]; // [0..127, 0xFF]
116 CODEC_PICTURE CurrPic; // [0..127]
117 uint8_t filter_level; // [0..63]
118 uint8_t sharpness_level; // [0..7]
119 uint8_t log2_tile_rows; // [0..2]
120 uint8_t log2_tile_columns; // [0..5]
121 uint8_t UncompressedHeaderLengthInBytes; // [0..255]
122 uint16_t UncompressedHeaderOffset; // [0..65535] - Offset to uncompressed header in bytes
123 uint16_t FirstPartitionSize; // [0..65535]
124 uint8_t SegTreeProbs[7];
125 uint8_t SegPredProbs[3];
126
127 uint32_t BSBytesInBuffer;
128
129 uint32_t StatusReportFeedbackNumber;
130
131 uint8_t profile; // [0..3]
132 uint8_t BitDepthMinus8; // [0, 2, 4]
133 uint8_t subsampling_x; // [0..1]
134 uint8_t subsampling_y; // [0..1]
135 } CODEC_VP9_PIC_PARAMS, *PCODEC_VP9_PIC_PARAMS;
136
137 typedef struct _CODEC_VP9_SEGMENT_PARAMS
138 {
139 CODEC_VP9_SEG_PARAMS SegData[8];
140 } CODEC_VP9_SEGMENT_PARAMS, *PCODEC_VP9_SEGMENT_PARAMS;
141
142 #endif