1 /*
2  *  gstvaapiprofile.h - VA profile abstraction
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *    Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6  *  Copyright (C) 2012-2013 Intel Corporation
7  *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public License
11  *  as published by the Free Software Foundation; either version 2.1
12  *  of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this library; if not, write to the Free
21  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  *  Boston, MA 02110-1301 USA
23  */
24 
25 #ifndef GST_VAAPI_PROFILE_H
26 #define GST_VAAPI_PROFILE_H
27 
28 #include <gst/gstvalue.h>
29 
30 G_BEGIN_DECLS
31 
32 /**
33  * GstVaapiCodec:
34  * @GST_VAAPI_CODEC_MPEG1: MPEG-1 (ISO/IEC 11172)
35  * @GST_VAAPI_CODEC_MPEG2: MPEG-2 (ISO/IEC 13818-2)
36  * @GST_VAAPI_CODEC_MPEG4: MPEG-4 Part 2 (ISO/IEC 14496-2)
37  * @GST_VAAPI_CODEC_H263: H.263
38  * @GST_VAAPI_CODEC_H264: H.264 aka MPEG-4 Part 10 (ISO/IEC 14496-10)
39  * @GST_VAAPI_CODEC_WMV3: Windows Media Video 9. VC-1 Simple or Main profile (SMPTE 421M)
40  * @GST_VAAPI_CODEC_VC1: VC-1 Advanced profile (SMPTE 421M)
41  * @GST_VAAPI_CODEC_JPEG: JPEG (ITU-T 81)
42  * @GST_VAAPI_CODEC_H265: H.265 aka MPEG-H Part 2 (ITU-T H.265)
43  * @GST_VAAPI_CODEC_VP9: VP9 (libvpx)
44  *
45  * The set of all codecs for #GstVaapiCodec.
46  */
47 typedef enum {
48     GST_VAAPI_CODEC_MPEG1       = GST_MAKE_FOURCC('M','P','1',0),
49     GST_VAAPI_CODEC_MPEG2       = GST_MAKE_FOURCC('M','P','2',0),
50     GST_VAAPI_CODEC_MPEG4       = GST_MAKE_FOURCC('M','P','4',0),
51     GST_VAAPI_CODEC_H263        = GST_MAKE_FOURCC('2','6','3',0),
52     GST_VAAPI_CODEC_H264        = GST_MAKE_FOURCC('2','6','4',0),
53     GST_VAAPI_CODEC_WMV3        = GST_MAKE_FOURCC('W','M','V',0),
54     GST_VAAPI_CODEC_VC1         = GST_MAKE_FOURCC('V','C','1',0),
55     GST_VAAPI_CODEC_JPEG        = GST_MAKE_FOURCC('J','P','G',0),
56     GST_VAAPI_CODEC_VP8         = GST_MAKE_FOURCC('V','P','8',0),
57     GST_VAAPI_CODEC_H265        = GST_MAKE_FOURCC('2','6','5',0),
58     GST_VAAPI_CODEC_VP9         = GST_MAKE_FOURCC('V','P','9',0),
59 } GstVaapiCodec;
60 
61 /**
62  * GST_VAAPI_MAKE_PROFILE:
63  * @codec: the #GstVaapiCodec without the GST_VAAPI_CODEC_ prefix
64  * @sub_id: a non-zero sub-codec id
65  *
66  * Macro that evaluates to the profile composed from @codec and
67  * @sub_id.
68  */
69 #define GST_VAAPI_MAKE_PROFILE(codec, sub_id) \
70     (GST_VAAPI_CODEC_##codec | GST_MAKE_FOURCC(0,0,0,sub_id))
71 
72 /**
73  * GstVaapiProfile:
74  * @GST_VAAPI_PROFILE_UNKNOWN:
75  *   Unknown profile, used for initializers
76  * @GST_VAAPI_PROFILE_MPEG1:
77  *   MPEG-1
78  * @GST_VAAPI_PROFILE_MPEG2_SIMPLE:
79  *   MPEG-2 simple profile
80  * @GST_VAAPI_PROFILE_MPEG2_MAIN:
81  *   MPEG-2 main profile
82  * @GST_VAAPI_PROFILE_MPEG2_HIGH:
83  *   MPEG-2 high profile
84  * @GST_VAAPI_PROFILE_MPEG4_SIMPLE:
85  *   MPEG-4 Part-2 simple profile
86  * @GST_VAAPI_PROFILE_MPEG4_ADVANCED_SIMPLE:
87  *   MPEG-4 Part-2 advanced simple profile
88  * @GST_VAAPI_PROFILE_MPEG4_MAIN:
89  *   MPEG-4 Part-2 main profile
90  * @GST_VAAPI_PROFILE_H263_BASELINE:
91  *   H.263 baseline profile
92  * @GST_VAAPI_PROFILE_H264_BASELINE:
93  *   H.264 (MPEG-4 Part-10) baseline profile [A.2.1]
94  * @GST_VAAPI_PROFILE_H264_CONSTRAINED_BASELINE:
95  *   H.264 (MPEG-4 Part-10) constrained baseline profile [A.2.1.1]
96  * @GST_VAAPI_PROFILE_H264_MAIN:
97  *   H.264 (MPEG-4 Part-10) main profile [A.2.2]
98  * @GST_VAAPI_PROFILE_H264_EXTENDED:
99  *   H.264 (MPEG-4 Part 10) extended profile [A.2.3]
100  * @GST_VAAPI_PROFILE_H264_HIGH:
101  *   H.264 (MPEG-4 Part-10) high profile [A.2.4]
102  * @GST_VAAPI_PROFILE_H264_HIGH10:
103  *   H.264 (MPEG-4 Part-10) high 10 profile [A.2.5], or high 10 intra
104  *   profile [A.2.8], depending on constraint_set3_flag
105  * @GST_VAAPI_PROFILE_H264_HIGH_422:
106  *   H.264 (MPEG-4 Part-10) high 4:2:2 profile [A.2.6], or high 4:2:2
107  *   intra profile [A.2.9], depending on constraint_set3_flag
108  * @GST_VAAPI_PROFILE_H264_HIGH_444:
109  *   H.264 (MPEG-4 Part-10) high 4:4:4 predictive profile [A.2.7], or
110  *   high 4:4:4 intra profile [A.2.10], depending on constraint_set3_flag
111  * @GST_VAAPI_PROFILE_H264_SCALABLE_BASELINE:
112  *   H.264 (MPEG-4 Part-10) scalable baseline profile [G.10.1.1]
113  * @GST_VAAPI_PROFILE_H264_SCALABLE_HIGH:
114  *   H.264 (MPEG-4 Part-10) scalable high profile [G.10.1.2], or scalable
115  *   high intra profile [G.10.1.3], depending on constraint_set3_flag
116  * @GST_VAAPI_PROFILE_H264_MULTIVIEW_HIGH:
117  *   H.264 (MPEG-4 Part-10) multiview high profile [H.10.1.1]
118  * @GST_VAAPI_PROFILE_H264_STEREO_HIGH:
119  *   H.264 (MPEG-4 Part-10) stereo high profile [H.10.1.2]
120  * @GST_VAAPI_PROFILE_VC1_SIMPLE:
121  *   VC-1 simple profile
122  * @GST_VAAPI_PROFILE_VC1_MAIN:
123  *   VC-1 main profile
124  * @GST_VAAPI_PROFILE_VC1_ADVANCED:
125  *   VC-1 advanced profile
126  * @GST_VAAPI_PROFILE_JPEG_BASELINE:
127  *   JPEG baseline profile
128  * @GST_VAAPI_PROFILE_H265_MAIN:
129  *   H.265 main profile [A.3.2]
130  * @GST_VAAPI_PROFILE_H265_MAIN10:
131  *   H.265 main 10 profile [A.3.3]
132  * @GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE:
133  *   H.265 main still picture profile [A.3.4]
134  * @GST_VAAPI_PROFILE_H265_MAIN_422_10:
135  *   H.265 main still picture profile [A.3.5]
136  * @GST_VAAPI_PROFILE_VP9_0:
137  *   VP9 prfile 0, bitdepth=8, 420
138  * @GST_VAAPI_PROFILE_VP9_1:
139  *   VP9 prfile 1, bitdepth=8, 422/444/440/RGB
140  * @GST_VAAPI_PROFILE_VP9_2:
141  *   VP9 prfile 2, bitdepth=10/12, 420
142  * @GST_VAAPI_PROFILE_VP9_3:
143  *   VP9 prfile 3 bitdepth=10/12, 422/444/440/RGB
144  *
145  * The set of all profiles for #GstVaapiProfile.
146  */
147 typedef enum {
148     GST_VAAPI_PROFILE_UNKNOWN               = 0,
149     GST_VAAPI_PROFILE_MPEG1                 = GST_VAAPI_MAKE_PROFILE(MPEG1,1),
150     GST_VAAPI_PROFILE_MPEG2_SIMPLE          = GST_VAAPI_MAKE_PROFILE(MPEG2,1),
151     GST_VAAPI_PROFILE_MPEG2_MAIN            = GST_VAAPI_MAKE_PROFILE(MPEG2,2),
152     GST_VAAPI_PROFILE_MPEG2_HIGH            = GST_VAAPI_MAKE_PROFILE(MPEG2,3),
153     GST_VAAPI_PROFILE_MPEG4_SIMPLE          = GST_VAAPI_MAKE_PROFILE(MPEG4,1),
154     GST_VAAPI_PROFILE_MPEG4_ADVANCED_SIMPLE = GST_VAAPI_MAKE_PROFILE(MPEG4,2),
155     GST_VAAPI_PROFILE_MPEG4_MAIN            = GST_VAAPI_MAKE_PROFILE(MPEG4,3),
156     GST_VAAPI_PROFILE_H263_BASELINE         = GST_VAAPI_MAKE_PROFILE(H263,1),
157     GST_VAAPI_PROFILE_H264_BASELINE         = GST_VAAPI_MAKE_PROFILE(H264,1),
158     GST_VAAPI_PROFILE_H264_CONSTRAINED_BASELINE =
159                                               GST_VAAPI_MAKE_PROFILE(H264,9),
160     GST_VAAPI_PROFILE_H264_MAIN             = GST_VAAPI_MAKE_PROFILE(H264,2),
161     GST_VAAPI_PROFILE_H264_EXTENDED         = GST_VAAPI_MAKE_PROFILE(H264,10),
162     GST_VAAPI_PROFILE_H264_HIGH             = GST_VAAPI_MAKE_PROFILE(H264,3),
163     GST_VAAPI_PROFILE_H264_HIGH10           = GST_VAAPI_MAKE_PROFILE(H264,7),
164     GST_VAAPI_PROFILE_H264_HIGH_422         = GST_VAAPI_MAKE_PROFILE(H264,4),
165     GST_VAAPI_PROFILE_H264_HIGH_444         = GST_VAAPI_MAKE_PROFILE(H264,8),
166     GST_VAAPI_PROFILE_H264_SCALABLE_BASELINE =
167                                               GST_VAAPI_MAKE_PROFILE(H264,5),
168     GST_VAAPI_PROFILE_H264_SCALABLE_HIGH    = GST_VAAPI_MAKE_PROFILE(H264,6),
169     GST_VAAPI_PROFILE_H264_MULTIVIEW_HIGH   = GST_VAAPI_MAKE_PROFILE(H264,11),
170     GST_VAAPI_PROFILE_H264_STEREO_HIGH      = GST_VAAPI_MAKE_PROFILE(H264,15),
171     GST_VAAPI_PROFILE_VC1_SIMPLE            = GST_VAAPI_MAKE_PROFILE(VC1,1),
172     GST_VAAPI_PROFILE_VC1_MAIN              = GST_VAAPI_MAKE_PROFILE(VC1,2),
173     GST_VAAPI_PROFILE_VC1_ADVANCED          = GST_VAAPI_MAKE_PROFILE(VC1,3),
174     GST_VAAPI_PROFILE_JPEG_BASELINE         = GST_VAAPI_MAKE_PROFILE(JPEG,1),
175     GST_VAAPI_PROFILE_VP8                   = GST_VAAPI_MAKE_PROFILE(VP8,1),
176     GST_VAAPI_PROFILE_H265_MAIN             = GST_VAAPI_MAKE_PROFILE(H265,1),
177     GST_VAAPI_PROFILE_H265_MAIN10           = GST_VAAPI_MAKE_PROFILE(H265,2),
178     GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE =
179                                                GST_VAAPI_MAKE_PROFILE(H265,3),
180     GST_VAAPI_PROFILE_H265_MAIN_422_10        = GST_VAAPI_MAKE_PROFILE(H265,4),
181     GST_VAAPI_PROFILE_H265_MAIN_444           = GST_VAAPI_MAKE_PROFILE(H265,5),
182     GST_VAAPI_PROFILE_H265_MAIN_444_10        = GST_VAAPI_MAKE_PROFILE(H265,6),
183     GST_VAAPI_PROFILE_VP9_0                   = GST_VAAPI_MAKE_PROFILE(VP9,1),
184     GST_VAAPI_PROFILE_VP9_1                   = GST_VAAPI_MAKE_PROFILE(VP9,2),
185     GST_VAAPI_PROFILE_VP9_2                   = GST_VAAPI_MAKE_PROFILE(VP9,3),
186     GST_VAAPI_PROFILE_VP9_3                   = GST_VAAPI_MAKE_PROFILE(VP9,4),
187 } GstVaapiProfile;
188 
189 /**
190  * GstVaapiEntrypoint:
191  * @GST_VAAPI_ENTRYPOINT_VLD: Variable Length Decoding
192  * @GST_VAAPI_ENTRYPOINT_IDCT: Inverse Decrete Cosine Transform
193  * @GST_VAAPI_ENTRYPOINT_MOCO: Motion Compensation
194  * @GST_VAAPI_ENTRYPOINT_SLICE_ENCODE: Encode Slice
195  * @GST_VAAPI_ENTRYPOINT_PICTURE_ENCODE: Encode Picture
196  * @GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP: Encode Slice low power/
197  *                                        high performace varient
198  * @GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_FEI: FEI Encode
199  *
200  * The set of all entrypoints for #GstVaapiEntrypoint
201  */
202 typedef enum {
203     GST_VAAPI_ENTRYPOINT_VLD = 1,
204     GST_VAAPI_ENTRYPOINT_IDCT,
205     GST_VAAPI_ENTRYPOINT_MOCO,
206     GST_VAAPI_ENTRYPOINT_SLICE_ENCODE,
207     GST_VAAPI_ENTRYPOINT_PICTURE_ENCODE,
208     GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP,
209     GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_FEI
210 } GstVaapiEntrypoint;
211 
212 const gchar *
213 gst_vaapi_codec_get_name(GstVaapiCodec codec);
214 
215 GstVaapiProfile
216 gst_vaapi_profile(VAProfile profile);
217 
218 GstVaapiProfile
219 gst_vaapi_profile_from_caps(const GstCaps *caps);
220 
221 const gchar *
222 gst_vaapi_profile_get_name(GstVaapiProfile profile);
223 
224 const gchar *
225 gst_vaapi_profile_get_media_type_name(GstVaapiProfile profile);
226 
227 VAProfile
228 gst_vaapi_profile_get_va_profile(GstVaapiProfile profile);
229 
230 GstCaps *
231 gst_vaapi_profile_get_caps(GstVaapiProfile profile);
232 
233 GstVaapiCodec
234 gst_vaapi_profile_get_codec(GstVaapiProfile profile);
235 
236 GstVaapiEntrypoint
237 gst_vaapi_entrypoint(VAEntrypoint entrypoint);
238 
239 VAEntrypoint
240 gst_vaapi_entrypoint_get_va_entrypoint(GstVaapiEntrypoint entrypoint);
241 
242 G_END_DECLS
243 
244 #endif /* GST_GST_VAAPI_IMAGE_H */
245