FFmpeg
vf_convolution.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013 Oka Motofumi (chikuzen.mo at gmail dot com)
3  * Copyright (c) 2015 Paul B Mahol
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "config_components.h"
23 
24 #include "libavutil/avstring.h"
25 #include "libavutil/imgutils.h"
26 #include "libavutil/intreadwrite.h"
27 #include "libavutil/mem.h"
28 #include "libavutil/mem_internal.h"
29 #include "libavutil/opt.h"
30 #include "libavutil/pixdesc.h"
31 #include "avfilter.h"
32 #include "convolution.h"
33 #include "filters.h"
34 #include "video.h"
35 
36 #define OFFSET(x) offsetof(ConvolutionContext, x)
37 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
38 
39 static const AVOption convolution_options[] = {
40  { "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 },
41  { "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 },
42  { "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 },
43  { "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 },
44  { "0rdiv", "set rdiv for 1st plane", OFFSET(user_rdiv[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
45  { "1rdiv", "set rdiv for 2nd plane", OFFSET(user_rdiv[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
46  { "2rdiv", "set rdiv for 3rd plane", OFFSET(user_rdiv[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
47  { "3rdiv", "set rdiv for 4th plane", OFFSET(user_rdiv[3]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
48  { "0bias", "set bias for 1st plane", OFFSET(bias[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
49  { "1bias", "set bias for 2nd plane", OFFSET(bias[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
50  { "2bias", "set bias for 3rd plane", OFFSET(bias[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
51  { "3bias", "set bias for 4th plane", OFFSET(bias[3]), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, INT_MAX, FLAGS},
52  { "0mode", "set matrix mode for 1st plane", OFFSET(mode[0]), AV_OPT_TYPE_INT, {.i64=MATRIX_SQUARE}, 0, MATRIX_NBMODES-1, FLAGS, .unit = "mode" },
53  { "1mode", "set matrix mode for 2nd plane", OFFSET(mode[1]), AV_OPT_TYPE_INT, {.i64=MATRIX_SQUARE}, 0, MATRIX_NBMODES-1, FLAGS, .unit = "mode" },
54  { "2mode", "set matrix mode for 3rd plane", OFFSET(mode[2]), AV_OPT_TYPE_INT, {.i64=MATRIX_SQUARE}, 0, MATRIX_NBMODES-1, FLAGS, .unit = "mode" },
55  { "3mode", "set matrix mode for 4th plane", OFFSET(mode[3]), AV_OPT_TYPE_INT, {.i64=MATRIX_SQUARE}, 0, MATRIX_NBMODES-1, FLAGS, .unit = "mode" },
56  { "square", "square matrix", 0, AV_OPT_TYPE_CONST, {.i64=MATRIX_SQUARE}, 0, 0, FLAGS, .unit = "mode" },
57  { "row", "single row matrix", 0, AV_OPT_TYPE_CONST, {.i64=MATRIX_ROW} , 0, 0, FLAGS, .unit = "mode" },
58  { "column", "single column matrix", 0, AV_OPT_TYPE_CONST, {.i64=MATRIX_COLUMN}, 0, 0, FLAGS, .unit = "mode" },
59  { NULL }
60 };
61 
62 AVFILTER_DEFINE_CLASS(convolution);
63 
64 static const int same3x3[9] = {0, 0, 0,
65  0, 1, 0,
66  0, 0, 0};
67 
68 static const int same5x5[25] = {0, 0, 0, 0, 0,
69  0, 0, 0, 0, 0,
70  0, 0, 1, 0, 0,
71  0, 0, 0, 0, 0,
72  0, 0, 0, 0, 0};
73 
74 static const int same7x7[49] = {0, 0, 0, 0, 0, 0, 0,
75  0, 0, 0, 0, 0, 0, 0,
76  0, 0, 0, 0, 0, 0, 0,
77  0, 0, 0, 1, 0, 0, 0,
78  0, 0, 0, 0, 0, 0, 0,
79  0, 0, 0, 0, 0, 0, 0,
80  0, 0, 0, 0, 0, 0, 0};
81 
82 static const enum AVPixelFormat pix_fmts[] = {
102 };
103 
104 typedef struct ThreadData {
105  AVFrame *in, *out;
106 } ThreadData;
107 
108 static void filter16_prewitt(uint8_t *dstp, int width,
109  float scale, float delta, const int *const matrix,
110  const uint8_t *c[], int peak, int radius,
111  int dstride, int stride, int size)
112 {
113  uint16_t *dst = (uint16_t *)dstp;
114  int x;
115 
116  for (x = 0; x < width; x++) {
117  float suma = AV_RN16A(&c[0][2 * x]) * -1 + AV_RN16A(&c[1][2 * x]) * -1 + AV_RN16A(&c[2][2 * x]) * -1 +
118  AV_RN16A(&c[6][2 * x]) * 1 + AV_RN16A(&c[7][2 * x]) * 1 + AV_RN16A(&c[8][2 * x]) * 1;
119  float sumb = AV_RN16A(&c[0][2 * x]) * -1 + AV_RN16A(&c[2][2 * x]) * 1 + AV_RN16A(&c[3][2 * x]) * -1 +
120  AV_RN16A(&c[5][2 * x]) * 1 + AV_RN16A(&c[6][2 * x]) * -1 + AV_RN16A(&c[8][2 * x]) * 1;
121 
122  dst[x] = av_clip(sqrtf(suma*suma + sumb*sumb) * scale + delta, 0, peak);
123  }
124 }
125 
126 static void filter16_roberts(uint8_t *dstp, int width,
127  float scale, float delta, const int *const matrix,
128  const uint8_t *c[], int peak, int radius,
129  int dstride, int stride, int size)
130 {
131  uint16_t *dst = (uint16_t *)dstp;
132  int x;
133 
134  for (x = 0; x < width; x++) {
135  float suma = AV_RN16A(&c[0][2 * x]) * 1 + AV_RN16A(&c[1][2 * x]) * -1;
136  float sumb = AV_RN16A(&c[4][2 * x]) * 1 + AV_RN16A(&c[3][2 * x]) * -1;
137 
138  dst[x] = av_clip(sqrtf(suma*suma + sumb*sumb) * scale + delta, 0, peak);
139  }
140 }
141 
142 static void filter16_scharr(uint8_t *dstp, int width,
143  float scale, float delta, const int *const matrix,
144  const uint8_t *c[], int peak, int radius,
145  int dstride, int stride, int size)
146 {
147  uint16_t *dst = (uint16_t *)dstp;
148  int x;
149 
150  for (x = 0; x < width; x++) {
151  float suma = AV_RN16A(&c[0][2 * x]) * -47 + AV_RN16A(&c[1][2 * x]) * -162 + AV_RN16A(&c[2][2 * x]) * -47 +
152  AV_RN16A(&c[6][2 * x]) * 47 + AV_RN16A(&c[7][2 * x]) * 162 + AV_RN16A(&c[8][2 * x]) * 47;
153  float sumb = AV_RN16A(&c[0][2 * x]) * -47 + AV_RN16A(&c[2][2 * x]) * 47 + AV_RN16A(&c[3][2 * x]) * -162 +
154  AV_RN16A(&c[5][2 * x]) * 162 + AV_RN16A(&c[6][2 * x]) * -47 + AV_RN16A(&c[8][2 * x]) * 47;
155 
156  suma /= 256.f;
157  sumb /= 256.f;
158  dst[x] = av_clip(sqrtf(suma*suma + sumb*sumb) * scale + delta, 0, peak);
159  }
160 }
161 
162 static void filter16_kirsch(uint8_t *dstp, int width,
163  float scale, float delta, const int *const matrix,
164  const uint8_t *c[], int peak, int radius,
165  int dstride, int stride, int size)
166 {
167  uint16_t *dst = (uint16_t *)dstp;
168  const uint16_t *c0 = (const uint16_t *)c[0], *c1 = (const uint16_t *)c[1], *c2 = (const uint16_t *)c[2];
169  const uint16_t *c3 = (const uint16_t *)c[3], *c5 = (const uint16_t *)c[5];
170  const uint16_t *c6 = (const uint16_t *)c[6], *c7 = (const uint16_t *)c[7], *c8 = (const uint16_t *)c[8];
171  int x;
172 
173  for (x = 0; x < width; x++) {
174  int sum0 = c0[x] * 5 + c1[x] * 5 + c2[x] * 5 +
175  c3[x] * -3 + c5[x] * -3 +
176  c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
177  int sum1 = c0[x] * -3 + c1[x] * 5 + c2[x] * 5 +
178  c3[x] * 5 + c5[x] * -3 +
179  c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
180  int sum2 = c0[x] * -3 + c1[x] * -3 + c2[x] * 5 +
181  c3[x] * 5 + c5[x] * 5 +
182  c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
183  int sum3 = c0[x] * -3 + c1[x] * -3 + c2[x] * -3 +
184  c3[x] * 5 + c5[x] * 5 +
185  c6[x] * 5 + c7[x] * -3 + c8[x] * -3;
186  int sum4 = c0[x] * -3 + c1[x] * -3 + c2[x] * -3 +
187  c3[x] * -3 + c5[x] * 5 +
188  c6[x] * 5 + c7[x] * 5 + c8[x] * -3;
189  int sum5 = c0[x] * -3 + c1[x] * -3 + c2[x] * -3 +
190  c3[x] * -3 + c5[x] * -3 +
191  c6[x] * 5 + c7[x] * 5 + c8[x] * 5;
192  int sum6 = c0[x] * 5 + c1[x] * -3 + c2[x] * -3 +
193  c3[x] * -3 + c5[x] * -3 +
194  c6[x] * -3 + c7[x] * 5 + c8[x] * 5;
195  int sum7 = c0[x] * 5 + c1[x] * 5 + c2[x] * -3 +
196  c3[x] * -3 + c5[x] * -3 +
197  c6[x] * -3 + c7[x] * -3 + c8[x] * 5;
198 
199  sum0 = FFMAX(sum0, sum1);
200  sum2 = FFMAX(sum2, sum3);
201  sum4 = FFMAX(sum4, sum5);
202  sum6 = FFMAX(sum6, sum7);
203  sum0 = FFMAX(sum0, sum2);
204  sum4 = FFMAX(sum4, sum6);
205  sum0 = FFMAX(sum0, sum4);
206 
207  dst[x] = av_clip(FFABS(sum0) * scale + delta, 0, peak);
208  }
209 }
210 
211 static void filter_prewitt(uint8_t *dst, int width,
212  float scale, float delta, const int *const matrix,
213  const uint8_t *c[], int peak, int radius,
214  int dstride, int stride, int size)
215 {
216  const uint8_t *c0 = c[0], *c1 = c[1], *c2 = c[2];
217  const uint8_t *c3 = c[3], *c5 = c[5];
218  const uint8_t *c6 = c[6], *c7 = c[7], *c8 = c[8];
219  int x;
220 
221  for (x = 0; x < width; x++) {
222  float suma = c0[x] * -1 + c1[x] * -1 + c2[x] * -1 +
223  c6[x] * 1 + c7[x] * 1 + c8[x] * 1;
224  float sumb = c0[x] * -1 + c2[x] * 1 + c3[x] * -1 +
225  c5[x] * 1 + c6[x] * -1 + c8[x] * 1;
226 
227  dst[x] = av_clip_uint8(sqrtf(suma*suma + sumb*sumb) * scale + delta);
228  }
229 }
230 
231 static void filter_roberts(uint8_t *dst, int width,
232  float scale, float delta, const int *const matrix,
233  const uint8_t *c[], int peak, int radius,
234  int dstride, int stride, int size)
235 {
236  int x;
237 
238  for (x = 0; x < width; x++) {
239  float suma = c[0][x] * 1 + c[1][x] * -1;
240  float sumb = c[4][x] * 1 + c[3][x] * -1;
241 
242  dst[x] = av_clip_uint8(sqrtf(suma*suma + sumb*sumb) * scale + delta);
243  }
244 }
245 
246 static void filter_scharr(uint8_t *dst, int width,
247  float scale, float delta, const int *const matrix,
248  const uint8_t *c[], int peak, int radius,
249  int dstride, int stride, int size)
250 {
251  const uint8_t *c0 = c[0], *c1 = c[1], *c2 = c[2];
252  const uint8_t *c3 = c[3], *c5 = c[5];
253  const uint8_t *c6 = c[6], *c7 = c[7], *c8 = c[8];
254  int x;
255 
256  for (x = 0; x < width; x++) {
257  float suma = c0[x] * -47 + c1[x] * -162 + c2[x] * -47 +
258  c6[x] * 47 + c7[x] * 162 + c8[x] * 47;
259  float sumb = c0[x] * -47 + c2[x] * 47 + c3[x] * -162 +
260  c5[x] * 162 + c6[x] * -47 + c8[x] * 47;
261 
262  suma /= 256.f;
263  sumb /= 256.f;
264  dst[x] = av_clip_uint8(sqrtf(suma*suma + sumb*sumb) * scale + delta);
265  }
266 }
267 
268 static void filter_kirsch(uint8_t *dst, int width,
269  float scale, float delta, const int *const matrix,
270  const uint8_t *c[], int peak, int radius,
271  int dstride, int stride, int size)
272 {
273  const uint8_t *c0 = c[0], *c1 = c[1], *c2 = c[2];
274  const uint8_t *c3 = c[3], *c5 = c[5];
275  const uint8_t *c6 = c[6], *c7 = c[7], *c8 = c[8];
276  int x;
277 
278  for (x = 0; x < width; x++) {
279  int sum0 = c0[x] * 5 + c1[x] * 5 + c2[x] * 5 +
280  c3[x] * -3 + c5[x] * -3 +
281  c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
282  int sum1 = c0[x] * -3 + c1[x] * 5 + c2[x] * 5 +
283  c3[x] * 5 + c5[x] * -3 +
284  c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
285  int sum2 = c0[x] * -3 + c1[x] * -3 + c2[x] * 5 +
286  c3[x] * 5 + c5[x] * 5 +
287  c6[x] * -3 + c7[x] * -3 + c8[x] * -3;
288  int sum3 = c0[x] * -3 + c1[x] * -3 + c2[x] * -3 +
289  c3[x] * 5 + c5[x] * 5 +
290  c6[x] * 5 + c7[x] * -3 + c8[x] * -3;
291  int sum4 = c0[x] * -3 + c1[x] * -3 + c2[x] * -3 +
292  c3[x] * -3 + c5[x] * 5 +
293  c6[x] * 5 + c7[x] * 5 + c8[x] * -3;
294  int sum5 = c0[x] * -3 + c1[x] * -3 + c2[x] * -3 +
295  c3[x] * -3 + c5[x] * -3 +
296  c6[x] * 5 + c7[x] * 5 + c8[x] * 5;
297  int sum6 = c0[x] * 5 + c1[x] * -3 + c2[x] * -3 +
298  c3[x] * -3 + c5[x] * -3 +
299  c6[x] * -3 + c7[x] * 5 + c8[x] * 5;
300  int sum7 = c0[x] * 5 + c1[x] * 5 + c2[x] * -3 +
301  c3[x] * -3 + c5[x] * -3 +
302  c6[x] * -3 + c7[x] * -3 + c8[x] * 5;
303 
304  sum0 = FFMAX(sum0, sum1);
305  sum2 = FFMAX(sum2, sum3);
306  sum4 = FFMAX(sum4, sum5);
307  sum6 = FFMAX(sum6, sum7);
308  sum0 = FFMAX(sum0, sum2);
309  sum4 = FFMAX(sum4, sum6);
310  sum0 = FFMAX(sum0, sum4);
311 
312  dst[x] = av_clip_uint8(FFABS(sum0) * scale + delta);
313  }
314 }
315 
316 static void filter16_3x3(uint8_t *dstp, int width,
317  float rdiv, float bias, const int *const matrix,
318  const uint8_t *c[], int peak, int radius,
319  int dstride, int stride, int size)
320 {
321  uint16_t *dst = (uint16_t *)dstp;
322  int x;
323 
324  for (x = 0; x < width; x++) {
325  unsigned sum = (unsigned)AV_RN16A(&c[0][2 * x]) * matrix[0] +
326  (unsigned)AV_RN16A(&c[1][2 * x]) * matrix[1] +
327  (unsigned)AV_RN16A(&c[2][2 * x]) * matrix[2] +
328  (unsigned)AV_RN16A(&c[3][2 * x]) * matrix[3] +
329  (unsigned)AV_RN16A(&c[4][2 * x]) * matrix[4] +
330  (unsigned)AV_RN16A(&c[5][2 * x]) * matrix[5] +
331  (unsigned)AV_RN16A(&c[6][2 * x]) * matrix[6] +
332  (unsigned)AV_RN16A(&c[7][2 * x]) * matrix[7] +
333  (unsigned)AV_RN16A(&c[8][2 * x]) * matrix[8];
334  dst[x] = av_clip((int)sum * rdiv + bias + 0.5f, 0, peak);
335  }
336 }
337 
338 static void filter16_5x5(uint8_t *dstp, int width,
339  float rdiv, float bias, const int *const matrix,
340  const uint8_t *c[], int peak, int radius,
341  int dstride, int stride, int size)
342 {
343  uint16_t *dst = (uint16_t *)dstp;
344  int x;
345 
346  for (x = 0; x < width; x++) {
347  int i;
348  unsigned sum = 0;
349 
350  for (i = 0; i < 25; i++)
351  sum += (unsigned)AV_RN16A(&c[i][2 * x]) * matrix[i];
352 
353  dst[x] = av_clip((int)sum * rdiv + bias + 0.5f, 0, peak);
354  }
355 }
356 
357 static void filter16_7x7(uint8_t *dstp, int width,
358  float rdiv, float bias, const int *const matrix,
359  const uint8_t *c[], int peak, int radius,
360  int dstride, int stride, int size)
361 {
362  uint16_t *dst = (uint16_t *)dstp;
363  int x;
364 
365  for (x = 0; x < width; x++) {
366  int i;
367  unsigned sum = 0;
368 
369  for (i = 0; i < 49; i++)
370  sum += (unsigned)AV_RN16A(&c[i][2 * x]) * matrix[i];
371 
372  dst[x] = av_clip((int)sum * rdiv + bias + 0.5f, 0, peak);
373  }
374 }
375 
376 static void filter16_row(uint8_t *dstp, int width,
377  float rdiv, float bias, const int *const matrix,
378  const uint8_t *c[], int peak, int radius,
379  int dstride, int stride, int size)
380 {
381  uint16_t *dst = (uint16_t *)dstp;
382  int x;
383 
384  for (x = 0; x < width; x++) {
385  int i;
386  unsigned sum = 0;
387 
388  for (i = 0; i < 2 * radius + 1; i++)
389  sum += (unsigned)AV_RN16A(&c[i][2 * x]) * matrix[i];
390 
391  dst[x] = av_clip((int)sum * rdiv + bias + 0.5f, 0, peak);
392  }
393 }
394 
395 static void filter16_column(uint8_t *dstp, int height,
396  float rdiv, float bias, const int *const matrix,
397  const uint8_t *c[], int peak, int radius,
398  int dstride, int stride, int size)
399 {
400  DECLARE_ALIGNED(64, unsigned, sum)[16];
401  uint16_t *dst = (uint16_t *)dstp;
402  const int width = FFMIN(16, size);
403 
404  for (int y = 0; y < height; y++) {
405 
406  memset(sum, 0, sizeof(sum));
407  for (int i = 0; i < 2 * radius + 1; i++) {
408  for (int off16 = 0; off16 < width; off16++)
409  sum[off16] += (unsigned)AV_RN16A(&c[i][0 + y * stride + off16 * 2]) * matrix[i];
410  }
411 
412  for (int off16 = 0; off16 < width; off16++) {
413  dst[off16] = av_clip((int)sum[off16] * rdiv + bias + 0.5f, 0, peak);
414  }
415  dst += dstride / 2;
416  }
417 }
418 
419 static void filter_7x7(uint8_t *dst, int width,
420  float rdiv, float bias, const int *const matrix,
421  const uint8_t *c[], int peak, int radius,
422  int dstride, int stride, int size)
423 {
424  int x;
425 
426  for (x = 0; x < width; x++) {
427  int i;
428  unsigned sum = 0;
429 
430  for (i = 0; i < 49; i++)
431  sum += (unsigned)c[i][x] * matrix[i];
432 
433  dst[x] = av_clip_uint8((int)sum * rdiv + bias + 0.5f);
434  }
435 }
436 
437 static void filter_5x5(uint8_t *dst, int width,
438  float rdiv, float bias, const int *const matrix,
439  const uint8_t *c[], int peak, int radius,
440  int dstride, int stride, int size)
441 {
442  int x;
443 
444  for (x = 0; x < width; x++) {
445  int i;
446  unsigned sum = 0;
447 
448  for (i = 0; i < 25; i++)
449  sum += (unsigned)c[i][x] * matrix[i];
450 
451  dst[x] = av_clip_uint8((int)sum * rdiv + bias + 0.5f);
452  }
453 }
454 
455 static void filter_3x3(uint8_t *dst, int width,
456  float rdiv, float bias, const int *const matrix,
457  const uint8_t *c[], int peak, int radius,
458  int dstride, int stride, int size)
459 {
460  const uint8_t *c0 = c[0], *c1 = c[1], *c2 = c[2];
461  const uint8_t *c3 = c[3], *c4 = c[4], *c5 = c[5];
462  const uint8_t *c6 = c[6], *c7 = c[7], *c8 = c[8];
463  int x;
464 
465  for (x = 0; x < width; x++) {
466  unsigned sum = (unsigned)c0[x] * matrix[0] + (unsigned)c1[x] * matrix[1] + (unsigned)c2[x] * matrix[2] +
467  (unsigned)c3[x] * matrix[3] + (unsigned)c4[x] * matrix[4] + (unsigned)c5[x] * matrix[5] +
468  (unsigned)c6[x] * matrix[6] + (unsigned)c7[x] * matrix[7] + (unsigned)c8[x] * matrix[8];
469  dst[x] = av_clip_uint8((int)sum * rdiv + bias + 0.5f);
470  }
471 }
472 
473 static void filter_row(uint8_t *dst, int width,
474  float rdiv, float bias, const int *const matrix,
475  const uint8_t *c[], int peak, int radius,
476  int dstride, int stride, int size)
477 {
478  int x;
479 
480  for (x = 0; x < width; x++) {
481  int i;
482  unsigned sum = 0;
483 
484  for (i = 0; i < 2 * radius + 1; i++)
485  sum += (unsigned)c[i][x] * matrix[i];
486 
487  dst[x] = av_clip_uint8((int)sum * rdiv + bias + 0.5f);
488  }
489 }
490 
491 static void filter_column(uint8_t *dst, int height,
492  float rdiv, float bias, const int *const matrix,
493  const uint8_t *c[], int peak, int radius,
494  int dstride, int stride, int size)
495 {
496  DECLARE_ALIGNED(64, unsigned, sum)[16];
497 
498  for (int y = 0; y < height; y++) {
499  memset(sum, 0, sizeof(sum));
500 
501  for (int i = 0; i < 2 * radius + 1; i++) {
502  for (int off16 = 0; off16 < 16; off16++)
503  sum[off16] += (unsigned)c[i][0 + y * stride + off16] * matrix[i];
504  }
505 
506  for (int off16 = 0; off16 < 16; off16++) {
507  dst[off16] = av_clip_uint8((int)sum[off16] * rdiv + bias + 0.5f);
508  }
509  dst += dstride;
510  }
511 }
512 
513 static void setup_5x5(int radius, const uint8_t *c[], const uint8_t *src, int stride,
514  int x, int w, int y, int h, int bpc)
515 {
516  int i;
517 
518  for (i = 0; i < 25; i++) {
519  int xoff = avpriv_mirror(x + (i % 5) - 2, w - 1);
520  int yoff = avpriv_mirror(y + (i / 5) - 2, h - 1);
521 
522  c[i] = src + xoff * bpc + yoff * stride;
523  }
524 }
525 
526 static void setup_7x7(int radius, const uint8_t *c[], const uint8_t *src, int stride,
527  int x, int w, int y, int h, int bpc)
528 {
529  int i;
530 
531  for (i = 0; i < 49; i++) {
532  int xoff = avpriv_mirror(x + (i % 7) - 3, w - 1);
533  int yoff = avpriv_mirror(y + (i / 7) - 3, h - 1);
534 
535  c[i] = src + xoff * bpc + yoff * stride;
536  }
537 }
538 
539 static void setup_row(int radius, const uint8_t *c[], const uint8_t *src, int stride,
540  int x, int w, int y, int h, int bpc)
541 {
542  int i;
543 
544  for (i = 0; i < radius * 2 + 1; i++) {
545  int xoff = avpriv_mirror(x + i - radius, w - 1);
546 
547  c[i] = src + xoff * bpc + y * stride;
548  }
549 }
550 
551 static void setup_column(int radius, const uint8_t *c[], const uint8_t *src, int stride,
552  int x, int w, int y, int h, int bpc)
553 {
554  int i;
555 
556  for (i = 0; i < radius * 2 + 1; i++) {
557  int xoff = avpriv_mirror(x + i - radius, h - 1);
558 
559  c[i] = src + y * bpc + xoff * stride;
560  }
561 }
562 
563 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
564 {
565  ConvolutionContext *s = ctx->priv;
566  ThreadData *td = arg;
567  AVFrame *in = td->in;
568  AVFrame *out = td->out;
569  int plane;
570 
571  for (plane = 0; plane < s->nb_planes; plane++) {
572  const int mode = s->mode[plane];
573  const int bpc = s->bpc;
574  const int radius = s->size[plane] / 2;
575  const int height = s->planeheight[plane];
576  const int width = s->planewidth[plane];
577  const int stride = in->linesize[plane];
578  const int dstride = out->linesize[plane];
579  const int sizeh = mode == MATRIX_COLUMN ? width : height;
580  const int sizew = mode == MATRIX_COLUMN ? height : width;
581  const int slice_start = ff_slice_pos(sizeh, jobnr, nb_jobs);
582  const int slice_end = ff_slice_pos(sizeh, jobnr + 1, nb_jobs);
583  const float rdiv = s->rdiv[plane];
584  const float bias = s->bias[plane];
585  const uint8_t *src = in->data[plane];
586  const int dst_pos = slice_start * (mode == MATRIX_COLUMN ? bpc : dstride);
587  uint8_t *dst = out->data[plane] + dst_pos;
588  const int *matrix = s->matrix[plane];
589  const int step = mode == MATRIX_COLUMN ? 16 : 1;
590  const uint8_t *c[49];
591  int y, x;
592 
593  if (s->copy[plane]) {
594  if (mode == MATRIX_COLUMN)
595  av_image_copy_plane(dst, dstride, src + slice_start * bpc, stride,
596  (slice_end - slice_start) * bpc, height);
597  else
599  width * bpc, slice_end - slice_start);
600  continue;
601  }
602  for (y = slice_start; y < slice_end; y += step) {
603  const int left = FFMIN(radius, sizew);
604  const int right = FFMAX(left, sizew - radius);
605  const int xoff = mode == MATRIX_COLUMN ? (y - slice_start) * bpc : left * bpc;
606  const int yoff = mode == MATRIX_COLUMN ? left * dstride : 0;
607 
608  for (x = 0; x < left; x++) {
609  const int xoff = mode == MATRIX_COLUMN ? (y - slice_start) * bpc : x * bpc;
610  const int yoff = mode == MATRIX_COLUMN ? x * dstride : 0;
611 
612  s->setup[plane](radius, c, src, stride, x, width, y, height, bpc);
613  s->filter[plane](dst + yoff + xoff, 1, rdiv,
614  bias, matrix, c, s->max, radius,
615  dstride, stride, slice_end - step);
616  }
617  s->setup[plane](radius, c, src, stride, left, width, y, height, bpc);
618  s->filter[plane](dst + yoff + xoff, right - left,
619  rdiv, bias, matrix, c, s->max, radius,
620  dstride, stride, slice_end - step);
621  for (x = right; x < sizew; x++) {
622  const int xoff = mode == MATRIX_COLUMN ? (y - slice_start) * bpc : x * bpc;
623  const int yoff = mode == MATRIX_COLUMN ? x * dstride : 0;
624 
625  s->setup[plane](radius, c, src, stride, x, width, y, height, bpc);
626  s->filter[plane](dst + yoff + xoff, 1, rdiv,
627  bias, matrix, c, s->max, radius,
628  dstride, stride, slice_end - step);
629  }
630  if (mode != MATRIX_COLUMN)
631  dst += dstride;
632  }
633  }
634 
635  return 0;
636 }
637 
639 {
640  ConvolutionContext *s = ctx->priv;
641  AVFilterLink *inlink = ctx->inputs[0];
643  int p, i;
644 
645  s->depth = desc->comp[0].depth;
646  s->max = (1 << s->depth) - 1;
647 
648  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
649  s->planewidth[0] = s->planewidth[3] = inlink->w;
650  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
651  s->planeheight[0] = s->planeheight[3] = inlink->h;
652 
653  s->nb_planes = av_pix_fmt_count_planes(inlink->format);
654  s->nb_threads = ff_filter_get_nb_threads(ctx);
655  s->bpc = (s->depth + 7) / 8;
656 
657  if (!strcmp(ctx->filter->name, "convolution")) {
658  for (i = 0; i < 4; i++) {
659  int *matrix = (int *)s->matrix[i];
660  char *orig, *p, *arg, *saveptr = NULL;
661  float sum = 1.f;
662 
663  p = orig = av_strdup(s->matrix_str[i]);
664  if (p) {
665  s->matrix_length[i] = 0;
666  s->rdiv[i] = s->user_rdiv[i];
667  sum = 0.f;
668 
669  while (s->matrix_length[i] < 49) {
670  if (!(arg = av_strtok(p, " |", &saveptr)))
671  break;
672 
673  p = NULL;
674  sscanf(arg, "%d", &matrix[s->matrix_length[i]]);
675  sum += matrix[s->matrix_length[i]];
676  s->matrix_length[i]++;
677  }
678 
679  av_freep(&orig);
680  if (!(s->matrix_length[i] & 1)) {
681  av_log(ctx, AV_LOG_ERROR, "number of matrix elements must be odd\n");
682  return AVERROR(EINVAL);
683  }
684  }
685 
686  if (s->mode[i] == MATRIX_ROW) {
687  s->filter[i] = filter_row;
688  s->setup[i] = setup_row;
689  s->size[i] = s->matrix_length[i];
690  } else if (s->mode[i] == MATRIX_COLUMN) {
691  s->filter[i] = filter_column;
692  s->setup[i] = setup_column;
693  s->size[i] = s->matrix_length[i];
694  } else if (s->matrix_length[i] == 9) {
695  s->size[i] = 3;
696 
697  if (!memcmp(matrix, same3x3, sizeof(same3x3))) {
698  s->copy[i] = 1;
699  } else {
700  s->filter[i] = filter_3x3;
701  s->copy[i] = 0;
702  }
703  s->setup[i] = setup_3x3;
704  } else if (s->matrix_length[i] == 25) {
705  s->size[i] = 5;
706  if (!memcmp(matrix, same5x5, sizeof(same5x5))) {
707  s->copy[i] = 1;
708  } else {
709  s->filter[i] = filter_5x5;
710  s->copy[i] = 0;
711  }
712  s->setup[i] = setup_5x5;
713  } else if (s->matrix_length[i] == 49) {
714  s->size[i] = 7;
715  if (!memcmp(matrix, same7x7, sizeof(same7x7))) {
716  s->copy[i] = 1;
717  } else {
718  s->filter[i] = filter_7x7;
719  s->copy[i] = 0;
720  }
721  s->setup[i] = setup_7x7;
722  } else {
723  return AVERROR(EINVAL);
724  }
725 
726  if (sum == 0)
727  sum = 1;
728  if (s->rdiv[i] == 0)
729  s->rdiv[i] = 1. / sum;
730 
731  if (s->copy[i] && (s->rdiv[i] != 1. || s->bias[i] != 0.))
732  s->copy[i] = 0;
733  }
734  } else if (!strcmp(ctx->filter->name, "prewitt")) {
735  for (i = 0; i < 4; i++) {
736  s->filter[i] = filter_prewitt;
737  s->copy[i] = !((1 << i) & s->planes);
738  s->size[i] = 3;
739  s->setup[i] = setup_3x3;
740  s->rdiv[i] = s->scale;
741  s->bias[i] = s->delta;
742  }
743  } else if (!strcmp(ctx->filter->name, "roberts")) {
744  for (i = 0; i < 4; i++) {
745  s->filter[i] = filter_roberts;
746  s->copy[i] = !((1 << i) & s->planes);
747  s->size[i] = 3;
748  s->setup[i] = setup_3x3;
749  s->rdiv[i] = s->scale;
750  s->bias[i] = s->delta;
751  }
752 #if CONFIG_SOBEL_FILTER
753  } else if (!strcmp(ctx->filter->name, "sobel")) {
754  ff_sobel_init(s, s->depth, s->nb_planes);
755 #endif
756  } else if (!strcmp(ctx->filter->name, "kirsch")) {
757  for (i = 0; i < 4; i++) {
758  s->filter[i] = filter_kirsch;
759  s->copy[i] = !((1 << i) & s->planes);
760  s->size[i] = 3;
761  s->setup[i] = setup_3x3;
762  s->rdiv[i] = s->scale;
763  s->bias[i] = s->delta;
764  }
765  } else if (!strcmp(ctx->filter->name, "scharr")) {
766  for (i = 0; i < 4; i++) {
767  s->filter[i] = filter_scharr;
768  s->copy[i] = !((1 << i) & s->planes);
769  s->size[i] = 3;
770  s->setup[i] = setup_3x3;
771  s->rdiv[i] = s->scale;
772  s->bias[i] = s->delta;
773  }
774  }
775 
776  if (!strcmp(ctx->filter->name, "convolution")) {
777  if (s->depth > 8) {
778  for (p = 0; p < s->nb_planes; p++) {
779  if (s->mode[p] == MATRIX_ROW)
780  s->filter[p] = filter16_row;
781  else if (s->mode[p] == MATRIX_COLUMN)
782  s->filter[p] = filter16_column;
783  else if (s->size[p] == 3)
784  s->filter[p] = filter16_3x3;
785  else if (s->size[p] == 5)
786  s->filter[p] = filter16_5x5;
787  else if (s->size[p] == 7)
788  s->filter[p] = filter16_7x7;
789  }
790  }
791 #if CONFIG_CONVOLUTION_FILTER && ARCH_X86_64 && HAVE_X86ASM
793 #endif
794  } else if (!strcmp(ctx->filter->name, "prewitt")) {
795  if (s->depth > 8)
796  for (p = 0; p < s->nb_planes; p++)
797  s->filter[p] = filter16_prewitt;
798  } else if (!strcmp(ctx->filter->name, "roberts")) {
799  if (s->depth > 8)
800  for (p = 0; p < s->nb_planes; p++)
801  s->filter[p] = filter16_roberts;
802  } else if (!strcmp(ctx->filter->name, "kirsch")) {
803  if (s->depth > 8)
804  for (p = 0; p < s->nb_planes; p++)
805  s->filter[p] = filter16_kirsch;
806  } else if (!strcmp(ctx->filter->name, "scharr")) {
807  if (s->depth > 8)
808  for (p = 0; p < s->nb_planes; p++)
809  s->filter[p] = filter16_scharr;
810  }
811 
812  return 0;
813 }
814 
816 {
817  AVFilterContext *ctx = inlink->dst;
818  return param_init(ctx);
819 }
820 
822 {
823  AVFilterContext *ctx = inlink->dst;
824  ConvolutionContext *s = ctx->priv;
825  AVFilterLink *outlink = ctx->outputs[0];
826  AVFrame *out;
827  ThreadData td;
828 
829  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
830  if (!out) {
831  av_frame_free(&in);
832  return AVERROR(ENOMEM);
833  }
835 
836  td.in = in;
837  td.out = out;
839  FFMIN3(s->planeheight[1], s->planewidth[1], s->nb_threads));
840 
841  av_frame_free(&in);
842  return ff_filter_frame(outlink, out);
843 }
844 
845 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
846  char *res, int res_len, int flags)
847 {
848  int ret;
849 
850  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
851  if (ret < 0)
852  return ret;
853 
854  return param_init(ctx);
855 }
856 
857 static const AVFilterPad convolution_inputs[] = {
858  {
859  .name = "default",
860  .type = AVMEDIA_TYPE_VIDEO,
861  .config_props = config_input,
862  .filter_frame = filter_frame,
863  },
864 };
865 
866 #if CONFIG_CONVOLUTION_FILTER
867 
868 const FFFilter ff_vf_convolution = {
869  .p.name = "convolution",
870  .p.description = NULL_IF_CONFIG_SMALL("Apply convolution filter."),
871  .p.priv_class = &convolution_class,
873  .priv_size = sizeof(ConvolutionContext),
877  .process_command = process_command,
878 };
879 
880 #endif /* CONFIG_CONVOLUTION_FILTER */
881 
882 static const AVOption common_options[] = {
883  { "planes", "set planes to filter", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=15}, 0, 15, FLAGS},
884  { "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=1.0}, 0.0, 65535, FLAGS},
885  { "delta", "set delta", OFFSET(delta), AV_OPT_TYPE_FLOAT, {.dbl=0}, -65535, 65535, FLAGS},
886  { NULL }
887 };
888 
889 AVFILTER_DEFINE_CLASS_EXT(common, "kirsch/prewitt/roberts/scharr/sobel",
891 
892 #if CONFIG_PREWITT_FILTER
893 
894 const FFFilter ff_vf_prewitt = {
895  .p.name = "prewitt",
896  .p.description = NULL_IF_CONFIG_SMALL("Apply prewitt operator."),
897  .p.priv_class = &common_class,
899  .priv_size = sizeof(ConvolutionContext),
903  .process_command = process_command,
904 };
905 
906 #endif /* CONFIG_PREWITT_FILTER */
907 
908 #if CONFIG_SOBEL_FILTER
909 
910 const FFFilter ff_vf_sobel = {
911  .p.name = "sobel",
912  .p.description = NULL_IF_CONFIG_SMALL("Apply sobel operator."),
913  .p.priv_class = &common_class,
915  .priv_size = sizeof(ConvolutionContext),
919  .process_command = process_command,
920 };
921 
922 #endif /* CONFIG_SOBEL_FILTER */
923 
924 #if CONFIG_ROBERTS_FILTER
925 
926 const FFFilter ff_vf_roberts = {
927  .p.name = "roberts",
928  .p.description = NULL_IF_CONFIG_SMALL("Apply roberts cross operator."),
929  .p.priv_class = &common_class,
931  .priv_size = sizeof(ConvolutionContext),
935  .process_command = process_command,
936 };
937 
938 #endif /* CONFIG_ROBERTS_FILTER */
939 
940 #if CONFIG_KIRSCH_FILTER
941 
942 const FFFilter ff_vf_kirsch = {
943  .p.name = "kirsch",
944  .p.description = NULL_IF_CONFIG_SMALL("Apply kirsch operator."),
945  .p.priv_class = &common_class,
947  .priv_size = sizeof(ConvolutionContext),
951  .process_command = process_command,
952 };
953 
954 #endif /* CONFIG_KIRSCH_FILTER */
955 
956 #if CONFIG_SCHARR_FILTER
957 
958 const FFFilter ff_vf_scharr = {
959  .p.name = "scharr",
960  .p.description = NULL_IF_CONFIG_SMALL("Apply scharr operator."),
961  .p.priv_class = &common_class,
963  .priv_size = sizeof(ConvolutionContext),
967  .process_command = process_command,
968 };
969 
970 #endif /* CONFIG_SCHARR_FILTER */
flags
const SwsFlags flags[]
Definition: swscale.c:85
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:89
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:596
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:565
setup_3x3
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)
Definition: convolution.h:69
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
av_clip
#define av_clip
Definition: common.h:100
OFFSET
#define OFFSET(x)
Definition: vf_convolution.c:36
AVERROR
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
opt.h
mem_internal.h
out
static FILE * out
Definition: movenc.c:55
ff_vf_kirsch
const FFFilter ff_vf_kirsch
filter_prewitt
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)
Definition: vf_convolution.c:211
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1068
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3456
matrix
Definition: vc1dsp.c:43
inlink
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
Definition: filter_design.txt:212
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:64
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:588
mode
Definition: swscale.c:71
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:466
pixdesc.h
step
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
Definition: rate_distortion.txt:58
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:595
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:590
AVOption
AVOption.
Definition: opt.h:429
filters.h
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:539
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_convolution.c:821
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:220
filter16_7x7
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)
Definition: vf_convolution.c:357
c1
static const uint64_t c1
Definition: murmur3.c:52
filter16_scharr
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)
Definition: vf_convolution.c:142
ThreadData::out
AVFrame * out
Definition: af_adeclick.c:526
convolution.h
video.h
ThreadData::in
AVFrame * in
Definition: af_adecorrelate.c:155
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:591
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:518
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:487
av_image_copy_plane
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.
Definition: imgutils.c:374
filter_slice
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_convolution.c:563
setup_row
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)
Definition: vf_convolution.c:539
same3x3
static const int same3x3[9]
Definition: vf_convolution.c:64
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3496
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:587
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:560
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
Definition: mpeg12dec.c:1691
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:558
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:597
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:244
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:537
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:522
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:40
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(convolution)
convolution_inputs
static const AVFilterPad convolution_inputs[]
Definition: vf_convolution.c:857
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:542
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:283
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
planes
static const struct @594 planes[]
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:551
MATRIX_NBMODES
@ MATRIX_NBMODES
Definition: convolution.h:31
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
FFFilter
Definition: filters.h:267
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:562
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:265
MATRIX_SQUARE
@ MATRIX_SQUARE
Definition: convolution.h:28
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:563
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:552
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
av_strtok
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().
Definition: avstring.c:179
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:594
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:536
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:550
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_convolution.c:845
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:521
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
arg
const char * arg
Definition: jacosubdec.c:65
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:74
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:519
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:561
NULL
#define NULL
Definition: coverity.c:32
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:599
bias
static int bias(int x, int c)
Definition: vqcdec.c:115
MATRIX_ROW
@ MATRIX_ROW
Definition: convolution.h:29
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
sqrtf
static __device__ float sqrtf(float a)
Definition: cuda_runtime.h:184
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_convolution.c:82
ConvolutionContext
Definition: convolution.h:34
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:540
avpriv_mirror
static av_always_inline av_const int avpriv_mirror(int x, int w)
Definition: internal.h:140
common_options
static const AVOption common_options[]
Definition: vf_convolution.c:882
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:557
c
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
Definition: undefined.txt:32
filter16_3x3
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)
Definition: vf_convolution.c:316
f
f
Definition: af_crystalizer.c:122
ff_vf_scharr
const FFFilter ff_vf_scharr
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
height
#define height
Definition: dsp.h:89
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:104
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
convolution_options
static const AVOption convolution_options[]
Definition: vf_convolution.c:39
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:544
size
int size
Definition: twinvq_data.h:10344
filter16_prewitt
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)
Definition: vf_convolution.c:108
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:546
filter16_column
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)
Definition: vf_convolution.c:395
setup_5x5
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)
Definition: vf_convolution.c:513
filter16_roberts
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)
Definition: vf_convolution.c:126
ff_vf_prewitt
const FFFilter ff_vf_prewitt
ff_filter_process_command
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.
Definition: avfilter.c:906
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_convolution.c:815
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:592
filter_row
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)
Definition: vf_convolution.c:473
same5x5
static const int same5x5[25]
Definition: vf_convolution.c:68
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:197
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
filter_kirsch
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)
Definition: vf_convolution.c:268
param_init
static int param_init(AVFilterContext *ctx)
Definition: vf_convolution.c:638
FFMIN3
#define FFMIN3(a, b, c)
Definition: macros.h:50
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:559
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:846
delta
float delta
Definition: vorbis_enc_data.h:430
ThreadData
Used for passing data between threads.
Definition: dsddec.c:71
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
same7x7
static const int same7x7[49]
Definition: vf_convolution.c:74
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:107
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:46
setup_7x7
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)
Definition: vf_convolution.c:526
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:538
filter_scharr
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)
Definition: vf_convolution.c:246
setup_column
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)
Definition: vf_convolution.c:551
slice_start
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)
Definition: dec.c:844
filter_3x3
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)
Definition: vf_convolution.c:455
filter_7x7
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)
Definition: vf_convolution.c:419
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:589
filter_column
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)
Definition: vf_convolution.c:491
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:264
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:543
left
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
Definition: snow.txt:386
filter_roberts
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)
Definition: vf_convolution.c:231
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:548
c2
static const uint64_t c2
Definition: murmur3.c:53
ff_filter_execute
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: avfilter.c:1692
AVFILTER_DEFINE_CLASS_EXT
AVFILTER_DEFINE_CLASS_EXT(common, "kirsch/prewitt/roberts/scharr/sobel", common_options)
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:593
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avfilter.h
AV_RN16A
#define AV_RN16A(p)
Definition: intreadwrite.h:518
FLAGS
#define FLAGS
Definition: vf_convolution.c:37
filter16_5x5
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)
Definition: vf_convolution.c:338
filter_5x5
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)
Definition: vf_convolution.c:437
Windows::Graphics::DirectX::Direct3D11::p
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
Definition: vsrc_gfxcapture_winrt.hpp:53
ff_vf_sobel
const FFFilter ff_vf_sobel
av_clip_uint8
#define av_clip_uint8
Definition: common.h:106
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AVFilterContext
An instance of a filter.
Definition: avfilter.h:274
MATRIX_COLUMN
@ MATRIX_COLUMN
Definition: convolution.h:30
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:167
desc
const char * desc
Definition: libsvtav1.c:83
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
FFFilter::p
AVFilter p
The public AVFilter.
Definition: filters.h:271
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
mem.h
av_strdup
#define av_strdup(s)
Definition: ops_asmgen.c:47
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
w
uint8_t w
Definition: llvidencdsp.c:39
ff_convolution_init_x86
void ff_convolution_init_x86(ConvolutionContext *s)
Definition: vf_convolution_init.c:37
ff_sobel_init
static void ff_sobel_init(ConvolutionContext *s, int depth, int nb_planes)
Definition: convolution.h:120
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: intra.c:278
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
filter16_kirsch
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)
Definition: vf_convolution.c:162
AVFormatContext::name
char * name
Name of this format context, only used for logging purposes.
Definition: avformat.h:1944
imgutils.h
ff_slice_pos
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
Definition: filters.h:763
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:511
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:545
h
h
Definition: vp9dsp_template.c:2070
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:549
stride
#define stride
Definition: h264pred_template.c:536
avstring.h
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
width
#define width
Definition: dsp.h:89
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:520
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
filter16_row
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)
Definition: vf_convolution.c:376
ff_vf_convolution
const FFFilter ff_vf_convolution
src
#define src
Definition: vp8dsp.c:248
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:547
ff_vf_roberts
const FFFilter ff_vf_roberts