Go to the documentation of this file.
34 #define OFFSET(x) offsetof(ConvolutionContext, x)
35 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
66 static const int same5x5[25] = {0, 0, 0, 0, 0,
72 static const int same7x7[49] = {0, 0, 0, 0, 0, 0, 0,
107 float scale,
float delta,
const int *
const matrix,
108 const uint8_t *
c[],
int peak,
int radius,
111 uint16_t *dst = (uint16_t *)dstp;
114 for (x = 0; x <
width; x++) {
125 float scale,
float delta,
const int *
const matrix,
126 const uint8_t *
c[],
int peak,
int radius,
129 uint16_t *dst = (uint16_t *)dstp;
132 for (x = 0; x <
width; x++) {
141 float scale,
float delta,
const int *
const matrix,
142 const uint8_t *
c[],
int peak,
int radius,
145 uint16_t *dst = (uint16_t *)dstp;
148 for (x = 0; x <
width; x++) {
159 float scale,
float delta,
const int *
const matrix,
160 const uint8_t *
c[],
int peak,
int radius,
163 uint16_t *dst = (uint16_t *)dstp;
166 for (x = 0; x <
width; x++) {
179 float scale,
float delta,
const int *
const matrix,
180 const uint8_t *
c[],
int peak,
int radius,
183 uint16_t *dst = (uint16_t *)dstp;
184 const uint16_t *c0 = (
const uint16_t *)
c[0], *
c1 = (
const uint16_t *)
c[1], *
c2 = (
const uint16_t *)
c[2];
185 const uint16_t *c3 = (
const uint16_t *)
c[3], *c5 = (
const uint16_t *)
c[5];
186 const uint16_t *c6 = (
const uint16_t *)
c[6], *c7 = (
const uint16_t *)
c[7], *c8 = (
const uint16_t *)
c[8];
189 for (x = 0; x <
width; x++) {
190 int sum0 = c0[x] * 5 +
c1[x] * 5 +
c2[x] * 5 +
191 c3[x] * -3 + c5[x] * -3 +
192 c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
193 int sum1 = c0[x] * -3 +
c1[x] * 5 +
c2[x] * 5 +
194 c3[x] * 5 + c5[x] * -3 +
195 c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
196 int sum2 = c0[x] * -3 +
c1[x] * -3 +
c2[x] * 5 +
197 c3[x] * 5 + c5[x] * 5 +
198 c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
199 int sum3 = c0[x] * -3 +
c1[x] * -3 +
c2[x] * -3 +
200 c3[x] * 5 + c5[x] * 5 +
201 c6[x] * 5 + c7[x] * -3 + c8[x] * -3;
202 int sum4 = c0[x] * -3 +
c1[x] * -3 +
c2[x] * -3 +
203 c3[x] * -3 + c5[x] * 5 +
204 c6[x] * 5 + c7[x] * 5 + c8[x] * -3;
205 int sum5 = c0[x] * -3 +
c1[x] * -3 +
c2[x] * -3 +
206 c3[x] * -3 + c5[x] * -3 +
207 c6[x] * 5 + c7[x] * 5 + c8[x] * 5;
208 int sum6 = c0[x] * 5 +
c1[x] * -3 +
c2[x] * -3 +
209 c3[x] * -3 + c5[x] * -3 +
210 c6[x] * -3 + c7[x] * 5 + c8[x] * 5;
211 int sum7 = c0[x] * 5 +
c1[x] * 5 +
c2[x] * -3 +
212 c3[x] * -3 + c5[x] * -3 +
213 c6[x] * -3 + c7[x] * -3 + c8[x] * 5;
215 sum0 =
FFMAX(sum0, sum1);
216 sum2 =
FFMAX(sum2, sum3);
217 sum4 =
FFMAX(sum4, sum5);
218 sum6 =
FFMAX(sum6, sum7);
219 sum0 =
FFMAX(sum0, sum2);
220 sum4 =
FFMAX(sum4, sum6);
221 sum0 =
FFMAX(sum0, sum4);
228 float scale,
float delta,
const int *
const matrix,
229 const uint8_t *
c[],
int peak,
int radius,
232 const uint8_t *c0 =
c[0], *
c1 =
c[1], *
c2 =
c[2];
233 const uint8_t *c3 =
c[3], *c5 =
c[5];
234 const uint8_t *c6 =
c[6], *c7 =
c[7], *c8 =
c[8];
237 for (x = 0; x <
width; x++) {
238 float suma = c0[x] * -1 +
c1[x] * -1 +
c2[x] * -1 +
239 c6[x] * 1 + c7[x] * 1 + c8[x] * 1;
240 float sumb = c0[x] * -1 +
c2[x] * 1 + c3[x] * -1 +
241 c5[x] * 1 + c6[x] * -1 + c8[x] * 1;
248 float scale,
float delta,
const int *
const matrix,
249 const uint8_t *
c[],
int peak,
int radius,
254 for (x = 0; x <
width; x++) {
255 float suma =
c[0][x] * 1 +
c[1][x] * -1;
256 float sumb =
c[4][x] * 1 +
c[3][x] * -1;
263 float scale,
float delta,
const int *
const matrix,
264 const uint8_t *
c[],
int peak,
int radius,
267 const uint8_t *c0 =
c[0], *
c1 =
c[1], *
c2 =
c[2];
268 const uint8_t *c3 =
c[3], *c5 =
c[5];
269 const uint8_t *c6 =
c[6], *c7 =
c[7], *c8 =
c[8];
272 for (x = 0; x <
width; x++) {
273 float suma = c0[x] * -1 +
c1[x] * -2 +
c2[x] * -1 +
274 c6[x] * 1 + c7[x] * 2 + c8[x] * 1;
275 float sumb = c0[x] * -1 +
c2[x] * 1 + c3[x] * -2 +
276 c5[x] * 2 + c6[x] * -1 + c8[x] * 1;
283 float scale,
float delta,
const int *
const matrix,
284 const uint8_t *
c[],
int peak,
int radius,
287 const uint8_t *c0 =
c[0], *
c1 =
c[1], *
c2 =
c[2];
288 const uint8_t *c3 =
c[3], *c5 =
c[5];
289 const uint8_t *c6 =
c[6], *c7 =
c[7], *c8 =
c[8];
292 for (x = 0; x <
width; x++) {
293 float suma = c0[x] * -47 +
c1[x] * -162 +
c2[x] * -47 +
294 c6[x] * 47 + c7[x] * 162 + c8[x] * 47;
295 float sumb = c0[x] * -47 +
c2[x] * 47 + c3[x] * -162 +
296 c5[x] * 162 + c6[x] * -47 + c8[x] * 47;
305 float scale,
float delta,
const int *
const matrix,
306 const uint8_t *
c[],
int peak,
int radius,
309 const uint8_t *c0 =
c[0], *
c1 =
c[1], *
c2 =
c[2];
310 const uint8_t *c3 =
c[3], *c5 =
c[5];
311 const uint8_t *c6 =
c[6], *c7 =
c[7], *c8 =
c[8];
314 for (x = 0; x <
width; x++) {
315 int sum0 = c0[x] * 5 +
c1[x] * 5 +
c2[x] * 5 +
316 c3[x] * -3 + c5[x] * -3 +
317 c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
318 int sum1 = c0[x] * -3 +
c1[x] * 5 +
c2[x] * 5 +
319 c3[x] * 5 + c5[x] * -3 +
320 c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
321 int sum2 = c0[x] * -3 +
c1[x] * -3 +
c2[x] * 5 +
322 c3[x] * 5 + c5[x] * 5 +
323 c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
324 int sum3 = c0[x] * -3 +
c1[x] * -3 +
c2[x] * -3 +
325 c3[x] * 5 + c5[x] * 5 +
326 c6[x] * 5 + c7[x] * -3 + c8[x] * -3;
327 int sum4 = c0[x] * -3 +
c1[x] * -3 +
c2[x] * -3 +
328 c3[x] * -3 + c5[x] * 5 +
329 c6[x] * 5 + c7[x] * 5 + c8[x] * -3;
330 int sum5 = c0[x] * -3 +
c1[x] * -3 +
c2[x] * -3 +
331 c3[x] * -3 + c5[x] * -3 +
332 c6[x] * 5 + c7[x] * 5 + c8[x] * 5;
333 int sum6 = c0[x] * 5 +
c1[x] * -3 +
c2[x] * -3 +
334 c3[x] * -3 + c5[x] * -3 +
335 c6[x] * -3 + c7[x] * 5 + c8[x] * 5;
336 int sum7 = c0[x] * 5 +
c1[x] * 5 +
c2[x] * -3 +
337 c3[x] * -3 + c5[x] * -3 +
338 c6[x] * -3 + c7[x] * -3 + c8[x] * 5;
340 sum0 =
FFMAX(sum0, sum1);
341 sum2 =
FFMAX(sum2, sum3);
342 sum4 =
FFMAX(sum4, sum5);
343 sum6 =
FFMAX(sum6, sum7);
344 sum0 =
FFMAX(sum0, sum2);
345 sum4 =
FFMAX(sum4, sum6);
346 sum0 =
FFMAX(sum0, sum4);
353 float rdiv,
float bias,
const int *
const matrix,
354 const uint8_t *
c[],
int peak,
int radius,
357 uint16_t *dst = (uint16_t *)dstp;
360 for (x = 0; x <
width; x++) {
361 int sum =
AV_RN16A(&
c[0][2 * x]) * matrix[0] +
370 sum = (
int)(sum * rdiv + bias + 0.5
f);
371 dst[x] =
av_clip(sum, 0, peak);
376 float rdiv,
float bias,
const int *
const matrix,
377 const uint8_t *
c[],
int peak,
int radius,
380 uint16_t *dst = (uint16_t *)dstp;
383 for (x = 0; x <
width; x++) {
386 for (
i = 0;
i < 25;
i++)
389 sum = (
int)(sum * rdiv + bias + 0.5
f);
390 dst[x] =
av_clip(sum, 0, peak);
395 float rdiv,
float bias,
const int *
const matrix,
396 const uint8_t *
c[],
int peak,
int radius,
399 uint16_t *dst = (uint16_t *)dstp;
402 for (x = 0; x <
width; x++) {
405 for (
i = 0;
i < 49;
i++)
408 sum = (
int)(sum * rdiv + bias + 0.5
f);
409 dst[x] =
av_clip(sum, 0, peak);
414 float rdiv,
float bias,
const int *
const matrix,
415 const uint8_t *
c[],
int peak,
int radius,
418 uint16_t *dst = (uint16_t *)dstp;
421 for (x = 0; x <
width; x++) {
424 for (
i = 0;
i < 2 * radius + 1;
i++)
427 sum = (
int)(sum * rdiv + bias + 0.5
f);
428 dst[x] =
av_clip(sum, 0, peak);
433 float rdiv,
float bias,
const int *
const matrix,
434 const uint8_t *
c[],
int peak,
int radius,
438 uint16_t *dst = (uint16_t *)dstp;
441 for (
int y = 0; y <
height; y++) {
443 memset(sum, 0,
sizeof(sum));
444 for (
int i = 0;
i < 2 * radius + 1;
i++) {
445 for (
int off16 = 0; off16 <
width; off16++)
449 for (
int off16 = 0; off16 <
width; off16++) {
450 sum[off16] = (
int)(sum[off16] * rdiv + bias + 0.5
f);
451 dst[off16] =
av_clip(sum[off16], 0, peak);
458 float rdiv,
float bias,
const int *
const matrix,
459 const uint8_t *
c[],
int peak,
int radius,
464 for (x = 0; x <
width; x++) {
467 for (
i = 0;
i < 49;
i++)
468 sum +=
c[
i][x] * matrix[
i];
470 sum = (
int)(sum * rdiv + bias + 0.5
f);
476 float rdiv,
float bias,
const int *
const matrix,
477 const uint8_t *
c[],
int peak,
int radius,
482 for (x = 0; x <
width; x++) {
485 for (
i = 0;
i < 25;
i++)
486 sum +=
c[
i][x] * matrix[
i];
488 sum = (
int)(sum * rdiv + bias + 0.5
f);
494 float rdiv,
float bias,
const int *
const matrix,
495 const uint8_t *
c[],
int peak,
int radius,
498 const uint8_t *c0 =
c[0], *
c1 =
c[1], *
c2 =
c[2];
499 const uint8_t *c3 =
c[3], *c4 =
c[4], *c5 =
c[5];
500 const uint8_t *c6 =
c[6], *c7 =
c[7], *c8 =
c[8];
503 for (x = 0; x <
width; x++) {
504 int sum = c0[x] * matrix[0] +
c1[x] * matrix[1] +
c2[x] * matrix[2] +
505 c3[x] * matrix[3] + c4[x] * matrix[4] + c5[x] * matrix[5] +
506 c6[x] * matrix[6] + c7[x] * matrix[7] + c8[x] * matrix[8];
507 sum = (
int)(sum * rdiv + bias + 0.5
f);
513 float rdiv,
float bias,
const int *
const matrix,
514 const uint8_t *
c[],
int peak,
int radius,
519 for (x = 0; x <
width; x++) {
522 for (
i = 0;
i < 2 * radius + 1;
i++)
523 sum +=
c[
i][x] * matrix[
i];
525 sum = (
int)(sum * rdiv + bias + 0.5
f);
531 float rdiv,
float bias,
const int *
const matrix,
532 const uint8_t *
c[],
int peak,
int radius,
537 for (
int y = 0; y <
height; y++) {
538 memset(sum, 0,
sizeof(sum));
540 for (
int i = 0;
i < 2 * radius + 1;
i++) {
541 for (
int off16 = 0; off16 < 16; off16++)
542 sum[off16] +=
c[
i][0 + y *
stride + off16] * matrix[
i];
545 for (
int off16 = 0; off16 < 16; off16++) {
546 sum[off16] = (
int)(sum[off16] * rdiv + bias + 0.5
f);
554 int x,
int w,
int y,
int h,
int bpc)
558 for (
i = 0;
i < 9;
i++) {
559 int xoff =
FFABS(x + ((
i % 3) - 1));
560 int yoff =
FFABS(y + (
i / 3) - 1);
562 xoff = xoff >=
w ? 2 *
w - 1 - xoff : xoff;
563 yoff = yoff >=
h ? 2 *
h - 1 - yoff : yoff;
570 int x,
int w,
int y,
int h,
int bpc)
574 for (
i = 0;
i < 25;
i++) {
575 int xoff =
FFABS(x + ((
i % 5) - 2));
576 int yoff =
FFABS(y + (
i / 5) - 2);
578 xoff = xoff >=
w ? 2 *
w - 1 - xoff : xoff;
579 yoff = yoff >=
h ? 2 *
h - 1 - yoff : yoff;
586 int x,
int w,
int y,
int h,
int bpc)
590 for (
i = 0;
i < 49;
i++) {
591 int xoff =
FFABS(x + ((
i % 7) - 3));
592 int yoff =
FFABS(y + (
i / 7) - 3);
594 xoff = xoff >=
w ? 2 *
w - 1 - xoff : xoff;
595 yoff = yoff >=
h ? 2 *
h - 1 - yoff : yoff;
602 int x,
int w,
int y,
int h,
int bpc)
606 for (
i = 0;
i < radius * 2 + 1;
i++) {
607 int xoff =
FFABS(x +
i - radius);
609 xoff = xoff >=
w ? 2 *
w - 1 - xoff : xoff;
616 int x,
int w,
int y,
int h,
int bpc)
620 for (
i = 0;
i < radius * 2 + 1;
i++) {
621 int xoff =
FFABS(x +
i - radius);
623 xoff = xoff >=
h ? 2 *
h - 1 - xoff : xoff;
637 for (plane = 0; plane <
s->nb_planes; plane++) {
638 const int mode =
s->mode[plane];
639 const int bpc =
s->bpc;
640 const int radius =
s->size[plane] / 2;
641 const int height =
s->planeheight[plane];
642 const int width =
s->planewidth[plane];
644 const int dstride =
out->linesize[plane];
647 const int slice_start = (sizeh * jobnr) / nb_jobs;
648 const int slice_end = (sizeh * (jobnr+1)) / nb_jobs;
649 const float rdiv =
s->rdiv[plane];
650 const float bias =
s->bias[plane];
651 const uint8_t *
src = in->
data[plane];
653 uint8_t *dst =
out->data[plane] + dst_pos;
654 const int *matrix =
s->matrix[plane];
656 const uint8_t *
c[49];
659 if (
s->copy[plane]) {
672 for (x = 0; x < radius; x++) {
677 s->filter[plane](dst + yoff + xoff, 1, rdiv,
678 bias, matrix,
c,
s->max, radius,
682 s->filter[plane](dst + yoff + xoff, sizew - 2 * radius,
683 rdiv, bias, matrix,
c,
s->max, radius,
685 for (x = sizew - radius; x < sizew; x++) {
690 s->filter[plane](dst + yoff + xoff, 1, rdiv,
691 bias, matrix,
c,
s->max, radius,
709 if (!strcmp(
ctx->filter->name,
"convolution")) {
710 for (
i = 0;
i < 4;
i++) {
711 int *matrix = (
int *)
s->matrix[
i];
712 char *orig, *p, *
arg, *saveptr =
NULL;
717 s->matrix_length[
i] = 0;
721 while (
s->matrix_length[
i] < 49) {
726 sscanf(
arg,
"%d", &matrix[
s->matrix_length[
i]]);
727 sum += matrix[
s->matrix_length[
i]];
728 s->matrix_length[
i]++;
732 if (!(
s->matrix_length[
i] & 1)) {
741 s->size[
i] =
s->matrix_length[
i];
745 s->size[
i] =
s->matrix_length[
i];
746 }
else if (
s->matrix_length[
i] == 9) {
756 }
else if (
s->matrix_length[
i] == 25) {
765 }
else if (
s->matrix_length[
i] == 49) {
781 s->rdiv[
i] = 1. / sum;
783 if (
s->copy[
i] && (
s->rdiv[
i] != 1. ||
s->bias[
i] != 0.))
786 }
else if (!strcmp(
ctx->filter->name,
"prewitt")) {
787 for (
i = 0;
i < 4;
i++) {
789 s->copy[
i] = !((1 <<
i) &
s->planes);
792 s->rdiv[
i] =
s->scale;
793 s->bias[
i] =
s->delta;
795 }
else if (!strcmp(
ctx->filter->name,
"roberts")) {
796 for (
i = 0;
i < 4;
i++) {
798 s->copy[
i] = !((1 <<
i) &
s->planes);
801 s->rdiv[
i] =
s->scale;
802 s->bias[
i] =
s->delta;
804 }
else if (!strcmp(
ctx->filter->name,
"sobel")) {
805 for (
i = 0;
i < 4;
i++) {
807 s->copy[
i] = !((1 <<
i) &
s->planes);
810 s->rdiv[
i] =
s->scale;
811 s->bias[
i] =
s->delta;
813 }
else if (!strcmp(
ctx->filter->name,
"kirsch")) {
814 for (
i = 0;
i < 4;
i++) {
816 s->copy[
i] = !((1 <<
i) &
s->planes);
819 s->rdiv[
i] =
s->scale;
820 s->bias[
i] =
s->delta;
822 }
else if (!strcmp(
ctx->filter->name,
"scharr")) {
823 for (
i = 0;
i < 4;
i++) {
825 s->copy[
i] = !((1 <<
i) &
s->planes);
828 s->rdiv[
i] =
s->scale;
829 s->bias[
i] =
s->delta;
833 s->depth =
desc->comp[0].depth;
834 s->max = (1 <<
s->depth) - 1;
837 s->planewidth[0] =
s->planewidth[3] =
inlink->w;
839 s->planeheight[0] =
s->planeheight[3] =
inlink->h;
843 s->bpc = (
s->depth + 7) / 8;
845 if (!strcmp(
ctx->filter->name,
"convolution")) {
847 for (p = 0; p <
s->nb_planes; p++) {
852 else if (
s->size[p] == 3)
854 else if (
s->size[p] == 5)
856 else if (
s->size[p] == 7)
860 #if CONFIG_CONVOLUTION_FILTER && ARCH_X86_64
863 }
else if (!strcmp(
ctx->filter->name,
"prewitt")) {
865 for (p = 0; p <
s->nb_planes; p++)
867 }
else if (!strcmp(
ctx->filter->name,
"roberts")) {
869 for (p = 0; p <
s->nb_planes; p++)
871 }
else if (!strcmp(
ctx->filter->name,
"sobel")) {
873 for (p = 0; p <
s->nb_planes; p++)
875 }
else if (!strcmp(
ctx->filter->name,
"kirsch")) {
877 for (p = 0; p <
s->nb_planes; p++)
879 }
else if (!strcmp(
ctx->filter->name,
"scharr")) {
881 for (p = 0; p <
s->nb_planes; p++)
912 FFMIN3(
s->planeheight[1],
s->planewidth[1],
s->nb_threads));
919 char *res,
int res_len,
int flags)
946 #if CONFIG_CONVOLUTION_FILTER
949 .
name =
"convolution",
952 .priv_class = &convolution_class,
972 #if CONFIG_PREWITT_FILTER
978 .priv_class = &common_class,
988 #if CONFIG_SOBEL_FILTER
994 .priv_class = &common_class,
1004 #if CONFIG_ROBERTS_FILTER
1010 .priv_class = &common_class,
1020 #if CONFIG_KIRSCH_FILTER
1026 .priv_class = &common_class,
1036 #if CONFIG_SCHARR_FILTER
1042 .priv_class = &common_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_GBRAP16
static const AVOption common_options[]
AVPixelFormat
Pixel format.
static void filter16_row(uint8_t *dstp, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
static void setup_5x5(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
static const int same5x5[25]
static void filter16_7x7(uint8_t *dstp, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static void filter_3x3(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
static void filter16_roberts(uint8_t *dstp, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
const AVFilter ff_vf_scharr
#define FILTER_PIXFMTS_ARRAY(array)
static const AVFilterPad convolution_inputs[]
const AVFilter ff_vf_roberts
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define AV_PIX_FMT_YUVA422P9
This structure describes decoded (raw) audio or video data.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P10
const AVFilter ff_vf_kirsch
static void filter16_prewitt(uint8_t *dstp, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
#define AV_PIX_FMT_YUV420P10
const AVFilter ff_vf_prewitt
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
const char * name
Filter name.
static void filter_column(uint8_t *dst, int height, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
A link between two filters.
#define AV_PIX_FMT_YUVA422P10
static void filter_sobel(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
static void setup_row(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_GBRP14
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
static void filter_scharr(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUVA444P16
static void setup_column(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
#define AV_PIX_FMT_YUV422P9
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static av_always_inline float scale(float x, float s)
#define AV_PIX_FMT_GRAY16
static void filter16_3x3(uint8_t *dstp, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
A filter pad used for either input or output.
#define AV_PIX_FMT_YUV444P10
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_PIX_FMT_YUV422P16
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_PIX_FMT_GBRAP10
static void filter16_column(uint8_t *dstp, int height, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
#define AV_PIX_FMT_GBRAP12
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
#define AV_PIX_FMT_YUV444P16
#define AV_CEIL_RSHIFT(a, b)
static void filter_prewitt(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
AVFILTER_DEFINE_CLASS(convolution)
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUV420P9
static void filter16_5x5(uint8_t *dstp, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_GRAY14
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FILTER_INPUTS(array)
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
static const struct @321 planes[]
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GBRP16
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUV422P10
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
static int param_init(AVFilterContext *ctx)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
const AVFilter ff_vf_convolution
static void filter_5x5(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static void filter_roberts(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV444P12
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
#define AV_PIX_FMT_YUVA444P10
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
#define DECLARE_ALIGNED(n, t, v)
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define i(width, name, range_min, range_max)
int w
agreed upon image width
static void setup_7x7(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
#define AV_PIX_FMT_GBRP12
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Used for passing data between threads.
static void filter_7x7(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
static void setup_3x3(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
const char * name
Pad name.
#define AV_PIX_FMT_YUV444P9
static const AVOption convolution_options[]
#define AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV422P14
static const AVFilterPad convolution_outputs[]
int h
agreed upon image height
#define AV_PIX_FMT_YUVA422P12
static void filter_kirsch(uint8_t *dst, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
AVFILTER_DEFINE_CLASS_EXT(common, "kirsch/prewitt/roberts/scharr/sobel", common_options)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
const AVFilter ff_vf_sobel
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
char * av_strdup(const char *s)
Duplicate a string.
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static void filter_row(uint8_t *dst, int width, float rdiv, float bias, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
void ff_convolution_init_x86(ConvolutionContext *s)
static void filter16_kirsch(uint8_t *dstp, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
static const int same3x3[9]
static int config_input(AVFilterLink *inlink)
static void filter16_sobel(uint8_t *dstp, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
#define FILTER_OUTPUTS(array)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
#define flags(name, subs,...)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
static const int same7x7[49]
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_GRAY12
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
static void filter16_scharr(uint8_t *dstp, int width, float scale, float delta, const int *const matrix, const uint8_t *c[], int peak, int radius, int dstride, int stride, int size)
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_PIX_FMT_YUV420P14