59static float lerpf(
float v0,
float v1,
float f)
61 return v0 + (v1 - v0) *
f;
64static 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 .p.name =
"colorchannelmixer",
499 .p.priv_class = &colorchannelmixer_class,
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
const FFFilter ff_vf_colorchannelmixer
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next 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.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Main libavfilter public API header.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FILTER_PIXFMTS_ARRAY(array)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
Memory handling functions.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRPF32
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_RGBA64
#define AV_PIX_FMT_GBRP12
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_RGB0
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_0RGB
packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined
#define AV_PIX_FMT_BGRA64
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRAPF32
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)
Describe the class of an AVClass context structure.
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int(* filter_slice[2])(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Used for passing data between threads.
static int filter_slice_gbrap12(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp9_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static const AVFilterPad colorchannelmixer_outputs[]
static const AVFilterPad colorchannelmixer_inputs[]
static void preservel(float *r, float *g, float *b, float lin, float lout, float max)
static int filter_slice_gbrap(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrap10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp32(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgb24_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp32_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgb24(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrap_pl(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_gbrap12_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgb0(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgba64_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_gbrp(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgba64(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp14_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp10(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgb48(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp12_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static int filter_slice_gbrap16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrap32(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 float lerpf(float v0, float v1, float f)
static int filter_slice_gbrp10_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static const AVOption colorchannelmixer_options[]
static int filter_slice_gbrp16_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgb48_pl(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 av_cold void uninit(AVFilterContext *ctx)
static int filter_slice_gbrap32_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrap10_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int config_output(AVFilterLink *outlink)
static int filter_slice_gbrap16_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp_pl(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_rgba(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp14(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static int filter_slice_gbrp12(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.