[FFmpeg-cvslog] avfilter/vf_cover_rect: clip rectangle if it is partly outside the input

Michael Niedermayer git at videolan.org
Mon May 4 23:18:45 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon May  4 22:33:17 2015 +0200| [b4cc7d67f564417af5da99c894a305d1fdd75d51] | committer: Michael Niedermayer

avfilter/vf_cover_rect: clip rectangle if it is partly outside the input

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavfilter/vf_cover_rect.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavfilter/vf_cover_rect.c b/libavfilter/vf_cover_rect.c
index 7e1a9f4..d12807a 100644
--- a/libavfilter/vf_cover_rect.c
+++ b/libavfilter/vf_cover_rect.c
@@ -163,6 +163,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
         return ff_filter_frame(ctx->outputs[0], in);
     }
 
+    if (x < 0) {
+        w += x;
+        x = 0;
+    }
+    if (y < 0) {
+        h += y;
+        y = 0;
+    }
+    w = FFMIN(w, in->width  - x);
+    h = FFMIN(h, in->height - y);
+
     if (w > in->width || h > in->height || w <= 0 || h <= 0)
         return AVERROR(EINVAL);
 



More information about the ffmpeg-cvslog mailing list