xref: /OK3568_Linux_fs/external/mpp/mpp/common/av1d_syntax.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2021 Rockchip Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _AV1D_SYNTAX_H_
18 #define _AV1D_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_AV1 {
37     union {
38         struct {
39             UCHAR Index7Bits     : 7;
40             UCHAR AssociatedFlag : 1;
41         };
42         UCHAR bPicEntry;
43     };
44 } DXVA_PicEntry_AV1, *LPDXVA_PicEntry_AV1;
45 
46 
47 typedef struct _DXVA_PicParams_AV1 {
48     DXVA_PicEntry_AV1 CurrPic;
49     USHORT width               ;
50     USHORT height              ;
51     USHORT max_width           ;
52     USHORT max_height          ;
53     USHORT CurrPicTextureIndex ;
54     USHORT superres_denom      ;
55     USHORT bitdepth            ;
56     USHORT seq_profile         ;
57     union {
58         struct {
59             UINT32 use_128x128_superblock       : 1;
60             UINT32 intra_edge_filter            : 1;
61             UINT32 interintra_compound          : 1;
62             UINT32 masked_compound              : 1;
63             UINT32 warped_motion                : 1;
64             UINT32 dual_filter                  : 1;
65             UINT32 jnt_comp                     : 1;
66             UINT32 screen_content_tools         : 1;
67             UINT32 integer_mv                   : 2;
68             UINT32 cdef_en                      : 1;
69             UINT32 restoration                  : 1;
70             UINT32 film_grain_en                : 1;
71             UINT32 intrabc                      : 1;
72             UINT32 high_precision_mv            : 1;
73             UINT32 switchable_motion_mode       : 1;
74             UINT32 filter_intra                 : 1;
75             UINT32 disable_frame_end_update_cdf : 1;
76             UINT32 disable_cdf_update           : 1;
77             UINT32 reference_mode               : 1;
78             UINT32 skip_mode                    : 1;
79             UINT32 reduced_tx_set               : 1;
80             UINT32 superres                     : 1;
81             UINT32 tx_mode                      : 3;
82             UINT32 use_ref_frame_mvs            : 1;
83             UINT32 enable_ref_frame_mvs         : 1;
84             UINT32 reference_frame_update       : 1;
85             UINT32 error_resilient_mode         : 1;
86         } coding;
87     };
88 
89     struct {
90         USHORT   cols;
91         USHORT   rows;
92         USHORT   context_update_id;
93         USHORT   widths[64];
94         USHORT   heights[64];
95         UINT32   tile_offset_start[128];
96         UINT32   tile_offset_end[128];
97         UCHAR    tile_sz_mag;
98     } tiles;
99 
100     struct {
101         UCHAR frame_type    ;
102         UCHAR show_frame    ;
103         UCHAR showable_frame;
104         UCHAR subsampling_x ;
105         UCHAR subsampling_y ;
106         UCHAR mono_chrome   ;
107     } format;
108 
109     UCHAR primary_ref_frame;
110     UCHAR order_hint;
111     UCHAR order_hint_bits;
112 
113     struct {
114         UCHAR filter_level[2]              ;
115         UCHAR filter_level_u               ;
116         UCHAR filter_level_v               ;
117         UCHAR sharpness_level              ;
118         UCHAR mode_ref_delta_enabled       ;
119         UCHAR mode_ref_delta_update        ;
120         UCHAR delta_lf_multi               ;
121         UCHAR delta_lf_present             ;
122         UCHAR delta_lf_res                 ;
123         CHAR  ref_deltas[8]                ;
124         CHAR  mode_deltas[2]               ;
125         UCHAR frame_restoration_type[3]    ;
126         UCHAR log2_restoration_unit_size[3];
127     } loop_filter;
128 
129     struct {
130         UCHAR delta_q_present;
131         UCHAR delta_q_res    ;
132         UCHAR base_qindex    ;
133         CHAR  y_dc_delta_q   ;
134         CHAR  u_dc_delta_q   ;
135         CHAR  v_dc_delta_q   ;
136         CHAR  u_ac_delta_q   ;
137         CHAR  v_ac_delta_q   ;
138         UCHAR qm_y           ;
139         UCHAR qm_u           ;
140         UCHAR qm_v           ;
141     } quantization;
142 
143     struct {
144         UCHAR damping;
145         UCHAR bits;
146 
147         struct {
148             UCHAR primary;
149             UCHAR secondary;
150         } y_strengths[8];
151         struct {
152             UCHAR primary;
153             UCHAR secondary;
154         } uv_strengths[8];
155     } cdef;
156 
157     struct {
158         UCHAR  enabled           ;
159         UCHAR  update_map        ;
160         UCHAR  update_data       ;
161         UCHAR  temporal_update   ;
162         UCHAR  feature_mask[8]   ;
163         INT    feature_data[8][8];
164     } segmentation;
165 
166     struct {
167         UCHAR apply_grain              ;
168         UCHAR scaling_shift_minus8     ;
169         UCHAR chroma_scaling_from_luma ;
170         UCHAR ar_coeff_lag             ;
171         UCHAR ar_coeff_shift_minus6    ;
172         UCHAR grain_scale_shift        ;
173         UCHAR overlap_flag             ;
174         UCHAR clip_to_restricted_range ;
175         UCHAR matrix_coeff_is_identity ;
176         UCHAR num_y_points             ;
177         UCHAR num_cb_points            ;
178         UCHAR num_cr_points            ;
179         UCHAR scaling_points_y[14][2]  ;
180         UCHAR scaling_points_cb[10][2] ;
181         UCHAR scaling_points_cr[10][2] ;
182         UCHAR ar_coeffs_y[24]          ;
183         UCHAR ar_coeffs_cb[25]         ;
184         UCHAR ar_coeffs_cr[25]         ;
185         UCHAR cb_mult                  ;
186         UCHAR cb_luma_mult             ;
187         UCHAR cr_mult                  ;
188         UCHAR cr_luma_mult             ;
189 
190         USHORT grain_seed              ;
191         USHORT cb_offset               ;
192         USHORT cr_offset               ;
193     } film_grain;
194 
195     struct {
196         UINT32  width;
197         UINT32  height;
198         UINT32  order_hint;
199         UINT32  lst_frame_offset;
200         UINT32  lst2_frame_offset;
201         UINT32  lst3_frame_offset;
202         UINT32  gld_frame_offset;
203         UINT32  bwd_frame_offset;
204         UINT32  alt2_frame_offset;
205         UINT32  alt_frame_offset;
206         UINT32  is_intra_frame;
207         UINT32  intra_only;
208         CHAR    Index;
209         UCHAR   wminvalid;
210         UCHAR   wmtype;
211         RK_S32  wmmat[6];
212         USHORT  alpha, beta, gamma, delta;
213     } frame_refs[7];
214 
215     UCHAR coded_lossless;
216     UCHAR interp_filter;
217     UCHAR RefFrameMapTextureIndex[7];
218     UINT32 upscaled_width;
219     UINT32 frame_to_show_map_idx;
220     UINT32 frame_tag_size;
221     UINT32 offset_to_dct_parts;
222     UCHAR  skip_ref0;
223     UCHAR  skip_ref1;
224     RK_U8 refresh_frame_flags;
225     void         *cdfs;
226     void          *cdfs_ndvc;
227     RK_U8 tile_cols_log2;
228 } DXVA_PicParams_AV1, *LPDXVA_PicParams_AV1;
229 
230 typedef struct _DXVA_Slice_AV1_Short {
231     UINT BSNALunitDataLocation;
232     UINT SliceByteInBuffer;
233     USHORT wBadSliceChopping;
234 } DXVA_Slice_AV1_Short, *LPDXVA_Slice_AV1_Short;
235 
236 #endif
237