FFmpeg
Data Structures | Macros | Functions | Variables
vf_extractplanes.c File Reference
#include "config_components.h"
#include "libavutil/avstring.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "drawutils.h"
#include "filters.h"
#include "formats.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  ExtractPlanesContext
 

Macros

#define PLANE_R   0x01
 
#define PLANE_G   0x02
 
#define PLANE_B   0x04
 
#define PLANE_A   0x08
 
#define PLANE_Y   0x10
 
#define PLANE_U   0x20
 
#define PLANE_V   0x40
 
#define OFFSET(x)   offsetof(ExtractPlanesContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 
#define EIGHTBIT_FORMATS
 
#define HIGHDEPTH_FORMATS(suf)
 
#define FLOAT_FORMATS(suf)
 

Functions

 AVFILTER_DEFINE_CLASS (extractplanes)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static void extract_from_packed (uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int width, int height, int depth, int step, int comp)
 
static int extract_plane (AVFilterLink *outlink, AVFrame *frame)
 
static int activate (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 

Variables

static const AVOption extractplanes_options []
 
static const AVFilterPad extractplanes_inputs []
 
const AVFilter ff_vf_extractplanes
 

Macro Definition Documentation

◆ PLANE_R

#define PLANE_R   0x01

Definition at line 34 of file vf_extractplanes.c.

◆ PLANE_G

#define PLANE_G   0x02

Definition at line 35 of file vf_extractplanes.c.

◆ PLANE_B

#define PLANE_B   0x04

Definition at line 36 of file vf_extractplanes.c.

◆ PLANE_A

#define PLANE_A   0x08

Definition at line 37 of file vf_extractplanes.c.

◆ PLANE_Y

#define PLANE_Y   0x10

Definition at line 38 of file vf_extractplanes.c.

◆ PLANE_U

#define PLANE_U   0x20

Definition at line 39 of file vf_extractplanes.c.

◆ PLANE_V

#define PLANE_V   0x40

Definition at line 40 of file vf_extractplanes.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(ExtractPlanesContext, x)

Definition at line 52 of file vf_extractplanes.c.

◆ FLAGS

Definition at line 53 of file vf_extractplanes.c.

◆ EIGHTBIT_FORMATS

#define EIGHTBIT_FORMATS
Value:
AV_PIX_FMT_YUV411P, \
AV_PIX_FMT_YUV440P, \
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, \
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P, \
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, \
AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P, \
AV_PIX_FMT_YUVJ411P, \
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P, \
AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A, \
AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, \
AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, \
AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, \
AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0, \
AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR, \
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP

Definition at line 68 of file vf_extractplanes.c.

◆ HIGHDEPTH_FORMATS

#define HIGHDEPTH_FORMATS (   suf)

Definition at line 86 of file vf_extractplanes.c.

◆ FLOAT_FORMATS

#define FLOAT_FORMATS (   suf)
Value:
AV_PIX_FMT_RGBF32##suf, AV_PIX_FMT_RGBAF32##suf, \
AV_PIX_FMT_GBRPF32##suf, AV_PIX_FMT_GBRAPF32##suf \

Definition at line 126 of file vf_extractplanes.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( extractplanes  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 131 of file vf_extractplanes.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 222 of file vf_extractplanes.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 254 of file vf_extractplanes.c.

Referenced by init().

◆ extract_from_packed()

static void extract_from_packed ( uint8_t *  dst,
int  dst_linesize,
const uint8_t *  src,
int  src_linesize,
int  width,
int  height,
int  depth,
int  step,
int  comp 
)
static

Definition at line 270 of file vf_extractplanes.c.

Referenced by extract_plane().

◆ extract_plane()

static int extract_plane ( AVFilterLink outlink,
AVFrame frame 
)
static

Definition at line 303 of file vf_extractplanes.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 332 of file vf_extractplanes.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 383 of file vf_extractplanes.c.

Variable Documentation

◆ extractplanes_options

const AVOption extractplanes_options[]
static
Initial value:
= {
{ "planes", "set planes", OFFSET(requested_planes), AV_OPT_TYPE_FLAGS, {.i64=1}, 1, 0xff, FLAGS, .unit = "flags"},
{ "y", "set luma plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_Y}, 0, 0, FLAGS, .unit = "flags"},
{ "u", "set u plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_U}, 0, 0, FLAGS, .unit = "flags"},
{ "v", "set v plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_V}, 0, 0, FLAGS, .unit = "flags"},
{ "r", "set red plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_R}, 0, 0, FLAGS, .unit = "flags"},
{ "g", "set green plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_G}, 0, 0, FLAGS, .unit = "flags"},
{ "b", "set blue plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_B}, 0, 0, FLAGS, .unit = "flags"},
{ "a", "set alpha plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_A}, 0, 0, FLAGS, .unit = "flags"},
{ NULL }
}

Definition at line 54 of file vf_extractplanes.c.

◆ extractplanes_inputs

const AVFilterPad extractplanes_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
},
}

Definition at line 411 of file vf_extractplanes.c.

◆ ff_vf_extractplanes

const AVFilter ff_vf_extractplanes
Initial value:
= {
.name = "extractplanes",
.description = NULL_IF_CONFIG_SMALL("Extract planes as grayscale frames."),
.priv_size = sizeof(ExtractPlanesContext),
.priv_class = &extractplanes_class,
.init = init,
.outputs = NULL,
}

Definition at line 419 of file vf_extractplanes.c.

FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
FLAGS
#define FLAGS
Definition: vf_extractplanes.c:53
AV_PIX_FMT_BGR24
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:76
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:102
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
PLANE_A
#define PLANE_A
Definition: vf_extractplanes.c:37
PLANE_B
#define PLANE_B
Definition: vf_extractplanes.c:36
activate
static int activate(AVFilterContext *ctx)
Definition: vf_extractplanes.c:332
PLANE_Y
#define PLANE_Y
Definition: vf_extractplanes.c:38
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
ExtractPlanesContext
Definition: vf_extractplanes.c:42
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_extractplanes.c:383
AV_PIX_FMT_GRAYF32
#define AV_PIX_FMT_GRAYF32
Definition: pixfmt.h:535
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
AV_PIX_FMT_GRAY8A
@ AV_PIX_FMT_GRAY8A
alias for AV_PIX_FMT_YA8
Definition: pixfmt.h:143
NULL
#define NULL
Definition: coverity.c:32
PLANE_G
#define PLANE_G
Definition: vf_extractplanes.c:35
AV_PIX_FMT_BGR0
@ AV_PIX_FMT_BGR0
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:265
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:101
AVFILTER_FLAG_DYNAMIC_OUTPUTS
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
Definition: avfilter.h:147
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
OFFSET
#define OFFSET(x)
Definition: vf_extractplanes.c:52
extractplanes_inputs
static const AVFilterPad extractplanes_inputs[]
Definition: vf_extractplanes.c:411
AV_PIX_FMT_0BGR
@ AV_PIX_FMT_0BGR
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:264
AV_PIX_FMT_GBRAPF32
#define AV_PIX_FMT_GBRAPF32
Definition: pixfmt.h:533
AV_PIX_FMT_RGBAF32
#define AV_PIX_FMT_RGBAF32
Definition: pixfmt.h:577
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
PLANE_U
#define PLANE_U
Definition: vf_extractplanes.c:39
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition: opt.h:255
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_extractplanes.c:222
PLANE_V
#define PLANE_V
Definition: vf_extractplanes.c:40
PLANE_R
#define PLANE_R
Definition: vf_extractplanes.c:34
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: filters.h:236
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_extractplanes.c:131