Go to the documentation of this file.
59 static float lerpf(
float v0,
float v1,
float f)
61 return v0 + (v1 -
v0) *
f;
64 static void preservel(
float *
r,
float *
g,
float *
b,
float lin,
float lout,
float max)
67 lout = 1.f / (
max * 2.f);
84 #define OFFSET(x) offsetof(ColorChannelMixerContext, x)
85 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
138 return filter_slice_rgba_planar_8(
ctx,
arg, jobnr, nb_jobs, 0, 8, 0);
143 return filter_slice_rgba_planar_8(
ctx,
arg, jobnr, nb_jobs, 1, 8, 0);
148 return filter_slice_rgba_planar_8(
ctx,
arg, jobnr, nb_jobs, 0, 8, 1);
153 return filter_slice_rgba_planar_8(
ctx,
arg, jobnr, nb_jobs, 1, 8, 1);
158 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 9, 0);
163 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 10, 0);
168 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 1, 10, 0);
173 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 12, 0);
178 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 1, 12, 0);
183 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 14, 0);
188 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 16, 0);
193 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 1, 16, 0);
198 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 9, 1);
203 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 10, 1);
208 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 1, 10, 1);
213 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 12, 1);
218 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 1, 12, 1);
223 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 14, 1);
228 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 0, 16, 1);
233 return filter_slice_rgba_planar_16(
ctx,
arg, jobnr, nb_jobs, 1, 16, 1);
238 return filter_slice_rgba_packed_16(
ctx,
arg, jobnr, nb_jobs, 1, 4, 0, 16);
243 return filter_slice_rgba_packed_16(
ctx,
arg, jobnr, nb_jobs, 0, 3, 0, 16);
248 return filter_slice_rgba_packed_16(
ctx,
arg, jobnr, nb_jobs, 1, 4, 1, 16);
253 return filter_slice_rgba_packed_16(
ctx,
arg, jobnr, nb_jobs, 0, 3, 1, 16);
258 return filter_slice_rgba_packed_8(
ctx,
arg, jobnr, nb_jobs, 1, 4, 0, 8);
263 return filter_slice_rgba_packed_8(
ctx,
arg, jobnr, nb_jobs, 0, 3, 0, 8);
268 return filter_slice_rgba_packed_8(
ctx,
arg, jobnr, nb_jobs, -1, 4, 0, 8);
273 return filter_slice_rgba_packed_8(
ctx,
arg, jobnr, nb_jobs, 1, 4, 1, 8);
278 return filter_slice_rgba_packed_8(
ctx,
arg, jobnr, nb_jobs, 0, 3, 1, 8);
283 return filter_slice_rgba_packed_8(
ctx,
arg, jobnr, nb_jobs, -1, 4, 1, 8);
288 return filter_slice_rgba_planar_32(
ctx,
arg, jobnr, nb_jobs, 0, 1, 0);
293 return filter_slice_rgba_planar_32(
ctx,
arg, jobnr, nb_jobs, 1, 1, 0);
298 return filter_slice_rgba_planar_32(
ctx,
arg, jobnr, nb_jobs, 0, 1, 1);
303 return filter_slice_rgba_planar_32(
ctx,
arg, jobnr, nb_jobs, 1, 1, 1);
311 const int depth =
desc->comp[0].depth;
322 for (
i = 0;
i < 4;
i++)
349 switch (outlink->
format) {
437 const int pc =
s->preserve_color > 0;
463 char *res,
int res_len,
int flags)
497 .
name =
"colorchannelmixer",
500 .priv_class = &colorchannelmixer_class,
static int filter_slice_rgba64(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
#define AV_PIX_FMT_GBRAP16
AVPixelFormat
Pixel format.
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
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static int filter_slice_gbrp10_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define FILTER_PIXFMTS_ARRAY(array)
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
static const AVOption colorchannelmixer_options[]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
static void preserve_color(int preserve_color, float ir, float ig, float ib, float r, float g, float b, float max, float *icolor, float *ocolor)
static int filter_slice_gbrp14(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
const char * name
Filter name.
static int filter_slice_rgb0(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A link between two filters.
static int filter_slice_gbrap(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgb0_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrap32(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int(* filter_slice[2])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrap_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_GBRP14
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
static int filter_slice_rgba(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_GBRP10
static int filter_slice_gbrap10_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrap16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
A filter pad used for either input or output.
static float lerpf(float v0, float v1, float f)
const AVFilter ff_vf_colorchannelmixer
#define AV_PIX_FMT_GBRAP10
static int filter_slice_gbrp14_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_GBRAP12
static int filter_slice_rgb48(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrap32_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define FILTER_INPUTS(array)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
static const AVFilterPad colorchannelmixer_outputs[]
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_RGBA64
Describe the class of an AVClass context structure.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
static int filter_slice_gbrp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp9(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
static void preservel(float *r, float *g, float *b, float lin, float lout, float max)
static int filter_slice_gbrap12_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
AVFILTER_DEFINE_CLASS(colorchannelmixer)
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
static int filter_slice_gbrap10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_PIX_FMT_GBRPF32
static int filter_slice_gbrap16_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int format
agreed upon media format
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
AVFilterContext * src
source filter
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.
static int filter_slice_gbrp12_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp32(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
#define AV_PIX_FMT_BGRA64
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
#define i(width, name, range_min, range_max)
static int filter_slice_rgba64_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int w
agreed upon image width
static int filter_slice_gbrp16_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_GBRP12
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Used for passing data between threads.
const char * name
Pad name.
static int filter_slice_gbrp12(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static av_cold void uninit(AVFilterContext *ctx)
static int filter_slice_rgb24(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
int h
agreed upon image height
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
#define AV_PIX_FMT_GBRAPF32
static int config_output(AVFilterLink *outlink)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
static int filter_slice_gbrap12(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define FILTER_OUTPUTS(array)
static int filter_slice_rgb48_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgba_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgb24_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
#define flags(name, subs,...)
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
static int filter_slice_gbrp16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static enum AVPixelFormat pix_fmts[]
static const AVFilterPad colorchannelmixer_inputs[]
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
static int filter_slice_gbrp32_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp9_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)