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
140 AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, \140 AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, \
141 AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16,141 AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16,
142 142
143static int query_formats(AVFilterContext *ctx)143static int query_formats(const AVFilterContext *ctx,
144 AVFilterFormatsConfig **cfg_in,
145 AVFilterFormatsConfig **cfg_out)
144{146{
145 LUT2Context *s = ctx->priv;147 const LUT2Context *s = ctx->priv;
146 static const enum AVPixelFormat all_pix_fmts[] = {148 static const enum AVPixelFormat all_pix_fmts[] = {
147 BIT8_FMTS149 BIT8_FMTS
148 BIT9_FMTS150 BIT9_FMTS
@@ -178,9 +180,9 @@ static int query_formats(AVFilterContext *ctx) · 29 unmodified lines
178 int ret;180 int ret;
179 181
180 if (s->tlut2 || !s->odepth)182 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);
182 184
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);
184 if (ret < 0)186 if (ret < 0)
185 return ret;187 return ret;
186 188
@@ -191,11 +193,10 @@ static int query_formats(AVFilterContext *ctx) · 4 unmodified lines
191 case 12: pix_fmts = bit12_pix_fmts; break;193 case 12: pix_fmts = bit12_pix_fmts; break;
192 case 14: pix_fmts = bit14_pix_fmts; break;194 case 14: pix_fmts = bit14_pix_fmts; break;
193 case 16: pix_fmts = bit16_pix_fmts; break;195 case 16: pix_fmts = bit16_pix_fmts; break;
194 default: av_log(ctx, AV_LOG_ERROR, "Unsupported output bit depth %d.\n", s->odepth);196 default: av_assert0(0);
195 return AVERROR(EINVAL);
196 }197 }
197 198
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);
199}200}
200 201
201static int config_inputx(AVFilterLink *inlink)202static int config_inputx(AVFilterLink *inlink)
@@ -573,7 +574,7 @@ const AVFilter ff_vf_lut2 = { · 371 unmodified lines
573 .activate = activate,574 .activate = activate,
574 FILTER_INPUTS(inputs),575 FILTER_INPUTS(inputs),
575 FILTER_OUTPUTS(outputs),576 FILTER_OUTPUTS(outputs),
576 FILTER_QUERY_FUNC(query_formats),577 FILTER_QUERY_FUNC2(query_formats),
577 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |578 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
578 AVFILTER_FLAG_SLICE_THREADS,579 AVFILTER_FLAG_SLICE_THREADS,
579 .process_command = process_command,580 .process_command = process_command,
@@ -587,6 +588,12 @@ static av_cold int init(AVFilterContext *ctx) · 7 unmodified lines
587 588
588 s->tlut2 = !strcmp(ctx->filter->name, "tlut2");589 s->tlut2 = !strcmp(ctx->filter->name, "tlut2");
589 590
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
590 return 0;597 return 0;
591}598}
592 599
@@ -663,7 +670,7 @@ const AVFilter ff_vf_tlut2 = { · 70 unmodified lines
663 .uninit = uninit,670 .uninit = uninit,
664 FILTER_INPUTS(tlut2_inputs),671 FILTER_INPUTS(tlut2_inputs),
665 FILTER_OUTPUTS(tlut2_outputs),672 FILTER_OUTPUTS(tlut2_outputs),
666 FILTER_QUERY_FUNC(query_formats),673 FILTER_QUERY_FUNC2(query_formats),
667 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |674 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
668 AVFILTER_FLAG_SLICE_THREADS,675 AVFILTER_FLAG_SLICE_THREADS,
669 .process_command = process_command,676 .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