FFmpeg
vf_monochrome.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 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 <float.h>
22 
23 #include "libavutil/opt.h"
24 #include "libavutil/imgutils.h"
25 #include "avfilter.h"
26 #include "formats.h"
27 #include "internal.h"
28 #include "video.h"
29 
30 typedef struct MonochromeContext {
31  const AVClass *class;
32 
33  float b, r;
34  float size;
35  float high;
36 
37  int depth;
38  int subw, subh;
39 
41  int jobnr, int nb_jobs);
43  int jobnr, int nb_jobs);
45 
46 static float envelope(const float x)
47 {
48  const float beta = 0.6f;
49 
50  if (x < beta) {
51  const float tmp = fabsf(x / beta - 1.f);
52 
53  return 1.f - tmp * tmp;
54  } else {
55  const float tmp = (1.f - x) / (1.f - beta);
56 
57  return tmp * tmp * (3.f - 2.f * tmp);
58  }
59 }
60 
61 static float filter(float b, float r, float u, float v, float size)
62 {
63  return expf(-av_clipf(((b - u) * (b - u) +
64  (r - v) * (r - v)) *
65  size, 0.f, 1.f));
66 }
67 
68 #define PROCESS() \
69  const int cx = x >> subw; \
70  float y = yptr[x] * imax; \
71  float u = uptr[cx] * imax - .5f; \
72  float v = vptr[cx] * imax - .5f; \
73  float tt, t, ny; \
74  \
75  ny = filter(b, r, u, v, size); \
76  tt = envelope(y); \
77  t = tt + (1.f - tt) * ihigh; \
78  ny = (1.f - t) * y + t * ny * y;
79 
80 static int monochrome_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
81 {
82  MonochromeContext *s = ctx->priv;
83  AVFrame *frame = arg;
84  const int depth = s->depth;
85  const int subw = s->subw;
86  const int subh = s->subh;
87  const float max = (1 << depth) - 1;
88  const float imax = 1.f / max;
89  const int width = frame->width;
90  const int height = frame->height;
91  const int slice_start = (height * jobnr) / nb_jobs;
92  const int slice_end = (height * (jobnr + 1)) / nb_jobs;
93  const int ylinesize = frame->linesize[0];
94  const int ulinesize = frame->linesize[1];
95  const int vlinesize = frame->linesize[2];
96  uint8_t *yptr = frame->data[0] + slice_start * ylinesize;
97  const float ihigh = 1.f - s->high;
98  const float size = 1.f / s->size;
99  const float b = s->b * .5f;
100  const float r = s->r * .5f;
101 
102  for (int y = slice_start; y < slice_end; y++) {
103  const int cy = y >> subh;
104  uint8_t *uptr = frame->data[1] + cy * ulinesize;
105  uint8_t *vptr = frame->data[2] + cy * vlinesize;
106 
107  for (int x = 0; x < width; x++) {
108  PROCESS()
109 
110  yptr[x] = av_clip_uint8(ny * max);
111  }
112 
113  yptr += ylinesize;
114  }
115 
116  return 0;
117 }
118 
119 static int monochrome_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
120 {
121  MonochromeContext *s = ctx->priv;
122  AVFrame *frame = arg;
123  const int depth = s->depth;
124  const int subw = s->subw;
125  const int subh = s->subh;
126  const float max = (1 << depth) - 1;
127  const float imax = 1.f / max;
128  const int width = frame->width;
129  const int height = frame->height;
130  const int slice_start = (height * jobnr) / nb_jobs;
131  const int slice_end = (height * (jobnr + 1)) / nb_jobs;
132  const int ylinesize = frame->linesize[0] / 2;
133  const int ulinesize = frame->linesize[1] / 2;
134  const int vlinesize = frame->linesize[2] / 2;
135  uint16_t *yptr = (uint16_t *)frame->data[0] + slice_start * ylinesize;
136  const float ihigh = 1.f - s->high;
137  const float size = 1.f / s->size;
138  const float b = s->b * .5f;
139  const float r = s->r * .5f;
140 
141  for (int y = slice_start; y < slice_end; y++) {
142  const int cy = y >> subh;
143  uint16_t *uptr = (uint16_t *)frame->data[1] + cy * ulinesize;
144  uint16_t *vptr = (uint16_t *)frame->data[2] + cy * vlinesize;
145 
146  for (int x = 0; x < width; x++) {
147  PROCESS()
148 
149  yptr[x] = av_clip_uintp2_c(ny * max, depth);
150  }
151 
152  yptr += ylinesize;
153  }
154 
155  return 0;
156 }
157 
158 static int clear_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
159 {
160  MonochromeContext *s = ctx->priv;
161  AVFrame *frame = arg;
162  const int depth = s->depth;
163  const int half = 1 << (depth - 1);
164  const int subw = s->subw;
165  const int subh = s->subh;
166  const int width = AV_CEIL_RSHIFT(frame->width, subw);
167  const int height = AV_CEIL_RSHIFT(frame->height, subh);
168  const int slice_start = (height * jobnr) / nb_jobs;
169  const int slice_end = (height * (jobnr + 1)) / nb_jobs;
170  const int ulinesize = frame->linesize[1];
171  const int vlinesize = frame->linesize[2];
172 
173  for (int y = slice_start; y < slice_end; y++) {
174  uint8_t *uptr = frame->data[1] + y * ulinesize;
175  uint8_t *vptr = frame->data[2] + y * vlinesize;
176 
177  memset(uptr, half, width);
178  memset(vptr, half, width);
179  }
180 
181  return 0;
182 }
183 
184 static int clear_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
185 {
186  MonochromeContext *s = ctx->priv;
187  AVFrame *frame = arg;
188  const int depth = s->depth;
189  const int half = 1 << (depth - 1);
190  const int subw = s->subw;
191  const int subh = s->subh;
192  const int width = AV_CEIL_RSHIFT(frame->width, subw);
193  const int height = AV_CEIL_RSHIFT(frame->height, subh);
194  const int slice_start = (height * jobnr) / nb_jobs;
195  const int slice_end = (height * (jobnr + 1)) / nb_jobs;
196  const int ulinesize = frame->linesize[1] / 2;
197  const int vlinesize = frame->linesize[2] / 2;
198 
199  for (int y = slice_start; y < slice_end; y++) {
200  uint16_t *uptr = (uint16_t *)frame->data[1] + y * ulinesize;
201  uint16_t *vptr = (uint16_t *)frame->data[2] + y * vlinesize;
202 
203  for (int x = 0; x < width; x++) {
204  uptr[x] = half;
205  vptr[x] = half;
206  }
207  }
208 
209  return 0;
210 }
211 
213 {
214  AVFilterContext *ctx = inlink->dst;
215  MonochromeContext *s = ctx->priv;
216 
217  ctx->internal->execute(ctx, s->do_slice, frame, NULL,
219  ctx->internal->execute(ctx, s->clear_uv, frame, NULL,
220  FFMIN(frame->height >> s->subh, ff_filter_get_nb_threads(ctx)));
221 
222  return ff_filter_frame(ctx->outputs[0], frame);
223 }
224 
226 {
227  static const enum AVPixelFormat pixel_fmts[] = {
246  };
247 
249 
250  formats = ff_make_format_list(pixel_fmts);
251  if (!formats)
252  return AVERROR(ENOMEM);
253 
255 }
256 
258 {
259  AVFilterContext *ctx = inlink->dst;
260  MonochromeContext *s = ctx->priv;
262 
263  s->depth = desc->comp[0].depth;
264  s->do_slice = s->depth <= 8 ? monochrome_slice8 : monochrome_slice16;
265  s->clear_uv = s->depth <= 8 ? clear_slice8 : clear_slice16;
266  s->subw = desc->log2_chroma_w;
267  s->subh = desc->log2_chroma_h;
268 
269  return 0;
270 }
271 
272 static const AVFilterPad monochrome_inputs[] = {
273  {
274  .name = "default",
275  .type = AVMEDIA_TYPE_VIDEO,
276  .needs_writable = 1,
277  .filter_frame = filter_frame,
278  .config_props = config_input,
279  },
280  { NULL }
281 };
282 
283 static const AVFilterPad monochrome_outputs[] = {
284  {
285  .name = "default",
286  .type = AVMEDIA_TYPE_VIDEO,
287  },
288  { NULL }
289 };
290 
291 #define OFFSET(x) offsetof(MonochromeContext, x)
292 #define VF AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
293 
294 static const AVOption monochrome_options[] = {
295  { "cb", "set the chroma blue spot", OFFSET(b), AV_OPT_TYPE_FLOAT, {.dbl=0},-1, 1, VF },
296  { "cr", "set the chroma red spot", OFFSET(r), AV_OPT_TYPE_FLOAT, {.dbl=0},-1, 1, VF },
297  { "size", "set the color filter size", OFFSET(size), AV_OPT_TYPE_FLOAT, {.dbl=1},.1,10, VF },
298  { "high", "set the highlights strength", OFFSET(high), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, 1, VF },
299  { NULL }
300 };
301 
302 AVFILTER_DEFINE_CLASS(monochrome);
303 
305  .name = "monochrome",
306  .description = NULL_IF_CONFIG_SMALL("Convert video to gray using custom color filter."),
307  .priv_size = sizeof(MonochromeContext),
308  .priv_class = &monochrome_class,
314 };
monochrome_outputs
static const AVFilterPad monochrome_outputs[]
Definition: vf_monochrome.c:283
formats
formats
Definition: signature.h:48
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:442
MonochromeContext::clear_uv
int(* clear_uv)(AVFilterContext *s, void *arg, int jobnr, int nb_jobs)
Definition: vf_monochrome.c:42
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
r
const char * r
Definition: vf_curves.c:116
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
ff_make_format_list
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:286
u
#define u(width, name, range_min, range_max)
Definition: cbs_h2645.c:264
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1096
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2573
MonochromeContext::high
float high
Definition: vf_monochrome.c:35
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_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:434
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:27
av_clip_uintp2_c
static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p)
Clip a signed integer to an unsigned power of two range.
Definition: common.h:302
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:441
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:436
AVOption
AVOption.
Definition: opt.h:248
b
#define b
Definition: input.c:41
monochrome_slice8
static int monochrome_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_monochrome.c:80
expf
#define expf(x)
Definition: libm.h:283
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:399
half
static uint8_t half(int a, int b)
Definition: mobiclip.c:541
query_formats
static av_cold int query_formats(AVFilterContext *ctx)
Definition: vf_monochrome.c:225
float.h
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
max
#define max(a, b)
Definition: cuda_runtime.h:33
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:149
video.h
AVFormatContext::internal
AVFormatInternal * internal
An opaque field for libavformat internal usage.
Definition: avformat.h:1699
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:437
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:65
formats.h
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:433
MonochromeContext::b
float b
Definition: vf_monochrome.c:33
VF
#define VF
Definition: vf_monochrome.c:292
MonochromeContext
Definition: vf_monochrome.c:30
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:443
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:397
fabsf
static __device__ float fabsf(float a)
Definition: cuda_runtime.h:181
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:54
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:402
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:258
MonochromeContext::subw
int subw
Definition: vf_monochrome.c:38
MonochromeContext::subh
int subh
Definition: vf_monochrome.c:38
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:411
ff_set_common_formats
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:587
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
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:257
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:412
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
slice_end
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2033
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:440
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:396
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:410
ctx
AVFormatContext * ctx
Definition: movenc.c:48
MonochromeContext::size
float size
Definition: vf_monochrome.c:34
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_monochrome.c:212
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
f
#define f(width, name)
Definition: cbs_vp9.c:255
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:66
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
NULL
#define NULL
Definition: coverity.c:32
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_clipf
#define av_clipf
Definition: common.h:170
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:401
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:400
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
for
for(j=16;j >0;--j)
Definition: h264pred_template.c:469
MonochromeContext::depth
int depth
Definition: vf_monochrome.c:37
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
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: af_acrusher.c:336
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:404
size
int size
Definition: twinvq_data.h:10344
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:406
MonochromeContext::do_slice
int(* do_slice)(AVFilterContext *s, void *arg, int jobnr, int nb_jobs)
Definition: vf_monochrome.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:882
height
#define height
PROCESS
#define PROCESS()
Definition: vf_monochrome.c:68
FFMIN
#define FFMIN(a, b)
Definition: common.h:105
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:177
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:438
monochrome_inputs
static const AVFilterPad monochrome_inputs[]
Definition: vf_monochrome.c:272
config_input
static av_cold int config_input(AVFilterLink *inlink)
Definition: vf_monochrome.c:257
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:126
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:228
envelope
static float envelope(const float x)
Definition: vf_monochrome.c:46
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:802
monochrome_options
static const AVOption monochrome_options[]
Definition: vf_monochrome.c:294
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
uint8_t
uint8_t
Definition: audio_convert.c:194
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:60
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:398
MonochromeContext::r
float r
Definition: vf_monochrome.c:33
AVFilter
Filter definition.
Definition: avfilter.h:145
filter
static float filter(float b, float r, float u, float v, float size)
Definition: vf_monochrome.c:61
clear_slice8
static int clear_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_monochrome.c:158
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:435
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:403
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:408
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:439
avfilter.h
ff_vf_monochrome
AVFilter ff_vf_monochrome
Definition: vf_monochrome.c:304
av_clip_uint8
#define av_clip_uint8
Definition: common.h:128
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:341
OFFSET
#define OFFSET(x)
Definition: vf_monochrome.c:291
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: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:81
monochrome_slice16
static int monochrome_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_monochrome.c:119
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:405
clear_slice16
static int clear_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_monochrome.c:184
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:409
int
int
Definition: ffmpeg_filter.c:170
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:176
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:407
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(monochrome)