FFmpeg
vf_pixelize.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 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/common.h"
22 #include "libavutil/internal.h"
23 #include "libavutil/imgutils.h"
24 #include "libavutil/opt.h"
25 
26 #include "avfilter.h"
27 #include "internal.h"
28 #include "video.h"
29 
35 };
36 
37 typedef struct PixelizeContext {
38  const AVClass *class;
39 
40  int block_w[4], block_h[4];
41  int mode;
42 
43  int depth;
44  int planes;
45  int nb_planes;
46  int linesize[4];
47  int planewidth[4];
48  int planeheight[4];
49 
52 
53  int (*pixelize[PIXELIZE_MODES])(const uint8_t *src, uint8_t *dst,
54  ptrdiff_t src_linesize,
55  ptrdiff_t dst_linesize,
56  int w, int h);
58 
59 static const enum AVPixelFormat pix_fmts[] = {
87 };
88 
89 typedef struct ThreadData {
90  AVFrame *in, *out;
91 } ThreadData;
92 
93 #define PIXELIZE_AVG(name, type, stype) \
94 static int pixelize_avg##name(const uint8_t *ssrc, uint8_t *ddst, \
95  ptrdiff_t src_linesize, ptrdiff_t dst_linesize, \
96  int w, int h) \
97 { \
98  const type *src = (const type *)ssrc; \
99  type *dst = (type *)ddst; \
100  stype sum = 0; \
101  type fill; \
102  for (int y = 0; y < h; y++) { \
103  for (int x = 0; x < w; x++) \
104  sum += src[x]; \
105  \
106  src += src_linesize / sizeof(type); \
107  } \
108  \
109  fill = sum / (w * h); \
110  \
111  for (int y = 0; y < h; y++) { \
112  for (int x = 0; x < w; x++) \
113  dst[x] = fill; \
114  \
115  dst += dst_linesize / sizeof(type); \
116  } \
117  \
118  return 0; \
119 }
120 
121 #define PIXELIZE_MIN(name, type, stype) \
122 static int pixelize_min##name(const uint8_t *ssrc, uint8_t *ddst, \
123  ptrdiff_t src_linesize, ptrdiff_t dst_linesize, \
124  int w, int h) \
125 { \
126  const type *src = (const type *)ssrc; \
127  type *dst = (type *)ddst; \
128  type fill = src[0]; \
129  \
130  for (int y = 0; y < h; y++) { \
131  for (int x = 0; x < w; x++) \
132  fill = FFMIN(src[x], fill); \
133  \
134  src += src_linesize / sizeof(type); \
135  } \
136  \
137  for (int y = 0; y < h; y++) { \
138  for (int x = 0; x < w; x++) \
139  dst[x] = fill; \
140  \
141  dst += dst_linesize / sizeof(type); \
142  } \
143  \
144  return 0; \
145 }
146 
147 #define PIXELIZE_MAX(name, type, stype) \
148 static int pixelize_max##name(const uint8_t *ssrc, uint8_t *ddst, \
149  ptrdiff_t src_linesize, ptrdiff_t dst_linesize, \
150  int w, int h) \
151 { \
152  const type *src = (const type *)ssrc; \
153  type *dst = (type *)ddst; \
154  type fill = src[0]; \
155  \
156  for (int y = 0; y < h; y++) { \
157  for (int x = 0; x < w; x++) \
158  fill = FFMAX(src[x], fill); \
159  \
160  src += src_linesize / sizeof(type); \
161  } \
162  \
163  for (int y = 0; y < h; y++) { \
164  for (int x = 0; x < w; x++) \
165  dst[x] = fill; \
166  \
167  dst += dst_linesize / sizeof(type); \
168  } \
169  \
170  return 0; \
171 }
172 
173 PIXELIZE_AVG(8, uint8_t, unsigned)
174 PIXELIZE_AVG(16, uint16_t, uint64_t)
175 PIXELIZE_MIN(8, uint8_t, unsigned)
176 PIXELIZE_MIN(16, uint16_t, uint64_t)
177 PIXELIZE_MAX(8, uint8_t, unsigned)
178 PIXELIZE_MAX(16, uint16_t, uint64_t)
179 
180 static int pixelize_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
181 {
182  PixelizeContext *s = ctx->priv;
183  const int mode = s->mode;
184  ThreadData *td = arg;
185  AVFrame *out = td->out;
186  AVFrame *in = td->in;
187 
188  for (int p = 0; p < s->nb_planes; p++) {
189  const int wh = s->planeheight[p];
190  const int h = (s->planeheight[p] + s->block_h[p] - 1) / s->block_h[p];
191  const int w = (s->planewidth[p] + s->block_w[p] - 1) / s->block_w[p];
192  const int wslice_start = (wh * jobnr) / nb_jobs;
193  const int wslice_end = (wh * (jobnr+1)) / nb_jobs;
194  const int slice_start = (h * jobnr) / nb_jobs;
195  const int slice_end = (h * (jobnr+1)) / nb_jobs;
196  const ptrdiff_t out_linesize = out->linesize[p];
197  const ptrdiff_t in_linesize = in->linesize[p];
198  const uint8_t *src = in->data[p];
199  uint8_t *dst = out->data[p];
200 
201  if (!((1 << p) & s->planes)) {
202  av_image_copy_plane(dst + wslice_start * out_linesize,
203  out_linesize,
204  src + wslice_start * in_linesize,
205  in_linesize,
206  s->linesize[p], wslice_end - wslice_start);
207  continue;
208  }
209 
210  for (int y = slice_start; y < slice_end; y++) {
211  const int block_h = FFMIN(s->block_h[p], s->planeheight[p] - y * s->block_h[p]);
212  for (int x = 0; x < w; x++) {
213  const int block_w = FFMIN(s->block_w[p], s->planewidth[p] - x * s->block_w[p]);
214 
215  s->pixelize[mode](src + s->block_h[p] * y * in_linesize +
216  x * s->block_w[p] * (1 + (s->depth > 8)),
217  dst + s->block_h[p] * y * out_linesize +
218  x * s->block_w[p] * (1 + (s->depth > 8)),
219  in_linesize, out_linesize, block_w, block_h);
220  }
221  }
222  }
223 
224  return 0;
225 }
226 
227 static int config_output(AVFilterLink *outlink)
228 {
229  AVFilterContext *ctx = outlink->src;
230  PixelizeContext *s = ctx->priv;
231  AVFilterLink *inlink = ctx->inputs[0];
232  const AVPixFmtDescriptor *desc;
233  int ret;
234 
235  desc = av_pix_fmt_desc_get(outlink->format);
236  if (!desc)
237  return AVERROR_BUG;
238  s->nb_planes = av_pix_fmt_count_planes(outlink->format);
239  s->depth = desc->comp[0].depth;
240 
241  if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
242  return ret;
243 
244  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
245  s->planewidth[0] = s->planewidth[3] = inlink->w;
246 
247  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
248  s->planeheight[0] = s->planeheight[3] = inlink->h;
249 
250  s->log2_chroma_w = desc->log2_chroma_w;
251  s->log2_chroma_h = desc->log2_chroma_h;
252 
253  s->pixelize[PIXELIZE_AVG] = s->depth <= 8 ? pixelize_avg8 : pixelize_avg16;
254  s->pixelize[PIXELIZE_MIN] = s->depth <= 8 ? pixelize_min8 : pixelize_min16;
255  s->pixelize[PIXELIZE_MAX] = s->depth <= 8 ? pixelize_max8 : pixelize_max16;
256 
257  return 0;
258 }
259 
261 {
262  AVFilterContext *ctx = inlink->dst;
263  AVFilterLink *outlink = ctx->outputs[0];
264  PixelizeContext *s = ctx->priv;
265  ThreadData td;
266  AVFrame *out;
267  int ret;
268 
269  s->block_w[1] = s->block_w[2] = FFMAX(1, s->block_w[0] >> s->log2_chroma_w);
270  s->block_w[3] = s->block_w[0] = s->block_w[1] << s->log2_chroma_w;
271 
272  s->block_h[1] = s->block_h[2] = FFMAX(1, s->block_h[0] >> s->log2_chroma_h);
273  s->block_h[3] = s->block_h[0] = s->block_h[1] << s->log2_chroma_h;
274 
275  if (av_frame_is_writable(in)) {
276  out = in;
277  } else {
278  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
279  if (!out) {
280  ret = AVERROR(ENOMEM);
281  goto fail;
282  }
283 
284  ret = av_frame_copy_props(out, in);
285  if (ret < 0) {
286  av_frame_free(&out);
287  goto fail;
288  }
289  }
290 
291  td.out = out;
292  td.in = in;
294  FFMIN((s->planeheight[1] + s->block_h[1] - 1) / s->block_h[1],
296 
297  if (out != in)
298  av_frame_free(&in);
299  return ff_filter_frame(outlink, out);
300 fail:
301  av_frame_free(&in);
302  return ret;
303 }
304 
305 #define OFFSET(x) offsetof(PixelizeContext, x)
306 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_RUNTIME_PARAM)
307 
308 static const AVOption pixelize_options[] = {
309  { "width", "set block width", OFFSET(block_w[0]), AV_OPT_TYPE_INT, {.i64=16}, 1, 1024, FLAGS },
310  { "w", "set block width", OFFSET(block_w[0]), AV_OPT_TYPE_INT, {.i64=16}, 1, 1024, FLAGS },
311  { "height", "set block height", OFFSET(block_h[0]), AV_OPT_TYPE_INT, {.i64=16}, 1, 1024, FLAGS },
312  { "h", "set block height", OFFSET(block_h[0]), AV_OPT_TYPE_INT, {.i64=16}, 1, 1024, FLAGS },
313  { "mode", "set the pixelize mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, PIXELIZE_MODES-1, FLAGS, "mode" },
314  { "m", "set the pixelize mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=0}, 0, PIXELIZE_MODES-1, FLAGS, "mode" },
315  { "avg", "average", 0, AV_OPT_TYPE_CONST, {.i64=PIXELIZE_AVG}, 0, 0, FLAGS, "mode" },
316  { "min", "minimum", 0, AV_OPT_TYPE_CONST, {.i64=PIXELIZE_MIN}, 0, 0, FLAGS, "mode" },
317  { "max", "maximum", 0, AV_OPT_TYPE_CONST, {.i64=PIXELIZE_MAX}, 0, 0, FLAGS, "mode" },
318  { "planes", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=15}, 0, 15, FLAGS },
319  { "p", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=15}, 0, 15, FLAGS },
320  { NULL },
321 };
322 
323 AVFILTER_DEFINE_CLASS(pixelize);
324 
325 static const AVFilterPad pixelize_inputs[] = {
326  {
327  .name = "default",
328  .type = AVMEDIA_TYPE_VIDEO,
329  .filter_frame = filter_frame,
330  },
331 };
332 
333 static const AVFilterPad pixelize_outputs[] = {
334  {
335  .name = "default",
336  .type = AVMEDIA_TYPE_VIDEO,
337  .config_props = config_output,
338  },
339 };
340 
342  .name = "pixelize",
343  .description = NULL_IF_CONFIG_SMALL("Pixelize video."),
344  .priv_size = sizeof(PixelizeContext),
345  .priv_class = &pixelize_class,
350  .process_command = ff_filter_process_command,
351 };
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
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:502
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
pixelize_slice
static int pixelize_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_pixelize.c:180
out
FILE * out
Definition: movenc.c:54
PixelizeContext::planewidth
int planewidth[4]
Definition: vf_pixelize.c:47
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1009
PixelizeContext::log2_chroma_w
int log2_chroma_w
Definition: vf_pixelize.c:50
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2888
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:170
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:116
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:494
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:501
w
uint8_t w
Definition: llviddspenc.c:38
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:496
AVOption
AVOption.
Definition: opt.h:251
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:459
PIXELIZE_MIN
#define PIXELIZE_MIN(name, type, stype)
Definition: vf_pixelize.c:121
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:175
ThreadData::out
AVFrame * out
Definition: af_adeclick.c:473
video.h
ThreadData::in
AVFrame * in
Definition: af_adecorrelate.c:154
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:497
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:439
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:346
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
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2928
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:493
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_pixelize.c:59
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
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_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:457
PIXELIZE_MAX
#define PIXELIZE_MAX(name, type, stype)
Definition: vf_pixelize.c:147
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:443
PixelizeContext::depth
int depth
Definition: vf_pixelize.c:43
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:49
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:462
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:276
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(pixelize)
pixelize_inputs
static const AVFilterPad pixelize_inputs[]
Definition: vf_pixelize.c:325
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:471
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:79
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:479
PixelizeContext::pixelize
int(* pixelize[PIXELIZE_MODES])(const uint8_t *src, uint8_t *dst, ptrdiff_t src_linesize, ptrdiff_t dst_linesize, int w, int h)
Definition: vf_pixelize.c:53
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_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:101
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
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_pixelize.c:227
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2010
PixelizeContext::mode
int mode
Definition: vf_pixelize.c:41
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:500
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:456
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:470
ctx
AVFormatContext * ctx
Definition: movenc.c:48
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:442
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:66
planes
static const struct @345 planes[]
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:190
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:80
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
FLAGS
#define FLAGS
Definition: vf_pixelize.c:306
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:603
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:78
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:461
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:460
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
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
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:464
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:466
av_frame_is_writable
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Definition: frame.c:533
PixelizeContext::block_w
int block_w[4]
Definition: vf_pixelize.c:40
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:873
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
ff_vf_pixelize
const AVFilter ff_vf_pixelize
Definition: vf_pixelize.c:341
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:152
PixelizeContext::linesize
int linesize[4]
Definition: vf_pixelize.c:46
pixelize_outputs
static const AVFilterPad pixelize_outputs[]
Definition: vf_pixelize.c:333
PixelizeContext::block_h
int block_h[4]
Definition: vf_pixelize.c:40
PIXELIZE_MODES
@ PIXELIZE_MODES
Definition: vf_pixelize.c:34
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:793
ThreadData
Used for passing data between threads.
Definition: dsddec.c:69
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
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:100
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:55
PixelizeContext::nb_planes
int nb_planes
Definition: vf_pixelize.c:45
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:458
PixelizeContext
Definition: vf_pixelize.c:37
AVFilter
Filter definition.
Definition: avfilter.h:171
ret
ret
Definition: filter_design.txt:187
PixelizeContext::log2_chroma_h
int log2_chroma_h
Definition: vf_pixelize.c:51
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:495
pixelize_options
static const AVOption pixelize_options[]
Definition: vf_pixelize.c:308
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:463
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:468
mode
mode
Definition: ebur128.h:83
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:499
PixelizeModes
PixelizeModes
Definition: vf_pixelize.c:30
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
avfilter.h
PixelizeContext::planeheight
int planeheight[4]
Definition: vf_pixelize.c:48
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:415
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:127
desc
const char * desc
Definition: libsvtav1.c:83
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
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:70
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:191
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
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:73
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:224
PIXELIZE_AVG
#define PIXELIZE_AVG(name, type, stype)
Definition: vf_pixelize.c:93
imgutils.h
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
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:370
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:72
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:465
h
h
Definition: vp9dsp_template.c:2038
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:469
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:441
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:142
int
int
Definition: ffmpeg_filter.c:156
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_pixelize.c:260
PixelizeContext::planes
int planes
Definition: vf_pixelize.c:44
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:166
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:467
OFFSET
#define OFFSET(x)
Definition: vf_pixelize.c:305