1 /* 2 * 3 * Copyright 2015 Rockchip Electronics Co. LTD 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 #ifndef _VP9D_SYNTAX_H_ 18 #define _VP9D_SYNTAX_H_ 19 20 typedef unsigned long DWORD; 21 typedef unsigned char BYTE; 22 typedef unsigned short WORD; 23 typedef unsigned long ULONG; 24 typedef unsigned short USHORT; 25 typedef unsigned char UCHAR; 26 typedef unsigned int UINT; 27 typedef unsigned int UINT32; 28 29 typedef signed int BOOL; 30 typedef signed int INT; 31 typedef signed char CHAR; 32 typedef signed short SHORT; 33 typedef signed long LONG; 34 typedef void *PVOID; 35 36 typedef struct _DXVA_PicEntry_VPx { 37 union { 38 struct { 39 UCHAR Index7Bits : 7; 40 UCHAR AssociatedFlag : 1; 41 }; 42 UCHAR bPicEntry; 43 }; 44 } DXVA_PicEntry_VPx, *LPDXVA_PicEntry_Vpx; 45 46 typedef struct _segmentation_VP9 { 47 union { 48 struct { 49 UCHAR enabled : 1; 50 UCHAR update_map : 1; 51 UCHAR temporal_update : 1; 52 UCHAR abs_delta : 1; 53 UCHAR ReservedSegmentFlags4Bits : 4; 54 }; 55 UCHAR wSegmentInfoFlags; 56 }; 57 UCHAR tree_probs[7]; 58 UCHAR pred_probs[3]; 59 SHORT feature_data[8][4]; 60 UCHAR feature_mask[8]; 61 } DXVA_segmentation_VP9; 62 63 typedef struct { 64 RK_U8 y_mode[4][9]; 65 RK_U8 uv_mode[10][9]; 66 RK_U8 filter[4][2]; 67 RK_U8 mv_mode[7][3]; 68 RK_U8 intra[4]; 69 RK_U8 comp[5]; 70 RK_U8 single_ref[5][2]; 71 RK_U8 comp_ref[5]; 72 RK_U8 tx32p[2][3]; 73 RK_U8 tx16p[2][2]; 74 RK_U8 tx8p[2]; 75 RK_U8 skip[3]; 76 RK_U8 mv_joint[3]; 77 struct { 78 RK_U8 sign; 79 RK_U8 classes[10]; 80 RK_U8 class0; 81 RK_U8 bits[10]; 82 RK_U8 class0_fp[2][3]; 83 RK_U8 fp[3]; 84 RK_U8 class0_hp; 85 RK_U8 hp; 86 } mv_comp[2]; 87 RK_U8 partition[4][4][3]; 88 } DXVA_prob_vp9; 89 90 typedef struct _DXVA_PicParams_VP9 { 91 DXVA_PicEntry_VPx CurrPic; 92 UCHAR profile; 93 union { 94 struct { 95 USHORT frame_type : 1; 96 USHORT show_frame : 1; 97 USHORT error_resilient_mode : 1; 98 USHORT subsampling_x : 1; 99 USHORT subsampling_y : 1; 100 USHORT extra_plane : 1; 101 USHORT refresh_frame_context : 1; 102 USHORT intra_only : 1; 103 USHORT frame_context_idx : 2; 104 USHORT reset_frame_context : 2; 105 USHORT allow_high_precision_mv : 1; 106 USHORT parallelmode : 1; 107 USHORT show_existing_frame : 1; 108 }; 109 USHORT wFormatAndPictureInfoFlags; 110 }; 111 UINT width; 112 UINT height; 113 UCHAR BitDepthMinus8Luma; 114 UCHAR BitDepthMinus8Chroma; 115 UCHAR interp_filter; 116 UCHAR Reserved8Bits; 117 DXVA_PicEntry_VPx ref_frame_map[8]; 118 UINT ref_frame_coded_width[8]; 119 UINT ref_frame_coded_height[8]; 120 DXVA_PicEntry_VPx frame_refs[3]; 121 CHAR ref_frame_sign_bias[4]; 122 CHAR filter_level; 123 CHAR sharpness_level; 124 union { 125 struct { 126 UCHAR mode_ref_delta_enabled : 1; 127 UCHAR mode_ref_delta_update : 1; 128 UCHAR use_prev_in_find_mv_refs : 1; 129 UCHAR ReservedControlInfo5Bits : 5; 130 }; 131 UCHAR wControlInfoFlags; 132 }; 133 CHAR ref_deltas[4]; 134 CHAR mode_deltas[2]; 135 SHORT base_qindex; 136 CHAR y_dc_delta_q; 137 CHAR uv_dc_delta_q; 138 CHAR uv_ac_delta_q; 139 DXVA_segmentation_VP9 stVP9Segments; 140 UCHAR log2_tile_cols; 141 UCHAR log2_tile_rows; 142 USHORT uncompressed_header_size_byte_aligned; 143 USHORT first_partition_size; 144 USHORT Reserved16Bits; 145 USHORT Reserved32Bits; 146 UINT StatusReportFeedbackNumber; 147 struct { 148 UCHAR y_mode[4][9]; 149 UCHAR uv_mode[10][9]; 150 UCHAR filter[4][2]; 151 UCHAR mv_mode[7][3]; 152 UCHAR intra[4]; 153 UCHAR comp[5]; 154 UCHAR single_ref[5][2]; 155 UCHAR comp_ref[5]; 156 UCHAR tx32p[2][3]; 157 UCHAR tx16p[2][2]; 158 UCHAR tx8p[2]; 159 UCHAR skip[3]; 160 UCHAR mv_joint[3]; 161 struct { 162 UCHAR sign; 163 UCHAR classes[10]; 164 UCHAR class0; 165 UCHAR bits[10]; 166 UCHAR class0_fp[2][3]; 167 UCHAR fp[3]; 168 UCHAR class0_hp; 169 UCHAR hp; 170 } mv_comp[2]; 171 UCHAR partition[4][4][3]; 172 UCHAR coef[4][2][2][6][6][3]; 173 } prob; 174 struct { 175 UINT partition[4][4][4]; 176 UINT skip[3][2]; 177 UINT intra[4][2]; 178 UINT tx32p[2][4]; 179 UINT tx16p[2][4]; 180 UINT tx8p[2][2]; 181 UINT y_mode[4][10]; 182 UINT uv_mode[10][10]; 183 UINT comp[5][2]; 184 UINT comp_ref[5][2]; 185 UINT single_ref[5][2][2]; 186 UINT mv_mode[7][4]; 187 UINT filter[4][3]; 188 UINT mv_joint[4]; 189 UINT sign[2][2]; 190 UINT classes[2][12]; // orign classes[12] 191 UINT class0[2][2]; 192 UINT bits[2][10][2]; 193 UINT class0_fp[2][2][4]; 194 UINT fp[2][4]; 195 UINT class0_hp[2][2]; 196 UINT hp[2][2]; 197 UINT coef[4][2][2][6][6][3]; 198 UINT eob[4][2][2][6][6][2]; 199 } counts; 200 struct { 201 DXVA_prob_vp9 p_flag; 202 DXVA_prob_vp9 p_delta; 203 RK_U8 coef_flag[4][2][2][6][6][3]; 204 RK_U8 coef_delta[4][2][2][6][6][3]; 205 } prob_flag_delta; 206 USHORT mvscale[3][2]; 207 CHAR txmode; 208 CHAR refmode; 209 } DXVA_PicParams_VP9, *LPDXVA_PicParams_VP9; 210 211 typedef struct _DXVA_Slice_VPx_Short { 212 UINT BSNALunitDataLocation; 213 UINT SliceByteInBuffer; 214 USHORT wBadSliceChopping; 215 } DXVA_Slice_VPx_Short, *LPDXVA_Slice_VPx_Short; 216 217 #endif 218 219