56 #define OFFSET(x) offsetof(EdgeDetectContext, x)
57 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
73 edgedetect->
low_u8 = edgedetect->
low * 255. + .5;
101 for (p = 0; p < edgedetect->
nb_planes; p++) {
114 uint8_t *dst,
int dst_linesize,
119 memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
120 memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
121 for (j = 2; j < h - 2; j++) {
124 for (i = 2; i < w - 2; i++) {
126 dst[i] = ((src[-2*src_linesize + i-2] + src[2*src_linesize + i-2]) * 2
127 + (src[-2*src_linesize + i-1] + src[2*src_linesize + i-1]) * 4
128 + (src[-2*src_linesize + i ] + src[2*src_linesize + i ]) * 5
129 + (src[-2*src_linesize + i+1] + src[2*src_linesize + i+1]) * 4
130 + (src[-2*src_linesize + i+2] + src[2*src_linesize + i+2]) * 2
132 + (src[ -src_linesize + i-2] + src[ src_linesize + i-2]) * 4
133 + (src[ -src_linesize + i-1] + src[ src_linesize + i-1]) * 9
134 + (src[ -src_linesize + i ] + src[ src_linesize + i ]) * 12
135 + (src[ -src_linesize + i+1] + src[ src_linesize + i+1]) * 9
136 + (src[ -src_linesize + i+2] + src[ src_linesize + i+2]) * 4
142 + src[i+2] * 5) / 159;
145 dst[i + 1] = src[i + 1];
150 memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
174 int tanpi8gx, tan3pi8gx;
179 tanpi8gx = 27146 * gx;
180 tan3pi8gx = 158218 * gx;
189 uint16_t *dst,
int dst_linesize,
190 int8_t *dir,
int dir_linesize,
195 for (j = 1; j < h - 1; j++) {
199 for (i = 1; i < w - 1; i++) {
201 -1*src[-src_linesize + i-1] + 1*src[-src_linesize + i+1]
202 -2*src[ i-1] + 2*src[ i+1]
203 -1*src[ src_linesize + i-1] + 1*src[ src_linesize + i+1];
205 -1*src[-src_linesize + i-1] + 1*src[ src_linesize + i-1]
206 -2*src[-src_linesize + i ] + 2*src[ src_linesize + i ]
207 -1*src[-src_linesize + i+1] + 1*src[ src_linesize + i+1];
216 uint8_t *dst,
int dst_linesize,
217 const int8_t *dir,
int dir_linesize,
218 const uint16_t *
src,
int src_linesize)
222 #define COPY_MAXIMA(ay, ax, by, bx) do { \
223 if (src[i] > src[(ay)*src_linesize + i+(ax)] && \
224 src[i] > src[(by)*src_linesize + i+(bx)]) \
225 dst[i] = av_clip_uint8(src[i]); \
228 for (j = 1; j < h - 1; j++) {
232 for (i = 1; i < w - 1; i++) {
244 uint8_t *dst,
int dst_linesize,
249 for (j = 0; j < h; j++) {
250 for (i = 0; i < w; i++) {
256 if ((!i || i == w - 1 || !j || j == h - 1) &&
258 (src[-src_linesize + i-1] > high ||
259 src[-src_linesize + i ] > high ||
260 src[-src_linesize + i+1] > high ||
263 src[ src_linesize + i-1] > high ||
264 src[ src_linesize + i ] > high ||
265 src[ src_linesize + i+1] > high))
276 uint8_t *dst,
int dst_linesize,
281 for (j = 0; j < h; j++) {
282 for (i = 0; i < w; i++)
283 dst[i] = (dst[i] + src[i]) >> 1;
309 for (p = 0; p < edgedetect->
nb_planes; p++) {
322 gradients, inlink->
w,
323 directions,inlink->
w,
328 memset(tmpbuf, 0, inlink->
w * inlink->
h);
331 directions,inlink->
w,
332 gradients, inlink->
w);
336 inlink->
w, inlink->
h,
357 for (p = 0; p < edgedetect->
nb_planes; p++) {
384 .
name =
"edgedetect",
390 .
inputs = edgedetect_inputs,
392 .priv_class = &edgedetect_class,