55 uint32_t **sc = fp->
sc;
61 const int amount = fp->
amount;
62 const int steps_x = fp->
steps_x;
63 const int steps_y = fp->
steps_y;
72 for (y = 0; y < 2 * steps_y; y++)
73 memset(sc[y], 0,
sizeof(sc[y][0]) * (width + 2 * steps_x));
75 for (y = -steps_y; y < height + steps_y; y++) {
79 memset(sr, 0,
sizeof(sr[0]) * (2 * steps_x - 1));
80 for (x = -steps_x; x < width + steps_x; x++) {
81 tmp1 = x <= 0 ? src2[0] : x >= width ? src2[width-1] : src2[x];
82 for (z = 0; z < steps_x * 2; z += 2) {
83 tmp2 = sr[z + 0] + tmp1; sr[z + 0] = tmp1;
84 tmp1 = sr[z + 1] + tmp2; sr[z + 1] = tmp2;
86 for (z = 0; z < steps_y * 2; z += 2) {
87 tmp2 = sc[z + 0][x + steps_x] + tmp1; sc[z + 0][x + steps_x] = tmp1;
88 tmp1 = sc[z + 1][x + steps_x] + tmp2; sc[z + 1][x + steps_x] = tmp2;
90 if (x >= steps_x && y >= steps_y) {
91 const uint8_t *srx = src - steps_y * src_stride + x - steps_x;
92 uint8_t *dsx = dst - steps_y * dst_stride + x - steps_x;
94 res = (
int32_t)*srx + ((((
int32_t) * srx - (
int32_t)((tmp1 + halfscale) >> scalebits)) * amount) >> 16);
95 *dsx = av_clip_uint8(res);
109 int i, plane_w[3], plane_h[3];
111 plane_w[0] = inlink->
w;
113 plane_h[0] = inlink->
h;
115 fp[0] = &unsharp->
luma;
116 fp[1] = fp[2] = &unsharp->
chroma;
117 for (i = 0; i < 3; i++) {
127 fp->
amount = amount * 65536.0;
145 if (!CONFIG_OPENCL && unsharp->
opencl) {
146 av_log(ctx,
AV_LOG_ERROR,
"OpenCL support was not enabled in this build, cannot be selected\n");
149 if (CONFIG_OPENCL && unsharp->
opencl) {
174 const char *effect = fp->
amount == 0 ?
"none" : fp->
amount < 0 ?
"blur" :
"sharpen";
178 "Invalid even size for %s matrix size %dx%d\n",
186 for (z = 0; z < 2 * fp->
steps_y; z++)
216 for (z = 0; z < 2 * fp->
steps_y; z++)
224 if (CONFIG_OPENCL && unsharp->
opencl) {
245 if (CONFIG_OPENCL && unsharp->
opencl) {
260 #define OFFSET(x) offsetof(UnsharpContext, x)
261 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
305 .priv_class = &unsharp_class,
309 .
inputs = avfilter_vf_unsharp_inputs,
310 .
outputs = avfilter_vf_unsharp_outputs,