[FFmpeg-cvslog] libavfilter: Add dehaze-filter option in existing derain.

Xuewei Meng git at videolan.org
Mon Aug 26 05:59:16 EEST 2019


ffmpeg | branch: master | Xuewei Meng <xwmeng96 at gmail.com> | Thu Aug 22 18:28:44 2019 +0800| [f0c97d613ea764db8e78b9cc40ff1c821b140c79] | committer: Steven Liu

libavfilter: Add dehaze-filter option in existing derain.

Add the support of dehaze filter in existing derain filter source
code. As the processing procedure in FFmpeg is the same for current
derain and dehaze, we reuse the derain filter source code. The
model training and generation scripts are in repo
https://github.com/XueweiMeng/derain_filter.git

Reviewed-by: Steven Liu <lq at onvideo.cn>
Signed-off-by: Xuewei Meng <xwmeng96 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0c97d613ea764db8e78b9cc40ff1c821b140c79
---

 doc/filters.texi        | 12 ++++++++++++
 libavfilter/vf_derain.c |  4 ++++
 2 files changed, 16 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index 2fbb479186..7759fe177b 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8449,6 +8449,18 @@ files (.pb) by using tools/python/convert.py
 The filter accepts the following options:
 
 @table @option
+ at item filter_type
+Specify which filter to use. This option accepts the following values:
+
+ at table @samp
+ at item derain
+Derain filter. To conduct derain filter, you need to use a derain model.
+
+ at item dehaze
+Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
+ at end table
+Default value is @samp{derain}.
+
 @item dnn_backend
 Specify which DNN backend to use for model loading and execution. This option accepts
 the following values:
diff --git a/libavfilter/vf_derain.c b/libavfilter/vf_derain.c
index c380b40122..ddf3632e46 100644
--- a/libavfilter/vf_derain.c
+++ b/libavfilter/vf_derain.c
@@ -34,6 +34,7 @@
 typedef struct DRContext {
     const AVClass *class;
 
+    int                filter_type;
     char              *model_filename;
     DNNBackendType     backend_type;
     DNNModule         *dnn_module;
@@ -46,6 +47,9 @@ typedef struct DRContext {
 #define OFFSET(x) offsetof(DRContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
 static const AVOption derain_options[] = {
+    { "filter_type", "filter type(derain/dehaze)",  OFFSET(filter_type),    AV_OPT_TYPE_INT,    { .i64 = 0 },    0, 1, FLAGS, "type" },
+    { "derain",      "derain filter flag",          0,                      AV_OPT_TYPE_CONST,  { .i64 = 0 },    0, 0, FLAGS, "type" },
+    { "dehaze",      "dehaze filter flag",          0,                      AV_OPT_TYPE_CONST,  { .i64 = 1 },    0, 0, FLAGS, "type" },
     { "dnn_backend", "DNN backend",             OFFSET(backend_type),   AV_OPT_TYPE_INT,    { .i64 = 0 },    0, 1, FLAGS, "backend" },
     { "native",      "native backend flag",     0,                      AV_OPT_TYPE_CONST,  { .i64 = 0 },    0, 0, FLAGS, "backend" },
 #if (CONFIG_LIBTENSORFLOW == 1)



More information about the ffmpeg-cvslog mailing list