[FFmpeg-cvslog] avfilter/vf_noise: dont corrupt the picture outside width x height

Michael Niedermayer git at videolan.org
Thu Sep 12 17:21:31 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Sep 12 16:33:21 2013 +0200| [51dab60c7b91a21ec280c7d3042aa8350aae048f] | committer: Michael Niedermayer

avfilter/vf_noise: dont corrupt the picture outside width x height

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

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

 libavfilter/vf_noise.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_noise.c b/libavfilter/vf_noise.c
index 9e82976..57af5b6 100644
--- a/libavfilter/vf_noise.c
+++ b/libavfilter/vf_noise.c
@@ -57,6 +57,7 @@ typedef struct {
     const AVClass *class;
     int nb_planes;
     int linesize[4];
+    int bytewidth[4];
     int height[4];
     FilterParams all;
     FilterParams param[4];
@@ -196,6 +197,9 @@ static int config_input(AVFilterLink *inlink)
     n->height[1] = n->height[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     n->height[0] = n->height[3] = inlink->h;
 
+    n->bytewidth [1] = n->bytewidth [2] = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w) * ((desc->comp[0].depth_minus1 + 1) / 8);
+    n->bytewidth [0] = n->bytewidth [3] = inlink->w * ((desc->comp[0].depth_minus1 + 1) / 8);
+
     return 0;
 }
 
@@ -377,7 +381,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
         noise(td->out->data[plane] + start * td->out->linesize[plane],
               td->in->data[plane]  + start * td->in->linesize[plane],
               td->out->linesize[plane], td->in->linesize[plane],
-              s->linesize[plane], start, end, s, plane);
+              s->bytewidth[plane], start, end, s, plane);
     }
     return 0;
 }



More information about the ffmpeg-cvslog mailing list