@desklink/host 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/NOTICE +23 -0
  2. package/README.md +107 -55
  3. package/bin/desklink-host.mjs +2 -2
  4. package/dist/bridge.d.ts +1 -0
  5. package/dist/bridge.d.ts.map +1 -1
  6. package/dist/bridge.js +12 -4
  7. package/dist/bridge.js.map +1 -1
  8. package/dist/engineProcess.d.ts.map +1 -1
  9. package/dist/engineProcess.js +1 -0
  10. package/dist/engineProcess.js.map +1 -1
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/keeper.d.ts +52 -0
  16. package/dist/keeper.d.ts.map +1 -0
  17. package/dist/keeper.js +101 -0
  18. package/dist/keeper.js.map +1 -0
  19. package/dist/protocol.d.ts +26 -0
  20. package/dist/protocol.d.ts.map +1 -1
  21. package/dist/protocol.js.map +1 -1
  22. package/dist/resolveEngine.d.ts +3 -3
  23. package/dist/resolveEngine.d.ts.map +1 -1
  24. package/dist/resolveEngine.js +24 -11
  25. package/dist/resolveEngine.js.map +1 -1
  26. package/docs/BOUNDARY.md +20 -8
  27. package/docs/PROTOCOL.md +347 -24
  28. package/engine/Cargo.lock +47 -1
  29. package/engine/Cargo.toml +13 -2
  30. package/engine/build.rs +28 -2
  31. package/engine/native/nvenc_shim.c +453 -0
  32. package/engine/native/vaapi_shim.c +727 -0
  33. package/engine/native/vpx_shim.c +54 -4
  34. package/engine/native/vt_shim.c +448 -0
  35. package/engine/src/capture.rs +75 -55
  36. package/engine/src/capture_mac.rs +24 -14
  37. package/engine/src/convert.rs +286 -61
  38. package/engine/src/encoder.rs +122 -13
  39. package/engine/src/h264.rs +188 -0
  40. package/engine/src/h264_nvenc.rs +308 -0
  41. package/engine/src/h264_openh264.rs +735 -0
  42. package/engine/src/h264_vaapi.rs +263 -0
  43. package/engine/src/h264_vt.rs +368 -0
  44. package/engine/src/keeper.rs +622 -0
  45. package/engine/src/mac.rs +9 -6
  46. package/engine/src/main.rs +64 -4
  47. package/engine/src/peer.rs +887 -42
  48. package/engine/src/protocol.rs +153 -4
  49. package/engine/src/session.rs +1547 -137
  50. package/engine/src/x11.rs +210 -9
  51. package/engine/src/x11_mac.rs +12 -0
  52. package/engine/vendor/libva/COPYING +19 -0
  53. package/engine/vendor/libva/va/va.h +5450 -0
  54. package/engine/vendor/libva/va/va_dec_av1.h +695 -0
  55. package/engine/vendor/libva/va/va_dec_hevc.h +616 -0
  56. package/engine/vendor/libva/va/va_dec_jpeg.h +157 -0
  57. package/engine/vendor/libva/va/va_dec_vp8.h +249 -0
  58. package/engine/vendor/libva/va/va_dec_vp9.h +312 -0
  59. package/engine/vendor/libva/va/va_dec_vvc.h +688 -0
  60. package/engine/vendor/libva/va/va_drm.h +61 -0
  61. package/engine/vendor/libva/va/va_enc_av1.h +1010 -0
  62. package/engine/vendor/libva/va/va_enc_h264.h +659 -0
  63. package/engine/vendor/libva/va/va_enc_hevc.h +958 -0
  64. package/engine/vendor/libva/va/va_enc_jpeg.h +162 -0
  65. package/engine/vendor/libva/va/va_enc_mpeg2.h +308 -0
  66. package/engine/vendor/libva/va/va_enc_vp8.h +350 -0
  67. package/engine/vendor/libva/va/va_enc_vp9.h +639 -0
  68. package/engine/vendor/libva/va/va_fei.h +170 -0
  69. package/engine/vendor/libva/va/va_fei_h264.h +505 -0
  70. package/engine/vendor/libva/va/va_fei_hevc.h +254 -0
  71. package/engine/vendor/libva/va/va_prot.h +525 -0
  72. package/engine/vendor/libva/va/va_version.h +87 -0
  73. package/engine/vendor/libva/va/va_vpp.h +1590 -0
  74. package/engine/vendor/nv-codec-headers/LICENSE +24 -0
  75. package/engine/vendor/nv-codec-headers/README +7 -0
  76. package/engine/vendor/nv-codec-headers/include/ffnvcodec/nvEncodeAPI.h +3825 -0
  77. package/examples/reference-client.html +1 -1
  78. package/package.json +3 -2
@@ -0,0 +1,695 @@
1
+ /*
2
+ * Copyright (c) 2019 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 INTEL 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
+ /**
26
+ * \file va_dec_av1.h
27
+ * \brief The AV1 decoding API
28
+ *
29
+ * This file contains the \ref api_dec_av1 "AV1 decoding API".
30
+ */
31
+
32
+ #ifndef VA_DEC_AV1_H
33
+ #define VA_DEC_AV1_H
34
+
35
+ #include <stdint.h>
36
+
37
+ #ifdef __cplusplus
38
+ extern "C" {
39
+ #endif
40
+
41
+ /**
42
+ * \defgroup api_dec_av1 AV1 decoding API
43
+ *
44
+ * This AV1 decoding API supports 8-bit/10bit 420 format only.
45
+ *
46
+ * @{
47
+ */
48
+
49
+ /** Attribute value for VAConfigAttribDecAV1Features.
50
+ *
51
+ * This attribute decribes the supported features of a AV1
52
+ * decoder configuration.
53
+ *
54
+ */
55
+ typedef union VAConfigAttribValDecAV1Features {
56
+ struct {
57
+ /** large scale tile
58
+ *
59
+ * This conveys whether AV1 large scale tile is supported by HW.
60
+ * 0 - unsupported, 1 - supported.
61
+ */
62
+ uint32_t lst_support : 2;
63
+ /* Reserved for future use. */
64
+ uint32_t reserved : 30;
65
+ } bits;
66
+ uint32_t value;
67
+ } VAConfigAttribValDecAV1Features;
68
+
69
+ /**
70
+ * \brief AV1 Decoding Picture Parameter Buffer Structure
71
+ *
72
+ * This structure conveys picture level parameters.
73
+ * App should send a surface with this data structure down to VAAPI once
74
+ * per frame.
75
+ *
76
+ */
77
+
78
+ /** \brief Segmentation Information
79
+ */
80
+ typedef struct _VASegmentationStructAV1 {
81
+ union {
82
+ struct {
83
+ /** Indicates whether segmentation map related syntax elements
84
+ * are present or not for current frame. If equal to 0,
85
+ * the segmentation map related syntax elements are
86
+ * not present for the current frame and the control flags of
87
+ * segmentation map related tables feature_data[][], and
88
+ * feature_mask[] are not valid and shall be ignored by accelerator.
89
+ */
90
+ uint32_t enabled : 1;
91
+ /** Value 1 indicates that the segmentation map are updated
92
+ * during the decoding of this frame.
93
+ * Value 0 means that the segmentation map from the previous
94
+ * frame is used.
95
+ */
96
+ uint32_t update_map : 1;
97
+ /** Value 1 indicates that the updates to the segmentation map
98
+ * are coded relative to the existing segmentation map.
99
+ * Value 0 indicates that the new segmentation map is coded
100
+ * without reference to the existing segmentation map.
101
+ */
102
+ uint32_t temporal_update : 1;
103
+ /** Value 1 indicates that new parameters are about to be
104
+ * specified for each segment.
105
+ * Value 0 indicates that the segmentation parameters
106
+ * should keep their existing values.
107
+ */
108
+ uint32_t update_data : 1;
109
+
110
+ /** \brief Reserved bytes for future use, must be zero */
111
+ uint32_t reserved : 28;
112
+ } bits;
113
+ uint32_t value;
114
+ } segment_info_fields;
115
+
116
+ /** \brief Segmentation parameters for current frame.
117
+ * feature_data[segment_id][feature_id]
118
+ * where segment_id has value range [0..7] indicating the segment id.
119
+ * and feature_id is defined as
120
+ typedef enum {
121
+ SEG_LVL_ALT_Q, // Use alternate Quantizer ....
122
+ SEG_LVL_ALT_LF_Y_V, // Use alternate loop filter value on y plane vertical
123
+ SEG_LVL_ALT_LF_Y_H, // Use alternate loop filter value on y plane horizontal
124
+ SEG_LVL_ALT_LF_U, // Use alternate loop filter value on u plane
125
+ SEG_LVL_ALT_LF_V, // Use alternate loop filter value on v plane
126
+ SEG_LVL_REF_FRAME, // Optional Segment reference frame
127
+ SEG_LVL_SKIP, // Optional Segment (0,0) + skip mode
128
+ SEG_LVL_GLOBALMV,
129
+ SEG_LVL_MAX
130
+ } SEG_LVL_FEATURES;
131
+ * feature_data[][] is equivalent to variable FeatureData[][] in spec,
132
+ * which is after clip3() operation.
133
+ * Clip3(x, y, z) = (z < x)? x : ((z > y)? y : z);
134
+ * The limit is defined in Segmentation_Feature_Max[ SEG_LVL_MAX ] = {
135
+ * 255, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, MAX_LOOP_FILTER, 7, 0, 0 }
136
+ */
137
+ int16_t feature_data[8][8];
138
+
139
+ /** \brief indicates if a feature is enabled or not.
140
+ * Each bit field itself is the feature_id. Index is segment_id.
141
+ * feature_mask[segment_id] & (1 << feature_id) equal to 1 specify that the feature of
142
+ * feature_id for segment of segment_id is enabled, otherwise disabled.
143
+ */
144
+ uint8_t feature_mask[8];
145
+
146
+ /** \brief Reserved bytes for future use, must be zero */
147
+ uint32_t va_reserved[VA_PADDING_LOW];
148
+
149
+ } VASegmentationStructAV1;
150
+
151
+ /** \brief Film Grain Information
152
+ */
153
+ typedef struct _VAFilmGrainStructAV1 {
154
+ union {
155
+ struct {
156
+ /** \brief Specify whether or not film grain is applied on current frame.
157
+ * If set to 0, all the rest parameters should be set to zero
158
+ * and ignored.
159
+ */
160
+ uint32_t apply_grain : 1;
161
+ uint32_t chroma_scaling_from_luma : 1;
162
+ uint32_t grain_scaling_minus_8 : 2;
163
+ uint32_t ar_coeff_lag : 2;
164
+ uint32_t ar_coeff_shift_minus_6 : 2;
165
+ uint32_t grain_scale_shift : 2;
166
+ uint32_t overlap_flag : 1;
167
+ uint32_t clip_to_restricted_range : 1;
168
+ /** \brief Reserved bytes for future use, must be zero */
169
+ uint32_t reserved : 20;
170
+ } bits;
171
+ uint32_t value;
172
+ } film_grain_info_fields;
173
+
174
+ uint16_t grain_seed;
175
+ /* value range [0..14] */
176
+ uint8_t num_y_points;
177
+ uint8_t point_y_value[14];
178
+ uint8_t point_y_scaling[14];
179
+ /* value range [0..10] */
180
+ uint8_t num_cb_points;
181
+ uint8_t point_cb_value[10];
182
+ uint8_t point_cb_scaling[10];
183
+ /* value range [0..10] */
184
+ uint8_t num_cr_points;
185
+ uint8_t point_cr_value[10];
186
+ uint8_t point_cr_scaling[10];
187
+ /* value range [-128..127] */
188
+ int8_t ar_coeffs_y[24];
189
+ int8_t ar_coeffs_cb[25];
190
+ int8_t ar_coeffs_cr[25];
191
+ uint8_t cb_mult;
192
+ uint8_t cb_luma_mult;
193
+ uint16_t cb_offset;
194
+ uint8_t cr_mult;
195
+ uint8_t cr_luma_mult;
196
+ uint16_t cr_offset;
197
+
198
+ /** \brief Reserved bytes for future use, must be zero */
199
+ uint32_t va_reserved[VA_PADDING_LOW];
200
+
201
+ } VAFilmGrainStructAV1;
202
+
203
+ typedef enum {
204
+ /** identity transformation, 0-parameter */
205
+ VAAV1TransformationIdentity = 0,
206
+ /** translational motion, 2-parameter */
207
+ VAAV1TransformationTranslation = 1,
208
+ /** simplified affine with rotation + zoom only, 4-parameter */
209
+ VAAV1TransformationRotzoom = 2,
210
+ /** affine, 6-parameter */
211
+ VAAV1TransformationAffine = 3,
212
+ /** transformation count */
213
+ VAAV1TransformationCount
214
+ } VAAV1TransformationType;
215
+
216
+ typedef struct _VAWarpedMotionParamsAV1 {
217
+
218
+ /** \brief Specify the type of warped motion */
219
+ VAAV1TransformationType wmtype;
220
+
221
+ /** \brief Specify warp motion parameters
222
+ * wm.wmmat[] corresponds to gm_params[][] in spec.
223
+ * Details in AV1 spec section 5.9.24 or refer to libaom code
224
+ * https://aomedia.googlesource.com/aom/+/refs/heads/master/av1/decoder/decodeframe.c
225
+ */
226
+ int32_t wmmat[8];
227
+
228
+ /* valid or invalid on affine set */
229
+ uint8_t invalid;
230
+
231
+ /** \brief Reserved bytes for future use, must be zero */
232
+ uint32_t va_reserved[VA_PADDING_LOW];
233
+
234
+ } VAWarpedMotionParamsAV1;
235
+
236
+ /**
237
+ * \brief AV1 Decoding Picture Parameter Buffer Structure
238
+ *
239
+ * This structure conveys picture level parameters and should be sent once
240
+ * per frame.
241
+ *
242
+ */
243
+ typedef struct _VADecPictureParameterBufferAV1 {
244
+ /**@{*/
245
+
246
+ /** \brief sequence level information
247
+ */
248
+
249
+ /** \brief AV1 bit stream profile
250
+ */
251
+ uint8_t profile;
252
+
253
+ uint8_t order_hint_bits_minus_1;
254
+
255
+ /** \brief bit depth index
256
+ * value range [0..2]
257
+ * 0 - bit depth 8;
258
+ * 1 - bit depth 10;
259
+ * 2 - bit depth 12;
260
+ */
261
+ uint8_t bit_depth_idx;
262
+
263
+ /** \brief corresponds to AV1 spec variable of the same name. */
264
+ uint8_t matrix_coefficients;
265
+
266
+ union {
267
+ struct {
268
+ uint32_t still_picture : 1;
269
+ uint32_t use_128x128_superblock : 1;
270
+ uint32_t enable_filter_intra : 1;
271
+ uint32_t enable_intra_edge_filter : 1;
272
+
273
+ /** read_compound_tools */
274
+ uint32_t enable_interintra_compound : 1;
275
+ uint32_t enable_masked_compound : 1;
276
+
277
+ uint32_t enable_dual_filter : 1;
278
+ uint32_t enable_order_hint : 1;
279
+ uint32_t enable_jnt_comp : 1;
280
+ uint32_t enable_cdef : 1;
281
+ uint32_t mono_chrome : 1;
282
+ uint32_t color_range : 1;
283
+ uint32_t subsampling_x : 1;
284
+ uint32_t subsampling_y : 1;
285
+ va_deprecated uint32_t chroma_sample_position : 1;
286
+ uint32_t film_grain_params_present : 1;
287
+ /** \brief Reserved bytes for future use, must be zero */
288
+ uint32_t reserved : 16;
289
+ } fields;
290
+ uint32_t value;
291
+ } seq_info_fields;
292
+
293
+ /** \brief Picture level information
294
+ */
295
+
296
+ /** \brief buffer description of decoded current picture
297
+ */
298
+ VASurfaceID current_frame;
299
+
300
+ /** \brief display buffer of current picture
301
+ * Used for film grain applied decoded picture.
302
+ * Valid only when apply_grain equals 1.
303
+ */
304
+ VASurfaceID current_display_picture;
305
+
306
+ /** \brief number of anchor frames for large scale tile
307
+ * This parameter gives the number of entries of anchor_frames_list[].
308
+ * Value range [0..128].
309
+ */
310
+ uint8_t anchor_frames_num;
311
+
312
+ /** \brief anchor frame list for large scale tile
313
+ * For large scale tile applications, the anchor frames could come from
314
+ * previously decoded frames in current sequence (aka. internal), or
315
+ * from external sources.
316
+ * For external anchor frames, application should call API
317
+ * vaCreateBuffer() to generate frame buffers and populate them with
318
+ * pixel frames. And this process may happen multiple times.
319
+ * The array anchor_frames_list[] is used to register all the available
320
+ * anchor frames from both external and internal, up to the current
321
+ * frame instance. If a previously registerred anchor frame is no longer
322
+ * needed, it should be removed from the list. But it does not prevent
323
+ * applications from relacing the frame buffer with new anchor frames.
324
+ * Please note that the internal anchor frames may not still be present
325
+ * in the current DPB buffer. But if it is in the anchor_frames_list[],
326
+ * it should not be replaced with other frames or removed from memory
327
+ * until it is not shown in the list.
328
+ * This number of entries of the list is given by parameter anchor_frames_num.
329
+ */
330
+ VASurfaceID *anchor_frames_list;
331
+
332
+ /** \brief Picture resolution minus 1
333
+ * Picture original resolution. If SuperRes is enabled,
334
+ * this is the upscaled resolution.
335
+ * value range [0..65535]
336
+ */
337
+ uint16_t frame_width_minus1;
338
+ uint16_t frame_height_minus1;
339
+
340
+ /** \brief Output frame buffer size in unit of tiles
341
+ * Valid only when large_scale_tile equals 1.
342
+ * value range [0..65535]
343
+ */
344
+ uint16_t output_frame_width_in_tiles_minus_1;
345
+ uint16_t output_frame_height_in_tiles_minus_1;
346
+
347
+ /** \brief Surface indices of reference frames in DPB.
348
+ *
349
+ * Contains a list of uncompressed frame buffer surface indices as references.
350
+ * Application needs to make sure all the entries point to valid frames
351
+ * except for intra frames by checking ref_frame_id[]. If missing frame
352
+ * is identified, application may choose to perform error recovery by
353
+ * pointing problematic index to an alternative frame buffer.
354
+ * Driver is not responsible to validate reference frames' id.
355
+ */
356
+ VASurfaceID ref_frame_map[8];
357
+
358
+ /** \brief Reference frame indices.
359
+ *
360
+ * Contains a list of indices into ref_frame_map[8].
361
+ * It specifies the reference frame correspondence.
362
+ * The indices of the array are defined as [LAST_FRAME – LAST_FRAME,
363
+ * LAST2_FRAME – LAST_FRAME, …, ALTREF_FRAME – LAST_FRAME], where each
364
+ * symbol is defined as:
365
+ * enum{INTRA_FRAME = 0, LAST_FRAME, LAST2_FRAME, LAST3_FRAME, GOLDEN_FRAME,
366
+ * BWDREF_FRAME, ALTREF2_FRAME, ALTREF_FRAME};
367
+ */
368
+ uint8_t ref_frame_idx[7];
369
+
370
+ /** \brief primary reference frame index
371
+ * Index into ref_frame_idx[], specifying which reference frame contains
372
+ * propagated info that should be loaded at the start of the frame.
373
+ * When value equals PRIMARY_REF_NONE (7), it indicates there is
374
+ * no primary reference frame.
375
+ * value range [0..7]
376
+ */
377
+ uint8_t primary_ref_frame;
378
+
379
+ uint8_t order_hint;
380
+
381
+ VASegmentationStructAV1 seg_info;
382
+ VAFilmGrainStructAV1 film_grain_info;
383
+
384
+ /** \brief tile structure
385
+ * When uniform_tile_spacing_flag == 1, width_in_sbs_minus_1[] and
386
+ * height_in_sbs_minus_1[] should be ignored, which will be generated
387
+ * by driver based on tile_cols and tile_rows.
388
+ */
389
+ uint8_t tile_cols;
390
+ uint8_t tile_rows;
391
+
392
+ /* The width/height of a tile minus 1 in units of superblocks. Though the
393
+ * maximum number of tiles is 64, since ones of the last tile are computed
394
+ * from ones of the other tiles and frame_width/height, they are not
395
+ * necessarily specified.
396
+ */
397
+ uint16_t width_in_sbs_minus_1[63];
398
+ uint16_t height_in_sbs_minus_1[63];
399
+
400
+ /** \brief number of tiles minus 1 in large scale tile list
401
+ * Same as AV1 semantic element.
402
+ * Valid only when large_scale_tiles == 1.
403
+ */
404
+ uint16_t tile_count_minus_1;
405
+
406
+ /* specify the tile index for context updating */
407
+ uint16_t context_update_tile_id;
408
+
409
+ union {
410
+ struct {
411
+ /** \brief flags for current picture
412
+ * same syntax and semantic as those in AV1 code
413
+ */
414
+
415
+ /** \brief Frame Type
416
+ * 0: KEY_FRAME;
417
+ * 1: INTER_FRAME;
418
+ * 2: INTRA_ONLY_FRAME;
419
+ * 3: SWITCH_FRAME
420
+ * For SWITCH_FRAME, application shall set error_resilient_mode = 1,
421
+ * refresh_frame_flags, etc. appropriately. And driver will convert it
422
+ * to INTER_FRAME.
423
+ */
424
+ uint32_t frame_type : 2;
425
+ uint32_t show_frame : 1;
426
+ uint32_t showable_frame : 1;
427
+ uint32_t error_resilient_mode : 1;
428
+ uint32_t disable_cdf_update : 1;
429
+ uint32_t allow_screen_content_tools : 1;
430
+ uint32_t force_integer_mv : 1;
431
+ uint32_t allow_intrabc : 1;
432
+ uint32_t use_superres : 1;
433
+ uint32_t allow_high_precision_mv : 1;
434
+ uint32_t is_motion_mode_switchable : 1;
435
+ uint32_t use_ref_frame_mvs : 1;
436
+ /* disable_frame_end_update_cdf is coded as refresh_frame_context. */
437
+ uint32_t disable_frame_end_update_cdf : 1;
438
+ uint32_t uniform_tile_spacing_flag : 1;
439
+ uint32_t allow_warped_motion : 1;
440
+ /** \brief indicate if current frame in large scale tile mode */
441
+ uint32_t large_scale_tile : 1;
442
+
443
+ /** \brief Reserved bytes for future use, must be zero */
444
+ uint32_t reserved : 15;
445
+ } bits;
446
+ uint32_t value;
447
+ } pic_info_fields;
448
+
449
+ /** \brief Supper resolution scale denominator.
450
+ * When use_superres=1, superres_scale_denominator must be in the range [9..16].
451
+ * When use_superres=0, superres_scale_denominator must be 8.
452
+ */
453
+ uint8_t superres_scale_denominator;
454
+
455
+ /** \brief Interpolation filter.
456
+ * value range [0..4]
457
+ */
458
+ uint8_t interp_filter;
459
+
460
+ /** \brief luma loop filter levels.
461
+ * value range [0..63].
462
+ */
463
+ uint8_t filter_level[2];
464
+
465
+ /** \brief chroma loop filter levels.
466
+ * value range [0..63].
467
+ */
468
+ uint8_t filter_level_u;
469
+ uint8_t filter_level_v;
470
+
471
+ union {
472
+ struct {
473
+ /** \brief flags for reference pictures
474
+ * same syntax and semantic as those in AV1 code
475
+ */
476
+ uint8_t sharpness_level : 3;
477
+ uint8_t mode_ref_delta_enabled : 1;
478
+ uint8_t mode_ref_delta_update : 1;
479
+
480
+ /** \brief Reserved bytes for future use, must be zero */
481
+ uint8_t reserved : 3;
482
+ } bits;
483
+ uint8_t value;
484
+ } loop_filter_info_fields;
485
+
486
+ /** \brief The adjustment needed for the filter level based on
487
+ * the chosen reference frame.
488
+ * value range [-64..63].
489
+ */
490
+ int8_t ref_deltas[8];
491
+
492
+ /** \brief The adjustment needed for the filter level based on
493
+ * the chosen mode.
494
+ * value range [-64..63].
495
+ */
496
+ int8_t mode_deltas[2];
497
+
498
+ /** \brief quantization
499
+ */
500
+ /** \brief Y AC index
501
+ * value range [0..255]
502
+ */
503
+ uint8_t base_qindex;
504
+ /** \brief Y DC delta from Y AC
505
+ * value range [-64..63]
506
+ */
507
+ int8_t y_dc_delta_q;
508
+ /** \brief U DC delta from Y AC
509
+ * value range [-64..63]
510
+ */
511
+ int8_t u_dc_delta_q;
512
+ /** \brief U AC delta from Y AC
513
+ * value range [-64..63]
514
+ */
515
+ int8_t u_ac_delta_q;
516
+ /** \brief V DC delta from Y AC
517
+ * value range [-64..63]
518
+ */
519
+ int8_t v_dc_delta_q;
520
+ /** \brief V AC delta from Y AC
521
+ * value range [-64..63]
522
+ */
523
+ int8_t v_ac_delta_q;
524
+
525
+ /** \brief quantization_matrix
526
+ */
527
+ union {
528
+ struct {
529
+ uint16_t using_qmatrix : 1;
530
+ /** \brief qm level
531
+ * value range [0..15]
532
+ * Invalid if using_qmatrix equals 0.
533
+ */
534
+ uint16_t qm_y : 4;
535
+ uint16_t qm_u : 4;
536
+ uint16_t qm_v : 4;
537
+
538
+ /** \brief Reserved bytes for future use, must be zero */
539
+ uint16_t reserved : 3;
540
+ } bits;
541
+ uint16_t value;
542
+ } qmatrix_fields;
543
+
544
+ union {
545
+ struct {
546
+ /** \brief delta_q parameters
547
+ */
548
+ uint32_t delta_q_present_flag : 1;
549
+ uint32_t log2_delta_q_res : 2;
550
+
551
+ /** \brief delta_lf parameters
552
+ */
553
+ uint32_t delta_lf_present_flag : 1;
554
+ uint32_t log2_delta_lf_res : 2;
555
+
556
+ /** \brief CONFIG_LOOPFILTER_LEVEL
557
+ */
558
+ uint32_t delta_lf_multi : 1;
559
+
560
+ /** \brief read_tx_mode
561
+ * value range [0..2]
562
+ */
563
+ uint32_t tx_mode : 2;
564
+
565
+ /* AV1 frame reference mode semantic */
566
+ uint32_t reference_select : 1;
567
+
568
+ uint32_t reduced_tx_set_used : 1;
569
+
570
+ uint32_t skip_mode_present : 1;
571
+
572
+ /** \brief Reserved bytes for future use, must be zero */
573
+ uint32_t reserved : 20;
574
+ } bits;
575
+ uint32_t value;
576
+ } mode_control_fields;
577
+
578
+ /** \brief CDEF parameters
579
+ */
580
+ /* value range [0..3] */
581
+ uint8_t cdef_damping_minus_3;
582
+ /* value range [0..3] */
583
+ uint8_t cdef_bits;
584
+
585
+ /** Encode cdef strength:
586
+ *
587
+ * The cdef_y_strengths[] and cdef_uv_strengths[] are expected to be packed
588
+ * with both primary and secondary strength. The secondary strength is
589
+ * given in the lower two bits and the primary strength is given in the next
590
+ * four bits.
591
+ *
592
+ * cdef_y_strengths[] & cdef_uv_strengths[] should be derived as:
593
+ * (cdef_y_strengths[]) = (cdef_y_pri_strength[] << 2) | (cdef_y_sec_strength[] & 0x03)
594
+ * (cdef_uv_strengths[]) = (cdef_uv_pri_strength[] << 2) | (cdef_uv_sec_strength[] & 0x03)
595
+ * In which, cdef_y_pri_strength[]/cdef_y_sec_strength[]/cdef_uv_pri_strength[]/cdef_uv_sec_strength[]
596
+ * are variables defined in AV1 Spec 5.9.19. The cdef_y_strengths[] & cdef_uv_strengths[]
597
+ * are corresponding to LIBAOM variables cm->cdef_strengths[] & cm->cdef_uv_strengths[] respectively.
598
+ */
599
+ /* value range [0..63] */
600
+ uint8_t cdef_y_strengths[8];
601
+ /* value range [0..63] */
602
+ uint8_t cdef_uv_strengths[8];
603
+
604
+ /** \brief loop restoration parameters
605
+ */
606
+ union {
607
+ struct {
608
+ uint16_t yframe_restoration_type : 2;
609
+ uint16_t cbframe_restoration_type : 2;
610
+ uint16_t crframe_restoration_type : 2;
611
+ uint16_t lr_unit_shift : 2;
612
+ uint16_t lr_uv_shift : 1;
613
+
614
+ /** \brief Reserved bytes for future use, must be zero */
615
+ uint16_t reserved : 7;
616
+ } bits;
617
+ uint16_t value;
618
+ } loop_restoration_fields;
619
+
620
+ /** \brief global motion
621
+ */
622
+ VAWarpedMotionParamsAV1 wm[7];
623
+
624
+ /**@}*/
625
+
626
+ /** \brief Reserved bytes for future use, must be zero */
627
+ uint32_t va_reserved[VA_PADDING_MEDIUM];
628
+ } VADecPictureParameterBufferAV1;
629
+
630
+
631
+ /**
632
+ * \brief AV1 Slice Parameter Buffer Structure
633
+ *
634
+ * This structure conveys parameters related to bit stream data and should be
635
+ * sent once per tile.
636
+ *
637
+ * It uses the name VASliceParameterBufferAV1 to be consistent with other codec,
638
+ * but actually means VATileParameterBufferAV1.
639
+ *
640
+ * Slice data buffer of VASliceDataBufferType is used
641
+ * to send the bitstream.
642
+ *
643
+ * Please note that host decoder is responsible to parse out the
644
+ * per tile information. And the bit stream in sent to driver in per
645
+ * tile granularity.
646
+ */
647
+ typedef struct _VASliceParameterBufferAV1 {
648
+ /**@{*/
649
+ /** \brief The byte count of current tile in the bitstream buffer,
650
+ * starting from first byte of the buffer.
651
+ * It uses the name slice_data_size to be consistent with other codec,
652
+ * but actually means tile_data_size.
653
+ */
654
+ uint32_t slice_data_size;
655
+ /**
656
+ * offset to the first byte of the data buffer.
657
+ */
658
+ uint32_t slice_data_offset;
659
+ /**
660
+ * see VA_SLICE_DATA_FLAG_XXX definitions
661
+ */
662
+ uint32_t slice_data_flag;
663
+
664
+ uint16_t tile_row;
665
+ uint16_t tile_column;
666
+
667
+ va_deprecated uint16_t tg_start;
668
+ va_deprecated uint16_t tg_end;
669
+ /** \brief anchor frame index for large scale tile.
670
+ * index into an array AnchorFrames of the frames that the tile uses
671
+ * for prediction.
672
+ * valid only when large_scale_tile equals 1.
673
+ */
674
+ uint8_t anchor_frame_idx;
675
+
676
+ /** \brief tile index in the tile list.
677
+ * Valid only when large_scale_tile is enabled.
678
+ * Driver uses this field to decide the tile output location.
679
+ */
680
+ uint16_t tile_idx_in_tile_list;
681
+
682
+ /**@}*/
683
+
684
+ /** \brief Reserved bytes for future use, must be zero */
685
+ uint32_t va_reserved[VA_PADDING_LOW];
686
+ } VASliceParameterBufferAV1;
687
+
688
+
689
+ /**@}*/
690
+
691
+ #ifdef __cplusplus
692
+ }
693
+ #endif
694
+
695
+ #endif /* VA_DEC_AV1_H */