Go to the documentation of this file.
   22 #include "config_components.h" 
   35 #define OFFSET(x) offsetof(ConvolutionContext, x) 
   36 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM 
   67 static const int same5x5[25] = {0, 0, 0, 0, 0,
 
   73 static const int same7x7[49] = {0, 0, 0, 0, 0, 0, 0,
 
  109                              const uint8_t *
c[], 
int peak, 
int radius,
 
  112     uint16_t *dst = (uint16_t *)dstp;
 
  115     for (x = 0; x < 
width; x++) {
 
  127                              const uint8_t *
c[], 
int peak, 
int radius,
 
  130     uint16_t *dst = (uint16_t *)dstp;
 
  133     for (x = 0; x < 
width; x++) {
 
  143                             const uint8_t *
c[], 
int peak, 
int radius,
 
  146     uint16_t *dst = (uint16_t *)dstp;
 
  149     for (x = 0; x < 
width; x++) {
 
  163                             const uint8_t *
c[], 
int peak, 
int radius,
 
  166     uint16_t *dst = (uint16_t *)dstp;
 
  167     const uint16_t *c0 = (
const uint16_t *)
c[0], *
c1 = (
const uint16_t *)
c[1], *
c2 = (
const uint16_t *)
c[2];
 
  168     const uint16_t *c3 = (
const uint16_t *)
c[3], *c5 = (
const uint16_t *)
c[5];
 
  169     const uint16_t *c6 = (
const uint16_t *)
c[6], *c7 = (
const uint16_t *)
c[7], *c8 = (
const uint16_t *)
c[8];
 
  172     for (x = 0; x < 
width; x++) {
 
  173         int sum0 = c0[x] *  5 + 
c1[x] *  5 + 
c2[x] *  5 +
 
  174                    c3[x] * -3 + c5[x] * -3 +
 
  175                    c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
 
  176         int sum1 = c0[x] * -3 + 
c1[x] *  5 + 
c2[x] *  5 +
 
  177                    c3[x] *  5 + c5[x] * -3 +
 
  178                    c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
 
  179         int sum2 = c0[x] * -3 + 
c1[x] * -3 + 
c2[x] *  5 +
 
  180                    c3[x] *  5 + c5[x] *  5 +
 
  181                    c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
 
  182         int sum3 = c0[x] * -3 + 
c1[x] * -3 + 
c2[x] * -3 +
 
  183                    c3[x] *  5 + c5[x] *  5 +
 
  184                    c6[x] *  5 + c7[x] * -3 + c8[x] * -3;
 
  185         int sum4 = c0[x] * -3 + 
c1[x] * -3 + 
c2[x] * -3 +
 
  186                    c3[x] * -3 + c5[x] *  5 +
 
  187                    c6[x] *  5 + c7[x] *  5 + c8[x] * -3;
 
  188         int sum5 = c0[x] * -3 + 
c1[x] * -3 + 
c2[x] * -3 +
 
  189                    c3[x] * -3 + c5[x] * -3 +
 
  190                    c6[x] *  5 + c7[x] *  5 + c8[x] *  5;
 
  191         int sum6 = c0[x] *  5 + 
c1[x] * -3 + 
c2[x] * -3 +
 
  192                    c3[x] * -3 + c5[x] * -3 +
 
  193                    c6[x] * -3 + c7[x] *  5 + c8[x] *  5;
 
  194         int sum7 = c0[x] *  5 + 
c1[x] *  5 + 
c2[x] * -3 +
 
  195                    c3[x] * -3 + c5[x] * -3 +
 
  196                    c6[x] * -3 + c7[x] * -3 + c8[x] *  5;
 
  198         sum0 = 
FFMAX(sum0, sum1);
 
  199         sum2 = 
FFMAX(sum2, sum3);
 
  200         sum4 = 
FFMAX(sum4, sum5);
 
  201         sum6 = 
FFMAX(sum6, sum7);
 
  202         sum0 = 
FFMAX(sum0, sum2);
 
  203         sum4 = 
FFMAX(sum4, sum6);
 
  204         sum0 = 
FFMAX(sum0, sum4);
 
  212                            const uint8_t *
c[], 
int peak, 
int radius,
 
  215     const uint8_t *c0 = 
c[0], *
c1 = 
c[1], *
c2 = 
c[2];
 
  216     const uint8_t *c3 = 
c[3], *c5 = 
c[5];
 
  217     const uint8_t *c6 = 
c[6], *c7 = 
c[7], *c8 = 
c[8];
 
  220     for (x = 0; x < 
width; x++) {
 
  221         float suma = c0[x] * -1 + 
c1[x] * -1 + 
c2[x] * -1 +
 
  222                      c6[x] *  1 + c7[x] *  1 + c8[x] *  1;
 
  223         float sumb = c0[x] * -1 + 
c2[x] *  1 + c3[x] * -1 +
 
  224                      c5[x] *  1 + c6[x] * -1 + c8[x] *  1;
 
  232                            const uint8_t *
c[], 
int peak, 
int radius,
 
  237     for (x = 0; x < 
width; x++) {
 
  238         float suma = 
c[0][x] *  1 + 
c[1][x] * -1;
 
  239         float sumb = 
c[4][x] *  1 + 
c[3][x] * -1;
 
  247                           const uint8_t *
c[], 
int peak, 
int radius,
 
  250     const uint8_t *c0 = 
c[0], *
c1 = 
c[1], *
c2 = 
c[2];
 
  251     const uint8_t *c3 = 
c[3], *c5 = 
c[5];
 
  252     const uint8_t *c6 = 
c[6], *c7 = 
c[7], *c8 = 
c[8];
 
  255     for (x = 0; x < 
width; x++) {
 
  256         float suma = c0[x] * -47 + 
c1[x] * -162 + 
c2[x] *  -47 +
 
  257                      c6[x] *  47 + c7[x] *  162 + c8[x] *   47;
 
  258         float sumb = c0[x] * -47 + 
c2[x] *   47 + c3[x] * -162 +
 
  259                      c5[x] * 162 + c6[x] *  -47 + c8[x] *   47;
 
  269                           const uint8_t *
c[], 
int peak, 
int radius,
 
  272     const uint8_t *c0 = 
c[0], *
c1 = 
c[1], *
c2 = 
c[2];
 
  273     const uint8_t *c3 = 
c[3], *c5 = 
c[5];
 
  274     const uint8_t *c6 = 
c[6], *c7 = 
c[7], *c8 = 
c[8];
 
  277     for (x = 0; x < 
width; x++) {
 
  278         int sum0 = c0[x] *  5 + 
c1[x] *  5 + 
c2[x] *  5 +
 
  279                    c3[x] * -3 + c5[x] * -3 +
 
  280                    c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
 
  281         int sum1 = c0[x] * -3 + 
c1[x] *  5 + 
c2[x] *  5 +
 
  282                    c3[x] *  5 + c5[x] * -3 +
 
  283                    c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
 
  284         int sum2 = c0[x] * -3 + 
c1[x] * -3 + 
c2[x] *  5 +
 
  285                    c3[x] *  5 + c5[x] *  5 +
 
  286                    c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
 
  287         int sum3 = c0[x] * -3 + 
c1[x] * -3 + 
c2[x] * -3 +
 
  288                    c3[x] *  5 + c5[x] *  5 +
 
  289                    c6[x] *  5 + c7[x] * -3 + c8[x] * -3;
 
  290         int sum4 = c0[x] * -3 + 
c1[x] * -3 + 
c2[x] * -3 +
 
  291                    c3[x] * -3 + c5[x] *  5 +
 
  292                    c6[x] *  5 + c7[x] *  5 + c8[x] * -3;
 
  293         int sum5 = c0[x] * -3 + 
c1[x] * -3 + 
c2[x] * -3 +
 
  294                    c3[x] * -3 + c5[x] * -3 +
 
  295                    c6[x] *  5 + c7[x] *  5 + c8[x] *  5;
 
  296         int sum6 = c0[x] *  5 + 
c1[x] * -3 + 
c2[x] * -3 +
 
  297                    c3[x] * -3 + c5[x] * -3 +
 
  298                    c6[x] * -3 + c7[x] *  5 + c8[x] *  5;
 
  299         int sum7 = c0[x] *  5 + 
c1[x] *  5 + 
c2[x] * -3 +
 
  300                    c3[x] * -3 + c5[x] * -3 +
 
  301                    c6[x] * -3 + c7[x] * -3 + c8[x] *  5;
 
  303         sum0 = 
FFMAX(sum0, sum1);
 
  304         sum2 = 
FFMAX(sum2, sum3);
 
  305         sum4 = 
FFMAX(sum4, sum5);
 
  306         sum6 = 
FFMAX(sum6, sum7);
 
  307         sum0 = 
FFMAX(sum0, sum2);
 
  308         sum4 = 
FFMAX(sum4, sum6);
 
  309         sum0 = 
FFMAX(sum0, sum4);
 
  316                          float rdiv, 
float bias, 
const int *
const matrix,
 
  317                          const uint8_t *
c[], 
int peak, 
int radius,
 
  320     uint16_t *dst = (uint16_t *)dstp;
 
  323     for (x = 0; x < 
width; x++) {
 
  333         sum = (
int)(sum * rdiv + 
bias + 0.5
f);
 
  334         dst[x] = 
av_clip(sum, 0, peak);
 
  339                          float rdiv, 
float bias, 
const int *
const matrix,
 
  340                          const uint8_t *
c[], 
int peak, 
int radius,
 
  343     uint16_t *dst = (uint16_t *)dstp;
 
  346     for (x = 0; x < 
width; x++) {
 
  349         for (
i = 0; 
i < 25; 
i++)
 
  352         sum = (
int)(sum * rdiv + 
bias + 0.5
f);
 
  353         dst[x] = 
av_clip(sum, 0, peak);
 
  358                          float rdiv, 
float bias, 
const int *
const matrix,
 
  359                          const uint8_t *
c[], 
int peak, 
int radius,
 
  362     uint16_t *dst = (uint16_t *)dstp;
 
  365     for (x = 0; x < 
width; x++) {
 
  368         for (
i = 0; 
i < 49; 
i++)
 
  371         sum = (
int)(sum * rdiv + 
bias + 0.5
f);
 
  372         dst[x] = 
av_clip(sum, 0, peak);
 
  377                          float rdiv, 
float bias, 
const int *
const matrix,
 
  378                          const uint8_t *
c[], 
int peak, 
int radius,
 
  381     uint16_t *dst = (uint16_t *)dstp;
 
  384     for (x = 0; x < 
width; x++) {
 
  387         for (
i = 0; 
i < 2 * radius + 1; 
i++)
 
  390         sum = (
int)(sum * rdiv + 
bias + 0.5
f);
 
  391         dst[x] = 
av_clip(sum, 0, peak);
 
  396                             float rdiv, 
float bias, 
const int *
const matrix,
 
  397                             const uint8_t *
c[], 
int peak, 
int radius,
 
  401     uint16_t *dst = (uint16_t *)dstp;
 
  404     for (
int y = 0; y < 
height; y++) {
 
  406         memset(sum, 0, 
sizeof(sum));
 
  407         for (
int i = 0; 
i < 2 * radius + 1; 
i++) {
 
  408             for (
int off16 = 0; off16 < 
width; off16++)
 
  412         for (
int off16 = 0; off16 < 
width; off16++) {
 
  413             sum[off16] = (
int)(sum[off16] * rdiv + 
bias + 0.5
f);
 
  414             dst[off16] = 
av_clip(sum[off16], 0, peak);
 
  421                        float rdiv, 
float bias, 
const int *
const matrix,
 
  422                        const uint8_t *
c[], 
int peak, 
int radius,
 
  427     for (x = 0; x < 
width; x++) {
 
  430         for (
i = 0; 
i < 49; 
i++)
 
  433         sum = (
int)(sum * rdiv + 
bias + 0.5
f);
 
  439                        float rdiv, 
float bias, 
const int *
const matrix,
 
  440                        const uint8_t *
c[], 
int peak, 
int radius,
 
  445     for (x = 0; x < 
width; x++) {
 
  448         for (
i = 0; 
i < 25; 
i++)
 
  451         sum = (
int)(sum * rdiv + 
bias + 0.5
f);
 
  457                        float rdiv, 
float bias, 
const int *
const matrix,
 
  458                        const uint8_t *
c[], 
int peak, 
int radius,
 
  461     const uint8_t *c0 = 
c[0], *
c1 = 
c[1], *
c2 = 
c[2];
 
  462     const uint8_t *c3 = 
c[3], *c4 = 
c[4], *c5 = 
c[5];
 
  463     const uint8_t *c6 = 
c[6], *c7 = 
c[7], *c8 = 
c[8];
 
  466     for (x = 0; x < 
width; x++) {
 
  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 < 2 * radius + 1; 
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,
 
  500     for (
int y = 0; y < 
height; y++) {
 
  501         memset(sum, 0, 
sizeof(sum));
 
  503         for (
int i = 0; 
i < 2 * radius + 1; 
i++) {
 
  504             for (
int off16 = 0; off16 < 16; off16++)
 
  508         for (
int off16 = 0; off16 < 16; off16++) {
 
  509             sum[off16] = (
int)(sum[off16] * rdiv + 
bias + 0.5
f);
 
  517                       int x, 
int w, 
int y, 
int h, 
int bpc)
 
  521     for (
i = 0; 
i < 25; 
i++) {
 
  522         int xoff = 
FFABS(x + ((
i % 5) - 2));
 
  523         int yoff = 
FFABS(y + (
i / 5) - 2);
 
  525         xoff = xoff >= 
w ? 2 * 
w - 1 - xoff : xoff;
 
  526         yoff = yoff >= 
h ? 2 * 
h - 1 - yoff : yoff;
 
  533                       int x, 
int w, 
int y, 
int h, 
int bpc)
 
  537     for (
i = 0; 
i < 49; 
i++) {
 
  538         int xoff = 
FFABS(x + ((
i % 7) - 3));
 
  539         int yoff = 
FFABS(y + (
i / 7) - 3);
 
  541         xoff = xoff >= 
w ? 2 * 
w - 1 - xoff : xoff;
 
  542         yoff = yoff >= 
h ? 2 * 
h - 1 - yoff : yoff;
 
  549                       int x, 
int w, 
int y, 
int h, 
int bpc)
 
  553     for (
i = 0; 
i < radius * 2 + 1; 
i++) {
 
  554         int xoff = 
FFABS(x + 
i - radius);
 
  556         xoff = xoff >= 
w ? 2 * 
w - 1 - xoff : xoff;
 
  563                          int x, 
int w, 
int y, 
int h, 
int bpc)
 
  567     for (
i = 0; 
i < radius * 2 + 1; 
i++) {
 
  568         int xoff = 
FFABS(x + 
i - radius);
 
  570         xoff = xoff >= 
h ? 2 * 
h - 1 - xoff : xoff;
 
  584     for (plane = 0; plane < 
s->nb_planes; plane++) {
 
  585         const int mode = 
s->mode[plane];
 
  586         const int bpc = 
s->bpc;
 
  587         const int radius = 
s->size[plane] / 2;
 
  588         const int height = 
s->planeheight[plane];
 
  589         const int width  = 
s->planewidth[plane];
 
  591         const int dstride = 
out->linesize[plane];
 
  595         const int slice_end = (sizeh * (jobnr+1)) / nb_jobs;
 
  596         const float rdiv = 
s->rdiv[plane];
 
  597         const float bias = 
s->bias[plane];
 
  598         const uint8_t *
src = in->
data[plane];
 
  600         uint8_t *dst = 
out->data[plane] + dst_pos;
 
  601         const int *
matrix = 
s->matrix[plane];
 
  603         const uint8_t *
c[49];
 
  606         if (
s->copy[plane]) {
 
  619             for (x = 0; x < radius; x++) {
 
  624                 s->filter[plane](dst + yoff + xoff, 1, rdiv,
 
  629             s->filter[plane](dst + yoff + xoff, sizew - 2 * radius,
 
  632             for (x = sizew - radius; x < sizew; x++) {
 
  637                 s->filter[plane](dst + yoff + xoff, 1, rdiv,
 
  656     s->depth = 
desc->comp[0].depth;
 
  657     s->max = (1 << 
s->depth) - 1;
 
  660     s->planewidth[0] = 
s->planewidth[3] = 
inlink->w;
 
  662     s->planeheight[0] = 
s->planeheight[3] = 
inlink->h;
 
  666     s->bpc = (
s->depth + 7) / 8;
 
  668     if (!strcmp(
ctx->filter->name, 
"convolution")) {
 
  669         for (
i = 0; 
i < 4; 
i++) {
 
  671             char *orig, *p, *
arg, *saveptr = 
NULL;
 
  676                 s->matrix_length[
i] = 0;
 
  677                 s->rdiv[
i] = 
s->user_rdiv[
i];
 
  680                 while (
s->matrix_length[
i] < 49) {
 
  687                     s->matrix_length[
i]++;
 
  691                 if (!(
s->matrix_length[
i] & 1)) {
 
  700                 s->size[
i] = 
s->matrix_length[
i];
 
  704                 s->size[
i] = 
s->matrix_length[
i];
 
  705             } 
else if (
s->matrix_length[
i] == 9) {
 
  715             } 
else if (
s->matrix_length[
i] == 25) {
 
  724             } 
else if (
s->matrix_length[
i] == 49) {
 
  740                 s->rdiv[
i] = 1. / sum;
 
  742             if (
s->copy[
i] && (
s->rdiv[
i] != 1. || 
s->bias[
i] != 0.))
 
  745     } 
else if (!strcmp(
ctx->filter->name, 
"prewitt")) {
 
  746         for (
i = 0; 
i < 4; 
i++) {
 
  748             s->copy[
i] = !((1 << 
i) & 
s->planes);
 
  751             s->rdiv[
i] = 
s->scale;
 
  752             s->bias[
i] = 
s->delta;
 
  754     } 
else if (!strcmp(
ctx->filter->name, 
"roberts")) {
 
  755         for (
i = 0; 
i < 4; 
i++) {
 
  757             s->copy[
i] = !((1 << 
i) & 
s->planes);
 
  760             s->rdiv[
i] = 
s->scale;
 
  761             s->bias[
i] = 
s->delta;
 
  763     } 
else if (!strcmp(
ctx->filter->name, 
"sobel")) {
 
  765     } 
else if (!strcmp(
ctx->filter->name, 
"kirsch")) {
 
  766         for (
i = 0; 
i < 4; 
i++) {
 
  768             s->copy[
i] = !((1 << 
i) & 
s->planes);
 
  771             s->rdiv[
i] = 
s->scale;
 
  772             s->bias[
i] = 
s->delta;
 
  774     } 
else if (!strcmp(
ctx->filter->name, 
"scharr")) {
 
  775         for (
i = 0; 
i < 4; 
i++) {
 
  777             s->copy[
i] = !((1 << 
i) & 
s->planes);
 
  780             s->rdiv[
i] = 
s->scale;
 
  781             s->bias[
i] = 
s->delta;
 
  785     if (!strcmp(
ctx->filter->name, 
"convolution")) {
 
  787             for (p = 0; p < 
s->nb_planes; p++) {
 
  792                 else if (
s->size[p] == 3)
 
  794                 else if (
s->size[p] == 5)
 
  796                 else if (
s->size[p] == 7)
 
  800 #if CONFIG_CONVOLUTION_FILTER && ARCH_X86_64 
  803     } 
else if (!strcmp(
ctx->filter->name, 
"prewitt")) {
 
  805             for (p = 0; p < 
s->nb_planes; p++)
 
  807     } 
else if (!strcmp(
ctx->filter->name, 
"roberts")) {
 
  809             for (p = 0; p < 
s->nb_planes; p++)
 
  811     } 
else if (!strcmp(
ctx->filter->name, 
"kirsch")) {
 
  813             for (p = 0; p < 
s->nb_planes; p++)
 
  815     } 
else if (!strcmp(
ctx->filter->name, 
"scharr")) {
 
  817             for (p = 0; p < 
s->nb_planes; p++)
 
  848                       FFMIN3(
s->planeheight[1], 
s->planewidth[1], 
s->nb_threads));
 
  855                            char *res, 
int res_len, 
int flags)
 
  875 #if CONFIG_CONVOLUTION_FILTER 
  878     .
name          = 
"convolution",
 
  881     .priv_class    = &convolution_class,
 
  901 #if CONFIG_PREWITT_FILTER 
  907     .priv_class    = &common_class,
 
  917 #if CONFIG_SOBEL_FILTER 
  923     .priv_class    = &common_class,
 
  933 #if CONFIG_ROBERTS_FILTER 
  939     .priv_class    = &common_class,
 
  949 #if CONFIG_KIRSCH_FILTER 
  955     .priv_class    = &common_class,
 
  965 #if CONFIG_SCHARR_FILTER 
  971     .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 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)
 
AVPixelFormat
Pixel format.
 
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_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)
 
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)
 
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
 
#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)
 
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 
const char * name
Filter name.
 
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)
 
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)
 
static av_unused void ff_sobel_init(ConvolutionContext *s, int depth, int nb_planes)
 
A link between two filters.
 
#define AV_PIX_FMT_YUVA422P10
 
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.
 
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
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)
 
static const int same3x3[9]
 
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
 
#define AV_PIX_FMT_GBRP10
 
#define AV_PIX_FMT_YUVA444P16
 
#define AV_PIX_FMT_YUV422P9
 
#define AV_PIX_FMT_GRAY16
 
A filter pad used for either input or output.
 
AVFILTER_DEFINE_CLASS(convolution)
 
static const AVFilterPad convolution_inputs[]
 
#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 slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
 
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
 
#define AV_PIX_FMT_YUV422P16
 
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
 
@ 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
 
#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 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().
 
#define AV_PIX_FMT_YUVA444P12
 
#define AV_PIX_FMT_YUV420P9
 
#define AV_PIX_FMT_YUV420P16
 
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 
#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...
 
#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.
 
static int bias(int x, int c)
 
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
 
static __device__ float sqrtf(float a)
 
static enum AVPixelFormat pix_fmts[]
 
#define AV_PIX_FMT_YUV422P10
 
static const AVOption common_options[]
 
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
 
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
 
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)
 
const AVFilter ff_vf_convolution
 
static void scale(int *out, const int *in, const int w, const int h, const int shift)
 
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
 
#define DECLARE_ALIGNED(n, t, v)
 
static const AVOption convolution_options[]
 
#define AV_PIX_FMT_YUV422P12
 
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_YUV444P12
 
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)
 
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 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_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.
 
static int config_input(AVFilterLink *inlink)
 
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
 
#define AV_PIX_FMT_YUVA444P10
 
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)
 
static const int same5x5[25]
 
#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 i(width, name, range_min, range_max)
 
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)
 
static int param_init(AVFilterContext *ctx)
 
int w
agreed upon image width
 
#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 const int same7x7[49]
 
@ 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.
 
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_YUV444P9
 
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)
 
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)
 
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 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)
 
#define AV_PIX_FMT_YUVA444P9
 
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)
 
#define AV_PIX_FMT_YUV420P12
 
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)
 
#define AV_PIX_FMT_YUV422P14
 
int h
agreed upon image height
 
AVFILTER_DEFINE_CLASS_EXT(common, "kirsch/prewitt/roberts/scharr/sobel", common_options)
 
#define AV_PIX_FMT_YUVA422P12
 
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)
 
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)
 
@ 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)
 
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 const struct @386 planes[]
 
#define FILTER_OUTPUTS(array)
 
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
 
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)
 
#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)
 
#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_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)
 
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
 
#define AV_PIX_FMT_YUV420P14