xref: /aosp_15_r20/external/libva/va/va_fei.h (revision 54e60f844a168e9a219354de272cd517ee8cd4b7)
1 /*
2  * Copyright (c) 2007-2017 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_fei.h
27  * \brief The FEI encoding common API
28  */
29 
30 #ifndef VA_FEI_H
31 #define VA_FEI_H
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #include <stdint.h>
38 
39 /**
40  * \defgroup api_fei FEI encoding common API
41  *
42  * @{
43  */
44 
45 /**
46  * \brief FEI specific attribute definitions
47  */
48 /** @name Attribute values for VAConfigAttribFEIFunctionType
49  *
50  * This is only for VAEntrypointFEI
51  * The desired type should be passed to driver when creating the configuration.
52  * If VA_FEI_FUNCTION_ENC_PAK is set, VA_FEI_FUNCTION_ENC and VA_FEI_FUNCTION_PAK
53  * will be ignored if set also. Combination of VA_FEI_FUNCTION_ENC and VA_FEI_FUNCTION_PAK
54  * is not valid. If  VA_FEI_FUNCTION_ENC is set, there will be no bitstream output.
55  * If VA_FEI_FUNCTION_PAK is set, two extra input buffers for PAK are needed:
56  * VAEncFEIMVBufferType and VAEncFEIMBCodeBufferType.
57  * VA_FEI_FUNCTION_ENC_PAK is recommended for best performance.
58  *
59  **/
60 /**@{*/
61 /** \brief ENC only is supported */
62 #define VA_FEI_FUNCTION_ENC                             0x00000001
63 /** \brief PAK only is supported */
64 #define VA_FEI_FUNCTION_PAK                             0x00000002
65 /** \brief ENC_PAK is supported */
66 #define VA_FEI_FUNCTION_ENC_PAK                         0x00000004
67 
68 /**@}*/
69 
70 /** \brief Attribute value for VAConfigAttribStats */
71 typedef union _VAConfigAttribValStats {
72     struct {
73         /** \brief Max number of past reference frames that are supported. */
74         uint32_t    max_num_past_references   : 4;
75         /** \brief Max number of future reference frames that are supported. */
76         uint32_t    max_num_future_references : 4;
77         /** \brief Number of supported output buffers for VAStatsStatisticsParameter->outputs */
78         uint32_t    num_outputs               : 3;
79         /** \brief Interlaced content is supported */
80         uint32_t    interlaced                : 1;
81         uint32_t    reserved                  : 20;
82     } bits;
83     uint32_t value;
84 } VAConfigAttribValStats;
85 
86 typedef struct _VAPictureStats {
87     VASurfaceID picture_id;
88     /*
89      * see flags below.
90      */
91     uint32_t flags;
92 } VAPictureStats;
93 /* flags in VAPictureStats could be one of the following */
94 #define VA_PICTURE_STATS_INVALID                   0x00000001
95 #define VA_PICTURE_STATS_PROGRESSIVE               0x00000000
96 #define VA_PICTURE_STATS_TOP_FIELD                 0x00000002
97 #define VA_PICTURE_STATS_BOTTOM_FIELD              0x00000004
98 /** \brief picutre surface content updated indicator.
99  * The picture surface content is updated, it means temporary buffer like downscaled pixel data in driver
100  * internal needs be forced freshing
101  **/
102 #define VA_PICTURE_STATS_CONTENT_UPDATED           0x00000010
103 
104 /** \brief Motion Vector and Statistics frame level controls.
105  * common part VAStatsStatisticsParameterBufferType for a MB or CTB
106  **/
107 typedef struct _VAStatsStatisticsParameter {
108     /** \brief Source surface ID.  */
109     VAPictureStats  input;
110 
111     /** \brief Past reference surface ID pointer.  */
112     VAPictureStats  *past_references;
113 
114     /** \brief Past reference surface number  */
115     uint32_t        num_past_references;
116 
117     /** \brief Statistics output for past reference surface.
118      * Only enabling statistics output for past reference picture when *past_ref_stat_buf is a valid
119      * VABufferID, it is needed in case app wants statistics data of both reference and current pictures
120      * in very special use cases for better performance.
121      * The output layout is defined by VAStatsStatisticsBufferType(for progressive and top field of
122      * interlaced case) and VAStatsStatisticsBottomFieldBufferType(only for interlaced case), only
123      * pixel_average_16x16/pixel_average_8x8 and variance_16x16/variance_8x8 data are valid.
124      **/
125     VABufferID      *past_ref_stat_buf;
126 
127     /** \brief Future reference surface ID pointer.  */
128     VAPictureStats  *future_references;
129 
130     /** \brief Future reference surface number  */
131     uint32_t        num_future_references;
132 
133     /** \brief Statistics output for future reference surface.
134      * Only enabling statistics output for future reference picture when *past_ref_stat_buf is a valid
135      * VABufferID, it is needed in case app wants statistics data of both reference and current pictures
136      * in very special use cases for better performance.
137      * The output layout is defined by VAStatsStatisticsBufferType(for progressive and top field of
138      * interlaced case) and VAStatsStatisticsBottomFieldBufferType(only for interlaced case), only
139      * pixel_average_16x16/pixel_average_8x8 and variance_16x16/variance_8x8 data are valid.
140      **/
141     VABufferID      *future_ref_stat_buf;
142 
143     /** \brief ID of the output buffer.
144      * The number of outputs is determined by below DisableMVOutput and DisableStatisticsOutput.
145      * The output layout is defined by VAStatsMVBufferType, VAStatsStatisticsBufferType(for progressive and
146      * top field of interlaced case) and VAStatsStatisticsBottomFieldBufferType(only for interlaced case).
147      **/
148     VABufferID      *outputs;
149 
150     /** \brief MV predictor. It is valid only when mv_predictor_ctrl is not 0.
151      * Each block has a pair of MVs, one for past and one for future reference
152      * as defined by VAMotionVector. The block is in raster scan order.
153      * Buffer size shall not be less than the number of blocks multiplied by sizeof(VAMotionVector).
154      **/
155     VABufferID      mv_predictor;
156 
157     /** \brief QP input buffer. It is valid only when mb_qp is set to 1.
158      * The data in this buffer correspond to the input source.
159      * One QP per MB or CTB block in raster scan order, each QP is a signed char (8-bit) value.
160      **/
161     VABufferID      qp;
162 } VAStatsStatisticsParameter;
163 
164 /**@}*/
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif /* VA_FEI_H */
171