45 double diff = sqrt((dr * dr + dg * dg + db * db) / (255.0 * 255.0));
47 if (ctx->
blend > 0.0001) {
58 const int slice_start = (frame->
height * jobnr) / nb_jobs;
65 for (y = slice_start; y <
slice_end; ++y) {
66 for (x = 0; x < frame->
width; ++x) {
69 frame->
data[0][o + ctx->
co[3]] =
71 frame->
data[0][o + ctx->
co[0]],
72 frame->
data[0][o + ctx->
co[1]],
73 frame->
data[0][o + ctx->
co[2]]);
105 for (i = 0; i < 4; ++i)
148 #define OFFSET(x) offsetof(ColorkeyContext, x)
149 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
162 .description =
NULL_IF_CONFIG_SMALL(
"Turns a certain color into transparency. Operates on RGB colors."),
164 .priv_class = &colorkey_class,
166 .
inputs = colorkey_inputs,
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
Main libavfilter public API header.
int h
agreed upon image height
static const AVFilterPad colorkey_outputs[]
static enum AVSampleFormat formats[]
struct AVFilterGraph * graph
filtergraph this filter belongs to
static av_cold int config_output(AVFilterLink *outlink)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
static uint8_t do_colorkey_pixel(ColorkeyContext *ctx, uint8_t r, uint8_t g, uint8_t b)
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
int nb_threads
Maximum number of threads used by filters in this graph.
A filter pad used for either input or output.
A link between two filters.
int width
width and height of the video frame
static const AVOption colorkey_options[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void * priv
private data for use by the filter
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
static int filter_frame(AVFilterLink *link, AVFrame *frame)
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int w
agreed upon image width
static int do_colorkey_slice(AVFilterContext *avctx, void *arg, int jobnr, int nb_jobs)
static const AVFilterPad colorkey_inputs[]
AVFilterContext * src
source filter
static const AVFilterPad outputs[]
int format
agreed upon media format
AVFILTER_DEFINE_CLASS(colorkey)
static const AVFilterPad inputs[]
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Describe the class of an AVClass context structure.
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
int offset
Number of elements before the component of the first pixel.
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
avfilter_execute_func * execute
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
static av_always_inline int diff(const uint32_t a, const uint32_t b)
AVFilterContext * dst
dest filter
static av_cold int query_formats(AVFilterContext *avctx)
AVPixelFormat
Pixel format.