Skip to content

Commit ac3fe55

Browse files
author
jianfeng.zheng
committed
add VAProfileAVSJizhun and VAProfileAVSGuangdian
Signed-off-by: jianfeng.zheng <[email protected]>
1 parent b8c7eed commit ac3fe55

File tree

8 files changed

+181
-1
lines changed

8 files changed

+181
-1
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_avs.h \
4849
$(VA_HEADER_DIR)/va_prot.h \
4950
$(VA_HEADER_DIR)/va_vpp.h \
5051
$(NULL)

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_avs.h',
2526
'va_prot.h',
2627
'va_vpp.h'
2728
]

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_avs.h \
5152
va_drmcommon.h \
5253
va_egl.h \
5354
va_enc_hevc.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_avs.h',
3031
'va_drmcommon.h',
3132
'va_egl.h',
3233
'va_enc_hevc.h',

va/va.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,9 @@ typedef enum {
538538
VAProfileHEVCSccMain444_10 = 34,
539539
/** \brief Profile ID used for protected video playback. */
540540
VAProfileProtected = 35,
541-
VAProfileH264High10 = 36
541+
VAProfileH264High10 = 36,
542+
VAProfileAVSJizhun = 37, // Chinese GB/T 20090.2—2006
543+
VAProfileAVSGuangdian = 38, // Chinese GY/T 257.1—2012
542544
} VAProfile;
543545

544546
/**
@@ -5300,6 +5302,7 @@ typedef union _VACopyOption {
53005302
*/
53015303
VAStatus vaCopy(VADisplay dpy, VACopyObject * dst, VACopyObject * src, VACopyOption option);
53025304

5305+
#include <va/va_dec_avs.h>
53035306
#include <va/va_dec_hevc.h>
53045307
#include <va/va_dec_jpeg.h>
53055308
#include <va/va_dec_vp8.h>

va/va_dec_avs.h

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
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_avs.h
27+
* \brief The AVS decoding API
28+
*
29+
* This file contains the \ref api_dec_avs "AVS decoding API".
30+
*/
31+
32+
#ifndef VA_DEC_AVS_H
33+
#define VA_DEC_AVS_H
34+
35+
#include <stdint.h>
36+
37+
#ifdef __cplusplus
38+
extern "C" {
39+
#endif
40+
41+
/**
42+
* \defgroup api_dec_avs AVS decoding API
43+
*
44+
* This AVS decoding API supports Jizhun & Guangdian profiles.
45+
*
46+
* @{
47+
*/
48+
49+
typedef enum {
50+
VA_AVS_I_IMG = 0,
51+
VA_AVS_P_IMG = 1,
52+
VA_AVS_B_IMG = 2,
53+
} VAAVSPicType;
54+
55+
typedef struct _VAPictureAVS {
56+
VASurfaceID surface_id;
57+
uint32_t flags;
58+
uint32_t poc;
59+
60+
/** \brief Reserved bytes for future use, must be zero */
61+
uint32_t va_reserved[VA_PADDING_LOW];
62+
} VAPictureAVS;
63+
64+
/* flags in VAPictureAVS could be OR of the following */
65+
#define VA_PICTURE_AVS_INVALID 0x00000001
66+
#define VA_PICTURE_AVS_TOP_FIELD 0x00000002
67+
#define VA_PICTURE_AVS_BOTTOM_FIELD 0x00000004
68+
69+
/**
70+
* \brief AVS Decoding Picture Parameter Buffer Structure
71+
*
72+
* This structure conveys picture level parameters and should be sent once
73+
* per frame.
74+
*/
75+
typedef struct _VAPictureParameterBufferAVS {
76+
VAPictureAVS curr_pic;
77+
VAPictureAVS ref_list[2];
78+
79+
uint16_t width; // coded width
80+
uint16_t height; // coded height
81+
82+
uint16_t picture_type : 2; // VAAVSPicType
83+
uint16_t progressive_seq_flag : 1;
84+
uint16_t progressive_frame_flag : 1;
85+
uint16_t picture_structure_flag : 1; // 0:field coding, 1:frame coding
86+
uint16_t fixed_pic_qp_flag : 1;
87+
uint16_t picture_qp : 6;
88+
uint16_t loop_filter_disable_flag : 1;
89+
uint16_t skip_mode_flag_flag : 1;
90+
uint16_t picture_reference_flag : 1;
91+
uint16_t no_forward_reference_flag : 1;
92+
93+
int8_t alpha_c_offset;
94+
int8_t beta_offset;
95+
96+
struct {
97+
uint16_t guangdian_flag : 1;
98+
uint16_t aec_flag : 1;
99+
uint16_t weight_quant_flag : 1;
100+
uint16_t pb_field_enhanced_flag : 1;
101+
uint16_t reserved : 12;
102+
int8_t chroma_quant_param_delta_cb;
103+
int8_t chroma_quant_param_delta_cr;
104+
uint8_t wqm_8x8[64];
105+
} guangdian_fields;
106+
107+
/** \brief Reserved bytes for future use, must be zero */
108+
uint32_t va_reserved[VA_PADDING_MEDIUM];
109+
} VAPictureParameterBufferAVS;
110+
111+
/**
112+
* \brief AVS Slice Parameter Buffer Structure
113+
*
114+
* Slice data buffer of VASliceDataBufferType is used to send the bitstream data.
115+
* When send AVS slice data, start code and slice header should be included.
116+
*/
117+
typedef struct _VASliceParameterBufferAVS {
118+
uint32_t slice_data_size; /* number of bytes in the slice data buffer for this slice */
119+
uint32_t slice_data_offset; /* the offset to the first byte of slice data */
120+
uint32_t slice_data_flag; /* see VA_SLICE_DATA_FLAG_XXX defintions */
121+
uint32_t mb_data_bit_offset; /* offset to the first bit of MB from the first byte of slice data (slice_data_offset) */
122+
123+
uint32_t slice_vertical_pos : 16; /* first mb row of the slice */
124+
uint32_t fixed_slice_qp_flag : 1;
125+
uint32_t slice_qp : 6;
126+
uint32_t slice_weight_pred_flag : 1;
127+
uint32_t mb_weight_pred_flag : 1;
128+
129+
uint8_t luma_scale[4];
130+
int8_t luma_shift[4];
131+
uint8_t chroma_scale[4];
132+
int8_t chroma_shift[4];
133+
134+
/** \brief Reserved bytes for future use, must be zero */
135+
uint32_t va_reserved[VA_PADDING_LOW];
136+
} VASliceParameterBufferAVS;
137+
138+
/**@}*/
139+
140+
#ifdef __cplusplus
141+
}
142+
#endif
143+
144+
#endif /* VA_DEC_AVS_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(VAProfileAVSJizhun);
42+
TOSTR(VAProfileAVSGuangdian);
4143
TOSTR(VAProfileVC1Simple);
4244
TOSTR(VAProfileVC1Main);
4345
TOSTR(VAProfileVC1Advanced);

va/va_trace.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5571,6 +5571,26 @@ static void va_TraceVC1Buf(
55715571
}
55725572
}
55735573

5574+
static void va_TraceAVSBuf(
5575+
VADisplay dpy,
5576+
VAContextID context,
5577+
VABufferID buffer,
5578+
VABufferType type,
5579+
unsigned int size,
5580+
unsigned int num_elements,
5581+
void *pbuf
5582+
)
5583+
{
5584+
DPY2TRACECTX(dpy, context, VA_INVALID_ID);
5585+
5586+
switch (type) {
5587+
5588+
default:
5589+
va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
5590+
break;
5591+
}
5592+
}
5593+
55745594
static void
55755595
va_TraceProcFilterParameterBufferDeinterlacing(
55765596
VADisplay dpy,
@@ -5930,6 +5950,13 @@ void va_TraceRenderPicture(
59305950
va_TraceAV1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
59315951
}
59325952
break;
5953+
case VAProfileAVSJizhun:
5954+
case VAProfileAVSGuangdian:
5955+
for (j = 0; j < num_elements; j++) {
5956+
va_TraceMsg(trace_ctx, "\telement[%d] = \n", j);
5957+
va_TraceAVSBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size * j);
5958+
}
5959+
break;
59335960
default:
59345961
break;
59355962
}

0 commit comments

Comments
 (0)