FFmpeg
Data Structures | Macros | Functions | Variables
vf_convolution.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "convolution.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define OFFSET(x)   offsetof(ConvolutionContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (convolution)
 
static int query_formats (AVFilterContext *ctx)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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)
 
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 setup_7x7 (int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int w, int y, int h, int bpc)
 
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 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 int filter_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold int init (AVFilterContext *ctx)
 

Variables

static const AVOption convolution_options []
 
static const int same3x3 [9]
 
static const int same5x5 [25]
 
static const int same7x7 [49]
 
static const AVFilterPad convolution_inputs []
 
static const AVFilterPad convolution_outputs []
 

Macro Definition Documentation

#define OFFSET (   x)    offsetof(ConvolutionContext, x)

Definition at line 33 of file vf_convolution.c.

Definition at line 34 of file vf_convolution.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( convolution  )
static int query_formats ( AVFilterContext ctx)
static

Definition at line 79 of file vf_convolution.c.

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 
)
static

Definition at line 109 of file vf_convolution.c.

Referenced by config_input().

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 
)
static

Definition at line 127 of file vf_convolution.c.

Referenced by config_input().

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 
)
static

Definition at line 143 of file vf_convolution.c.

Referenced by config_input().

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 
)
static

Definition at line 161 of file vf_convolution.c.

Referenced by init().

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 
)
static

Definition at line 181 of file vf_convolution.c.

Referenced by init().

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 
)
static

Definition at line 196 of file vf_convolution.c.

Referenced by init().

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 
)
static

Definition at line 216 of file vf_convolution.c.

Referenced by config_input().

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 
)
static

Definition at line 239 of file vf_convolution.c.

Referenced by config_input().

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 
)
static

Definition at line 258 of file vf_convolution.c.

Referenced by config_input().

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 
)
static

Definition at line 277 of file vf_convolution.c.

Referenced by config_input().

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 
)
static

Definition at line 296 of file vf_convolution.c.

Referenced by config_input().

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 
)
static

Definition at line 316 of file vf_convolution.c.

Referenced by init().

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 
)
static

Definition at line 334 of file vf_convolution.c.

Referenced by init().

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 
)
static

Definition at line 352 of file vf_convolution.c.

Referenced by init().

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 
)
static

Definition at line 371 of file vf_convolution.c.

Referenced by init().

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 
)
static

Definition at line 389 of file vf_convolution.c.

Referenced by init().

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 
)
static

Definition at line 408 of file vf_convolution.c.

Referenced by init().

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

Definition at line 424 of file vf_convolution.c.

Referenced by init().

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 
)
static

Definition at line 440 of file vf_convolution.c.

Referenced by init().

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

Definition at line 456 of file vf_convolution.c.

Referenced by init().

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

Definition at line 470 of file vf_convolution.c.

Referenced by init().

static int filter_slice ( AVFilterContext ctx,
void arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 484 of file vf_convolution.c.

Referenced by filter_frame().

static int config_input ( AVFilterLink inlink)
static

Definition at line 557 of file vf_convolution.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 611 of file vf_convolution.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 634 of file vf_convolution.c.

Variable Documentation

const AVOption convolution_options[]
static
Initial value:
= {
{ "0m", "set matrix for 1st plane", OFFSET(matrix_str[0]), AV_OPT_TYPE_STRING, {.str="0 0 0 0 1 0 0 0 0"}, 0, 0, FLAGS },
{ "1m", "set matrix for 2nd plane", OFFSET(matrix_str[1]), AV_OPT_TYPE_STRING, {.str="0 0 0 0 1 0 0 0 0"}, 0, 0, FLAGS },
{ "2m", "set matrix for 3rd plane", OFFSET(matrix_str[2]), AV_OPT_TYPE_STRING, {.str="0 0 0 0 1 0 0 0 0"}, 0, 0, FLAGS },
{ "3m", "set matrix for 4th plane", OFFSET(matrix_str[3]), AV_OPT_TYPE_STRING, {.str="0 0 0 0 1 0 0 0 0"}, 0, 0, FLAGS },
{ "0rdiv", "set rdiv for 1st plane", OFFSET(rdiv[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
{ "1rdiv", "set rdiv for 2nd plane", OFFSET(rdiv[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
{ "2rdiv", "set rdiv for 3rd plane", OFFSET(rdiv[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
{ "3rdiv", "set rdiv for 4th plane", OFFSET(rdiv[3]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
{ "0bias", "set bias for 1st plane", OFFSET(bias[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
{ "1bias", "set bias for 2nd plane", OFFSET(bias[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
{ "2bias", "set bias for 3rd plane", OFFSET(bias[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
{ "3bias", "set bias for 4th plane", OFFSET(bias[3]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
{ "0mode", "set matrix mode for 1st plane", OFFSET(mode[0]), AV_OPT_TYPE_INT, {.i64=MATRIX_SQUARE}, 0, MATRIX_NBMODES-1, FLAGS, "mode" },
{ "1mode", "set matrix mode for 2nd plane", OFFSET(mode[1]), AV_OPT_TYPE_INT, {.i64=MATRIX_SQUARE}, 0, MATRIX_NBMODES-1, FLAGS, "mode" },
{ "2mode", "set matrix mode for 3rd plane", OFFSET(mode[2]), AV_OPT_TYPE_INT, {.i64=MATRIX_SQUARE}, 0, MATRIX_NBMODES-1, FLAGS, "mode" },
{ "3mode", "set matrix mode for 4th plane", OFFSET(mode[3]), AV_OPT_TYPE_INT, {.i64=MATRIX_SQUARE}, 0, MATRIX_NBMODES-1, FLAGS, "mode" },
{ "square", "square matrix", 0, AV_OPT_TYPE_CONST, {.i64=MATRIX_SQUARE}, 0, 0, FLAGS, "mode" },
{ "row", "single row matrix", 0, AV_OPT_TYPE_CONST, {.i64=MATRIX_ROW} , 0, 0, FLAGS, "mode" },
{ "column", "single column matrix", 0, AV_OPT_TYPE_CONST, {.i64=MATRIX_COLUMN}, 0, 0, FLAGS, "mode" },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FLAGS
#define OFFSET(x)
mode
Use these values in ebur128_init (or'ed).
Definition: ebur128.h:83

Definition at line 36 of file vf_convolution.c.

const int same3x3[9]
static
Initial value:
= {0, 0, 0,
0, 1, 0,
0, 0, 0}

Definition at line 61 of file vf_convolution.c.

Referenced by init().

const int same5x5[25]
static
Initial value:
= {0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 1, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0}

Definition at line 65 of file vf_convolution.c.

Referenced by init().

const int same7x7[49]
static
Initial value:
= {0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0}

Definition at line 71 of file vf_convolution.c.

Referenced by init().

const AVFilterPad convolution_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int config_input(AVFilterLink *inlink)

Definition at line 739 of file vf_convolution.c.

const AVFilterPad convolution_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 749 of file vf_convolution.c.