FFmpeg
vf_shufflepixels.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/avassert.h"
22 #include "libavutil/avstring.h"
23 #include "libavutil/common.h"
24 #include "libavutil/internal.h"
25 #include "libavutil/imgutils.h"
26 #include "libavutil/lfg.h"
27 #include "libavutil/opt.h"
28 #include "libavutil/pixdesc.h"
29 #include "libavutil/random_seed.h"
30 
31 #include "avfilter.h"
32 #include "internal.h"
33 #include "video.h"
34 
35 typedef struct ShufflePixelsContext {
36  const AVClass *class;
37 
39  int mode;
40  int direction;
41  int64_t seed;
42 
43  int depth;
44  int nb_planes;
45  int linesize[4];
46  int planewidth[4];
47  int planeheight[4];
48 
49  int nb_blocks;
50 
51  uint8_t *used;
53 
55 
56  int (*shuffle_pixels)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
58 
59 static const enum AVPixelFormat pix_fmts[] = {
68 };
69 
71 {
72  ShufflePixelsContext *s = ctx->priv;
73  const int nb_blocks = s->nb_blocks;
74  AVLFG *c = &s->c;
75  uint8_t *used = s->used;
76  int32_t *map = s->map;
77 
78  for (int x = 0; x < s->planewidth[0];) {
79  int rand = av_lfg_get(c) % nb_blocks;
80 
81  if (used[rand] == 0) {
82  int width;
83 
84  if (s->direction) {
85  width = FFMIN(s->block_w, s->planewidth[0] - x);
86  map[rand * s->block_w] = x;
87  } else {
88  width = FFMIN(s->block_w, s->planewidth[0] - rand * s->block_w);
89  map[x] = rand * s->block_w;
90  }
91  used[rand] = 1;
92 
93  if (s->direction) {
94  for (int i = 1; i < width; i++) {
95  map[rand * s->block_w + i] = map[rand * s->block_w] + i;
96  }
97  } else {
98  for (int i = 1; i < width; i++) {
99  map[x + i] = map[x] + i;
100  }
101  }
102 
103  x += width;
104  }
105  }
106 }
107 
109 {
110  ShufflePixelsContext *s = ctx->priv;
111  const int nb_blocks = s->nb_blocks;
112  AVLFG *c = &s->c;
113  uint8_t *used = s->used;
114  int32_t *map = s->map;
115 
116  for (int y = 0; y < s->planeheight[0];) {
117  int rand = av_lfg_get(c) % nb_blocks;
118 
119  if (used[rand] == 0) {
120  int height;
121 
122  if (s->direction) {
123  height = FFMIN(s->block_h, s->planeheight[0] - y);
124  map[rand * s->block_h] = y;
125  } else {
126  height = FFMIN(s->block_h, s->planeheight[0] - rand * s->block_h);
127  map[y] = rand * s->block_h;
128  }
129  used[rand] = 1;
130 
131  if (s->direction) {
132  for (int i = 1; i < height; i++) {
133  map[rand * s->block_h + i] = map[rand * s->block_h] + i;
134  }
135  } else {
136  for (int i = 1; i < height; i++) {
137  map[y + i] = map[y] + i;
138  }
139  }
140 
141  y += height;
142  }
143  }
144 }
145 
147 {
148  ShufflePixelsContext *s = ctx->priv;
149  const int nb_blocks = s->nb_blocks;
150  int nb_blocks_w = s->planewidth[0] / s->block_w;
151  AVLFG *c = &s->c;
152  uint8_t *used = s->used;
153  int32_t *map = s->map;
154 
155  for (int i = 0; i < nb_blocks;) {
156  int rand = av_lfg_get(c) % nb_blocks;
157 
158  if (used[rand] == 0) {
159  int yin = i / nb_blocks_w;
160  int xin = i % nb_blocks_w;
161  int in = yin * s->block_h * s->planewidth[0] + xin * s->block_w;
162  int yout = rand / nb_blocks_w;
163  int xout = rand % nb_blocks_w;
164  int out = yout * s->block_h * s->planewidth[0] + xout * s->block_w;
165 
166  if (s->direction) {
167  map[out] = in;
168  } else {
169  map[in] = out;
170  }
171  used[rand] = 1;
172 
173  if (s->direction) {
174  for (int y = 0; y < s->block_h; y++) {
175  for (int x = 0; x < s->block_w; x++) {
176  map[out + y * s->planewidth[0] + x] = map[out] + x + y * s->planewidth[0];
177  }
178  }
179  } else {
180  for (int y = 0; y < s->block_h; y++) {
181  for (int x = 0; x < s->block_w; x++) {
182  map[in + y * s->planewidth[0] + x] = map[in] + x + y * s->planewidth[0];
183  }
184  }
185  }
186 
187  i++;
188  }
189  }
190 }
191 
192 typedef struct ThreadData {
193  AVFrame *in, *out;
194 } ThreadData;
195 
196 
197 #define SHUFFLE_HORIZONTAL(name, type) \
198 static int shuffle_horizontal## name(AVFilterContext *ctx, void *arg, \
199  int jobnr, int nb_jobs) \
200 { \
201  ShufflePixelsContext *s = ctx->priv; \
202  ThreadData *td = arg; \
203  AVFrame *in = td->in; \
204  AVFrame *out = td->out; \
205  \
206  for (int p = 0; p < s->nb_planes; p++) { \
207  const int slice_start = (s->planeheight[p] * jobnr) / nb_jobs; \
208  const int slice_end = (s->planeheight[p] * (jobnr+1)) / nb_jobs; \
209  type *dst = (type *)(out->data[p] + slice_start * out->linesize[p]); \
210  const type *src = (const type *)(in->data[p] + \
211  slice_start * in->linesize[p]); \
212  const int32_t *map = s->map; \
213  \
214  for (int y = slice_start; y < slice_end; y++) { \
215  for (int x = 0; x < s->planewidth[p]; x++) { \
216  dst[x] = src[map[x]]; \
217  } \
218  \
219  dst += out->linesize[p] / sizeof(type); \
220  src += in->linesize[p] / sizeof(type); \
221  } \
222  } \
223  \
224  return 0; \
225 }
226 
227 SHUFFLE_HORIZONTAL(8, uint8_t)
228 SHUFFLE_HORIZONTAL(16, uint16_t)
229 
230 #define SHUFFLE_VERTICAL(name, type) \
231 static int shuffle_vertical## name(AVFilterContext *ctx, void *arg, \
232  int jobnr, int nb_jobs) \
233 { \
234  ShufflePixelsContext *s = ctx->priv; \
235  ThreadData *td = arg; \
236  AVFrame *in = td->in; \
237  AVFrame *out = td->out; \
238  \
239  for (int p = 0; p < s->nb_planes; p++) { \
240  const int slice_start = (s->planeheight[p] * jobnr) / nb_jobs; \
241  const int slice_end = (s->planeheight[p] * (jobnr+1)) / nb_jobs; \
242  type *dst = (type *)(out->data[p] + slice_start * out->linesize[p]); \
243  const int32_t *map = s->map; \
244  \
245  for (int y = slice_start; y < slice_end; y++) { \
246  const type *src = (const type *)(in->data[p] + \
247  map[y] * in->linesize[p]); \
248  \
249  memcpy(dst, src, s->linesize[p]); \
250  dst += out->linesize[p] / sizeof(type); \
251  } \
252  } \
253  \
254  return 0; \
255 }
256 
257 SHUFFLE_VERTICAL(8, uint8_t)
258 SHUFFLE_VERTICAL(16, uint16_t)
259 
260 #define SHUFFLE_BLOCK(name, type) \
261 static int shuffle_block## name(AVFilterContext *ctx, void *arg, \
262  int jobnr, int nb_jobs) \
263 { \
264  ShufflePixelsContext *s = ctx->priv; \
265  ThreadData *td = arg; \
266  AVFrame *in = td->in; \
267  AVFrame *out = td->out; \
268  \
269  for (int p = 0; p < s->nb_planes; p++) { \
270  const int slice_start = (s->planeheight[p] * jobnr) / nb_jobs; \
271  const int slice_end = (s->planeheight[p] * (jobnr+1)) / nb_jobs; \
272  type *dst = (type *)(out->data[p] + slice_start * out->linesize[p]); \
273  const type *src = (const type *)in->data[p]; \
274  const int32_t *map = s->map + slice_start * s->planewidth[p]; \
275  \
276  for (int y = slice_start; y < slice_end; y++) { \
277  for (int x = 0; x < s->planewidth[p]; x++) { \
278  int ymap = map[x] / s->planewidth[p]; \
279  int xmap = map[x] % s->planewidth[p]; \
280  \
281  dst[x] = src[xmap + ymap * in->linesize[p] / sizeof(type)]; \
282  } \
283  \
284  dst += out->linesize[p] / sizeof(type); \
285  map += s->planewidth[p]; \
286  } \
287  } \
288  \
289  return 0; \
290 }
291 
292 SHUFFLE_BLOCK(8, uint8_t)
293 SHUFFLE_BLOCK(16, uint16_t)
294 
295 static int config_output(AVFilterLink *outlink)
296 {
297  AVFilterContext *ctx = outlink->src;
298  ShufflePixelsContext *s = ctx->priv;
299  AVFilterLink *inlink = ctx->inputs[0];
300  const AVPixFmtDescriptor *desc;
301  int ret;
302 
303  if (s->seed == -1)
304  s->seed = av_get_random_seed();
305  av_lfg_init(&s->c, s->seed);
306 
307  desc = av_pix_fmt_desc_get(outlink->format);
308  if (!desc)
309  return AVERROR_BUG;
310  s->nb_planes = av_pix_fmt_count_planes(outlink->format);
311  s->depth = desc->comp[0].depth;
312 
313  if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
314  return ret;
315 
316  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
317  s->planewidth[0] = s->planewidth[3] = inlink->w;
318 
319  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
320  s->planeheight[0] = s->planeheight[3] = inlink->h;
321 
322  s->map = av_calloc(inlink->w * inlink->h, sizeof(*s->map));
323  if (!s->map)
324  return AVERROR(ENOMEM);
325 
326  switch (s->mode) {
327  case 0:
328  s->shuffle_pixels = s->depth <= 8 ? shuffle_horizontal8 : shuffle_horizontal16;
329  s->nb_blocks = (s->planewidth[0] + s->block_w - 1) / s->block_w;
330  break;
331  case 1:
332  s->shuffle_pixels = s->depth <= 8 ? shuffle_vertical8 : shuffle_vertical16;
333  s->nb_blocks = (s->planeheight[0] + s->block_h - 1) / s->block_h;
334  break;
335  case 2:
336  s->shuffle_pixels = s->depth <= 8 ? shuffle_block8 : shuffle_block16;
337  s->nb_blocks = (s->planeheight[0] / s->block_h) *
338  (s->planewidth[0] / s->block_w);
339  break;
340  default:
341  av_assert0(0);
342  }
343 
344  s->used = av_calloc(s->nb_blocks, sizeof(*s->used));
345  if (!s->used)
346  return AVERROR(ENOMEM);
347 
348  switch (s->mode) {
349  case 0:
351  break;
352  case 1:
354  break;
355  case 2:
357  break;
358  default:
359  av_assert0(0);
360  }
361 
362  return 0;
363 }
364 
366 {
367  AVFilterContext *ctx = inlink->dst;
368  ShufflePixelsContext *s = ctx->priv;
369  AVFrame *out = ff_get_video_buffer(ctx->outputs[0], in->width, in->height);
370  ThreadData td;
371  int ret;
372 
373  if (!out) {
374  ret = AVERROR(ENOMEM);
375  goto fail;
376  }
377 
378  ret = av_frame_copy_props(out, in);
379  if (ret < 0) {
380  av_frame_free(&out);
381  goto fail;
382  }
383 
384  td.out = out;
385  td.in = in;
386  ff_filter_execute(ctx, s->shuffle_pixels, &td, NULL,
387  FFMIN(s->planeheight[1], ff_filter_get_nb_threads(ctx)));
388 
389  av_frame_free(&in);
390  return ff_filter_frame(ctx->outputs[0], out);
391 fail:
392  av_frame_free(&in);
393  return ret;
394 }
395 
397 {
398  ShufflePixelsContext *s = ctx->priv;
399 
400  av_freep(&s->map);
401  av_freep(&s->used);
402 }
403 
404 #define OFFSET(x) offsetof(ShufflePixelsContext, x)
405 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
406 static const AVOption shufflepixels_options[] = {
407  { "direction", "set shuffle direction", OFFSET(direction), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "dir" },
408  { "d", "set shuffle direction", OFFSET(direction), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "dir" },
409  { "forward", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "dir" },
410  { "inverse", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "dir" },
411  { "mode", "set shuffle mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "mode" },
412  { "m", "set shuffle mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 2, FLAGS, "mode" },
413  { "horizontal", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mode" },
414  { "vertical", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mode" },
415  { "block", 0, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "mode" },
416  { "width", "set block width", OFFSET(block_w), AV_OPT_TYPE_INT, {.i64=10}, 1, 8000, FLAGS },
417  { "w", "set block width", OFFSET(block_w), AV_OPT_TYPE_INT, {.i64=10}, 1, 8000, FLAGS },
418  { "height", "set block height", OFFSET(block_h), AV_OPT_TYPE_INT, {.i64=10}, 1, 8000, FLAGS },
419  { "h", "set block height", OFFSET(block_h), AV_OPT_TYPE_INT, {.i64=10}, 1, 8000, FLAGS },
420  { "seed", "set random seed", OFFSET(seed), AV_OPT_TYPE_INT64, {.i64=-1}, -1, UINT_MAX, FLAGS },
421  { "s", "set random seed", OFFSET(seed), AV_OPT_TYPE_INT64, {.i64=-1}, -1, UINT_MAX, FLAGS },
422  { NULL },
423 };
424 
425 AVFILTER_DEFINE_CLASS(shufflepixels);
426 
428  {
429  .name = "default",
430  .type = AVMEDIA_TYPE_VIDEO,
431  .filter_frame = filter_frame,
432  },
433 };
434 
436  {
437  .name = "default",
438  .type = AVMEDIA_TYPE_VIDEO,
439  .config_props = config_output,
440  },
441 };
442 
444  .name = "shufflepixels",
445  .description = NULL_IF_CONFIG_SMALL("Shuffle video pixels."),
446  .priv_size = sizeof(ShufflePixelsContext),
447  .priv_class = &shufflepixels_class,
448  .uninit = uninit,
453 };
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:101
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(shufflepixels)
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:481
td
#define td
Definition: regdef.h:70
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
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
out
FILE * out
Definition: movenc.c:54
av_lfg_init
av_cold void av_lfg_init(AVLFG *c, unsigned int seed)
Definition: lfg.c:32
SHUFFLE_BLOCK
#define SHUFFLE_BLOCK(name, type)
Definition: vf_shufflepixels.c:260
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:969
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2888
ShufflePixelsContext::depth
int depth
Definition: vf_shufflepixels.c:43
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:174
ShufflePixelsContext::used
uint8_t * used
Definition: vf_shufflepixels.c:51
ff_vf_shufflepixels
const AVFilter ff_vf_shufflepixels
Definition: vf_shufflepixels.c:443
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
FLAGS
#define FLAGS
Definition: vf_shufflepixels.c:405
SHUFFLE_HORIZONTAL
#define SHUFFLE_HORIZONTAL(name, type)
Definition: vf_shufflepixels.c:197
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:99
make_horizontal_map
static void make_horizontal_map(AVFilterContext *ctx)
Definition: vf_shufflepixels.c:70
shufflepixels_inputs
static const AVFilterPad shufflepixels_inputs[]
Definition: vf_shufflepixels.c:427
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:330
pixdesc.h
AVFrame::width
int width
Definition: frame.h:402
AVOption
AVOption.
Definition: opt.h:251
ShufflePixelsContext::nb_blocks
int nb_blocks
Definition: vf_shufflepixels.c:49
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:165
ThreadData::out
AVFrame * out
Definition: af_adeclick.c:473
ShufflePixelsContext::planeheight
int planeheight[4]
Definition: vf_shufflepixels.c:47
video.h
ThreadData::in
AVFrame * in
Definition: af_adecorrelate.c:154
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:439
av_get_random_seed
uint32_t av_get_random_seed(void)
Get a seed to use in conjunction with random functions.
Definition: random_seed.c:121
ShufflePixelsContext::block_w
int block_w
Definition: vf_shufflepixels.c:38
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2928
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:477
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
OFFSET
#define OFFSET(x)
Definition: vf_shufflepixels.c:404
ShufflePixelsContext::mode
int mode
Definition: vf_shufflepixels.c:39
fail
#define fail()
Definition: checkasm.h:134
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:475
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:503
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:443
shufflepixels_options
static const AVOption shufflepixels_options[]
Definition: vf_shufflepixels.c:406
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:49
shufflepixels_outputs
static const AVFilterPad shufflepixels_outputs[]
Definition: vf_shufflepixels.c:435
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:462
avassert.h
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:479
width
#define width
av_image_fill_linesizes
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
Definition: imgutils.c:89
s
#define s(width, name)
Definition: cbs_vp9.c:256
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:480
av_lfg_get
static unsigned int av_lfg_get(AVLFG *c)
Get the next random unsigned 32-bit number using an ALFG.
Definition: lfg.h:53
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:472
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:50
lfg.h
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:226
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
ctx
AVFormatContext * ctx
Definition: movenc.c:48
make_vertical_map
static void make_vertical_map(AVFilterContext *ctx)
Definition: vf_shufflepixels.c:108
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:442
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:194
arg
const char * arg
Definition: jacosubdec.c:67
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:440
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:478
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
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:594
ShufflePixelsContext::block_h
int block_h
Definition: vf_shufflepixels.c:38
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:474
seed
static unsigned int seed
Definition: videogen.c:78
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
AVLFG
Context structure for the Lagged Fibonacci PRNG.
Definition: lfg.h:33
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:115
ShufflePixelsContext::map
int32_t * map
Definition: vf_shufflepixels.c:52
ShufflePixelsContext::nb_planes
int nb_planes
Definition: vf_shufflepixels.c:44
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:466
ShufflePixelsContext
Definition: vf_shufflepixels.c:35
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_shufflepixels.c:396
height
#define height
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:167
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:498
internal.h
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:142
ShufflePixelsContext::c
AVLFG c
Definition: vf_shufflepixels.c:54
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
internal.h
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:476
common.h
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:777
ShufflePixelsContext::linesize
int linesize[4]
Definition: vf_shufflepixels.c:45
ThreadData
Used for passing data between threads.
Definition: dsddec.c:69
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:55
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:262
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:458
ShufflePixelsContext::planewidth
int planewidth[4]
Definition: vf_shufflepixels.c:46
AVFilter
Filter definition.
Definition: avfilter.h:161
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:495
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_shufflepixels.c:59
AVFrame::height
int height
Definition: frame.h:402
random_seed.h
mode
mode
Definition: ebur128.h:83
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
avfilter.h
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_shufflepixels.c:295
ShufflePixelsContext::shuffle_pixels
int(* shuffle_pixels)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_shufflepixels.c:56
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:71
AVFilterContext
An instance of a filter.
Definition: avfilter.h:392
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:158
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:117
desc
const char * desc
Definition: libsvtav1.c:83
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
ShufflePixelsContext::seed
int64_t seed
Definition: vf_shufflepixels.c:41
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:71
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:195
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
int32_t
int32_t
Definition: audioconvert.c:56
imgutils.h
ShufflePixelsContext::direction
int direction
Definition: vf_shufflepixels.c:40
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
SHUFFLE_VERTICAL
#define SHUFFLE_VERTICAL(name, type)
Definition: vf_shufflepixels.c:230
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_shufflepixels.c:365
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:469
avstring.h
make_block_map
static void make_block_map(AVFilterContext *ctx)
Definition: vf_shufflepixels.c:146
ff_filter_execute
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: internal.h:146
int
int
Definition: ffmpeg_filter.c:156
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234