summaryrefslogtreecommitdiff
path: root/libavfilter/vf_derain.c
diff options
context:
space:
mode:
authorGuo, Yejun <yejun.guo@intel.com>2020-03-20 20:54:07 +0800
committerGuo, Yejun <yejun.guo@intel.com>2020-04-07 11:04:47 +0800
commit7e4527e8fa1f8f0bba6a7f7cadc407813f17fbd1 (patch)
tree6f01c89c95ce4f50296625c05a4f7bc4df1d6c72 /libavfilter/vf_derain.c
parentbbc64799dce727aaa73522353eaf01b11ad79755 (diff)
avfilter/vf_derain.c: put all the calculation in model file.
currently, the model outputs the rain, and so need a subtraction in filter c code to get the final derain result. I've sent a PR to update the model file and accepted, see at https://github.com/XueweiMeng/derain_filter/pull/3 Signed-off-by: Guo, Yejun <yejun.guo@intel.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavfilter/vf_derain.c')
-rw-r--r--libavfilter/vf_derain.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/libavfilter/vf_derain.c b/libavfilter/vf_derain.c
index 89f9d5a2ed..74322602b0 100644
--- a/libavfilter/vf_derain.c
+++ b/libavfilter/vf_derain.c
@@ -100,7 +100,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterLink *outlink = ctx->outputs[0];
DRContext *dr_context = ctx->priv;
DNNReturnType dnn_result;
- int pad_size;
AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) {
@@ -129,15 +128,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
out->width = dr_context->output.width;
outlink->h = dr_context->output.height;
outlink->w = dr_context->output.width;
- pad_size = (in->height - out->height) >> 1;
for (int i = 0; i < out->height; i++){
for(int j = 0; j < out->width * 3; j++){
int k = i * out->linesize[0] + j;
int t = i * out->width * 3 + j;
-
- int t_in = (i + pad_size) * in->width * 3 + j + pad_size * 3;
- out->data[0][k] = CLIP((int)((((float *)dr_context->input.data)[t_in] - ((float *)dr_context->output.data)[t]) * 255), 0, 255);
+ out->data[0][k] = CLIP((int)((((float *)dr_context->output.data)[t]) * 255), 0, 255);
}
}