[FFmpeg-cvslog] avfilter/vf_neighbor: check if width is 1

Paul B Mahol git at videolan.org
Fri Apr 8 01:30:37 EEST 2022


ffmpeg | branch: release/4.2 | Paul B Mahol <onemda at gmail.com> | Fri Oct 11 11:18:10 2019 +0200| [98981312e15ad6bf1c90e660abf666b15924e350] | committer: Michael Niedermayer

avfilter/vf_neighbor: check if width is 1

Fixes #8242

(cherry picked from commit e787f8fd7ee99ba0c3e0f086ce2ce59eea7ed86c)

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

 libavfilter/vf_neighbor.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_neighbor.c b/libavfilter/vf_neighbor.c
index e50d4b4ed0..47c6175a12 100644
--- a/libavfilter/vf_neighbor.c
+++ b/libavfilter/vf_neighbor.c
@@ -296,9 +296,11 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
                                                src + (width - 2) * bpc,                                                      src + (width - 2) * bpc,
                                                src + (width - 2) * bpc + ph * stride, src + (width - 1) * bpc + ph * stride, src + (width - 2) * bpc + ph * stride};
 
-            s->filter(dst,                     src,                     1,         threshold, coordinateslb, s->coordinates, s->max);
-            s->filter(dst          + 1  * bpc, src          + 1  * bpc, width - 2, threshold, coordinates,   s->coordinates, s->max);
-            s->filter(dst + (width - 1) * bpc, src + (width - 1) * bpc, 1,         threshold, coordinatesrb, s->coordinates, s->max);
+            s->filter(dst,                         src,                     1,         threshold, coordinateslb, s->coordinates, s->max);
+            if (width > 1) {
+                s->filter(dst          + 1  * bpc, src          + 1  * bpc, width - 2, threshold, coordinates,   s->coordinates, s->max);
+                s->filter(dst + (width - 1) * bpc, src + (width - 1) * bpc, 1,         threshold, coordinatesrb, s->coordinates, s->max);
+            }
 
             src += stride;
             dst += dstride;



More information about the ffmpeg-cvslog mailing list