History

lavfi/vf_lut2: switch to query_func2()

Anton Khirnov committed 2 years ago

Commit 4b2580c1 parent 57e81f31 file · +16 −9Browse files

Unified · Split

libavfilter/vf_lut2.c+16−9
@@ -140,9 +140,11 @@ static av_cold void uninit(AVFilterContext *ctx) · 139 unmodified lines
140140 AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, \
141141 AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16,
142142
143−static int query_formats(AVFilterContext *ctx)
143+static int query_formats(const AVFilterContext *ctx,
144+ AVFilterFormatsConfig **cfg_in,
145+ AVFilterFormatsConfig **cfg_out)
144146 {
145− LUT2Context *s = ctx->priv;
147+ const LUT2Context *s = ctx->priv;
146148 static const enum AVPixelFormat all_pix_fmts[] = {
147149 BIT8_FMTS
148150 BIT9_FMTS
@@ -178,9 +180,9 @@ static int query_formats(AVFilterContext *ctx) · 29 unmodified lines
178180 int ret;
179181
180182 if (s->tlut2 || !s->odepth)
181− return ff_set_common_formats_from_list(ctx, all_pix_fmts);
183+ return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, all_pix_fmts);
182184
183− ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), &ctx->inputs[0]->outcfg.formats);
185+ ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), &cfg_in[0]->formats);
184186 if (ret < 0)
185187 return ret;
186188
@@ -191,11 +193,10 @@ static int query_formats(AVFilterContext *ctx) · 4 unmodified lines
191193 case 12: pix_fmts = bit12_pix_fmts; break;
192194 case 14: pix_fmts = bit14_pix_fmts; break;
193195 case 16: pix_fmts = bit16_pix_fmts; break;
194− default: av_log(ctx, AV_LOG_ERROR, "Unsupported output bit depth %d.\n", s->odepth);
195− return AVERROR(EINVAL);
196+ default: av_assert0(0);
196197 }
197198
198− return ff_formats_ref(ff_make_format_list(pix_fmts), &ctx->outputs[0]->incfg.formats);
199+ return ff_formats_ref(ff_make_format_list(pix_fmts), &cfg_out[0]->formats);
199200 }
200201
201202 static int config_inputx(AVFilterLink *inlink)
@@ -573,7 +574,7 @@ const AVFilter ff_vf_lut2 = { · 371 unmodified lines
573574 .activate = activate,
574575 FILTER_INPUTS(inputs),
575576 FILTER_OUTPUTS(outputs),
576− FILTER_QUERY_FUNC(query_formats),
577+ FILTER_QUERY_FUNC2(query_formats),
577578 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
578579 AVFILTER_FLAG_SLICE_THREADS,
579580 .process_command = process_command,
@@ -587,6 +588,12 @@ static av_cold int init(AVFilterContext *ctx) · 7 unmodified lines
587588
588589 s->tlut2 = !strcmp(ctx->filter->name, "tlut2");
589590
591+ if (!(s->odepth == 0 || s->odepth == 8 || s->odepth == 9 || s->odepth == 10 ||
592+ s->odepth == 12 || s->odepth == 14 || s->odepth == 16)) {
593+ av_log(ctx, AV_LOG_ERROR, "Unsupported output bit depth %d.\n", s->odepth);
594+ return AVERROR(EINVAL);
595+ }
596+
590597 return 0;
591598 }
592599
@@ -663,7 +670,7 @@ const AVFilter ff_vf_tlut2 = { · 70 unmodified lines
663670 .uninit = uninit,
664671 FILTER_INPUTS(tlut2_inputs),
665672 FILTER_OUTPUTS(tlut2_outputs),
666− FILTER_QUERY_FUNC(query_formats),
673+ FILTER_QUERY_FUNC2(query_formats),
667674 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
668675 AVFILTER_FLAG_SLICE_THREADS,
669676 .process_command = process_command,

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