• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * GStreamer gstreamer-onnxelement
3  * Copyright (C) 2021 Collabora Ltd
4  *
5  * gstonnxelement.c
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25 
26 #include "gstonnxelement.h"
27 
28 GType
gst_onnx_optimization_level_get_type(void)29 gst_onnx_optimization_level_get_type (void)
30 {
31   static GType onnx_optimization_type = 0;
32 
33   if (g_once_init_enter (&onnx_optimization_type)) {
34     static GEnumValue optimization_level_types[] = {
35       {GST_ONNX_OPTIMIZATION_LEVEL_DISABLE_ALL, "Disable all optimization",
36           "disable-all"},
37       {GST_ONNX_OPTIMIZATION_LEVEL_ENABLE_BASIC,
38             "Enable basic optimizations (redundant node removals))",
39           "enable-basic"},
40       {GST_ONNX_OPTIMIZATION_LEVEL_ENABLE_EXTENDED,
41             "Enable extended optimizations (redundant node removals + node fusions)",
42           "enable-extended"},
43       {GST_ONNX_OPTIMIZATION_LEVEL_ENABLE_ALL,
44           "Enable all possible optimizations", "enable-all"},
45       {0, NULL, NULL},
46     };
47 
48     GType temp = g_enum_register_static ("GstOnnxOptimizationLevel",
49         optimization_level_types);
50 
51     g_once_init_leave (&onnx_optimization_type, temp);
52   }
53 
54   return onnx_optimization_type;
55 }
56 
57 GType
gst_onnx_execution_provider_get_type(void)58 gst_onnx_execution_provider_get_type (void)
59 {
60   static GType onnx_execution_type = 0;
61 
62   if (g_once_init_enter (&onnx_execution_type)) {
63     static GEnumValue execution_provider_types[] = {
64       {GST_ONNX_EXECUTION_PROVIDER_CPU, "CPU execution provider",
65           "cpu"},
66       {GST_ONNX_EXECUTION_PROVIDER_CUDA,
67             "CUDA execution provider",
68           "cuda"},
69       {0, NULL, NULL},
70     };
71 
72     GType temp = g_enum_register_static ("GstOnnxExecutionProvider",
73         execution_provider_types);
74 
75     g_once_init_leave (&onnx_execution_type, temp);
76   }
77 
78   return onnx_execution_type;
79 }
80 
81 GType
gst_ml_model_input_image_format_get_type(void)82 gst_ml_model_input_image_format_get_type (void)
83 {
84   static GType ml_model_input_image_format = 0;
85 
86   if (g_once_init_enter (&ml_model_input_image_format)) {
87     static GEnumValue ml_model_input_image_format_types[] = {
88       {GST_ML_MODEL_INPUT_IMAGE_FORMAT_HWC,
89             "Height Width Channel (HWC) a.k.a. interleaved image data format",
90           "hwc"},
91       {GST_ML_MODEL_INPUT_IMAGE_FORMAT_CHW,
92             "Channel Height Width (CHW) a.k.a. planar image data format",
93           "chw"},
94       {0, NULL, NULL},
95     };
96 
97     GType temp = g_enum_register_static ("GstMlModelInputImageFormat",
98         ml_model_input_image_format_types);
99 
100     g_once_init_leave (&ml_model_input_image_format, temp);
101   }
102 
103   return ml_model_input_image_format;
104 }
105