Skip to content

Commit 0a67d7b

Browse files
author
jianfeng.zheng
committed
add VAProfileAVS2Main and VAProfileAVS2Main10
Signed-off-by: jianfeng.zheng <[email protected]>
1 parent f2b9b43 commit 0a67d7b

File tree

8 files changed

+211
-0
lines changed

8 files changed

+211
-0
lines changed

doc/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ VA_HEADER_FILES = \
4545
$(VA_HEADER_DIR)/va_dec_vp8.h \
4646
$(VA_HEADER_DIR)/va_dec_vp9.h \
4747
$(VA_HEADER_DIR)/va_dec_av1.h \
48+
$(VA_HEADER_DIR)/va_dec_avs2.h \
4849
$(VA_HEADER_DIR)/va_dec_avs.h \
4950
$(VA_HEADER_DIR)/va_prot.h \
5051
$(VA_HEADER_DIR)/va_vpp.h \

doc/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ libva_headers_doc = [
2222
'va_dec_vp8.h',
2323
'va_dec_vp9.h',
2424
'va_dec_av1.h',
25+
'va_dec_avs2.h',
2526
'va_dec_avs.h',
2627
'va_prot.h',
2728
'va_vpp.h'

va/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ libva_source_h = \
4848
va_dec_jpeg.h \
4949
va_dec_vp8.h \
5050
va_dec_vp9.h \
51+
va_dec_avs2.h \
5152
va_dec_avs.h \
5253
va_drmcommon.h \
5354
va_egl.h \

va/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ libva_headers = [
2727
'va_dec_vp8.h',
2828
'va_dec_vp9.h',
2929
'va_dec_av1.h',
30+
'va_dec_avs2.h',
3031
'va_dec_avs.h',
3132
'va_drmcommon.h',
3233
'va_egl.h',

va/va.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ typedef enum {
541541
VAProfileH264High10 = 36,
542542
VAProfileAVSJizhun = 37, // Chinese GB/T 20090.2—2006
543543
VAProfileAVSGuangdian = 38, // Chinese GY/T 257.1—2012
544+
VAProfileAVS2Main = 39,
545+
VAProfileAVS2Main10 = 40
544546
} VAProfile;
545547

546548
/**
@@ -5259,6 +5261,7 @@ typedef union _VACopyOption {
52595261
*/
52605262
VAStatus vaCopy(VADisplay dpy, VACopyObject * dst, VACopyObject * src, VACopyOption option);
52615263

5264+
#include <va/va_dec_avs2.h>
52625265
#include <va/va_dec_avs.h>
52635266
#include <va/va_dec_hevc.h>
52645267
#include <va/va_dec_jpeg.h>

va/va_dec_avs2.h

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
/*
2+
* Copyright (c) 2022 MTHREADS 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_avs2.h
27+
* \brief The AVS2 decoding API
28+
*
29+
* This file contains the \ref api_dec_avs2 "AVS2 decoding API".
30+
*/
31+
32+
#ifndef VA_DEC_AVS2_H
33+
#define VA_DEC_AVS2_H
34+
35+
#include <stdint.h>
36+
37+
#ifdef __cplusplus
38+
extern "C" {
39+
#endif
40+
41+
/**
42+
* \defgroup api_dec_avs2 AVS2 decoding API
43+
*
44+
* This AVS2 decoding API supports Main and Main10 profiles.
45+
* And it supports both short slice format and long slice format.
46+
*
47+
* @{
48+
*/
49+
50+
#define VA_AVS2_MAX_REF_COUNT 7
51+
52+
typedef enum {
53+
VA_AVS2_I_IMG = 0,
54+
VA_AVS2_P_IMG = 1,
55+
VA_AVS2_B_IMG = 2,
56+
VA_AVS2_F_IMG = 3,
57+
VA_AVS2_S_IMG = 4,
58+
VA_AVS2_G_IMG = 5,
59+
VA_AVS2_GB_IMG = 6,
60+
} VAAVS2PicType;
61+
62+
typedef struct _VAPictureAVS2 {
63+
/**
64+
* \brief reconstructed picture buffer surface index
65+
* invalid when taking value VA_INVALID_SURFACE.
66+
*/
67+
VASurfaceID surface_id;
68+
69+
int16_t doi;
70+
int16_t poi;
71+
72+
int num_ref;
73+
int16_t ref_doi[VA_AVS2_MAX_REF_COUNT];
74+
int16_t ref_poi[VA_AVS2_MAX_REF_COUNT];
75+
76+
/** \brief Reserved bytes for future use, must be zero */
77+
uint32_t va_reserved[VA_PADDING_LOW];
78+
} VAPictureAVS2;
79+
80+
/**
81+
* \brief AVS2 Decoding Picture Parameter Buffer Structure
82+
*
83+
* This structure conveys picture level parameters and should be sent once
84+
* per frame.
85+
*/
86+
typedef struct _VAPictureParameterBufferAVS2 {
87+
uint32_t non_ref_flag : 1; // [ 0]
88+
uint32_t num_of_ref : 3; // [ 3: 1]
89+
uint32_t reserved_0 : 28; // [31: 4]
90+
91+
VAPictureAVS2 CurrPic;
92+
VAPictureAVS2 ref_list[VA_AVS2_MAX_REF_COUNT];
93+
94+
uint32_t width : 16; // [15: 0]
95+
uint32_t height : 16; // [31:16]
96+
97+
uint32_t log2_lcu_size_minus4 : 2; // [ 1: 0]
98+
uint32_t chroma_format : 2; // [ 3: 2]
99+
uint32_t output_bit_depth_minus8 : 2; // [ 5: 4]
100+
uint32_t weighted_skip_enable : 1; // [ 6]
101+
uint32_t multi_hypothesis_skip_enable : 1; // [ 7]
102+
uint32_t nonsquare_intra_prediction_enable : 1; // [ 8]
103+
uint32_t dph_enable : 1; // [ 9]
104+
uint32_t encoding_bit_depth_minus8 : 2; // [11:10]
105+
uint32_t field_coded_sequence : 1; // [ 12]
106+
uint32_t pmvr_enable : 1; // [ 13]
107+
uint32_t nonsquare_quadtree_transform_enable : 1; // [ 14]
108+
uint32_t inter_amp_enable : 1; // [ 15]
109+
uint32_t secondary_transform_enable_flag : 1; // [ 16]
110+
uint32_t fixed_pic_qp : 1; // [ 17]
111+
uint32_t pic_qp : 7; // [24:18]
112+
uint32_t picture_structure : 1; // [ 25]
113+
uint32_t top_field_picture_flag : 1; // [ 26]
114+
uint32_t scene_picture_disable : 1; // [ 27]
115+
uint32_t scene_reference_enable : 1; // [ 28]
116+
uint32_t pic_type : 3; // [31:29] VAAVS2PicType
117+
118+
uint32_t lf_cross_slice_enable_flag : 1; // [ 0]
119+
uint32_t lf_pic_dbk_disable_flag : 1; // [ 1]
120+
uint32_t sao_enable : 1; // [ 2]
121+
uint32_t alf_enable : 1; // [ 3]
122+
uint32_t pic_alf_on_Y : 1; // [ 4]
123+
uint32_t pic_alf_on_U : 1; // [ 5]
124+
uint32_t pic_alf_on_V : 1; // [ 6]
125+
uint32_t pic_weight_quant_enable : 1; // [ 7]
126+
uint32_t pic_weight_quant_data_index : 2; // [ 9: 8]
127+
uint32_t reserved_1 : 22; // [31:10]
128+
129+
int8_t alpha_c_offset; // -8 ~ +8
130+
int8_t beta_offset; // -8 ~ +8
131+
int8_t chroma_quant_param_delta_cb; // -16 ~ +16
132+
int8_t chroma_quant_param_delta_cr; // -16 ~ +16
133+
134+
uint8_t wq_mat[16 + 64];
135+
136+
// alf_coeff[ 0-15: luma, 16:cb, 17:cr ][ ]
137+
int8_t alf_coeff[16 + 2][9];
138+
139+
/** \brief Reserved bytes for future use, must be zero */
140+
uint32_t va_reserved[VA_PADDING_LOW];
141+
} VAPictureParameterBufferAVS2;
142+
143+
/**
144+
* \brief AVS2 Slice Parameter Buffer Structure
145+
*
146+
* Slice data buffer of VASliceDataBufferType is used to send the bitstream data.
147+
* When send AVS2 slice data, start code and slice header should be included.
148+
*/
149+
typedef struct _VASliceParameterBufferAVS2 {
150+
uint32_t slice_data_size; /* number of bytes in the slice data buffer for this slice */
151+
uint32_t slice_data_offset; /* the offset to the first byte of slice data */
152+
uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
153+
154+
uint16_t lcu_start_x;
155+
uint16_t lcu_start_y;
156+
157+
uint32_t fixed_slice_qp : 1;
158+
uint32_t slice_qp : 7;
159+
uint32_t slice_sao_enable_Y : 1;
160+
uint32_t slice_sao_enable_U : 1;
161+
uint32_t slice_sao_enable_V : 1;
162+
uint32_t vlc_byte_offset : 4;
163+
uint32_t reserved : 17;
164+
165+
/** \brief Reserved bytes for future use, must be zero */
166+
uint32_t va_reserved[VA_PADDING_LOW];
167+
} VASliceParameterBufferAVS2;
168+
169+
/**@}*/
170+
171+
#ifdef __cplusplus
172+
}
173+
#endif
174+
175+
#endif /* VA_DEC_AVS2_H */

va/va_str.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const char *vaProfileStr(VAProfile profile)
3838
TOSTR(VAProfileH264Main);
3939
TOSTR(VAProfileH264High);
4040
TOSTR(VAProfileH264High10);
41+
TOSTR(VAProfileAVS2Main);
42+
TOSTR(VAProfileAVS2Main10);
4143
TOSTR(VAProfileAVSJizhun);
4244
TOSTR(VAProfileAVSGuangdian);
4345
TOSTR(VAProfileVC1Simple);

va/va_trace.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5544,6 +5544,26 @@ static void va_TraceVC1Buf(
55445544
}
55455545
}
55465546

5547+
static void va_TraceAVS2Buf(
5548+
VADisplay dpy,
5549+
VAContextID context,
5550+
VABufferID buffer,
5551+
VABufferType type,
5552+
unsigned int size,
5553+
unsigned int num_elements,
5554+
void *pbuf
5555+
)
5556+
{
5557+
DPY2TRACECTX(dpy, context, VA_INVALID_ID);
5558+
5559+
switch (type) {
5560+
5561+
default:
5562+
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
5563+
break;
5564+
}
5565+
}
5566+
55475567
static void va_TraceAVSBuf(
55485568
VADisplay dpy,
55495569
VAContextID context,
@@ -5930,6 +5950,13 @@ void va_TraceRenderPicture(
59305950
va_TraceAVSBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
59315951
}
59325952
break;
5953+
case VAProfileAVS2Main:
5954+
case VAProfileAVS2Main10:
5955+
for (j = 0; j < num_elements; j++) {
5956+
va_TraceMsg(trace_ctx, "\telement[%d] = \n", j);
5957+
va_TraceAVS2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
5958+
}
5959+
break;
59335960
default:
59345961
break;
59355962
}

0 commit comments

Comments
 (0)