~misterc/libva/Trunk

« back to all changes in this revision

Viewing changes to va/va_dec_hevc.h

  • Committer: Sean V Kelley
  • Date: 2017-02-18 23:19:05 UTC
  • Revision ID: git-v1:7b8cc07dc7a9b954b9a8c9bde5091fb2e8d443dc
PROJECT HAS MOVED

See https://github.com/01org/libva

Signed-off-by: Sean V Kelley <seanvk@posteo.de>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2014 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_hevc.h
27
 
 * \brief The HEVC decoding API
28
 
 *
29
 
 * This file contains the \ref api_dec_hevc "HEVC decoding API".
30
 
 */
31
 
 
32
 
#ifndef VA_DEC_HEVC_H
33
 
#define VA_DEC_HEVC_H
34
 
 
35
 
#include <stdint.h>
36
 
 
37
 
#ifdef __cplusplus
38
 
extern "C" {
39
 
#endif
40
 
 
41
 
/**
42
 
 * \defgroup api_dec_hevc HEVC decoding API
43
 
 *
44
 
 * This HEVC decoding API supports Main and Main Still Picture profiles.
45
 
 * And it supports both short slice format and long slice format.
46
 
 *
47
 
 * @{
48
 
 */
49
 
 
50
 
/**
51
 
 * \brief HEVC Decoding Picture Parameter Buffer Structure
52
 
 *
53
 
 * This structure conveys picture level parameters and should be sent once
54
 
 * per frame.
55
 
 *
56
 
 */
57
 
typedef struct  _VAPictureParameterBufferHEVC
58
 
{
59
 
    /** \brief buffer description of decoded current picture
60
 
     * only VA_PICTURE_HEVC_FIELD_PIC and VA_PICTURE_HEVC_BOTTOM_FIELD
61
 
     * of "flags" fields are meaningful.
62
 
     */
63
 
    VAPictureHEVC           CurrPic;
64
 
    /** \brief buffer description of reference frames in DPB */
65
 
    VAPictureHEVC           ReferenceFrames[15];
66
 
    /** \brief picture width, shall be integer multiple of minimum CB size. */
67
 
    uint16_t                pic_width_in_luma_samples;
68
 
    /** \brief picture height, shall be integer multiple of minimum CB size. */
69
 
    uint16_t                pic_height_in_luma_samples;
70
 
 
71
 
 
72
 
    union
73
 
    {
74
 
        struct
75
 
        {
76
 
        /** following flags have same syntax and semantic as those in HEVC spec */
77
 
            uint32_t        chroma_format_idc                           : 2;
78
 
            uint32_t        separate_colour_plane_flag                  : 1;
79
 
            uint32_t        pcm_enabled_flag                            : 1;
80
 
            uint32_t        scaling_list_enabled_flag                   : 1;
81
 
            uint32_t        transform_skip_enabled_flag                 : 1;
82
 
            uint32_t        amp_enabled_flag                            : 1;
83
 
            uint32_t        strong_intra_smoothing_enabled_flag         : 1;
84
 
            uint32_t        sign_data_hiding_enabled_flag               : 1;
85
 
            uint32_t        constrained_intra_pred_flag                 : 1;
86
 
            uint32_t        cu_qp_delta_enabled_flag                    : 1;
87
 
            uint32_t        weighted_pred_flag                          : 1;
88
 
            uint32_t        weighted_bipred_flag                        : 1;
89
 
            uint32_t        transquant_bypass_enabled_flag              : 1;
90
 
            uint32_t        tiles_enabled_flag                          : 1;
91
 
            uint32_t        entropy_coding_sync_enabled_flag            : 1;
92
 
            uint32_t        pps_loop_filter_across_slices_enabled_flag  : 1;
93
 
            uint32_t        loop_filter_across_tiles_enabled_flag       : 1;
94
 
            uint32_t        pcm_loop_filter_disabled_flag               : 1;
95
 
            /** set based on sps_max_num_reorder_pics of current temporal layer. */
96
 
            uint32_t        NoPicReorderingFlag                         : 1;
97
 
            /** picture has no B slices */
98
 
            uint32_t        NoBiPredFlag                                : 1;
99
 
 
100
 
            uint32_t        ReservedBits                                : 11;
101
 
        } bits;
102
 
        uint32_t            value;
103
 
    } pic_fields;
104
 
 
105
 
    /** following parameters have same syntax with those in HEVC spec */
106
 
    /** \brief DPB size for current temporal layer */
107
 
    uint8_t                 sps_max_dec_pic_buffering_minus1;
108
 
    uint8_t                 bit_depth_luma_minus8;
109
 
    uint8_t                 bit_depth_chroma_minus8;
110
 
    uint8_t                 pcm_sample_bit_depth_luma_minus1;
111
 
    uint8_t                 pcm_sample_bit_depth_chroma_minus1;
112
 
    uint8_t                 log2_min_luma_coding_block_size_minus3;
113
 
    uint8_t                 log2_diff_max_min_luma_coding_block_size;
114
 
    uint8_t                 log2_min_transform_block_size_minus2;
115
 
    uint8_t                 log2_diff_max_min_transform_block_size;
116
 
    uint8_t                 log2_min_pcm_luma_coding_block_size_minus3;
117
 
    uint8_t                 log2_diff_max_min_pcm_luma_coding_block_size;
118
 
    uint8_t                 max_transform_hierarchy_depth_intra;
119
 
    uint8_t                 max_transform_hierarchy_depth_inter;
120
 
    int8_t                  init_qp_minus26;
121
 
    uint8_t                 diff_cu_qp_delta_depth;
122
 
    int8_t                  pps_cb_qp_offset;
123
 
    int8_t                  pps_cr_qp_offset;
124
 
    uint8_t                 log2_parallel_merge_level_minus2;
125
 
    uint8_t                 num_tile_columns_minus1;
126
 
    uint8_t                 num_tile_rows_minus1;
127
 
    /**
128
 
     * when uniform_spacing_flag equals 1, application should populate
129
 
     * column_width_minus[], and row_height_minus1[] with approperiate values.
130
 
     */
131
 
    uint16_t                column_width_minus1[19];
132
 
    uint16_t                row_height_minus1[21];
133
 
 
134
 
    /**
135
 
     *  The Following Parameters are needed for Short Slice Format Only.
136
 
     *  Only format decoding can ignore them.
137
 
     */
138
 
 
139
 
    /**
140
 
     * \brief Parameters needed for parsing slice segment headers
141
 
     */
142
 
    union
143
 
    {
144
 
        struct
145
 
        {
146
 
            /** following parameters have same syntax with those in HEVC spec */
147
 
            uint32_t        lists_modification_present_flag             : 1;
148
 
            uint32_t        long_term_ref_pics_present_flag             : 1;
149
 
            uint32_t        sps_temporal_mvp_enabled_flag               : 1;
150
 
            uint32_t        cabac_init_present_flag                     : 1;
151
 
            uint32_t        output_flag_present_flag                    : 1;
152
 
            uint32_t        dependent_slice_segments_enabled_flag       : 1;
153
 
            uint32_t        pps_slice_chroma_qp_offsets_present_flag    : 1;
154
 
            uint32_t        sample_adaptive_offset_enabled_flag         : 1;
155
 
            uint32_t        deblocking_filter_override_enabled_flag     : 1;
156
 
            uint32_t        pps_disable_deblocking_filter_flag          : 1;
157
 
            uint32_t        slice_segment_header_extension_present_flag : 1;
158
 
 
159
 
            /** current picture with NUT between 16 and 21 inclusive */
160
 
            uint32_t        RapPicFlag                                  : 1;
161
 
            /** current picture with NUT between 19 and 20 inclusive */
162
 
            uint32_t        IdrPicFlag                                  : 1;
163
 
            /** current picture has only intra slices */
164
 
            uint32_t        IntraPicFlag                                : 1;
165
 
 
166
 
            uint32_t        ReservedBits                                : 18;
167
 
        } bits;
168
 
        uint32_t            value;
169
 
    } slice_parsing_fields;
170
 
 
171
 
    /** following parameters have same syntax with those in HEVC spec */
172
 
    uint8_t                 log2_max_pic_order_cnt_lsb_minus4;
173
 
    uint8_t                 num_short_term_ref_pic_sets;
174
 
    uint8_t                 num_long_term_ref_pic_sps;
175
 
    uint8_t                 num_ref_idx_l0_default_active_minus1;
176
 
    uint8_t                 num_ref_idx_l1_default_active_minus1;
177
 
    int8_t                  pps_beta_offset_div2;
178
 
    int8_t                  pps_tc_offset_div2;
179
 
    uint8_t                 num_extra_slice_header_bits;
180
 
 
181
 
    /**
182
 
     * \brief number of bits that structure
183
 
     * short_term_ref_pic_set( num_short_term_ref_pic_sets ) takes in slice
184
 
     * segment header when short_term_ref_pic_set_sps_flag equals 0.
185
 
     * if short_term_ref_pic_set_sps_flag equals 1, the value should be 0.
186
 
     * the bit count is calculated after emulation prevention bytes are removed
187
 
     * from bit streams.
188
 
     * This variable is used for accelorater to skip parsing the
189
 
     * short_term_ref_pic_set( num_short_term_ref_pic_sets ) structure.
190
 
     */
191
 
    uint32_t                st_rps_bits;
192
 
 
193
 
} VAPictureParameterBufferHEVC;
194
 
 
195
 
 
196
 
 
197
 
/**
198
 
 * \brief HEVC Slice Parameter Buffer Structure For Short Format
199
 
 *
200
 
 * VASliceParameterBufferBaseHEVC structure should be accompanied by a
201
 
 * slice data buffer, which holds the whole raw slice NAL unit bit streams
202
 
 * including start code prefix and emulation prevention bytes not removed.
203
 
 *
204
 
 * This structure conveys parameters related to slice segment header and should
205
 
 * be sent once per slice.
206
 
 *
207
 
 * For long format, this data structure is not sent by application.
208
 
 *
209
 
 */
210
 
typedef struct  _VASliceParameterBufferBaseHEVC
211
 
{
212
 
    /** @name Codec-independent Slice Parameter Buffer base. */
213
 
 
214
 
    /**@{*/
215
 
 
216
 
    /** \brief Number of bytes in the slice data buffer for this slice
217
 
     *  counting from and including NAL unit header.
218
 
     */
219
 
    uint32_t                slice_data_size;
220
 
    /** \brief The offset to the NAL unit header for this slice */
221
 
    uint32_t                slice_data_offset;
222
 
    /** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_XXX. */
223
 
    uint16_t                slice_data_flag;
224
 
    /**@}*/
225
 
 
226
 
} VASliceParameterBufferBaseHEVC;
227
 
 
228
 
 
229
 
 
230
 
 
231
 
/**
232
 
 * \brief HEVC Slice Parameter Buffer Structure For Long Format
233
 
 *
234
 
 * VASliceParameterBufferHEVC structure should be accompanied by a
235
 
 * slice data buffer, which holds the whole raw slice NAL unit bit streams
236
 
 * including start code prefix and emulation prevention bytes not removed.
237
 
 *
238
 
 * This structure conveys parameters related to slice segment header and should
239
 
 * be sent once per slice.
240
 
 *
241
 
 * For short format, this data structure is not sent by application.
242
 
 *
243
 
 */
244
 
typedef struct  _VASliceParameterBufferHEVC
245
 
{
246
 
    /** @name Codec-independent Slice Parameter Buffer base. */
247
 
 
248
 
    /**@{*/
249
 
 
250
 
    /** \brief Number of bytes in the slice data buffer for this slice
251
 
     * counting from and including NAL unit header.
252
 
     */
253
 
    uint32_t                slice_data_size;
254
 
    /** \brief The offset to the NAL unit header for this slice */
255
 
    uint32_t                slice_data_offset;
256
 
    /** \brief Slice data buffer flags. See \c VA_SLICE_DATA_FLAG_XXX. */
257
 
    uint16_t                slice_data_flag;
258
 
    /**
259
 
     * \brief Byte offset from NAL unit header to the begining of slice_data().
260
 
     *
261
 
     * This byte offset is relative to and includes the NAL unit header
262
 
     * and represents the number of bytes parsed in the slice_header()
263
 
     * after the removal of any emulation prevention bytes in
264
 
     * there. However, the slice data buffer passed to the hardware is
265
 
     * the original bitstream, thus including any emulation prevention
266
 
     * bytes.
267
 
     */
268
 
    uint32_t                slice_data_byte_offset;
269
 
    /** HEVC syntax element. */
270
 
    uint32_t                slice_segment_address;
271
 
    /** \brief index into ReferenceFrames[]
272
 
     * RefPicList[0][] corresponds to RefPicList0[] of HEVC variable.
273
 
     * RefPicList[1][] corresponds to RefPicList1[] of HEVC variable.
274
 
     * value range [0..14, 0xFF], where 0xFF indicates invalid entry.
275
 
     */
276
 
    uint8_t                 RefPicList[2][15];
277
 
    union
278
 
    {
279
 
        uint32_t            value;
280
 
        struct
281
 
        {
282
 
            /** current slice is last slice of picture. */
283
 
            uint32_t        LastSliceOfPic                              : 1;
284
 
    /** HEVC syntax element. */
285
 
            uint32_t        dependent_slice_segment_flag                : 1;
286
 
    /** HEVC syntax element. */
287
 
            uint32_t        slice_type                                  : 2;
288
 
    /** HEVC syntax element. */
289
 
            uint32_t        color_plane_id                              : 2;
290
 
    /** HEVC syntax element. */
291
 
            uint32_t        slice_sao_luma_flag                         : 1;
292
 
    /** HEVC syntax element. */
293
 
            uint32_t        slice_sao_chroma_flag                       : 1;
294
 
    /** HEVC syntax element. */
295
 
            uint32_t        mvd_l1_zero_flag                            : 1;
296
 
    /** HEVC syntax element. */
297
 
            uint32_t        cabac_init_flag                             : 1;
298
 
    /** HEVC syntax element. */
299
 
            uint32_t        slice_temporal_mvp_enabled_flag             : 1;
300
 
    /** HEVC syntax element. */
301
 
            uint32_t        slice_deblocking_filter_disabled_flag       : 1;
302
 
    /** HEVC syntax element. */
303
 
            uint32_t        collocated_from_l0_flag                     : 1;
304
 
    /** HEVC syntax element. */
305
 
            uint32_t        slice_loop_filter_across_slices_enabled_flag : 1;
306
 
            uint32_t        reserved                                    : 18;
307
 
        } fields;
308
 
    } LongSliceFlags;
309
 
 
310
 
    /** HEVC syntax element. Collocated Reference Picture Index.
311
 
     * index to RefPicList[0][] or RefPicList[1][].
312
 
     * when slice_temporal_mvp_enabled_flag equals 0, it should take value 0xFF.
313
 
     * value range [0..14, 0xFF].
314
 
     */
315
 
    uint8_t                 collocated_ref_idx;
316
 
    /** HEVC syntax element.
317
 
     * if num_ref_idx_active_override_flag equals 0, host decoder should
318
 
     * set its value to num_ref_idx_l0_default_minus1.
319
 
     */
320
 
    uint8_t                 num_ref_idx_l0_active_minus1;
321
 
    /** HEVC syntax element.
322
 
     * if num_ref_idx_active_override_flag equals 0, host decoder should
323
 
     * set its value to num_ref_idx_l1_default_minus1.
324
 
     */
325
 
    uint8_t                 num_ref_idx_l1_active_minus1;
326
 
    /** HEVC syntax element. */
327
 
    int8_t                  slice_qp_delta;
328
 
    /** HEVC syntax element. */
329
 
    int8_t                  slice_cb_qp_offset;
330
 
    /** HEVC syntax element. */
331
 
    int8_t                  slice_cr_qp_offset;
332
 
    /** HEVC syntax element. */
333
 
    int8_t                  slice_beta_offset_div2;
334
 
    /** HEVC syntax element. */
335
 
    int8_t                  slice_tc_offset_div2;
336
 
    /** HEVC syntax element. */
337
 
    uint8_t                 luma_log2_weight_denom;
338
 
    /** HEVC syntax element. */
339
 
    int8_t                  delta_chroma_log2_weight_denom;
340
 
    /** HEVC syntax element. */
341
 
    int8_t                  delta_luma_weight_l0[15];
342
 
    /** HEVC syntax element. */
343
 
    int8_t                  luma_offset_l0[15];
344
 
    /** HEVC syntax element. */
345
 
    int8_t                  delta_chroma_weight_l0[15][2];
346
 
    /** corresponds to HEVC spec variable of the same name. */
347
 
    int8_t                  ChromaOffsetL0[15][2];
348
 
    /** HEVC syntax element. */
349
 
    int8_t                  delta_luma_weight_l1[15];
350
 
    /** HEVC syntax element. */
351
 
    int8_t                  luma_offset_l1[15];
352
 
    /** HEVC syntax element. */
353
 
    int8_t                  delta_chroma_weight_l1[15][2];
354
 
    /** corresponds to HEVC spec variable of the same name. */
355
 
    int8_t                  ChromaOffsetL1[15][2];
356
 
    /** HEVC syntax element. */
357
 
    uint8_t                 five_minus_max_num_merge_cand;
358
 
    /**@}*/
359
 
 
360
 
} VASliceParameterBufferHEVC;
361
 
 
362
 
 
363
 
 
364
 
/**
365
 
 * \brief HEVC Inverse Quantization Matrix Buffer Structure
366
 
 *
367
 
 * This structure is sent once per frame,
368
 
 * and only when scaling_list_enabled_flag = 1.
369
 
 * When sps_scaling_list_data_present_flag = 0, app still
370
 
 * needs to send in this structure with default matrix values.
371
 
 *
372
 
 * Matrix entries are in raster scan order which follows HEVC spec.
373
 
 */
374
 
typedef struct _VAIQMatrixBufferHEVC
375
 
{
376
 
    /**
377
 
     * \brief scaling lists,
378
 
     * corresponds to same HEVC spec syntax element
379
 
     * ScalingList[ i ][ MatrixID ][ j ].
380
 
     *
381
 
     * \brief 4x4 scaling,
382
 
     * correspongs i = 0, MatrixID is in the range of 0 to 5,
383
 
     * inclusive. And j is in the range of 0 to 15, inclusive.
384
 
     */
385
 
    uint8_t                 ScalingList4x4[6][16];
386
 
    /**
387
 
     * \brief 8x8 scaling,
388
 
     * correspongs i = 1, MatrixID is in the range of 0 to 5,
389
 
     * inclusive. And j is in the range of 0 to 63, inclusive.
390
 
     */
391
 
    uint8_t                 ScalingList8x8[6][64];
392
 
    /**
393
 
     * \brief 16x16 scaling,
394
 
     * correspongs i = 2, MatrixID is in the range of 0 to 5,
395
 
     * inclusive. And j is in the range of 0 to 63, inclusive.
396
 
     */
397
 
    uint8_t                 ScalingList16x16[6][64];
398
 
    /**
399
 
     * \brief 32x32 scaling,
400
 
     * correspongs i = 3, MatrixID is in the range of 0 to 1,
401
 
     * inclusive. And j is in the range of 0 to 63, inclusive.
402
 
     */
403
 
    uint8_t                 ScalingList32x32[2][64];
404
 
    /**
405
 
     * \brief DC values of the 16x16 scaling lists,
406
 
     * corresponds to HEVC spec syntax
407
 
     * scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
408
 
     * with sizeID = 2 and matrixID in the range of 0 to 5, inclusive.
409
 
     */
410
 
    uint8_t                 ScalingListDC16x16[6];
411
 
    /**
412
 
     * \brief DC values of the 32x32 scaling lists,
413
 
     * corresponds to HEVC spec syntax
414
 
     * scaling_list_dc_coef_minus8[ sizeID - 2 ][ matrixID ] + 8
415
 
     * with sizeID = 3 and matrixID in the range of 0 to 1, inclusive.
416
 
     */
417
 
    uint8_t                 ScalingListDC32x32[2];
418
 
} VAIQMatrixBufferHEVC;
419
 
 
420
 
 
421
 
/**@}*/
422
 
 
423
 
#ifdef __cplusplus
424
 
}
425
 
#endif
426
 
 
427
 
#endif /* VA_DEC_HEVC_H */