diff options
author | Paul B Mahol <onemda@gmail.com> | 2021-02-07 21:41:04 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2021-02-07 21:45:26 +0100 |
commit | 629dd8efb5ec74a27f676f7252c517ed96879cd5 (patch) | |
tree | 2c461ede5139d258a5db355f251629c7baa08afe | |
parent | cae57cae1f70371591223a5f9fe3f370ce8dfd50 (diff) | |
download | ffmpeg-629dd8efb5ec74a27f676f7252c517ed96879cd5.tar.gz |
avfilter/vf_extractplanes: add float formats support
-rw-r--r-- | libavfilter/drawutils.c | 4 | ||||
-rw-r--r-- | libavfilter/vf_extractplanes.c | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c index 71fe25692c..0a59ff9987 100644 --- a/libavfilter/drawutils.c +++ b/libavfilter/drawutils.c @@ -70,6 +70,10 @@ int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt) case AV_PIX_FMT_GBRAP12BE: case AV_PIX_FMT_GBRAP16LE: case AV_PIX_FMT_GBRAP16BE: + case AV_PIX_FMT_GBRPF32LE: + case AV_PIX_FMT_GBRPF32BE: + case AV_PIX_FMT_GBRAPF32LE: + case AV_PIX_FMT_GBRAPF32BE: case AV_PIX_FMT_GBRP: rgba_map[GREEN] = 0; rgba_map[BLUE ] = 1; rgba_map[RED ] = 2; rgba_map[ALPHA] = 3; break; default: /* unsupported */ return AVERROR(EINVAL); diff --git a/libavfilter/vf_extractplanes.c b/libavfilter/vf_extractplanes.c index b10cd13f8f..01ce4d1a3d 100644 --- a/libavfilter/vf_extractplanes.c +++ b/libavfilter/vf_extractplanes.c @@ -115,16 +115,22 @@ AVFILTER_DEFINE_CLASS(extractplanes); AV_PIX_FMT_YUV422P14##suf, \ AV_PIX_FMT_YUV444P14##suf +#define FLOAT_FORMATS(suf) \ + AV_PIX_FMT_GRAYF32##suf, \ + AV_PIX_FMT_GBRPF32##suf, AV_PIX_FMT_GBRAPF32##suf \ + static int query_formats(AVFilterContext *ctx) { static const enum AVPixelFormat in_pixfmts_le[] = { EIGHTBIT_FORMATS, HIGHDEPTH_FORMATS(LE), + FLOAT_FORMATS(LE), AV_PIX_FMT_NONE, }; static const enum AVPixelFormat in_pixfmts_be[] = { EIGHTBIT_FORMATS, HIGHDEPTH_FORMATS(BE), + FLOAT_FORMATS(BE), AV_PIX_FMT_NONE, }; static const enum AVPixelFormat out8_pixfmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE }; @@ -138,6 +144,8 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat out14be_pixfmts[] = { AV_PIX_FMT_GRAY14BE, AV_PIX_FMT_NONE }; static const enum AVPixelFormat out16le_pixfmts[] = { AV_PIX_FMT_GRAY16LE, AV_PIX_FMT_NONE }; static const enum AVPixelFormat out16be_pixfmts[] = { AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_NONE }; + static const enum AVPixelFormat out32le_pixfmts[] = { AV_PIX_FMT_GRAYF32LE, AV_PIX_FMT_NONE }; + static const enum AVPixelFormat out32be_pixfmts[] = { AV_PIX_FMT_GRAYF32BE, AV_PIX_FMT_NONE }; const enum AVPixelFormat *out_pixfmts, *in_pixfmts; const AVPixFmtDescriptor *desc; AVFilterFormats *avff; @@ -187,10 +195,14 @@ static int query_formats(AVFilterContext *ctx) out_pixfmts = out14le_pixfmts; else if (be && depth == 14) out_pixfmts = out14be_pixfmts; - else if (be) + else if (be && depth == 16) out_pixfmts = out16be_pixfmts; - else + else if (!be && depth == 16) out_pixfmts = out16le_pixfmts; + else if (be && depth == 32) + out_pixfmts = out32be_pixfmts; + else + out_pixfmts = out32le_pixfmts; for (i = 0; i < ctx->nb_outputs; i++) if ((ret = ff_formats_ref(ff_make_format_list(out_pixfmts), &ctx->outputs[i]->incfg.formats)) < 0) |