FFmpeg
vf_chromashift.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 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/avstring.h"
22 #include "libavutil/eval.h"
23 #include "libavutil/imgutils.h"
24 #include "libavutil/intreadwrite.h"
25 #include "libavutil/opt.h"
26 #include "libavutil/pixdesc.h"
27 
28 #include "avfilter.h"
29 #include "formats.h"
30 #include "internal.h"
31 #include "video.h"
32 
33 typedef struct ChromaShiftContext {
34  const AVClass *class;
35  int cbh, cbv;
36  int crh, crv;
37  int rh, rv;
38  int gh, gv;
39  int bh, bv;
40  int ah, av;
41  int edge;
42 
43  int nb_planes;
44  int depth;
45  int height[4];
46  int width[4];
47  int linesize[4];
48 
50 
52  int (*filter_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
54 
55 #define DEFINE_SMEAR(depth, type, div) \
56 static int smear_slice ## depth(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
57 { \
58  ChromaShiftContext *s = ctx->priv; \
59  AVFrame *in = s->in; \
60  AVFrame *out = arg; \
61  const int sulinesize = in->linesize[1] / div; \
62  const int svlinesize = in->linesize[2] / div; \
63  const int ulinesize = out->linesize[1] / div; \
64  const int vlinesize = out->linesize[2] / div; \
65  const int cbh = s->cbh; \
66  const int cbv = s->cbv; \
67  const int crh = s->crh; \
68  const int crv = s->crv; \
69  const int h = s->height[1]; \
70  const int w = s->width[1]; \
71  const int slice_start = (h * jobnr) / nb_jobs; \
72  const int slice_end = (h * (jobnr+1)) / nb_jobs; \
73  const type *su = (const type *)in->data[1]; \
74  const type *sv = (const type *)in->data[2]; \
75  type *du = (type *)out->data[1] + slice_start * ulinesize; \
76  type *dv = (type *)out->data[2] + slice_start * vlinesize; \
77  \
78  for (int y = slice_start; y < slice_end; y++) { \
79  const int duy = av_clip(y - cbv, 0, h-1) * sulinesize; \
80  const int dvy = av_clip(y - crv, 0, h-1) * svlinesize; \
81  \
82  for (int x = 0; x < w; x++) { \
83  du[x] = su[av_clip(x - cbh, 0, w - 1) + duy]; \
84  dv[x] = sv[av_clip(x - crh, 0, w - 1) + dvy]; \
85  } \
86  \
87  du += ulinesize; \
88  dv += vlinesize; \
89  } \
90  \
91  return 0; \
92 }
93 
94 DEFINE_SMEAR(8, uint8_t, 1)
95 DEFINE_SMEAR(16, uint16_t, 2)
96 
97 #define DEFINE_WRAP(depth, type, div) \
98 static int wrap_slice ## depth(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
99 { \
100  ChromaShiftContext *s = ctx->priv; \
101  AVFrame *in = s->in; \
102  AVFrame *out = arg; \
103  const int sulinesize = in->linesize[1] / div; \
104  const int svlinesize = in->linesize[2] / div; \
105  const int ulinesize = out->linesize[1] / div; \
106  const int vlinesize = out->linesize[2] / div; \
107  const int cbh = s->cbh; \
108  const int cbv = s->cbv; \
109  const int crh = s->crh; \
110  const int crv = s->crv; \
111  const int h = s->height[1]; \
112  const int w = s->width[1]; \
113  const int slice_start = (h * jobnr) / nb_jobs; \
114  const int slice_end = (h * (jobnr+1)) / nb_jobs; \
115  const type *su = (const type *)in->data[1]; \
116  const type *sv = (const type *)in->data[2]; \
117  type *du = (type *)out->data[1] + slice_start * ulinesize; \
118  type *dv = (type *)out->data[2] + slice_start * vlinesize; \
119  \
120  for (int y = slice_start; y < slice_end; y++) { \
121  int uy = (y - cbv) % h; \
122  int vy = (y - crv) % h; \
123  \
124  if (uy < 0) \
125  uy += h; \
126  if (vy < 0) \
127  vy += h; \
128  \
129  for (int x = 0; x < w; x++) { \
130  int ux = (x - cbh) % w; \
131  int vx = (x - crh) % w; \
132  \
133  if (ux < 0) \
134  ux += w; \
135  if (vx < 0) \
136  vx += w; \
137  \
138  du[x] = su[ux + uy * sulinesize]; \
139  dv[x] = sv[vx + vy * svlinesize]; \
140  } \
141  \
142  du += ulinesize; \
143  dv += vlinesize; \
144  } \
145  \
146  return 0; \
147 }
148 
149 DEFINE_WRAP(8, uint8_t, 1)
150 DEFINE_WRAP(16, uint16_t, 2)
151 
152 #define DEFINE_RGBASMEAR(depth, type, div) \
153 static int rgbasmear_slice ## depth(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
154 { \
155  ChromaShiftContext *s = ctx->priv; \
156  AVFrame *in = s->in; \
157  AVFrame *out = arg; \
158  const int srlinesize = in->linesize[2] / div; \
159  const int sglinesize = in->linesize[0] / div; \
160  const int sblinesize = in->linesize[1] / div; \
161  const int salinesize = in->linesize[3] / div; \
162  const int rlinesize = out->linesize[2] / div; \
163  const int glinesize = out->linesize[0] / div; \
164  const int blinesize = out->linesize[1] / div; \
165  const int alinesize = out->linesize[3] / div; \
166  const int rh = s->rh; \
167  const int rv = s->rv; \
168  const int gh = s->gh; \
169  const int gv = s->gv; \
170  const int bh = s->bh; \
171  const int bv = s->bv; \
172  const int ah = s->ah; \
173  const int av = s->av; \
174  const int h = s->height[1]; \
175  const int w = s->width[1]; \
176  const int slice_start = (h * jobnr) / nb_jobs; \
177  const int slice_end = (h * (jobnr+1)) / nb_jobs; \
178  const type *sr = (const type *)in->data[2]; \
179  const type *sg = (const type *)in->data[0]; \
180  const type *sb = (const type *)in->data[1]; \
181  const type *sa = (const type *)in->data[3]; \
182  type *dr = (type *)out->data[2] + slice_start * rlinesize; \
183  type *dg = (type *)out->data[0] + slice_start * glinesize; \
184  type *db = (type *)out->data[1] + slice_start * blinesize; \
185  type *da = (type *)out->data[3] + slice_start * alinesize; \
186  \
187  for (int y = slice_start; y < slice_end; y++) { \
188  const int ry = av_clip(y - rv, 0, h-1) * srlinesize; \
189  const int gy = av_clip(y - gv, 0, h-1) * sglinesize; \
190  const int by = av_clip(y - bv, 0, h-1) * sblinesize; \
191  int ay; \
192  \
193  for (int x = 0; x < w; x++) { \
194  dr[x] = sr[av_clip(x - rh, 0, w - 1) + ry]; \
195  dg[x] = sg[av_clip(x - gh, 0, w - 1) + gy]; \
196  db[x] = sb[av_clip(x - bh, 0, w - 1) + by]; \
197  } \
198  \
199  dr += rlinesize; \
200  dg += glinesize; \
201  db += blinesize; \
202  \
203  if (s->nb_planes < 4) \
204  continue; \
205  ay = av_clip(y - av, 0, h-1) * salinesize; \
206  for (int x = 0; x < w; x++) { \
207  da[x] = sa[av_clip(x - ah, 0, w - 1) + ay]; \
208  } \
209  \
210  da += alinesize; \
211  } \
212  \
213  return 0; \
214 }
215 
216 DEFINE_RGBASMEAR(8, uint8_t, 1)
217 DEFINE_RGBASMEAR(16, uint16_t, 2)
218 
219 #define DEFINE_RGBAWRAP(depth, type, div) \
220 static int rgbawrap_slice ## depth(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) \
221 { \
222  ChromaShiftContext *s = ctx->priv; \
223  AVFrame *in = s->in; \
224  AVFrame *out = arg; \
225  const int srlinesize = in->linesize[2] / div; \
226  const int sglinesize = in->linesize[0] / div; \
227  const int sblinesize = in->linesize[1] / div; \
228  const int salinesize = in->linesize[3] / div; \
229  const int rlinesize = out->linesize[2] / div; \
230  const int glinesize = out->linesize[0] / div; \
231  const int blinesize = out->linesize[1] / div; \
232  const int alinesize = out->linesize[3] / div; \
233  const int rh = s->rh; \
234  const int rv = s->rv; \
235  const int gh = s->gh; \
236  const int gv = s->gv; \
237  const int bh = s->bh; \
238  const int bv = s->bv; \
239  const int ah = s->ah; \
240  const int av = s->av; \
241  const int h = s->height[1]; \
242  const int w = s->width[1]; \
243  const int slice_start = (h * jobnr) / nb_jobs; \
244  const int slice_end = (h * (jobnr+1)) / nb_jobs; \
245  const type *sr = (const type *)in->data[2]; \
246  const type *sg = (const type *)in->data[0]; \
247  const type *sb = (const type *)in->data[1]; \
248  const type *sa = (const type *)in->data[3]; \
249  type *dr = (type *)out->data[2] + slice_start * rlinesize; \
250  type *dg = (type *)out->data[0] + slice_start * glinesize; \
251  type *db = (type *)out->data[1] + slice_start * blinesize; \
252  type *da = (type *)out->data[3] + slice_start * alinesize; \
253  \
254  for (int y = slice_start; y < slice_end; y++) { \
255  int ry = (y - rv) % h; \
256  int gy = (y - gv) % h; \
257  int by = (y - bv) % h; \
258  \
259  if (ry < 0) \
260  ry += h; \
261  if (gy < 0) \
262  gy += h; \
263  if (by < 0) \
264  by += h; \
265  \
266  for (int x = 0; x < w; x++) { \
267  int rx = (x - rh) % w; \
268  int gx = (x - gh) % w; \
269  int bx = (x - bh) % w; \
270  \
271  if (rx < 0) \
272  rx += w; \
273  if (gx < 0) \
274  gx += w; \
275  if (bx < 0) \
276  bx += w; \
277  dr[x] = sr[rx + ry * srlinesize]; \
278  dg[x] = sg[gx + gy * sglinesize]; \
279  db[x] = sb[bx + by * sblinesize]; \
280  } \
281  \
282  dr += rlinesize; \
283  dg += glinesize; \
284  db += blinesize; \
285  \
286  if (s->nb_planes < 4) \
287  continue; \
288  for (int x = 0; x < w; x++) { \
289  int ax = (x - ah) % w; \
290  int ay = (x - av) % h; \
291  \
292  if (ax < 0) \
293  ax += w; \
294  if (ay < 0) \
295  ay += h; \
296  da[x] = sa[ax + ay * salinesize]; \
297  } \
298  \
299  da += alinesize; \
300  } \
301  \
302  return 0; \
303 }
304 
305 DEFINE_RGBAWRAP(8, uint8_t, 1)
306 DEFINE_RGBAWRAP(16, uint16_t, 2)
307 
309 {
310  AVFilterContext *ctx = inlink->dst;
311  AVFilterLink *outlink = ctx->outputs[0];
312  ChromaShiftContext *s = ctx->priv;
313  AVFrame *out;
314 
315  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
316  if (!out) {
317  av_frame_free(&in);
318  return AVERROR(ENOMEM);
319  }
321 
322  s->in = in;
323  if (!s->is_rgbashift) {
324  av_image_copy_plane(out->data[0],
325  out->linesize[0],
326  in->data[0], in->linesize[0],
327  s->linesize[0], s->height[0]);
328  }
329  ff_filter_execute(ctx, s->filter_slice, out, NULL,
330  FFMIN3(s->height[1],
331  s->height[2],
333  s->in = NULL;
334  av_frame_free(&in);
335  return ff_filter_frame(outlink, out);
336 }
337 
339 {
340  AVFilterContext *ctx = inlink->dst;
341  ChromaShiftContext *s = ctx->priv;
343 
344  s->is_rgbashift = !strcmp(ctx->filter->name, "rgbashift");
345  s->depth = desc->comp[0].depth;
346  s->nb_planes = desc->nb_components;
347  if (s->is_rgbashift) {
348  if (s->edge)
349  s->filter_slice = s->depth > 8 ? rgbawrap_slice16 : rgbawrap_slice8;
350  else
351  s->filter_slice = s->depth > 8 ? rgbasmear_slice16 : rgbasmear_slice8;
352  } else {
353  if (s->edge)
354  s->filter_slice = s->depth > 8 ? wrap_slice16 : wrap_slice8;
355  else
356  s->filter_slice = s->depth > 8 ? smear_slice16 : smear_slice8;
357  }
358  s->height[1] = s->height[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
359  s->height[0] = s->height[3] = inlink->h;
360  s->width[1] = s->width[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
361  s->width[0] = s->width[3] = inlink->w;
362 
363  return av_image_fill_linesizes(s->linesize, inlink->format, inlink->w);
364 }
365 
366 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
367  char *res, int res_len, int flags)
368 {
369  int ret;
370 
371  ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
372  if (ret < 0)
373  return ret;
374 
375  return config_input(ctx->inputs[0]);
376 }
377 
378 #define OFFSET(x) offsetof(ChromaShiftContext, x)
379 #define VFR AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
380 
381 static const AVOption chromashift_options[] = {
382  { "cbh", "shift chroma-blue horizontally", OFFSET(cbh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
383  { "cbv", "shift chroma-blue vertically", OFFSET(cbv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
384  { "crh", "shift chroma-red horizontally", OFFSET(crh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
385  { "crv", "shift chroma-red vertically", OFFSET(crv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
386  { "edge", "set edge operation", OFFSET(edge), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = VFR, "edge" },
387  { "smear", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = VFR, "edge" },
388  { "wrap", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = VFR, "edge" },
389  { NULL },
390 };
391 
392 static const AVFilterPad inputs[] = {
393  {
394  .name = "default",
395  .type = AVMEDIA_TYPE_VIDEO,
396  .filter_frame = filter_frame,
397  .config_props = config_input,
398  },
399 };
400 
401 static const AVFilterPad outputs[] = {
402  {
403  .name = "default",
404  .type = AVMEDIA_TYPE_VIDEO,
405  },
406 };
407 
408 static const enum AVPixelFormat yuv_pix_fmts[] = {
421 };
422 
423 AVFILTER_DEFINE_CLASS(chromashift);
424 
426  .name = "chromashift",
427  .description = NULL_IF_CONFIG_SMALL("Shift chroma."),
428  .priv_size = sizeof(ChromaShiftContext),
429  .priv_class = &chromashift_class,
434  .process_command = process_command,
435 };
436 
437 static const enum AVPixelFormat rgb_pix_fmts[] = {
443 };
444 
445 static const AVOption rgbashift_options[] = {
446  { "rh", "shift red horizontally", OFFSET(rh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
447  { "rv", "shift red vertically", OFFSET(rv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
448  { "gh", "shift green horizontally", OFFSET(gh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
449  { "gv", "shift green vertically", OFFSET(gv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
450  { "bh", "shift blue horizontally", OFFSET(bh), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
451  { "bv", "shift blue vertically", OFFSET(bv), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
452  { "ah", "shift alpha horizontally", OFFSET(ah), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
453  { "av", "shift alpha vertically", OFFSET(av), AV_OPT_TYPE_INT, {.i64=0}, -255, 255, .flags = VFR },
454  { "edge", "set edge operation", OFFSET(edge), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, .flags = VFR, "edge" },
455  { "smear", 0, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = VFR, "edge" },
456  { "wrap", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = VFR, "edge" },
457  { NULL },
458 };
459 
460 AVFILTER_DEFINE_CLASS(rgbashift);
461 
463  .name = "rgbashift",
464  .description = NULL_IF_CONFIG_SMALL("Shift RGBA."),
465  .priv_size = sizeof(ChromaShiftContext),
466  .priv_class = &rgbashift_class,
471  .process_command = process_command,
472 };
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:98
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:447
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:426
ChromaShiftContext
Definition: vf_chromashift.c:33
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_chromashift.c:366
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
ChromaShiftContext::in
AVFrame * in
Definition: vf_chromashift.c:49
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1018
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2660
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:171
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
yuv_pix_fmts
static enum AVPixelFormat yuv_pix_fmts[]
Definition: vf_chromashift.c:408
DEFINE_SMEAR
#define DEFINE_SMEAR(depth, type, div)
Definition: vf_chromashift.c:55
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:109
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:317
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:446
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_chromashift.c:338
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:441
AVOption
AVOption.
Definition: opt.h:247
ChromaShiftContext::height
int height[4]
Definition: vf_chromashift.c:45
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:404
ff_vf_chromashift
const AVFilter ff_vf_chromashift
Definition: vf_chromashift.c:425
ChromaShiftContext::nb_planes
int nb_planes
Definition: vf_chromashift.c:43
ff_vf_rgbashift
const AVFilter ff_vf_rgbashift
Definition: vf_chromashift.c:462
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
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:169
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:442
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
formats.h
ChromaShiftContext::rh
int rh
Definition: vf_chromashift.c:37
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:422
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:205
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:420
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:448
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:402
ChromaShiftContext::crv
int crv
Definition: vf_chromashift.c:36
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
ChromaShiftContext::bv
int bv
Definition: vf_chromashift.c:39
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:407
DEFINE_WRAP
#define DEFINE_WRAP(depth, type, div)
Definition: vf_chromashift.c:97
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:248
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(chromashift)
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:416
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:424
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
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:425
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:417
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:51
ChromaShiftContext::width
int width[4]
Definition: vf_chromashift.c:46
ChromaShiftContext::linesize
int linesize[4]
Definition: vf_chromashift.c:47
ChromaShiftContext::ah
int ah
Definition: vf_chromashift.c:40
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:445
ChromaShiftContext::av
int av
Definition: vf_chromashift.c:40
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:401
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:415
ctx
AVFormatContext * ctx
Definition: movenc.c:48
DEFINE_RGBAWRAP
#define DEFINE_RGBAWRAP(depth, type, div)
Definition: vf_chromashift.c:219
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
ChromaShiftContext::cbv
int cbv
Definition: vf_chromashift.c:35
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
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
ChromaShiftContext::bh
int bh
Definition: vf_chromashift.c:39
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:423
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:537
rgbashift_options
static const AVOption rgbashift_options[]
Definition: vf_chromashift.c:445
ChromaShiftContext::gh
int gh
Definition: vf_chromashift.c:38
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
ChromaShiftContext::filter_slice
int(* filter_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_chromashift.c:52
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:406
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:405
DEFINE_RGBASMEAR
#define DEFINE_RGBASMEAR(depth, type, div)
Definition: vf_chromashift.c:152
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:419
OFFSET
#define OFFSET(x)
Definition: vf_chromashift.c:378
eval.h
rgb_pix_fmts
static enum AVPixelFormat rgb_pix_fmts[]
Definition: vf_chromashift.c:437
inputs
static const AVFilterPad inputs[]
Definition: vf_chromashift.c:392
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:117
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:409
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:411
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:882
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:443
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:146
FFMIN3
#define FFMIN3(a, b, c)
Definition: macros.h:50
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:421
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:803
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:56
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:403
ChromaShiftContext::cbh
int cbh
Definition: vf_chromashift.c:35
ChromaShiftContext::is_rgbashift
int is_rgbashift
Definition: vf_chromashift.c:51
chromashift_options
static const AVOption chromashift_options[]
Definition: vf_chromashift.c:381
ChromaShiftContext::gv
int gv
Definition: vf_chromashift.c:38
AVFilter
Filter definition.
Definition: avfilter.h:165
ret
ret
Definition: filter_design.txt:187
VFR
#define VFR
Definition: vf_chromashift.c:379
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:408
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:413
ChromaShiftContext::crh
int crh
Definition: vf_chromashift.c:36
ChromaShiftContext::depth
int depth
Definition: vf_chromashift.c:44
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:444
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
avfilter.h
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_chromashift.c:308
ChromaShiftContext::edge
int edge
Definition: vf_chromashift.c:41
ChromaShiftContext::rv
int rv
Definition: vf_chromashift.c:37
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:402
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:121
desc
const char * desc
Definition: libsvtav1.c:79
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:192
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
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
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:410
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:414
avstring.h
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:143
int
int
Definition: ffmpeg_filter.c:153
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
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:412
outputs
static const AVFilterPad outputs[]
Definition: vf_chromashift.c:401