mirror of https://git.ffmpeg.org/ffmpeg.git
lavfi/vf_lut2: switch to query_func2()
This commit is contained in:
parent
57e81f36a4
commit
4b2580c184
|
@ -140,9 +140,11 @@ static av_cold void uninit(AVFilterContext *ctx)
|
||||||
AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, \
|
AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16, \
|
||||||
AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16,
|
AV_PIX_FMT_GBRP16, AV_PIX_FMT_GBRAP16, AV_PIX_FMT_GRAY16,
|
||||||
|
|
||||||
static int query_formats(AVFilterContext *ctx)
|
static int query_formats(const AVFilterContext *ctx,
|
||||||
|
AVFilterFormatsConfig **cfg_in,
|
||||||
|
AVFilterFormatsConfig **cfg_out)
|
||||||
{
|
{
|
||||||
LUT2Context *s = ctx->priv;
|
const LUT2Context *s = ctx->priv;
|
||||||
static const enum AVPixelFormat all_pix_fmts[] = {
|
static const enum AVPixelFormat all_pix_fmts[] = {
|
||||||
BIT8_FMTS
|
BIT8_FMTS
|
||||||
BIT9_FMTS
|
BIT9_FMTS
|
||||||
|
@ -178,9 +180,9 @@ static int query_formats(AVFilterContext *ctx)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (s->tlut2 || !s->odepth)
|
if (s->tlut2 || !s->odepth)
|
||||||
return ff_set_common_formats_from_list(ctx, all_pix_fmts);
|
return ff_set_common_formats_from_list2(ctx, cfg_in, cfg_out, all_pix_fmts);
|
||||||
|
|
||||||
ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), &ctx->inputs[0]->outcfg.formats);
|
ret = ff_formats_ref(ff_make_format_list(all_pix_fmts), &cfg_in[0]->formats);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -191,11 +193,10 @@ static int query_formats(AVFilterContext *ctx)
|
||||||
case 12: pix_fmts = bit12_pix_fmts; break;
|
case 12: pix_fmts = bit12_pix_fmts; break;
|
||||||
case 14: pix_fmts = bit14_pix_fmts; break;
|
case 14: pix_fmts = bit14_pix_fmts; break;
|
||||||
case 16: pix_fmts = bit16_pix_fmts; break;
|
case 16: pix_fmts = bit16_pix_fmts; break;
|
||||||
default: av_log(ctx, AV_LOG_ERROR, "Unsupported output bit depth %d.\n", s->odepth);
|
default: av_assert0(0);
|
||||||
return AVERROR(EINVAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ff_formats_ref(ff_make_format_list(pix_fmts), &ctx->outputs[0]->incfg.formats);
|
return ff_formats_ref(ff_make_format_list(pix_fmts), &cfg_out[0]->formats);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_inputx(AVFilterLink *inlink)
|
static int config_inputx(AVFilterLink *inlink)
|
||||||
|
@ -573,7 +574,7 @@ const AVFilter ff_vf_lut2 = {
|
||||||
.activate = activate,
|
.activate = activate,
|
||||||
FILTER_INPUTS(inputs),
|
FILTER_INPUTS(inputs),
|
||||||
FILTER_OUTPUTS(outputs),
|
FILTER_OUTPUTS(outputs),
|
||||||
FILTER_QUERY_FUNC(query_formats),
|
FILTER_QUERY_FUNC2(query_formats),
|
||||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
|
||||||
AVFILTER_FLAG_SLICE_THREADS,
|
AVFILTER_FLAG_SLICE_THREADS,
|
||||||
.process_command = process_command,
|
.process_command = process_command,
|
||||||
|
@ -587,6 +588,12 @@ static av_cold int init(AVFilterContext *ctx)
|
||||||
|
|
||||||
s->tlut2 = !strcmp(ctx->filter->name, "tlut2");
|
s->tlut2 = !strcmp(ctx->filter->name, "tlut2");
|
||||||
|
|
||||||
|
if (!(s->odepth == 0 || s->odepth == 8 || s->odepth == 9 || s->odepth == 10 ||
|
||||||
|
s->odepth == 12 || s->odepth == 14 || s->odepth == 16)) {
|
||||||
|
av_log(ctx, AV_LOG_ERROR, "Unsupported output bit depth %d.\n", s->odepth);
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,7 +670,7 @@ const AVFilter ff_vf_tlut2 = {
|
||||||
.uninit = uninit,
|
.uninit = uninit,
|
||||||
FILTER_INPUTS(tlut2_inputs),
|
FILTER_INPUTS(tlut2_inputs),
|
||||||
FILTER_OUTPUTS(tlut2_outputs),
|
FILTER_OUTPUTS(tlut2_outputs),
|
||||||
FILTER_QUERY_FUNC(query_formats),
|
FILTER_QUERY_FUNC2(query_formats),
|
||||||
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
|
||||||
AVFILTER_FLAG_SLICE_THREADS,
|
AVFILTER_FLAG_SLICE_THREADS,
|
||||||
.process_command = process_command,
|
.process_command = process_command,
|
||||||
|
|
Loading…
Reference in New Issue