|
FFmpeg
|
Video color space detector, tries to auto-detect YUV range and alpha mode. More...
#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_colordetectdsp.h"Go to the source code of this file.
Data Structures | |
| struct | ColorDetectContext |
Macros | |
| #define | OFFSET(x) |
| #define | FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM |
Enumerations | |
| 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 | report_detected_props (AVFilterContext *ctx) |
| static int | activate (AVFilterContext *ctx) |
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 | ) |
Definition at line 71 of file vf_colordetect.c.
| #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM |
Definition at line 72 of file vf_colordetect.c.
| enum ColorDetectMode |
| Enumerator | |
|---|---|
| COLOR_DETECT_COLOR_RANGE | |
| COLOR_DETECT_ALPHA_MODE | |
Definition at line 42 of file vf_colordetect.c.
| AVFILTER_DEFINE_CLASS | ( | colordetect | ) |
|
static |
Definition at line 87 of file vf_colordetect.c.
|
static |
Alpha mode detection:
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 + threshold
This simplifies to: (x - mpeg_min - threshold) * pixel_max > (mpeg_max - mpeg_min) * a = range * x - offset > mpeg_range * a in the below formula.
We subtract an additional offset of (1 << (depth - 1)) to account for rounding errors in the value of x.
For full range input this degenerates to x > a + threshold, so the threshold is passed through directly, without the range scaling.
Definition at line 106 of file vf_colordetect.c.
|
static |
Definition at line 170 of file vf_colordetect.c.
Referenced by filter_frame().
|
static |
Definition at line 188 of file vf_colordetect.c.
Referenced by filter_frame().
|
static |
Definition at line 217 of file vf_colordetect.c.
Referenced by activate().
|
static |
Definition at line 235 of file vf_colordetect.c.
Referenced by activate().
|
static |
Definition at line 261 of file vf_colordetect.c.
|
static |
Definition at line 74 of file vf_colordetect.c.
|
static |
Definition at line 293 of file vf_colordetect.c.
| const FFFilter ff_vf_colordetect |
Definition at line 301 of file vf_colordetect.c.