Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
093f5da5
Commit
093f5da5
authored
May 07, 2024
by
Zhao Zhili
Committed by
Guo Yejun
May 30, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/dnn: Don't show backends which are not supported by a filter
parent
4f051c74
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
28 additions
and
12 deletions
+28
-12
dnn_interface.c
libavfilter/dnn/dnn_interface.c
+8
-3
dnn_filter_common.h
libavfilter/dnn_filter_common.h
+9
-2
dnn_interface.h
libavfilter/dnn_interface.h
+6
-2
vf_derain.c
libavfilter/vf_derain.c
+1
-1
vf_dnn_classify.c
libavfilter/vf_dnn_classify.c
+1
-1
vf_dnn_detect.c
libavfilter/vf_dnn_detect.c
+1
-1
vf_dnn_processing.c
libavfilter/vf_dnn_processing.c
+1
-1
vf_sr.c
libavfilter/vf_sr.c
+1
-1
No files found.
libavfilter/dnn/dnn_interface.c
View file @
093f5da5
...
...
@@ -120,11 +120,16 @@ void *ff_dnn_child_next(DnnContext *obj, void *prev) {
return
NULL
;
}
const
AVClass
*
ff_dnn_child_class_iterate
(
void
**
iter
)
const
AVClass
*
ff_dnn_child_class_iterate
_with_mask
(
void
**
iter
,
uint32_t
backend_mask
)
{
uintptr_t
i
=
(
uintptr_t
)
*
iter
;
for
(
uintptr_t
i
=
(
uintptr_t
)
*
iter
;
i
<
FF_ARRAY_ELEMS
(
dnn_backend_info_list
);
i
++
)
{
if
(
i
>
0
)
{
const
DNNModule
*
module
=
dnn_backend_info_list
[
i
].
module
;
if
(
!
(
module
->
type
&
backend_mask
))
continue
;
}
if
(
i
<
FF_ARRAY_ELEMS
(
dnn_backend_info_list
))
{
*
iter
=
(
void
*
)(
i
+
1
);
return
dnn_backend_info_list
[
i
].
class
;
}
...
...
libavfilter/dnn_filter_common.h
View file @
093f5da5
...
...
@@ -26,6 +26,12 @@
#include "dnn_interface.h"
#define DNN_FILTER_CHILD_CLASS_ITERATE(name, backend_mask) \
static const AVClass *name##_child_class_iterate(void **iter) \
{ \
return ff_dnn_child_class_iterate_with_mask(iter, (backend_mask)); \
}
#define AVFILTER_DNN_DEFINE_CLASS_EXT(name, desc, options) \
static const AVClass name##_class = { \
.class_name = desc, \
...
...
@@ -34,10 +40,11 @@
.version = LIBAVUTIL_VERSION_INT, \
.category = AV_CLASS_CATEGORY_FILTER, \
.child_next = ff_dnn_filter_child_next, \
.child_class_iterate =
ff_dnn
_child_class_iterate, \
.child_class_iterate =
name##
_child_class_iterate, \
}
#define AVFILTER_DNN_DEFINE_CLASS(fname) \
#define AVFILTER_DNN_DEFINE_CLASS(fname, backend_mask) \
DNN_FILTER_CHILD_CLASS_ITERATE(fname, backend_mask) \
AVFILTER_DNN_DEFINE_CLASS_EXT(fname, #fname, fname##_options)
void
*
ff_dnn_filter_child_next
(
void
*
obj
,
void
*
prev
);
...
...
libavfilter/dnn_interface.h
View file @
093f5da5
...
...
@@ -32,7 +32,11 @@
#define DNN_GENERIC_ERROR FFERRTAG('D','N','N','!')
typedef
enum
{
DNN_TF
=
1
,
DNN_OV
,
DNN_TH
}
DNNBackendType
;
typedef
enum
{
DNN_TF
=
1
,
DNN_OV
=
1
<<
1
,
DNN_TH
=
1
<<
2
}
DNNBackendType
;
typedef
enum
{
DNN_FLOAT
=
1
,
DNN_UINT8
=
4
}
DNNDataType
;
...
...
@@ -190,7 +194,7 @@ const DNNModule *ff_get_dnn_module(DNNBackendType backend_type, void *log_ctx);
void
ff_dnn_init_child_class
(
DnnContext
*
ctx
);
void
*
ff_dnn_child_next
(
DnnContext
*
obj
,
void
*
prev
);
const
AVClass
*
ff_dnn_child_class_iterate
(
void
**
iter
);
const
AVClass
*
ff_dnn_child_class_iterate
_with_mask
(
void
**
iter
,
uint32_t
backend_mask
);
static
inline
int
dnn_get_width_idx_by_layout
(
DNNLayout
layout
)
{
...
...
libavfilter/vf_derain.c
View file @
093f5da5
...
...
@@ -49,7 +49,7 @@ static const AVOption derain_options[] = {
{
NULL
}
};
AVFILTER_DNN_DEFINE_CLASS
(
derain
);
AVFILTER_DNN_DEFINE_CLASS
(
derain
,
DNN_TF
);
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
in
)
{
...
...
libavfilter/vf_dnn_classify.c
View file @
093f5da5
...
...
@@ -56,7 +56,7 @@ static const AVOption dnn_classify_options[] = {
{
NULL
}
};
AVFILTER_DNN_DEFINE_CLASS
(
dnn_classify
);
AVFILTER_DNN_DEFINE_CLASS
(
dnn_classify
,
DNN_OV
);
static
int
dnn_classify_post_proc
(
AVFrame
*
frame
,
DNNData
*
output
,
uint32_t
bbox_index
,
AVFilterContext
*
filter_ctx
)
{
...
...
libavfilter/vf_dnn_detect.c
View file @
093f5da5
...
...
@@ -84,7 +84,7 @@ static const AVOption dnn_detect_options[] = {
{
NULL
}
};
AVFILTER_DNN_DEFINE_CLASS
(
dnn_detect
);
AVFILTER_DNN_DEFINE_CLASS
(
dnn_detect
,
DNN_TF
|
DNN_OV
);
static
inline
float
sigmoid
(
float
x
)
{
return
1
.
f
/
(
1
.
f
+
exp
(
-
x
));
...
...
libavfilter/vf_dnn_processing.c
View file @
093f5da5
...
...
@@ -57,7 +57,7 @@ static const AVOption dnn_processing_options[] = {
{
NULL
}
};
AVFILTER_DNN_DEFINE_CLASS
(
dnn_processing
);
AVFILTER_DNN_DEFINE_CLASS
(
dnn_processing
,
DNN_TF
|
DNN_OV
|
DNN_TH
);
static
av_cold
int
init
(
AVFilterContext
*
context
)
{
...
...
libavfilter/vf_sr.c
View file @
093f5da5
...
...
@@ -53,7 +53,7 @@ static const AVOption sr_options[] = {
{
NULL
}
};
AVFILTER_DNN_DEFINE_CLASS
(
sr
);
AVFILTER_DNN_DEFINE_CLASS
(
sr
,
DNN_TF
);
static
av_cold
int
init
(
AVFilterContext
*
context
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment