• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 Intel Corporation. All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sub license, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial portions
14  * of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef TESTVAAPI_test_data_h
26 #define TESTVAAPI_test_data_h
27 
28 #include "test_defs.h"
29 #include "test_utils.h"
30 
31 #include <map>
32 #include <va/va.h>
33 #include <va/va_drmcommon.h>
34 
35 namespace VAAPI
36 {
37 
38 static const Profiles g_vaProfiles = {
39     VAProfileNone,
40     VAProfileMPEG2Simple,
41     VAProfileMPEG2Main,
42     VAProfileMPEG4Simple,
43     VAProfileMPEG4AdvancedSimple,
44     VAProfileMPEG4Main,
45     VAProfileH264Main,
46     VAProfileH264High,
47     VAProfileVC1Simple,
48     VAProfileVC1Main,
49     VAProfileVC1Advanced,
50     VAProfileH263Baseline,
51     VAProfileJPEGBaseline,
52     VAProfileH264ConstrainedBaseline,
53     VAProfileVP8Version0_3,
54     VAProfileH264MultiviewHigh,
55     VAProfileH264StereoHigh,
56     VAProfileHEVCMain,
57     VAProfileHEVCMain10,
58     VAProfileVP9Profile0,
59     VAProfileVP9Profile1,
60     VAProfileVP9Profile2,
61     VAProfileVP9Profile3,
62 #if VA_CHECK_VERSION(1,8,0)
63     VAProfileAV1Profile0,
64     VAProfileAV1Profile1,
65 #endif
66 #if VA_CHECK_VERSION(1,18,0)
67     VAProfileH264High10,
68 #endif
69 };
70 
71 static const Profiles g_vaNoneProfiles = {
72     VAProfileNone,
73 };
74 
75 static const Profiles g_vaMPEG2Profiles = {
76     VAProfileMPEG2Main, VAProfileMPEG2Simple,
77 };
78 
79 static const Profiles g_vaMPEG4Profiles = {
80     VAProfileMPEG4Simple, VAProfileMPEG4Simple, VAProfileMPEG4AdvancedSimple,
81     VAProfileMPEG4Main,
82 };
83 
84 static const Profiles g_vaH263Profiles = {
85     VAProfileH263Baseline,
86 };
87 
88 static const Profiles g_vaH264Profiles = {
89     VAProfileH264Main, VAProfileH264High, VAProfileH264ConstrainedBaseline,
90     VAProfileH264MultiviewHigh, VAProfileH264StereoHigh,
91 #if VA_CHECK_VERSION(1,18,0)
92     VAProfileH264High10,
93 #endif
94 };
95 
96 static const Profiles g_vaVC1Profiles = {
97     VAProfileVC1Simple, VAProfileVC1Main, VAProfileVC1Advanced,
98 };
99 
100 static const Profiles g_vaJPEGProfiles = {
101     VAProfileJPEGBaseline,
102 };
103 
104 static const Profiles g_vaVP8Profiles = {
105     VAProfileVP8Version0_3,
106 };
107 
108 static const Profiles g_vaHEVCProfiles = {
109     VAProfileHEVCMain, VAProfileHEVCMain10,
110 };
111 
112 static const Profiles g_vaVP9Profiles = {
113     VAProfileVP9Profile0, VAProfileVP9Profile1, VAProfileVP9Profile2,
114     VAProfileVP9Profile3,
115 };
116 
117 static const Profiles g_vaAV1Profiles = {
118 #if VA_CHECK_VERSION(1,8,0)
119     VAProfileAV1Profile0, VAProfileAV1Profile1,
120 #endif
121 };
122 
123 static const Entrypoints g_vaEntrypoints = {
124     VAEntrypointVLD,
125     VAEntrypointIZZ,
126     VAEntrypointIDCT,
127     VAEntrypointMoComp,
128     VAEntrypointDeblocking,
129     VAEntrypointEncSlice,
130     VAEntrypointEncPicture,
131     VAEntrypointEncSliceLP,
132     VAEntrypointVideoProc,
133     VAEntrypointFEI,
134 };
135 
136 static const ConfigAttribTypes g_vaConfigAttribTypes = {
137     VAConfigAttribRTFormat,
138     VAConfigAttribSpatialResidual,
139     VAConfigAttribSpatialClipping,
140     VAConfigAttribIntraResidual,
141     VAConfigAttribEncryption,
142     VAConfigAttribRateControl,
143     VAConfigAttribDecSliceMode,
144     VAConfigAttribEncPackedHeaders,
145     VAConfigAttribEncInterlaced,
146     VAConfigAttribEncMaxRefFrames,
147     VAConfigAttribEncMaxSlices,
148     VAConfigAttribEncSliceStructure,
149     VAConfigAttribEncMacroblockInfo,
150     VAConfigAttribEncJPEG,
151     VAConfigAttribEncQualityRange,
152     VAConfigAttribEncSkipFrame,
153     VAConfigAttribEncROI,
154     VAConfigAttribEncRateControlExt,
155     VAConfigAttribFEIFunctionType,
156     VAConfigAttribFEIMVPredictors,
157 };
158 
159 static const SurfaceAttribTypes g_vaSurfaceAttribTypes = {
160     VASurfaceAttribNone,
161     VASurfaceAttribPixelFormat,
162     VASurfaceAttribMinWidth,
163     VASurfaceAttribMaxWidth,
164     VASurfaceAttribMinHeight,
165     VASurfaceAttribMaxHeight,
166     VASurfaceAttribMemoryType,
167     VASurfaceAttribExternalBufferDescriptor,
168     VASurfaceAttribUsageHint,
169     VASurfaceAttribCount,
170 };
171 
172 static const Resolutions g_vaResolutions = {
173     { 16, 16 },      { 32, 32 },     { 176, 120 },   { 352, 240 },
174     { 352, 288 },    { 480, 320 },   { 720, 480 },   { 720, 576 },
175     { 768, 576 },    { 800, 480 },   { 854, 480 },   { 1280, 720 },
176     { 1920, 1080 },  { 2048, 1080 }, { 4096, 2160 }, { 8192, 8192 },
177     { 10240, 10240 }
178 };
179 
180 static const BitMasks g_vaRTFormats = {
181     VA_RT_FORMAT_YUV420, VA_RT_FORMAT_YUV422, VA_RT_FORMAT_YUV444,
182     VA_RT_FORMAT_YUV411, VA_RT_FORMAT_YUV400, VA_RT_FORMAT_YUV420_10BPP,
183     VA_RT_FORMAT_YUV422_10, VA_RT_FORMAT_YUV444_10, VA_RT_FORMAT_YUV420_12,
184     VA_RT_FORMAT_YUV422_12, VA_RT_FORMAT_YUV444_12,
185     VA_RT_FORMAT_RGB16, VA_RT_FORMAT_RGB32, VA_RT_FORMAT_RGBP,
186     VA_RT_FORMAT_RGB32_10BPP, VA_RT_FORMAT_PROTECTED,
187 };
188 
189 static const BufferTypes g_vaBufferTypes = {
190     VAPictureParameterBufferType,
191     VAIQMatrixBufferType,
192     VABitPlaneBufferType,
193     VASliceGroupMapBufferType,
194     VASliceParameterBufferType,
195     VASliceDataBufferType,
196     VAMacroblockParameterBufferType,
197     VAResidualDataBufferType,
198     VADeblockingParameterBufferType,
199     VAImageBufferType,
200     VAProtectedSliceDataBufferType,
201     VAQMatrixBufferType,
202     VAHuffmanTableBufferType,
203     VAProbabilityBufferType,
204     VAEncCodedBufferType,
205     VAEncSequenceParameterBufferType,
206     VAEncPictureParameterBufferType,
207     VAEncSliceParameterBufferType,
208     VAEncPackedHeaderParameterBufferType,
209     VAEncPackedHeaderDataBufferType,
210     VAEncMiscParameterBufferType,
211     VAEncMacroblockParameterBufferType,
212     VAEncMacroblockMapBufferType,
213     VAProcPipelineParameterBufferType,
214     VAProcFilterParameterBufferType,
215     VAEncFEIMVBufferType,
216     VAEncFEIMBCodeBufferType,
217     VAEncFEIDistortionBufferType,
218     VAEncFEIMBControlBufferType,
219     VAEncFEIMVPredictorBufferType,
220 };
221 
222 static const BitMasks g_vaRateControls = {
223     VA_RC_NONE, VA_RC_CBR, VA_RC_VBR, VA_RC_VCM, VA_RC_CQP,
224     VA_RC_VBR_CONSTRAINED, VA_RC_ICQ, VA_RC_MB, VA_RC_CFS,
225     VA_RC_PARALLEL, VA_RC_QVBR, VA_RC_AVBR,
226 #if VA_CHECK_VERSION(1, 10, 0)
227     VA_RC_TCBRC,
228 #endif
229 };
230 
231 static const BitMasks g_vaDecSliceModes = {
232     VA_DEC_SLICE_MODE_NORMAL, VA_DEC_SLICE_MODE_BASE,
233 };
234 
235 static const BitMasks g_vaEncPackedHeaders = {
236     VA_ENC_PACKED_HEADER_SEQUENCE, VA_ENC_PACKED_HEADER_PICTURE,
237     VA_ENC_PACKED_HEADER_SLICE, VA_ENC_PACKED_HEADER_MISC,
238     VA_ENC_PACKED_HEADER_RAW_DATA,
239 };
240 
241 static const BitMasks g_vaEncInterlaced = {
242     VA_ENC_INTERLACED_FRAME, VA_ENC_INTERLACED_FIELD, VA_ENC_INTERLACED_MBAFF,
243     VA_ENC_INTERLACED_PAFF,
244 };
245 
246 static const BitMasks g_vaFEIFunctionTypes = {
247     VA_FEI_FUNCTION_ENC, VA_FEI_FUNCTION_PAK, VA_FEI_FUNCTION_ENC_PAK,
248 };
249 
250 #if VA_CHECK_VERSION(1, 11, 0)
251 static const BitMasks g_vaEncryptionTypes = {
252     VA_ENCRYPTION_TYPE_FULLSAMPLE_CTR,
253     VA_ENCRYPTION_TYPE_FULLSAMPLE_CBC,
254     VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR,
255     VA_ENCRYPTION_TYPE_SUBSAMPLE_CBC,
256 };
257 #endif
258 
259 static const std::map<VAConfigAttribType, const BitMasks&>
260 g_vaConfigAttribBitMasks = {
261     {VAConfigAttribRTFormat, g_vaRTFormats},
262     {VAConfigAttribRateControl, g_vaRateControls},
263     {VAConfigAttribDecSliceMode, g_vaDecSliceModes},
264     {VAConfigAttribEncPackedHeaders, g_vaEncPackedHeaders},
265     {VAConfigAttribEncInterlaced, g_vaEncInterlaced},
266     {VAConfigAttribFEIFunctionType, g_vaFEIFunctionTypes},
267 #if VA_CHECK_VERSION(1, 11, 0)
268     {VAConfigAttribEncryption, g_vaEncryptionTypes},
269 #endif
270 };
271 
272 static const BitMasks g_vaSurfaceMemTypes = {
273     VA_SURFACE_ATTRIB_MEM_TYPE_VA, VA_SURFACE_ATTRIB_MEM_TYPE_V4L2,
274     VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR, VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM,
275     VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME,
276     VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2,
277 #if VA_CHECK_VERSION(1, 21, 0)
278     VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3,
279 #endif
280 };
281 
282 static const std::map<VASurfaceAttribType, const BitMasks&>
283 g_vaSurfaceAttribBitMasks = {
284     {VASurfaceAttribMemoryType, g_vaSurfaceMemTypes},
285 };
286 
287 } // namespace VAAPI
288 #endif
289