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

Go to the source code of this file.

Data Structures

struct  ConvolutionContext
 
struct  ThreadData
 

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 line_copy8 (uint8_t *line, const uint8_t *srcp, int width, int mergin)
 
static void line_copy16 (uint16_t *line, const uint16_t *srcp, int width, int mergin)
 
static int filter16_prewitt (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter16_roberts (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter16_sobel (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_prewitt (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_roberts (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_sobel (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter16_3x3 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter16_5x5 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter16_7x7 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_3x3 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_5x5 (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_7x7 (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)
 
static av_cold void uninit (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

◆ OFFSET

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

Definition at line 58 of file vf_convolution.c.

◆ FLAGS

Definition at line 59 of file vf_convolution.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( convolution  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 97 of file vf_convolution.c.

◆ line_copy8()

static void line_copy8 ( uint8_t line,
const uint8_t srcp,
int  width,
int  mergin 
)
inlinestatic

◆ line_copy16()

static void line_copy16 ( uint16_t *  line,
const uint16_t *  srcp,
int  width,
int  mergin 
)
inlinestatic

◆ filter16_prewitt()

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

Definition at line 152 of file vf_convolution.c.

Referenced by config_input().

◆ filter16_roberts()

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

Definition at line 209 of file vf_convolution.c.

Referenced by config_input().

◆ filter16_sobel()

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

Definition at line 258 of file vf_convolution.c.

Referenced by config_input().

◆ filter_prewitt()

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

Definition at line 315 of file vf_convolution.c.

Referenced by init().

◆ filter_roberts()

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

Definition at line 371 of file vf_convolution.c.

Referenced by init().

◆ filter_sobel()

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

Definition at line 419 of file vf_convolution.c.

Referenced by init().

◆ filter16_3x3()

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

Definition at line 475 of file vf_convolution.c.

Referenced by config_input().

◆ filter16_5x5()

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

Definition at line 530 of file vf_convolution.c.

Referenced by config_input().

◆ filter16_7x7()

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

Definition at line 596 of file vf_convolution.c.

Referenced by config_input().

◆ filter_3x3()

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

Definition at line 671 of file vf_convolution.c.

Referenced by init().

◆ filter_5x5()

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

Definition at line 725 of file vf_convolution.c.

Referenced by init().

◆ filter_7x7()

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

Definition at line 791 of file vf_convolution.c.

Referenced by init().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 865 of file vf_convolution.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 923 of file vf_convolution.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 959 of file vf_convolution.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 1030 of file vf_convolution.c.

Variable Documentation

◆ convolution_options

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=1.0}, 0.0, INT_MAX, FLAGS},
{ "1rdiv", "set rdiv for 2nd plane", OFFSET(rdiv[1]), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, INT_MAX, FLAGS},
{ "2rdiv", "set rdiv for 3rd plane", OFFSET(rdiv[2]), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, INT_MAX, FLAGS},
{ "3rdiv", "set rdiv for 4th plane", OFFSET(rdiv[3]), AV_OPT_TYPE_FLOAT, {.dbl=1.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},
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define FLAGS
#define OFFSET(x)

Definition at line 61 of file vf_convolution.c.

◆ same3x3

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

Definition at line 79 of file vf_convolution.c.

Referenced by init().

◆ same5x5

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 83 of file vf_convolution.c.

Referenced by init().

◆ same7x7

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 89 of file vf_convolution.c.

Referenced by init().

◆ convolution_inputs

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 1038 of file vf_convolution.c.

◆ convolution_outputs

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

Definition at line 1048 of file vf_convolution.c.