Merge branch 'split-out-tensor-decoders' into 'main'

Draft: RFC: Split out tensor decoders from the ONNX plugin and make the Tensor meta public.

See merge request gstreamer/gstreamer!6000
This commit is contained in:
Olivier Crête 2024-05-03 22:34:02 +00:00
commit 341d8495ab
12 changed files with 35 additions and 16 deletions

View file

@ -24,17 +24,12 @@
#include "config.h"
#endif
#include "decoders/gstssdobjectdetector.h"
#include "gstonnxinference.h"
#include "tensor/gsttensormeta.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
gboolean success = GST_ELEMENT_REGISTER (ssd_object_detector, plugin);
success |= GST_ELEMENT_REGISTER (onnx_inference, plugin);
return success;
return GST_ELEMENT_REGISTER (onnx_inference, plugin);
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,

View file

@ -23,10 +23,10 @@
#define __GST_ONNX_CLIENT_H__
#include <gst/gst.h>
#include <gst/analytics/analytics.h>
#include <onnxruntime_cxx_api.h>
#include <gst/video/video.h>
#include "gstml.h"
#include "tensor/gsttensormeta.h"
GST_DEBUG_CATEGORY_EXTERN (onnx_inference_debug);

View file

@ -15,16 +15,14 @@ endif
if onnxrt_dep.found()
gstonnx = library('gstonnx',
'gstonnx.c',
'decoders/gstssdobjectdetector.c',
'gstonnxinference.cpp',
'gstonnxclient.cpp',
'tensor/gsttensormeta.c',
c_args : gst_plugins_bad_args + extra_args,
cpp_args : gst_plugins_bad_args + extra_args,
link_args : noseh_link_args,
include_directories : [configinc, libsinc, cuda_stubinc],
dependencies : [gstbase_dep, gstvideo_dep, gstanalytics_dep, onnxrt_dep,
libm, gio_dep] + extra_deps,
libm] + extra_deps,
install : true,
install_dir : plugins_install_dir,
)

View file

@ -30,5 +30,6 @@
#include <gst/analytics/gstanalyticsclassificationmtd.h>
#include <gst/analytics/gstanalyticsobjectdetectionmtd.h>
#include <gst/analytics/gstanalyticsobjecttrackingmtd.h>
#include <gst/analytics/gsttensormeta.h>
#endif /* __ANALYTICS_H__ */

View file

@ -19,10 +19,16 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef __GST_TENSOR_META_H__
#define __GST_TENSOR_META_H__
#include <gst/gst.h>
#include <gst/analytics/analytics-meta-prelude.h>
/**
* GstTensorDataType:
@ -114,9 +120,13 @@ G_BEGIN_DECLS
#define GST_TENSOR_META_INFO \
(gst_tensor_meta_get_info())
GST_ANALYTICS_META_API
GType gst_tensor_meta_api_get_type (void);
GST_ANALYTICS_META_API
const GstMetaInfo *gst_tensor_meta_get_info (void);
GST_ANALYTICS_META_API
gint gst_tensor_meta_get_index_from_id(GstTensorMeta *meta, GQuark id);
G_END_DECLS

View file

@ -1,14 +1,16 @@
analytics_sources = files( 'gstanalyticsmeta.c',
'gstanalyticsclassificationmtd.c',
'gstanalyticsobjectdetectionmtd.c',
'gstanalyticsobjecttrackingmtd.c')
'gstanalyticsobjecttrackingmtd.c',
'gsttensormeta.c')
analytics_headers = files( 'analytics.h',
'gstanalyticsmeta.h',
'analytics-meta-prelude.h',
'gstanalyticsclassificationmtd.h',
'gstanalyticsobjectdetectionmtd.h',
'gstanalyticsobjecttrackingmtd.h')
'gstanalyticsobjecttrackingmtd.h',
'gsttensormeta.h')
install_headers(analytics_headers, subdir : 'gstreamer-1.0/gst/analytics')
pkg_name = 'gstreamer-analytics-1.0'

View file

@ -11,7 +11,7 @@ foreach plugin : ['accurip', 'adpcmdec', 'adpcmenc', 'aiff', 'asfmux',
'mse', 'mxf', 'netsim', 'onvif', 'pcapparse', 'pnm', 'proxy',
'rawparse', 'removesilence', 'rist', 'rtmp2', 'rtp', 'sdp',
'segmentclip', 'siren', 'smooth', 'speed', 'subenc', 'switchbin',
'timecode', 'transcode', 'unixfd', 'videofilters',
'tensordecoders', 'timecode', 'transcode', 'unixfd', 'videofilters',
'videoframe_audiolevel', 'videoparsers', 'videosignal',
'vmnc', 'y4m']
if not get_option(plugin).disabled()

View file

@ -2,7 +2,7 @@
* GStreamer gstreamer-ssdobjectdetector
* Copyright (C) 2021 Collabora Ltd.
*
* gstssdobjectdetector.cpp
* gstssdobjectdetector.c
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@ -51,7 +51,6 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/analytics/analytics.h>
#include "tensor/gsttensormeta.h"
/* Object detection tensor id strings */
#define GST_MODEL_OBJECT_DETECTOR_BOXES "Gst.Model.ObjectDetector.Boxes"

View file

@ -0,0 +1,13 @@
tensordecoders_sources = [
'gstssdobjectdetector.c'
]
gsttensordecoders = library('gsttensordecoders',
tensordecoders_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstbase_dep, gstvideo_dep, gstanalytics_dep, gio_dep, libm],
install : true,
install_dir : plugins_install_dir,
)
plugins += [gsttensordecoders]

View file

@ -65,6 +65,7 @@ option('smooth', type : 'feature', value : 'auto')
option('speed', type : 'feature', value : 'auto')
option('subenc', type : 'feature', value : 'auto')
option('switchbin', type : 'feature', value : 'auto')
option('tensordecoders', type : 'feature', value : 'auto')
option('timecode', type : 'feature', value : 'auto')
option('unixfd', type : 'feature', value : 'auto')
option('videofilters', type : 'feature', value : 'auto')