LCOV - code coverage report
Current view: top level - libavfilter - vf_extractplanes.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 105 148 70.9 %
Date: 2018-05-20 11:54:08 Functions: 8 8 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Paul B Mahol
       3             :  *
       4             :  * This file is part of FFmpeg.
       5             :  *
       6             :  * FFmpeg is free software; you can redistribute it and/or
       7             :  * modify it under the terms of the GNU Lesser General Public
       8             :  * License as published by the Free Software Foundation; either
       9             :  * version 2.1 of the License, or (at your option) any later version.
      10             :  *
      11             :  * FFmpeg is distributed in the hope that it will be useful,
      12             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14             :  * Lesser General Public License for more details.
      15             :  *
      16             :  * You should have received a copy of the GNU Lesser General Public
      17             :  * License along with FFmpeg; if not, write to the Free Software
      18             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
      19             :  */
      20             : 
      21             : #include "libavutil/avstring.h"
      22             : #include "libavutil/imgutils.h"
      23             : #include "libavutil/opt.h"
      24             : #include "libavutil/pixdesc.h"
      25             : 
      26             : #define FF_INTERNAL_FIELDS 1
      27             : #include "libavfilter/framequeue.h"
      28             : 
      29             : #include "avfilter.h"
      30             : #include "drawutils.h"
      31             : #include "internal.h"
      32             : 
      33             : #define PLANE_R 0x01
      34             : #define PLANE_G 0x02
      35             : #define PLANE_B 0x04
      36             : #define PLANE_A 0x08
      37             : #define PLANE_Y 0x10
      38             : #define PLANE_U 0x20
      39             : #define PLANE_V 0x40
      40             : 
      41             : typedef struct ExtractPlanesContext {
      42             :     const AVClass *class;
      43             :     int requested_planes;
      44             :     int map[4];
      45             :     int linesize[4];
      46             :     int is_packed;
      47             :     int depth;
      48             :     int step;
      49             : } ExtractPlanesContext;
      50             : 
      51             : #define OFFSET(x) offsetof(ExtractPlanesContext, x)
      52             : #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
      53             : static const AVOption extractplanes_options[] = {
      54             :     { "planes", "set planes",  OFFSET(requested_planes), AV_OPT_TYPE_FLAGS, {.i64=1}, 1, 0xff, FLAGS, "flags"},
      55             :     {      "y", "set luma plane",  0, AV_OPT_TYPE_CONST, {.i64=PLANE_Y}, 0, 0, FLAGS, "flags"},
      56             :     {      "u", "set u plane",     0, AV_OPT_TYPE_CONST, {.i64=PLANE_U}, 0, 0, FLAGS, "flags"},
      57             :     {      "v", "set v plane",     0, AV_OPT_TYPE_CONST, {.i64=PLANE_V}, 0, 0, FLAGS, "flags"},
      58             :     {      "r", "set red plane",   0, AV_OPT_TYPE_CONST, {.i64=PLANE_R}, 0, 0, FLAGS, "flags"},
      59             :     {      "g", "set green plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_G}, 0, 0, FLAGS, "flags"},
      60             :     {      "b", "set blue plane",  0, AV_OPT_TYPE_CONST, {.i64=PLANE_B}, 0, 0, FLAGS, "flags"},
      61             :     {      "a", "set alpha plane", 0, AV_OPT_TYPE_CONST, {.i64=PLANE_A}, 0, 0, FLAGS, "flags"},
      62             :     { NULL }
      63             : };
      64             : 
      65             : AVFILTER_DEFINE_CLASS(extractplanes);
      66             : 
      67           4 : static int query_formats(AVFilterContext *ctx)
      68             : {
      69             :     static const enum AVPixelFormat in_pixfmts_le[] = {
      70             :         AV_PIX_FMT_YUV410P,
      71             :         AV_PIX_FMT_YUV411P,
      72             :         AV_PIX_FMT_YUV440P,
      73             :         AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,
      74             :         AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P,
      75             :         AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
      76             :         AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,
      77             :         AV_PIX_FMT_YUVJ411P,
      78             :         AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P,
      79             :         AV_PIX_FMT_YUV420P16LE, AV_PIX_FMT_YUVA420P16LE,
      80             :         AV_PIX_FMT_YUV422P16LE, AV_PIX_FMT_YUVA422P16LE,
      81             :         AV_PIX_FMT_YUV444P16LE, AV_PIX_FMT_YUVA444P16LE,
      82             :         AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A,
      83             :         AV_PIX_FMT_YA16LE, AV_PIX_FMT_GRAY16LE,
      84             :         AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
      85             :         AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,
      86             :         AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,
      87             :         AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,
      88             :         AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR,
      89             :         AV_PIX_FMT_RGB48LE, AV_PIX_FMT_BGR48LE,
      90             :         AV_PIX_FMT_RGBA64LE, AV_PIX_FMT_BGRA64LE,
      91             :         AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
      92             :         AV_PIX_FMT_GBRP16LE, AV_PIX_FMT_GBRAP16LE,
      93             :         AV_PIX_FMT_YUV420P10LE,
      94             :         AV_PIX_FMT_YUV422P10LE,
      95             :         AV_PIX_FMT_YUV444P10LE,
      96             :         AV_PIX_FMT_YUV440P10LE,
      97             :         AV_PIX_FMT_YUVA420P10LE,
      98             :         AV_PIX_FMT_YUVA422P10LE,
      99             :         AV_PIX_FMT_YUVA444P10LE,
     100             :         AV_PIX_FMT_YUV420P12LE,
     101             :         AV_PIX_FMT_YUV422P12LE,
     102             :         AV_PIX_FMT_YUV444P12LE,
     103             :         AV_PIX_FMT_YUV440P12LE,
     104             :         AV_PIX_FMT_GBRP10LE, AV_PIX_FMT_GBRAP10LE,
     105             :         AV_PIX_FMT_GBRP12LE, AV_PIX_FMT_GBRAP12LE,
     106             :         AV_PIX_FMT_YUV420P9LE,
     107             :         AV_PIX_FMT_YUV422P9LE,
     108             :         AV_PIX_FMT_YUV444P9LE,
     109             :         AV_PIX_FMT_YUVA420P9LE,
     110             :         AV_PIX_FMT_YUVA422P9LE,
     111             :         AV_PIX_FMT_YUVA444P9LE,
     112             :         AV_PIX_FMT_GBRP9LE,
     113             :         AV_PIX_FMT_NONE,
     114             :     };
     115             :     static const enum AVPixelFormat in_pixfmts_be[] = {
     116             :         AV_PIX_FMT_YUV410P,
     117             :         AV_PIX_FMT_YUV411P,
     118             :         AV_PIX_FMT_YUV440P,
     119             :         AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P,
     120             :         AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P,
     121             :         AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
     122             :         AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,
     123             :         AV_PIX_FMT_YUVJ411P,
     124             :         AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P,
     125             :         AV_PIX_FMT_YUV420P16BE, AV_PIX_FMT_YUVA420P16BE,
     126             :         AV_PIX_FMT_YUV422P16BE, AV_PIX_FMT_YUVA422P16BE,
     127             :         AV_PIX_FMT_YUV444P16BE, AV_PIX_FMT_YUVA444P16BE,
     128             :         AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A,
     129             :         AV_PIX_FMT_YA16BE, AV_PIX_FMT_GRAY16BE,
     130             :         AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
     131             :         AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA,
     132             :         AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR,
     133             :         AV_PIX_FMT_RGB0, AV_PIX_FMT_BGR0,
     134             :         AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR,
     135             :         AV_PIX_FMT_RGB48BE, AV_PIX_FMT_BGR48BE,
     136             :         AV_PIX_FMT_RGBA64BE, AV_PIX_FMT_BGRA64BE,
     137             :         AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
     138             :         AV_PIX_FMT_GBRP16BE, AV_PIX_FMT_GBRAP16BE,
     139             :         AV_PIX_FMT_YUV420P10BE,
     140             :         AV_PIX_FMT_YUV422P10BE,
     141             :         AV_PIX_FMT_YUV444P10BE,
     142             :         AV_PIX_FMT_YUV440P10BE,
     143             :         AV_PIX_FMT_YUVA420P10BE,
     144             :         AV_PIX_FMT_YUVA422P10BE,
     145             :         AV_PIX_FMT_YUVA444P10BE,
     146             :         AV_PIX_FMT_YUV420P12BE,
     147             :         AV_PIX_FMT_YUV422P12BE,
     148             :         AV_PIX_FMT_YUV444P12BE,
     149             :         AV_PIX_FMT_YUV440P12BE,
     150             :         AV_PIX_FMT_GBRP10BE, AV_PIX_FMT_GBRAP10BE,
     151             :         AV_PIX_FMT_GBRP12BE, AV_PIX_FMT_GBRAP12BE,
     152             :         AV_PIX_FMT_YUV420P9BE,
     153             :         AV_PIX_FMT_YUV422P9BE,
     154             :         AV_PIX_FMT_YUV444P9BE,
     155             :         AV_PIX_FMT_YUVA420P9BE,
     156             :         AV_PIX_FMT_YUVA422P9BE,
     157             :         AV_PIX_FMT_YUVA444P9BE,
     158             :         AV_PIX_FMT_GBRP9BE,
     159             :         AV_PIX_FMT_NONE,
     160             :     };
     161             :     static const enum AVPixelFormat out8_pixfmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
     162             :     static const enum AVPixelFormat out9le_pixfmts[] = { AV_PIX_FMT_GRAY9LE, AV_PIX_FMT_NONE };
     163             :     static const enum AVPixelFormat out9be_pixfmts[] = { AV_PIX_FMT_GRAY9BE, AV_PIX_FMT_NONE };
     164             :     static const enum AVPixelFormat out10le_pixfmts[] = { AV_PIX_FMT_GRAY10LE, AV_PIX_FMT_NONE };
     165             :     static const enum AVPixelFormat out10be_pixfmts[] = { AV_PIX_FMT_GRAY10BE, AV_PIX_FMT_NONE };
     166             :     static const enum AVPixelFormat out12le_pixfmts[] = { AV_PIX_FMT_GRAY12LE, AV_PIX_FMT_NONE };
     167             :     static const enum AVPixelFormat out12be_pixfmts[] = { AV_PIX_FMT_GRAY12BE, AV_PIX_FMT_NONE };
     168             :     static const enum AVPixelFormat out14le_pixfmts[] = { AV_PIX_FMT_GRAY14LE, AV_PIX_FMT_NONE };
     169             :     static const enum AVPixelFormat out14be_pixfmts[] = { AV_PIX_FMT_GRAY14BE, AV_PIX_FMT_NONE };
     170             :     static const enum AVPixelFormat out16le_pixfmts[] = { AV_PIX_FMT_GRAY16LE, AV_PIX_FMT_NONE };
     171             :     static const enum AVPixelFormat out16be_pixfmts[] = { AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_NONE };
     172             :     const enum AVPixelFormat *out_pixfmts, *in_pixfmts;
     173             :     const AVPixFmtDescriptor *desc;
     174             :     AVFilterFormats *avff;
     175           4 :     int i, ret, depth = 0, be = 0;
     176             : 
     177           8 :     if (!ctx->inputs[0]->in_formats ||
     178           4 :         !ctx->inputs[0]->in_formats->nb_formats) {
     179           0 :         return AVERROR(EAGAIN);
     180             :     }
     181             : 
     182           4 :     avff = ctx->inputs[0]->in_formats;
     183           4 :     desc = av_pix_fmt_desc_get(avff->formats[0]);
     184           4 :     depth = desc->comp[0].depth;
     185           4 :     be = desc->flags & AV_PIX_FMT_FLAG_BE;
     186           4 :     if (be) {
     187           0 :         in_pixfmts = in_pixfmts_be;
     188             :     } else {
     189           4 :         in_pixfmts = in_pixfmts_le;
     190             :     }
     191           4 :     if (!ctx->inputs[0]->out_formats)
     192           2 :         if ((ret = ff_formats_ref(ff_make_format_list(in_pixfmts), &ctx->inputs[0]->out_formats)) < 0)
     193           0 :             return ret;
     194             : 
     195          27 :     for (i = 1; i < avff->nb_formats; i++) {
     196          25 :         desc = av_pix_fmt_desc_get(avff->formats[i]);
     197          48 :         if (depth != desc->comp[0].depth ||
     198          23 :             be    != (desc->flags & AV_PIX_FMT_FLAG_BE)) {
     199           2 :             return AVERROR(EAGAIN);
     200             :         }
     201             :     }
     202             : 
     203           2 :     if (depth == 8)
     204           2 :         out_pixfmts = out8_pixfmts;
     205           0 :     else if (!be && depth == 9)
     206           0 :         out_pixfmts = out9le_pixfmts;
     207           0 :     else if (be && depth == 9)
     208           0 :         out_pixfmts = out9be_pixfmts;
     209           0 :     else if (!be && depth == 10)
     210           0 :         out_pixfmts = out10le_pixfmts;
     211           0 :     else if (be && depth == 10)
     212           0 :         out_pixfmts = out10be_pixfmts;
     213           0 :     else if (!be && depth == 12)
     214           0 :         out_pixfmts = out12le_pixfmts;
     215           0 :     else if (be && depth == 12)
     216           0 :         out_pixfmts = out12be_pixfmts;
     217           0 :     else if (!be && depth == 14)
     218           0 :         out_pixfmts = out14le_pixfmts;
     219           0 :     else if (be && depth == 14)
     220           0 :         out_pixfmts = out14be_pixfmts;
     221           0 :     else if (be)
     222           0 :         out_pixfmts = out16be_pixfmts;
     223             :     else
     224           0 :         out_pixfmts = out16le_pixfmts;
     225             : 
     226           4 :     for (i = 0; i < ctx->nb_outputs; i++)
     227           2 :         if ((ret = ff_formats_ref(ff_make_format_list(out_pixfmts), &ctx->outputs[i]->in_formats)) < 0)
     228           0 :             return ret;
     229           2 :     return 0;
     230             : }
     231             : 
     232           2 : static int config_input(AVFilterLink *inlink)
     233             : {
     234           2 :     AVFilterContext *ctx = inlink->dst;
     235           2 :     ExtractPlanesContext *s = ctx->priv;
     236           2 :     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
     237             :     int plane_avail, ret, i;
     238             :     uint8_t rgba_map[4];
     239             : 
     240           5 :     plane_avail = ((desc->flags & AV_PIX_FMT_FLAG_RGB) ? PLANE_R|PLANE_G|PLANE_B :
     241           1 :                                                  PLANE_Y |
     242           1 :                                 ((desc->nb_components > 2) ? PLANE_U|PLANE_V : 0)) |
     243           2 :                   ((desc->flags & AV_PIX_FMT_FLAG_ALPHA) ? PLANE_A : 0);
     244           2 :     if (s->requested_planes & ~plane_avail) {
     245           0 :         av_log(ctx, AV_LOG_ERROR, "Requested planes not available.\n");
     246           0 :         return AVERROR(EINVAL);
     247             :     }
     248           2 :     if ((ret = av_image_fill_linesizes(s->linesize, inlink->format, inlink->w)) < 0)
     249           0 :         return ret;
     250             : 
     251           2 :     s->depth = desc->comp[0].depth >> 3;
     252           2 :     s->step = av_get_padded_bits_per_pixel(desc) >> 3;
     253           3 :     s->is_packed = !(desc->flags & AV_PIX_FMT_FLAG_PLANAR) &&
     254           1 :                     (desc->nb_components > 1);
     255           2 :     if (desc->flags & AV_PIX_FMT_FLAG_RGB) {
     256           1 :         ff_fill_rgba_map(rgba_map, inlink->format);
     257           5 :         for (i = 0; i < 4; i++)
     258           4 :             s->map[i] = rgba_map[s->map[i]];
     259             :     }
     260             : 
     261           2 :     return 0;
     262             : }
     263             : 
     264           2 : static int config_output(AVFilterLink *outlink)
     265             : {
     266           2 :     AVFilterContext *ctx = outlink->src;
     267           2 :     AVFilterLink *inlink = ctx->inputs[0];
     268           2 :     ExtractPlanesContext *s = ctx->priv;
     269           2 :     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
     270           2 :     const int output = outlink->srcpad - ctx->output_pads;
     271             : 
     272           2 :     if (s->map[output] == 1 || s->map[output] == 2) {
     273           0 :         outlink->h = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
     274           0 :         outlink->w = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
     275             :     }
     276             : 
     277           2 :     return 0;
     278             : }
     279             : 
     280          50 : static void extract_from_packed(uint8_t *dst, int dst_linesize,
     281             :                                 const uint8_t *src, int src_linesize,
     282             :                                 int width, int height,
     283             :                                 int depth, int step, int comp)
     284             : {
     285             :     int x, y;
     286             : 
     287       14450 :     for (y = 0; y < height; y++) {
     288       14400 :         switch (depth) {
     289       14400 :         case 1:
     290     5083200 :             for (x = 0; x < width; x++)
     291     5068800 :                 dst[x] = src[x * step + comp];
     292       14400 :             break;
     293           0 :         case 2:
     294           0 :             for (x = 0; x < width; x++) {
     295           0 :                 dst[x * 2    ] = src[x * step + comp * 2    ];
     296           0 :                 dst[x * 2 + 1] = src[x * step + comp * 2 + 1];
     297             :             }
     298           0 :             break;
     299             :         }
     300       14400 :         dst += dst_linesize;
     301       14400 :         src += src_linesize;
     302             :     }
     303          50 : }
     304             : 
     305         100 : static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
     306             : {
     307         100 :     AVFilterContext *ctx = inlink->dst;
     308         100 :     ExtractPlanesContext *s = ctx->priv;
     309         100 :     int i, eof = 0, ret = 0;
     310             : 
     311         200 :     for (i = 0; i < ctx->nb_outputs; i++) {
     312         100 :         AVFilterLink *outlink = ctx->outputs[i];
     313         100 :         const int idx = s->map[i];
     314             :         AVFrame *out;
     315             : 
     316         100 :         if (outlink->status_in)
     317           0 :             continue;
     318             : 
     319         100 :         out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
     320         100 :         if (!out) {
     321           0 :             ret = AVERROR(ENOMEM);
     322           0 :             break;
     323             :         }
     324         100 :         av_frame_copy_props(out, frame);
     325             : 
     326         100 :         if (s->is_packed) {
     327         150 :             extract_from_packed(out->data[0], out->linesize[0],
     328         100 :                                 frame->data[0], frame->linesize[0],
     329             :                                 outlink->w, outlink->h,
     330             :                                 s->depth,
     331             :                                 s->step, idx);
     332             :         } else {
     333         150 :             av_image_copy_plane(out->data[0], out->linesize[0],
     334         100 :                                 frame->data[idx], frame->linesize[idx],
     335             :                                 s->linesize[idx], outlink->h);
     336             :         }
     337             : 
     338         100 :         ret = ff_filter_frame(outlink, out);
     339         100 :         if (ret == AVERROR_EOF)
     340           0 :             eof++;
     341         100 :         else if (ret < 0)
     342           0 :             break;
     343             :     }
     344         100 :     av_frame_free(&frame);
     345             : 
     346         100 :     if (eof == ctx->nb_outputs)
     347           0 :         ret = AVERROR_EOF;
     348         100 :     else if (ret == AVERROR_EOF)
     349           0 :         ret = 0;
     350         100 :     return ret;
     351             : }
     352             : 
     353           4 : static av_cold int init(AVFilterContext *ctx)
     354             : {
     355           4 :     ExtractPlanesContext *s = ctx->priv;
     356           4 :     int planes = (s->requested_planes & 0xf) | (s->requested_planes >> 4);
     357             :     int i, ret;
     358             : 
     359          20 :     for (i = 0; i < 4; i++) {
     360             :         char *name;
     361          16 :         AVFilterPad pad = { 0 };
     362             : 
     363          16 :         if (!(planes & (1 << i)))
     364          12 :             continue;
     365             : 
     366           4 :         name = av_asprintf("out%d", ctx->nb_outputs);
     367           4 :         if (!name)
     368           0 :             return AVERROR(ENOMEM);
     369           4 :         s->map[ctx->nb_outputs] = i;
     370           4 :         pad.name = name;
     371           4 :         pad.type = AVMEDIA_TYPE_VIDEO;
     372           4 :         pad.config_props = config_output;
     373             : 
     374           4 :         if ((ret = ff_insert_outpad(ctx, ctx->nb_outputs, &pad)) < 0) {
     375           0 :             av_freep(&pad.name);
     376           0 :             return ret;
     377             :         }
     378             :     }
     379             : 
     380           4 :     return 0;
     381             : }
     382             : 
     383           4 : static av_cold void uninit(AVFilterContext *ctx)
     384             : {
     385             :     int i;
     386             : 
     387           8 :     for (i = 0; i < ctx->nb_outputs; i++)
     388           4 :         av_freep(&ctx->output_pads[i].name);
     389           4 : }
     390             : 
     391             : static const AVFilterPad extractplanes_inputs[] = {
     392             :     {
     393             :         .name         = "default",
     394             :         .type         = AVMEDIA_TYPE_VIDEO,
     395             :         .filter_frame = filter_frame,
     396             :         .config_props = config_input,
     397             :     },
     398             :     { NULL }
     399             : };
     400             : 
     401             : AVFilter ff_vf_extractplanes = {
     402             :     .name          = "extractplanes",
     403             :     .description   = NULL_IF_CONFIG_SMALL("Extract planes as grayscale frames."),
     404             :     .priv_size     = sizeof(ExtractPlanesContext),
     405             :     .priv_class    = &extractplanes_class,
     406             :     .init          = init,
     407             :     .uninit        = uninit,
     408             :     .query_formats = query_formats,
     409             :     .inputs        = extractplanes_inputs,
     410             :     .outputs       = NULL,
     411             :     .flags         = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
     412             : };
     413             : 
     414             : #if CONFIG_ALPHAEXTRACT_FILTER
     415             : 
     416           4 : static av_cold int init_alphaextract(AVFilterContext *ctx)
     417             : {
     418           4 :     ExtractPlanesContext *s = ctx->priv;
     419             : 
     420           4 :     s->requested_planes = PLANE_A;
     421             : 
     422           4 :     return init(ctx);
     423             : }
     424             : 
     425             : AVFilter ff_vf_alphaextract = {
     426             :     .name           = "alphaextract",
     427             :     .description    = NULL_IF_CONFIG_SMALL("Extract an alpha channel as a "
     428             :                       "grayscale image component."),
     429             :     .priv_size      = sizeof(ExtractPlanesContext),
     430             :     .init           = init_alphaextract,
     431             :     .uninit         = uninit,
     432             :     .query_formats  = query_formats,
     433             :     .inputs         = extractplanes_inputs,
     434             :     .outputs        = NULL,
     435             :     .flags          = AVFILTER_FLAG_DYNAMIC_OUTPUTS,
     436             : };
     437             : #endif  /* CONFIG_ALPHAEXTRACT_FILTER */

Generated by: LCOV version 1.13