int i, j;
memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
- if (h > 1)
+ if (h > 1) {
memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
+ }
for (j = 2; j < h - 2; j++) {
dst[0] = src[0];
- dst[1] = src[1];
+ if (w > 1)
+ dst[1] = src[1];
for (i = 2; i < w - 2; i++) {
/* Gaussian mask of size 5x5 with sigma = 1.4 */
dst[i] = ((src[-2*src_linesize + i-2] + src[2*src_linesize + i-2]) * 2
+ src[i+1] * 12
+ src[i+2] * 5) / 159;
}
- dst[i ] = src[i ];
- dst[i + 1] = src[i + 1];
+ if (w > 2)
+ dst[i ] = src[i ];
+ if (w > 3)
+ dst[i + 1] = src[i + 1];
dst += dst_linesize;
src += src_linesize;
}
- if (h > 2)
+ if (h > 2) {
memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
+ }
if (h > 3)
memcpy(dst, src, w);
}
if (gx < 0)
gx = -gx, gy = -gy;
- gy <<= 16;
+ gy *= (1 << 16);
tanpi8gx = 27146 * gx;
tan3pi8gx = 158218 * gx;
if (gy > -tan3pi8gx && gy < -tanpi8gx) return DIRECTION_45UP;
continue;
}
- if ((!i || i == w - 1 || !j || j == h - 1) &&
+ if (!(!i || i == w - 1 || !j || j == h - 1) &&
src[i] > low &&
(src[-src_linesize + i-1] > high ||
src[-src_linesize + i ] > high ||
{ NULL }
};
-AVFilter ff_vf_edgedetect = {
+const AVFilter ff_vf_edgedetect = {
.name = "edgedetect",
.description = NULL_IF_CONFIG_SMALL("Detect and draw edge."),
.priv_size = sizeof(EdgeDetectContext),