26 #define FF_INTERNAL_FIELDS 1
51 #define OFFSET(x) offsetof(ExtractPlanesContext, x)
52 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
67 #define EIGHTBIT_FORMATS \
71 AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, \
72 AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P, \
73 AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, \
74 AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P, \
75 AV_PIX_FMT_YUVJ411P, \
76 AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P, \
77 AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A, \
78 AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24, \
79 AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, \
80 AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, \
81 AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0, \
82 AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR, \
83 AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP
85 #define HIGHDEPTH_FORMATS(suf) \
86 AV_PIX_FMT_YA16##suf, AV_PIX_FMT_GRAY16##suf, \
87 AV_PIX_FMT_YUV420P16##suf, AV_PIX_FMT_YUVA420P16##suf, \
88 AV_PIX_FMT_YUV422P16##suf, AV_PIX_FMT_YUVA422P16##suf, \
89 AV_PIX_FMT_YUV444P16##suf, AV_PIX_FMT_YUVA444P16##suf, \
90 AV_PIX_FMT_RGB48##suf, AV_PIX_FMT_BGR48##suf, \
91 AV_PIX_FMT_RGBA64##suf, AV_PIX_FMT_BGRA64##suf, \
92 AV_PIX_FMT_GBRP16##suf, AV_PIX_FMT_GBRAP16##suf, \
93 AV_PIX_FMT_YUV420P10##suf, \
94 AV_PIX_FMT_YUV422P10##suf, \
95 AV_PIX_FMT_YUV444P10##suf, \
96 AV_PIX_FMT_YUV440P10##suf, \
97 AV_PIX_FMT_YUVA420P10##suf, \
98 AV_PIX_FMT_YUVA422P10##suf, \
99 AV_PIX_FMT_YUVA444P10##suf, \
100 AV_PIX_FMT_YUV420P12##suf, \
101 AV_PIX_FMT_YUV422P12##suf, \
102 AV_PIX_FMT_YUV444P12##suf, \
103 AV_PIX_FMT_YUV440P12##suf, \
104 AV_PIX_FMT_GBRP10##suf, AV_PIX_FMT_GBRAP10##suf, \
105 AV_PIX_FMT_GBRP12##suf, AV_PIX_FMT_GBRAP12##suf, \
106 AV_PIX_FMT_YUV420P9##suf, \
107 AV_PIX_FMT_YUV422P9##suf, \
108 AV_PIX_FMT_YUV444P9##suf, \
109 AV_PIX_FMT_YUVA420P9##suf, \
110 AV_PIX_FMT_YUVA422P9##suf, \
111 AV_PIX_FMT_YUVA444P9##suf, \
112 AV_PIX_FMT_GBRP9##suf, \
113 AV_PIX_FMT_GBRP14##suf, \
114 AV_PIX_FMT_YUV420P14##suf, \
115 AV_PIX_FMT_YUV422P14##suf, \
116 AV_PIX_FMT_YUV444P14##suf
144 int i, ret, depth = 0, be = 0;
156 in_pixfmts = in_pixfmts_be;
158 in_pixfmts = in_pixfmts_le;
173 out_pixfmts = out8_pixfmts;
174 else if (!be && depth == 9)
175 out_pixfmts = out9le_pixfmts;
176 else if (be && depth == 9)
177 out_pixfmts = out9be_pixfmts;
178 else if (!be && depth == 10)
179 out_pixfmts = out10le_pixfmts;
180 else if (be && depth == 10)
181 out_pixfmts = out10be_pixfmts;
182 else if (!be && depth == 12)
183 out_pixfmts = out12le_pixfmts;
184 else if (be && depth == 12)
185 out_pixfmts = out12be_pixfmts;
186 else if (!be && depth == 14)
187 out_pixfmts = out14le_pixfmts;
188 else if (be && depth == 14)
189 out_pixfmts = out14be_pixfmts;
191 out_pixfmts = out16be_pixfmts;
193 out_pixfmts = out16le_pixfmts;
206 int plane_avail, ret, i;
226 for (i = 0; i < 4; i++)
227 s->
map[i] = rgba_map[s->
map[i]];
241 if (s->
map[output] == 1 || s->
map[output] == 2) {
252 int depth,
int step,
int comp)
256 for (y = 0; y <
height; y++) {
259 for (x = 0; x <
width; x++)
260 dst[x] = src[x * step + comp];
263 for (x = 0; x <
width; x++) {
264 dst[x * 2 ] = src[x * step + comp * 2 ];
265 dst[x * 2 + 1] = src[x * step + comp * 2 + 1];
278 int i, eof = 0, ret = 0;
282 const int idx = s->
map[i];
285 if (outlink->status_in)
298 outlink->
w, outlink->
h,
328 for (i = 0; i < 4; i++) {
332 if (!(planes & (1 << i)))
371 .
name =
"extractplanes",
374 .priv_class = &extractplanes_class,
378 .
inputs = extractplanes_inputs,
383 #if CONFIG_ALPHAEXTRACT_FILTER
395 .
name =
"alphaextract",
397 "grayscale image component."),
399 .
init = init_alphaextract,
402 .
inputs = extractplanes_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
enum AVMediaType type
AVFilterPad type.
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Y , 12bpp, little-endian.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
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.
AVFilterPad * output_pads
array of output pads
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
#define AVERROR_EOF
End of file.
Y , 10bpp, little-endian.
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
A filter pad used for either input or output.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
unsigned nb_outputs
number of output pads
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel for the pixel format described by pixdesc, including any padding ...
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
int w
agreed upon image width
char * av_asprintf(const char *fmt,...)
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
static const struct @304 planes[]
uint8_t nb_components
The number of components each pixel has, (1-4)
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
int format
agreed upon media format
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
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...
AVFilter ff_vf_alphaextract
Describe the class of an AVClass context structure.
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width)
Fill plane linesizes for an image with pixel format pix_fmt and width width.
const char * name
Filter name.
Y , 14bpp, little-endian.
AVFilterLink ** outputs
array of pointers to output links
#define flags(name, subs,...)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
AVFilterContext * dst
dest filter
Y , 16bpp, little-endian.
AVFilterPad * srcpad
output pad on the source filter
int(* config_props)(AVFilterLink *link)
Link configuration callback.
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
int depth
Number of bits in the component.
static int ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
AVPixelFormat
Pixel format.
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
AVFilterFormats * out_formats
#define AV_CEIL_RSHIFT(a, b)