Go to the documentation of this file.
21 #ifndef AVFILTER_CONVOLUTION_H
22 #define AVFILTER_CONVOLUTION_H
61 const uint8_t *
c[],
int peak,
int radius,
69 int x,
int w,
int y,
int h,
int bpc)
73 for (
i = 0;
i < 9;
i++) {
74 int xoff =
FFABS(x + ((
i % 3) - 1));
75 int yoff =
FFABS(y + (
i / 3) - 1);
77 xoff = xoff >=
w ? 2 *
w - 1 - xoff : xoff;
78 yoff = yoff >=
h ? 2 *
h - 1 - yoff : yoff;
86 const uint8_t *
c[],
int peak,
int radius,
89 const uint8_t *c0 =
c[0], *
c1 =
c[1], *
c2 =
c[2];
90 const uint8_t *c3 =
c[3], *c5 =
c[5];
91 const uint8_t *c6 =
c[6], *c7 =
c[7], *c8 =
c[8];
94 for (x = 0; x <
width; x++) {
95 float suma = c0[x] * -1 +
c1[x] * -2 +
c2[x] * -1 +
96 c6[x] * 1 + c7[x] * 2 + c8[x] * 1;
97 float sumb = c0[x] * -1 +
c2[x] * 1 + c3[x] * -2 +
98 c5[x] * 2 + c6[x] * -1 + c8[x] * 1;
106 const uint8_t *
c[],
int peak,
int radius,
109 uint16_t *dst = (uint16_t *)dstp;
112 for (x = 0; x <
width; x++) {
124 for (
int i = 0;
i < 4;
i++) {
126 s->copy[
i] = !((1 <<
i) &
s->planes);
129 s->rdiv[
i] =
s->scale;
130 s->bias[
i] =
s->delta;
133 for (
int i = 0;
i < 4;
i++)
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 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)
void ff_sobel_init_x86(ConvolutionContext *s, int depth, int nb_planes)
static av_unused void ff_sobel_init(ConvolutionContext *s, int depth, int nb_planes)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Describe the class of an AVClass context structure.
static __device__ float sqrtf(float a)
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 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 scale(int *out, const int *in, const int w, const int h, const int shift)
#define i(width, name, range_min, range_max)
void(* filter[4])(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)
void(* setup[4])(int radius, const uint8_t *c[], const uint8_t *src, int stride, int x, int width, int y, int height, int bpc)
void ff_convolution_init_x86(ConvolutionContext *s)