History

avfilter/vf_extractplanes: add float formats support

Paul B Mahol committed 5 years ago

Commit 629dd8e1 parent cae57ca2 files · +18 −2Browse files

Unified · Split

2 files
  1. libavfilter/drawutils.c +4 −0
  2. libavfilter/vf_extractplanes.c +14 −2
libavfilter/drawutils.c+4−0
@@ -70,6 +70,10 @@ int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt) · 69 unmodified lines
70 case AV_PIX_FMT_GBRAP12BE:70 case AV_PIX_FMT_GBRAP12BE:
71 case AV_PIX_FMT_GBRAP16LE:71 case AV_PIX_FMT_GBRAP16LE:
72 case AV_PIX_FMT_GBRAP16BE:72 case AV_PIX_FMT_GBRAP16BE:
73 case AV_PIX_FMT_GBRPF32LE:
74 case AV_PIX_FMT_GBRPF32BE:
75 case AV_PIX_FMT_GBRAPF32LE:
76 case AV_PIX_FMT_GBRAPF32BE:
73 case AV_PIX_FMT_GBRP: rgba_map[GREEN] = 0; rgba_map[BLUE ] = 1; rgba_map[RED ] = 2; rgba_map[ALPHA] = 3; break;77 case AV_PIX_FMT_GBRP: rgba_map[GREEN] = 0; rgba_map[BLUE ] = 1; rgba_map[RED ] = 2; rgba_map[ALPHA] = 3; break;
74 default: /* unsupported */78 default: /* unsupported */
75 return AVERROR(EINVAL);79 return AVERROR(EINVAL);
libavfilter/vf_extractplanes.c+14−2
@@ -115,16 +115,22 @@ AVFILTER_DEFINE_CLASS(extractplanes); · 114 unmodified lines
115 AV_PIX_FMT_YUV422P14##suf, \115 AV_PIX_FMT_YUV422P14##suf, \
116 AV_PIX_FMT_YUV444P14##suf116 AV_PIX_FMT_YUV444P14##suf
117 117
118#define FLOAT_FORMATS(suf) \
119 AV_PIX_FMT_GRAYF32##suf, \
120 AV_PIX_FMT_GBRPF32##suf, AV_PIX_FMT_GBRAPF32##suf \
121
118static int query_formats(AVFilterContext *ctx)122static int query_formats(AVFilterContext *ctx)
119{123{
120 static const enum AVPixelFormat in_pixfmts_le[] = {124 static const enum AVPixelFormat in_pixfmts_le[] = {
121 EIGHTBIT_FORMATS,125 EIGHTBIT_FORMATS,
122 HIGHDEPTH_FORMATS(LE),126 HIGHDEPTH_FORMATS(LE),
127 FLOAT_FORMATS(LE),
123 AV_PIX_FMT_NONE,128 AV_PIX_FMT_NONE,
124 };129 };
125 static const enum AVPixelFormat in_pixfmts_be[] = {130 static const enum AVPixelFormat in_pixfmts_be[] = {
126 EIGHTBIT_FORMATS,131 EIGHTBIT_FORMATS,
127 HIGHDEPTH_FORMATS(BE),132 HIGHDEPTH_FORMATS(BE),
133 FLOAT_FORMATS(BE),
128 AV_PIX_FMT_NONE,134 AV_PIX_FMT_NONE,
129 };135 };
130 static const enum AVPixelFormat out8_pixfmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };136 static const enum AVPixelFormat out8_pixfmts[] = { AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE };
@@ -138,6 +144,8 @@ static int query_formats(AVFilterContext *ctx) · 7 unmodified lines
138 static const enum AVPixelFormat out14be_pixfmts[] = { AV_PIX_FMT_GRAY14BE, AV_PIX_FMT_NONE };144 static const enum AVPixelFormat out14be_pixfmts[] = { AV_PIX_FMT_GRAY14BE, AV_PIX_FMT_NONE };
139 static const enum AVPixelFormat out16le_pixfmts[] = { AV_PIX_FMT_GRAY16LE, AV_PIX_FMT_NONE };145 static const enum AVPixelFormat out16le_pixfmts[] = { AV_PIX_FMT_GRAY16LE, AV_PIX_FMT_NONE };
140 static const enum AVPixelFormat out16be_pixfmts[] = { AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_NONE };146 static const enum AVPixelFormat out16be_pixfmts[] = { AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_NONE };
147 static const enum AVPixelFormat out32le_pixfmts[] = { AV_PIX_FMT_GRAYF32LE, AV_PIX_FMT_NONE };
148 static const enum AVPixelFormat out32be_pixfmts[] = { AV_PIX_FMT_GRAYF32BE, AV_PIX_FMT_NONE };
141 const enum AVPixelFormat *out_pixfmts, *in_pixfmts;149 const enum AVPixelFormat *out_pixfmts, *in_pixfmts;
142 const AVPixFmtDescriptor *desc;150 const AVPixFmtDescriptor *desc;
143 AVFilterFormats *avff;151 AVFilterFormats *avff;
@@ -187,10 +195,14 @@ static int query_formats(AVFilterContext *ctx) · 43 unmodified lines
187 out_pixfmts = out14le_pixfmts;195 out_pixfmts = out14le_pixfmts;
188 else if (be && depth == 14)196 else if (be && depth == 14)
189 out_pixfmts = out14be_pixfmts;197 out_pixfmts = out14be_pixfmts;
190 else if (be)198 else if (be && depth == 16)
191 out_pixfmts = out16be_pixfmts;199 out_pixfmts = out16be_pixfmts;
192 else200 else if (!be && depth == 16)
193 out_pixfmts = out16le_pixfmts;201 out_pixfmts = out16le_pixfmts;
202 else if (be && depth == 32)
203 out_pixfmts = out32be_pixfmts;
204 else
205 out_pixfmts = out32le_pixfmts;
194 206
195 for (i = 0; i < ctx->nb_outputs; i++)207 for (i = 0; i < ctx->nb_outputs; i++)
196 if ((ret = ff_formats_ref(ff_make_format_list(out_pixfmts), &ctx->outputs[i]->incfg.formats)) < 0)208 if ((ret = ff_formats_ref(ff_make_format_list(out_pixfmts), &ctx->outputs[i]->incfg.formats)) < 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t