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
Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | typedef struct DRContext { |
| 35 | 35 | const AVClass *class; |
| 36 | 36 | |
| 37 | + int filter_type; | |
| 37 | 38 | char *model_filename; |
| 38 | 39 | DNNBackendType backend_type; |
| 39 | 40 | DNNModule *dnn_module; |
| @@ -46,6 +47,9 @@ typedef struct DRContext { · 6 unmodified lines | ||
| 46 | 47 | #define OFFSET(x) offsetof(DRContext, x) |
| 47 | 48 | #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM |
| 48 | 49 | static const AVOption derain_options[] = { |
| 50 | + { "filter_type", "filter type(derain/dehaze)", OFFSET(filter_type), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "type" }, | |
| 51 | + { "derain", "derain filter flag", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "type" }, | |
| 52 | + { "dehaze", "dehaze filter flag", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "type" }, | |
| 49 | 53 | { "dnn_backend", "DNN backend", OFFSET(backend_type), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "backend" }, |
| 50 | 54 | { "native", "native backend flag", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "backend" }, |
| 51 | 55 | #if (CONFIG_LIBTENSORFLOW == 1) |