summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_delogo.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index ba35cf5c8d..e882dd523a 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -246,8 +246,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
FF_CEIL_RSHIFT(inlink->w, hsub),
FF_CEIL_RSHIFT(inlink->h, vsub),
sar, s->x>>hsub, s->y>>vsub,
- FF_CEIL_RSHIFT(s->w, hsub),
- FF_CEIL_RSHIFT(s->h, vsub),
+ /* Up and left borders were rounded down, inject lost bits
+ * into width and height to avoid error accumulation */
+ FF_CEIL_RSHIFT(s->w + (s->x & ((1<<hsub)-1)), hsub),
+ FF_CEIL_RSHIFT(s->h + (s->y & ((1<<vsub)-1)), vsub),
s->band>>FFMIN(hsub, vsub),
s->show, direct);
}