avfilter/vf_neighbor: simplify code little

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2018-05-01 14:50:48 +02:00
parent 273edb2fe4
commit ddf844d17c

View File

@ -165,8 +165,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
for (plane = 0; plane < s->nb_planes; plane++) { for (plane = 0; plane < s->nb_planes; plane++) {
const int threshold = s->threshold[plane]; const int threshold = s->threshold[plane];
if (threshold) {
const int stride = in->linesize[plane]; const int stride = in->linesize[plane];
const int dstride = out->linesize[plane]; const int dstride = out->linesize[plane];
const uint8_t *src = in->data[plane]; const uint8_t *src = in->data[plane];
@ -174,6 +172,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
const int height = s->planeheight[plane]; const int height = s->planeheight[plane];
const int width = s->planewidth[plane]; const int width = s->planewidth[plane];
if (!threshold) {
av_image_copy_plane(dst, dstride, src, stride, width, height);
continue;
}
for (y = 0; y < height; y++) { for (y = 0; y < height; y++) {
const int nh = y > 0; const int nh = y > 0;
const int ph = y < height - 1; const int ph = y < height - 1;
@ -196,11 +199,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
src += stride; src += stride;
dst += dstride; dst += dstride;
} }
} else {
av_image_copy_plane(out->data[plane], out->linesize[plane],
in->data[plane], in->linesize[plane],
s->planewidth[plane], s->planeheight[plane]);
}
} }
av_frame_free(&in); av_frame_free(&in);