• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer Intel MSDK plugin
2  * Copyright (c) 2018, Intel corporation
3  * All rights reserved.
4  *
5  * Author:Sreerenj Balachandran <sreerenj.balachandran@intel.com>
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  *    this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  *    this list of conditions and the following disclaimer in the documentation
15  *    and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
25  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #include "msdk-enums.h"
35 
36 /*========= MSDK Decoder Enums =========================*/
37 GType
gst_msdkdec_output_order_get_type(void)38 gst_msdkdec_output_order_get_type (void)
39 {
40   static GType type = 0;
41 
42   static const GEnumValue values[] = {
43     {GST_MSDKDEC_OUTPUT_ORDER_DISPLAY, "Output frames in Display order",
44         "display"},
45     {GST_MSDKDEC_OUTPUT_ORDER_DECODE, "Output frames in Decoded order",
46         "decoded"},
47     {0, NULL, NULL}
48   };
49 
50   if (!type) {
51     type = g_enum_register_static ("GstMsdkDecOutputOrder", values);
52   }
53   return type;
54 }
55 
56 /*========= MSDK Encoder Enums =========================*/
57 GType
gst_msdkenc_rate_control_get_type(void)58 gst_msdkenc_rate_control_get_type (void)
59 {
60   static GType type = 0;
61 
62   static const GEnumValue values[] = {
63     {MFX_RATECONTROL_CBR, "Constant Bitrate", "cbr"},
64     {MFX_RATECONTROL_VBR, "Variable Bitrate", "vbr"},
65     {MFX_RATECONTROL_CQP, "Constant Quantizer", "cqp"},
66     {MFX_RATECONTROL_AVBR, "Average Bitrate", "avbr"},
67     {MFX_RATECONTROL_LA, "VBR with look ahead (Non HRD compliant)", "la_vbr"},
68     {MFX_RATECONTROL_ICQ, "Intelligent CQP", "icq"},
69     {MFX_RATECONTROL_VCM, "Video Conferencing Mode (Non HRD compliant)", "vcm"},
70     {MFX_RATECONTROL_LA_ICQ, "Intelligent CQP with LA (Non HRD compliant)",
71         "la_icq"},
72 #if 0
73     /* intended for one to N transcode scenario */
74     {MFX_RATECONTROL_LA_EXT, "Extended LA", "la_ext"},
75 #endif
76     {MFX_RATECONTROL_LA_HRD, "HRD compliant LA", "la_hrd"},
77     {MFX_RATECONTROL_QVBR, "VBR with CQP", "qvbr"},
78     {0, NULL, NULL}
79   };
80 
81   if (!type) {
82     type = g_enum_register_static ("GstMsdkEncRateControl", values);
83   }
84   return type;
85 }
86 
87 GType
gst_msdkenc_trellis_quantization_get_type(void)88 gst_msdkenc_trellis_quantization_get_type (void)
89 {
90   static GType type = 0;
91 
92   static const GFlagsValue values[] = {
93     {_MFX_TRELLIS_NONE, "Disable for all frames", "None"},
94     {MFX_TRELLIS_I, "Enable for I frames", "i"},
95     {MFX_TRELLIS_P, "Enable for P frames", "p"},
96     {MFX_TRELLIS_B, "Enable for B frames", "b"},
97     {0, NULL, NULL}
98   };
99 
100   if (!type) {
101     type = g_flags_register_static ("GstMsdkEncTrellisQuantization", values);
102   }
103   return type;
104 }
105 
106 GType
gst_msdkenc_rc_lookahead_ds_get_type(void)107 gst_msdkenc_rc_lookahead_ds_get_type (void)
108 {
109   static GType type = 0;
110 
111   static const GEnumValue values[] = {
112     {MFX_LOOKAHEAD_DS_UNKNOWN, "SDK desides what to do", "default"},
113     {MFX_LOOKAHEAD_DS_OFF, "No downsampling", "off"},
114     {MFX_LOOKAHEAD_DS_2x, "Down sample 2-times before estimation", "2x"},
115     {MFX_LOOKAHEAD_DS_4x, "Down sample 4-times before estimation", "4x"},
116     {0, NULL, NULL}
117   };
118 
119   if (!type) {
120     type = g_enum_register_static ("GstMsdkEncRCLookAheadDownsampling", values);
121   }
122   return type;
123 }
124 
125 GType
gst_msdkenc_mbbrc_get_type(void)126 gst_msdkenc_mbbrc_get_type (void)
127 {
128   static GType type = 0;
129 
130   static const GEnumValue values[] = {
131     {MFX_CODINGOPTION_UNKNOWN, "SDK desides what to do", "auto"},
132     {MFX_CODINGOPTION_OFF, "Disable Macroblock level bit rate control", "off"},
133     {MFX_CODINGOPTION_ON, "Enable Macroblock level bit rate control ", "on"},
134     {0, NULL, NULL}
135   };
136 
137   if (!type) {
138     type = g_enum_register_static ("GstMsdkEncMbBitrateControl", values);
139   }
140   return type;
141 }
142 
143 GType
gst_msdkenc_adaptive_i_get_type(void)144 gst_msdkenc_adaptive_i_get_type (void)
145 {
146   static GType type = 0;
147 
148   static const GEnumValue values[] = {
149     {MFX_CODINGOPTION_UNKNOWN, "SDK desides what to do", "auto"},
150     {MFX_CODINGOPTION_OFF, "Disable Adaptive I frame insertion ", "off"},
151     {MFX_CODINGOPTION_ON, "Enable Aaptive I frame insertion ", "on"},
152     {0, NULL, NULL}
153   };
154 
155   if (!type) {
156     type = g_enum_register_static ("GstMsdkEncAdaptiveI", values);
157   }
158   return type;
159 }
160 
161 GType
gst_msdkenc_adaptive_b_get_type(void)162 gst_msdkenc_adaptive_b_get_type (void)
163 {
164   static GType type = 0;
165 
166   static const GEnumValue values[] = {
167     {MFX_CODINGOPTION_UNKNOWN, "SDK desides what to do", "auto"},
168     {MFX_CODINGOPTION_OFF, "Disable Adaptive B-Frame insertion ", "off"},
169     {MFX_CODINGOPTION_ON, "Enable Aaptive B-Frame insertion ", "on"},
170     {0, NULL, NULL}
171   };
172 
173   if (!type) {
174     type = g_enum_register_static ("GstMsdkEncAdaptiveB", values);
175   }
176   return type;
177 }
178 
179 GType
gst_msdkenc_tune_mode_get_type(void)180 gst_msdkenc_tune_mode_get_type (void)
181 {
182   static GType type = 0;
183 
184   static const GEnumValue values[] = {
185     {MFX_CODINGOPTION_UNKNOWN, "Auto ", "auto"},
186     {MFX_CODINGOPTION_OFF, "None ", "none"},
187     {MFX_CODINGOPTION_ON, "Low power mode ", "low-power"},
188     {0, NULL, NULL}
189   };
190 
191   if (!type) {
192     type = g_enum_register_static ("GstMsdkEncTuneMode", values);
193   }
194 
195   return type;
196 }
197 
198 GType
gst_msdkenc_transform_skip_get_type(void)199 gst_msdkenc_transform_skip_get_type (void)
200 {
201   static GType type = 0;
202 
203   static const GEnumValue values[] = {
204     {MFX_CODINGOPTION_UNKNOWN, "SDK desides what to do", "auto"},
205     {MFX_CODINGOPTION_OFF,
206         "transform_skip_enabled_flag will be set to 0 in PPS ", "off"},
207     {MFX_CODINGOPTION_ON,
208         "transform_skip_enabled_flag will be set to 1 in PPS ", "on"},
209     {0, NULL, NULL}
210   };
211 
212   if (!type) {
213     type = g_enum_register_static ("GstMsdkEncTransformSkip", values);
214   }
215   return type;
216 }
217 
218 GType
gst_msdkenc_intra_refresh_type_get_type(void)219 gst_msdkenc_intra_refresh_type_get_type (void)
220 {
221   static GType type = 0;
222 
223   static const GEnumValue values[] = {
224     {MFX_REFRESH_NO, "No (default)", "no"},
225     {MFX_REFRESH_VERTICAL, "Vertical", "vertical"},
226     {MFX_REFRESH_HORIZONTAL, "Horizontal ", "horizontal"},
227     {MFX_REFRESH_SLICE, "Slice ", "slice"},
228     {0, NULL, NULL}
229   };
230 
231   if (!type) {
232     type = g_enum_register_static ("GstMsdkEncIntraRefreshType", values);
233   }
234 
235   return type;
236 }
237 
238 /*========= MSDK VPP Enums =========================*/
239 
240 #ifndef GST_REMOVE_DEPRECATED
241 GType
gst_msdkvpp_rotation_get_type(void)242 gst_msdkvpp_rotation_get_type (void)
243 {
244   static GType type = 0;
245 
246   static const GEnumValue values[] = {
247     {MFX_ANGLE_0, "Unrotated mode", "0"},
248     {MFX_ANGLE_90, "Rotated by 90°", "90"},
249     {MFX_ANGLE_180, "Rotated by 180°", "180"},
250     {MFX_ANGLE_270, "Rotated by 270°", "270"},
251     {0, NULL, NULL}
252   };
253 
254   if (!type) {
255     type = g_enum_register_static ("GstMsdkVPPRotation", values);
256   }
257   return type;
258 }
259 #endif
260 
261 GType
gst_msdkvpp_deinterlace_mode_get_type(void)262 gst_msdkvpp_deinterlace_mode_get_type (void)
263 {
264   static GType type = 0;
265 
266   static const GEnumValue values[] = {
267     {GST_MSDKVPP_DEINTERLACE_MODE_AUTO,
268         "Auto detection", "auto"},
269     {GST_MSDKVPP_DEINTERLACE_MODE_INTERLACED,
270         "Force deinterlacing", "interlaced"},
271     {GST_MSDKVPP_DEINTERLACE_MODE_DISABLED,
272         "Never deinterlace", "disabled"},
273     {0, NULL, NULL},
274   };
275 
276   if (!type) {
277     type = g_enum_register_static ("GstMsdkVPPDeinterlaceMode", values);
278   }
279   return type;
280 }
281 
282 GType
gst_msdkvpp_deinterlace_method_get_type(void)283 gst_msdkvpp_deinterlace_method_get_type (void)
284 {
285   static GType type = 0;
286 
287   static const GEnumValue values[] = {
288     {_MFX_DEINTERLACE_METHOD_NONE,
289         "Disable deinterlacing", "none"},
290     {MFX_DEINTERLACING_BOB, "Bob deinterlacing", "bob"},
291     {MFX_DEINTERLACING_ADVANCED, "Advanced deinterlacing (Motion adaptive)",
292         "advanced"},
293 #if 0
294     {MFX_DEINTERLACING_AUTO_DOUBLE,
295           "Auto mode with deinterlacing double framerate output",
296         "auto-double"},
297     {MFX_DEINTERLACING_AUTO_SINGLE,
298           "Auto mode with deinterlacing single framerate output",
299         "auto-single"},
300     {MFX_DEINTERLACING_FULL_FR_OUT,
301         "Deinterlace only mode with full framerate output", "full-fr"},
302     {MFX_DEINTERLACING_HALF_FR_OUT,
303         "Deinterlace only Mode with half framerate output", "half-fr"},
304     {MFX_DEINTERLACING_24FPS_OUT, "24 fps fixed output mode", "24-fps"},
305     {MFX_DEINTERLACING_FIXED_TELECINE_PATTERN,
306         "Fixed telecine pattern removal mode", "fixed-telecine-removal"},
307     {MFX_DEINTERLACING_30FPS_OUT, "30 fps fixed output mode", "30-fps"},
308     {MFX_DEINTERLACING_DETECT_INTERLACE, "Only interlace detection",
309         "only-detect"},
310 #endif
311     {MFX_DEINTERLACING_ADVANCED_NOREF,
312           "Advanced deinterlacing mode without using of reference frames",
313         "advanced-no-ref"},
314     {MFX_DEINTERLACING_ADVANCED_SCD,
315           "Advanced deinterlacing mode with scene change detection",
316         "advanced-scd"},
317     {MFX_DEINTERLACING_FIELD_WEAVING, "Field weaving", "field-weave"},
318     {0, NULL, NULL},
319   };
320 
321   if (!type) {
322     type = g_enum_register_static ("GstMsdkVPPDeinterlaceMethod", values);
323   }
324   return type;
325 }
326 
327 #ifndef GST_REMOVE_DEPRECATED
328 GType
gst_msdkvpp_mirroring_get_type(void)329 gst_msdkvpp_mirroring_get_type (void)
330 {
331   static GType type = 0;
332 
333   static const GEnumValue values[] = {
334     {MFX_MIRRORING_DISABLED, "Disable mirroring", "disable"},
335     {MFX_MIRRORING_HORIZONTAL, "Horizontal Mirroring", "horizontal"},
336     {MFX_MIRRORING_VERTICAL, "Vertical Mirroring", "vertical"},
337     {0, NULL, NULL}
338   };
339 
340   if (!type) {
341     type = g_enum_register_static ("GstMsdkVPPMirroring", values);
342   }
343   return type;
344 }
345 #endif
346 
347 GType
gst_msdkvpp_scaling_mode_get_type(void)348 gst_msdkvpp_scaling_mode_get_type (void)
349 {
350   static GType type = 0;
351 
352   static const GEnumValue values[] = {
353     {MFX_SCALING_MODE_DEFAULT, "Default Scaling", "disable"},
354     {MFX_SCALING_MODE_LOWPOWER, "Lowpower Scaling", "lowpower"},
355     {MFX_SCALING_MODE_QUALITY, "High Quality Scaling", "quality"},
356     {0, NULL, NULL}
357   };
358 
359   if (!type) {
360     type = g_enum_register_static ("GstMsdkVPPScalingMode", values);
361   }
362   return type;
363 }
364 
365 GType
gst_msdkvpp_frc_algorithm_get_type(void)366 gst_msdkvpp_frc_algorithm_get_type (void)
367 {
368   static GType type = 0;
369 
370   static const GEnumValue values[] = {
371     {_MFX_FRC_ALGORITHM_NONE, "No FrameRate Control algorithm", "none"},
372     {MFX_FRCALGM_PRESERVE_TIMESTAMP,
373         "Frame dropping/repetition, Preserve timestamp", "preserve-ts"},
374     {MFX_FRCALGM_DISTRIBUTED_TIMESTAMP,
375         "Frame dropping/repetition, Distribute timestamp", "distribute-ts"},
376     {MFX_FRCALGM_FRAME_INTERPOLATION, "Frame interpolation", "interpolate"},
377     {MFX_FRCALGM_FRAME_INTERPOLATION | MFX_FRCALGM_PRESERVE_TIMESTAMP,
378         "Frame interpolation, Preserve timestamp", "interpolate-preserve-ts"},
379     {MFX_FRCALGM_FRAME_INTERPOLATION | MFX_FRCALGM_DISTRIBUTED_TIMESTAMP,
380           "Frame interpolation, Distribute timestamp",
381         "interpolate-distribute-ts"},
382     {0, NULL, NULL}
383   };
384 
385   if (!type) {
386     type = g_enum_register_static ("GstMsdkVPPFrcAlgorithm", values);
387   }
388   return type;
389 }
390