xref: /rockchip-linux_mpp/mpp/common/m2vd_syntax.h (revision 437bfbeb9567cca9cd9080e3f6954aa9d6a94f18)
1 /*
2  * Copyright 2015 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 __M2VD_SYNTAX_H__
18 #define __M2VD_SYNTAX_H__
19 
20 #include "rk_type.h"
21 
22 typedef struct _DXVA_PicEntry_M2V {
23     union {
24         struct {
25             RK_U8 Index7Bits     : 7;
26             RK_U8 AssociatedFlag : 1;
27         };
28         RK_U8 bPicEntry;
29     };
30 } DXVA_PicEntry_M2V;
31 
32 
33 /* ISO/IEC 13818-2 section 6.2.2.1:  sequence_Dxvaer() */
34 typedef struct M2VDDxvaSeq_t {
35     RK_U32          decode_width; //horizontal_size_value
36     RK_U32          decode_height; //vertical_size_value
37     RK_S32          aspect_ratio_information;
38     RK_S32          frame_rate_code;
39     RK_S32          bit_rate_value;
40     RK_S32          vbv_buffer_size;
41     RK_S32          constrained_parameters_flag;
42     RK_U32          load_intra_quantizer_matrix; //[TEMP]
43     RK_U32          load_non_intra_quantizer_matrix; //[TEMP]
44 } M2VDDxvaSeq;
45 
46 /* ISO/IEC 13818-2 section 6.2.2.3:  sequence_extension() */
47 typedef struct M2VDDxvaSeqExt_t {
48     RK_S32             profile_and_level_indication;
49     RK_S32             progressive_sequence;
50     RK_S32             chroma_format;
51     RK_S32             low_delay;
52     RK_S32             frame_rate_extension_n;
53     RK_S32             frame_rate_extension_d;
54 } M2VDDxvaSeqExt;
55 
56 /* ISO/IEC 13818-2 section 6.2.2.6: group_of_pictures_Dxvaer()  */
57 typedef struct M2VDDxvaGop_t {
58     RK_S32             drop_flag;
59     RK_S32             hour;
60     RK_S32             minute;
61     RK_S32             sec;
62     RK_S32             frame;
63     RK_S32             closed_gop;
64     RK_S32             broken_link;
65 } M2VDDxvaGop;
66 
67 
68 /* ISO/IEC 13818-2 section 6.2.3: picture_Dxvaer() */
69 typedef struct M2VDDxvaPic_t {
70     RK_S32             temporal_reference;
71     RK_S32             picture_coding_type;
72     RK_S32             pre_picture_coding_type;
73     RK_S32             vbv_delay;
74     RK_S32             full_pel_forward_vector;
75     RK_S32             forward_f_code;
76     RK_S32             full_pel_backward_vector;
77     RK_S32             backward_f_code;
78     RK_S32             pre_temporal_reference;
79 } M2VDDxvaPic;
80 
81 
82 /* ISO/IEC 13818-2 section 6.2.2.4:  sequence_display_extension() */
83 typedef struct M2VDDxvaSeqDispExt_t {
84     RK_S32             video_format;
85     RK_S32             color_description;
86     RK_S32             color_primaries;
87     RK_S32             transfer_characteristics;
88     RK_S32             matrix_coefficients;
89 } M2VDDxvaSeqDispExt;
90 
91 /* ISO/IEC 13818-2 section 6.2.3.1: picture_coding_extension() Dxvaer */
92 typedef struct M2VDDxvaPicCodeExt_t {
93     RK_S32             f_code[2][2];
94     RK_S32             intra_dc_precision;
95     RK_S32             picture_structure;
96     RK_S32             top_field_first;
97     RK_S32             frame_pred_frame_dct;
98     RK_S32             concealment_motion_vectors;
99     RK_S32             q_scale_type;
100     RK_S32             intra_vlc_format;
101     RK_S32             alternate_scan;
102     RK_S32             repeat_first_field;
103     RK_S32             chroma_420_type;
104     RK_S32             progressive_frame;
105     RK_S32             composite_display_flag;
106     RK_S32             v_axis;
107     RK_S32             field_sequence;
108     RK_S32             sub_carrier;
109     RK_S32             burst_amplitude;
110     RK_S32             sub_carrier_phase;
111 } M2VDDxvaPicCodeExt;
112 
113 
114 /* ISO/IEC 13818-2 section 6.2.3.3: picture_display_extension() Dxvaer */
115 typedef struct M2VDDxvaPicDispExt_t {
116     RK_S32             frame_center_horizontal_offset[3];
117     RK_S32             frame_center_vertical_offset[3];
118 } M2VDDxvaPicDispExt;
119 
120 
121 typedef struct M2VDDxvaParam_t {
122     RK_U32              bitstream_length;
123     RK_U32              bitstream_start_bit;
124     RK_U32              bitstream_offset;
125     RK_U8               *qp_tab;
126 
127     DXVA_PicEntry_M2V   CurrPic;
128     DXVA_PicEntry_M2V   frame_refs[4];
129 
130     RK_U32              seq_ext_head_dec_flag;
131 
132     M2VDDxvaSeq         seq;
133     M2VDDxvaSeqExt      seq_ext;
134     M2VDDxvaGop         gop;
135     M2VDDxvaPic         pic;
136     M2VDDxvaSeqDispExt  seq_disp_ext;
137     M2VDDxvaPicCodeExt  pic_code_ext;
138     M2VDDxvaPicDispExt  pic_disp_ext;
139 } M2VDDxvaParam;
140 
141 #endif
142