|
FFmpeg
|
#include <stdbool.h>#include <stdatomic.h>#include "config.h"#include "libavutil/mem.h"#include "libavutil/opt.h"#include "libavutil/pixdesc.h"#include "avfilter.h"#include "filters.h"#include "formats.h"#include "video.h"#include "vf_colordetect.h"Go to the source code of this file.
Data Structures | |
| struct | ColorDetectContext |
Macros | |
| #define | OFFSET(x) offsetof(ColorDetectContext, x) |
| #define | FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM |
Enumerations | |
| enum | AlphaMode { ALPHA_NONE = -1, ALPHA_UNDETERMINED = 0, ALPHA_STRAIGHT } |
| enum | ColorDetectMode { COLOR_DETECT_COLOR_RANGE = 1 << 0, COLOR_DETECT_ALPHA_MODE = 1 << 1 } |
Functions | |
| AVFILTER_DEFINE_CLASS (colordetect) | |
| static int | query_format (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out) |
| static int | config_input (AVFilterLink *inlink) |
| static int | detect_range (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) |
| static int | detect_alpha (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) |
| static int | filter_frame (AVFilterLink *inlink, AVFrame *in) |
| static av_cold void | uninit (AVFilterContext *ctx) |
| av_cold void | ff_color_detect_dsp_init (FFColorDetectDSPContext *dsp, int depth, enum AVColorRange color_range) |
Variables | |
| static const AVOption | colordetect_options [] |
| static const AVFilterPad | colordetect_inputs [] |
| const FFFilter | ff_vf_colordetect |
Video color space detector, tries to auto-detect YUV range and alpha mode.
Definition in file vf_colordetect.c.
| #define OFFSET | ( | x | ) | offsetof(ColorDetectContext, x) |
Definition at line 70 of file vf_colordetect.c.
| #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM |
Definition at line 71 of file vf_colordetect.c.
| enum AlphaMode |
| Enumerator | |
|---|---|
| ALPHA_NONE | |
| ALPHA_UNDETERMINED | |
| ALPHA_STRAIGHT | |
Definition at line 42 of file vf_colordetect.c.
| enum ColorDetectMode |
| Enumerator | |
|---|---|
| COLOR_DETECT_COLOR_RANGE | |
| COLOR_DETECT_ALPHA_MODE | |
Definition at line 49 of file vf_colordetect.c.
| AVFILTER_DEFINE_CLASS | ( | colordetect | ) |
|
static |
Definition at line 83 of file vf_colordetect.c.
|
static |
Definition at line 102 of file vf_colordetect.c.
|
static |
Definition at line 136 of file vf_colordetect.c.
Referenced by filter_frame().
|
static |
To check if a value is out of range, we need to compare the color value against the maximum possible color for a given alpha value. x > ((mpeg_max - mpeg_min) / pixel_max) * a + mpeg_min
This simplifies to: (x - mpeg_min) * pixel_max > (mpeg_max - mpeg_min) * a = P * x - K > Q * a in the below formula.
We subtract an additional offset of (1 << (depth - 1)) to account for rounding errors in the value of x, and an extra safety margin of Q because vf_premultiply.c et al. add an offset of (a >> 1) & 1.
Definition at line 153 of file vf_colordetect.c.
Referenced by filter_frame().
|
static |
Definition at line 197 of file vf_colordetect.c.
|
static |
Definition at line 211 of file vf_colordetect.c.
| av_cold void ff_color_detect_dsp_init | ( | FFColorDetectDSPContext * | dsp, |
| int | depth, | ||
| enum AVColorRange | color_range | ||
| ) |
Definition at line 232 of file vf_colordetect.c.
Referenced by check_alpha_detect(), check_range_detect(), and config_input().
|
static |
Definition at line 73 of file vf_colordetect.c.
|
static |
Definition at line 250 of file vf_colordetect.c.
| const FFFilter ff_vf_colordetect |
Definition at line 259 of file vf_colordetect.c.
1.8.17