2017-02-19 17:23:07 +00:00
|
|
|
/*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2017-02-27 21:29:46 +00:00
|
|
|
#include "libavutil/common.h"
|
2017-02-19 17:23:07 +00:00
|
|
|
#include "libavutil/opt.h"
|
|
|
|
#include "libavutil/pixdesc.h"
|
|
|
|
|
|
|
|
#include "avfilter.h"
|
|
|
|
#include "formats.h"
|
|
|
|
#include "internal.h"
|
|
|
|
#include "video.h"
|
2018-01-08 08:07:38 +00:00
|
|
|
#include "vaapi_vpp.h"
|
2017-02-19 17:23:07 +00:00
|
|
|
|
|
|
|
#define MAX_REFERENCES 8
|
|
|
|
|
|
|
|
typedef struct DeintVAAPIContext {
|
2018-01-24 00:40:59 +00:00
|
|
|
VAAPIVPPContext vpp_ctx; // must be the first field
|
2017-02-19 17:23:07 +00:00
|
|
|
|
|
|
|
int mode;
|
2017-02-27 21:29:46 +00:00
|
|
|
int field_rate;
|
|
|
|
int auto_enable;
|
2017-02-19 17:23:07 +00:00
|
|
|
|
|
|
|
VAProcFilterCapDeinterlacing
|
|
|
|
deint_caps[VAProcDeinterlacingCount];
|
|
|
|
int nb_deint_caps;
|
|
|
|
VAProcPipelineCaps pipeline_caps;
|
|
|
|
|
|
|
|
int queue_depth;
|
|
|
|
int queue_count;
|
|
|
|
AVFrame *frame_queue[MAX_REFERENCES];
|
2017-02-27 21:29:46 +00:00
|
|
|
int extra_delay_for_timestamps;
|
2017-02-19 17:23:07 +00:00
|
|
|
} DeintVAAPIContext;
|
|
|
|
|
|
|
|
static const char *deint_vaapi_mode_name(int mode)
|
|
|
|
{
|
|
|
|
switch (mode) {
|
|
|
|
#define D(name) case VAProcDeinterlacing ## name: return #name
|
|
|
|
D(Bob);
|
|
|
|
D(Weave);
|
|
|
|
D(MotionAdaptive);
|
|
|
|
D(MotionCompensated);
|
|
|
|
#undef D
|
|
|
|
default:
|
|
|
|
return "Invalid";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-08 08:07:38 +00:00
|
|
|
static void deint_vaapi_pipeline_uninit(AVFilterContext *avctx)
|
2017-02-19 17:23:07 +00:00
|
|
|
{
|
2018-01-08 08:07:38 +00:00
|
|
|
DeintVAAPIContext *ctx = avctx->priv;
|
2017-02-19 17:23:07 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ctx->queue_count; i++)
|
|
|
|
av_frame_free(&ctx->frame_queue[i]);
|
|
|
|
ctx->queue_count = 0;
|
|
|
|
|
2018-01-08 08:07:38 +00:00
|
|
|
ff_vaapi_vpp_pipeline_uninit(avctx);
|
2017-02-19 17:23:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int deint_vaapi_build_filter_params(AVFilterContext *avctx)
|
|
|
|
{
|
2018-01-08 08:07:38 +00:00
|
|
|
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
|
|
|
DeintVAAPIContext *ctx = avctx->priv;
|
2017-02-19 17:23:07 +00:00
|
|
|
VAStatus vas;
|
|
|
|
VAProcFilterParameterBufferDeinterlacing params;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
ctx->nb_deint_caps = VAProcDeinterlacingCount;
|
2018-01-08 08:07:38 +00:00
|
|
|
vas = vaQueryVideoProcFilterCaps(vpp_ctx->hwctx->display,
|
|
|
|
vpp_ctx->va_context,
|
2017-02-19 17:23:07 +00:00
|
|
|
VAProcFilterDeinterlacing,
|
|
|
|
&ctx->deint_caps,
|
|
|
|
&ctx->nb_deint_caps);
|
|
|
|
if (vas != VA_STATUS_SUCCESS) {
|
|
|
|
av_log(avctx, AV_LOG_ERROR, "Failed to query deinterlacing "
|
|
|
|
"caps: %d (%s).\n", vas, vaErrorStr(vas));
|
|
|
|
return AVERROR(EIO);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->mode == VAProcDeinterlacingNone) {
|
|
|
|
for (i = 0; i < ctx->nb_deint_caps; i++) {
|
|
|
|
if (ctx->deint_caps[i].type > ctx->mode)
|
|
|
|
ctx->mode = ctx->deint_caps[i].type;
|
|
|
|
}
|
|
|
|
av_log(avctx, AV_LOG_VERBOSE, "Picking %d (%s) as default "
|
|
|
|
"deinterlacing mode.\n", ctx->mode,
|
|
|
|
deint_vaapi_mode_name(ctx->mode));
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < ctx->nb_deint_caps; i++) {
|
|
|
|
if (ctx->deint_caps[i].type == ctx->mode)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i >= ctx->nb_deint_caps) {
|
|
|
|
av_log(avctx, AV_LOG_ERROR, "Deinterlacing mode %d (%s) is "
|
|
|
|
"not supported.\n", ctx->mode,
|
|
|
|
deint_vaapi_mode_name(ctx->mode));
|
2019-01-14 07:29:54 +00:00
|
|
|
return AVERROR(EINVAL);
|
2017-02-19 17:23:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
params.type = VAProcFilterDeinterlacing;
|
|
|
|
params.algorithm = ctx->mode;
|
|
|
|
params.flags = 0;
|
|
|
|
|
2018-01-08 08:07:38 +00:00
|
|
|
vas = ff_vaapi_vpp_make_param_buffers(avctx,
|
|
|
|
VAProcFilterParameterBufferType,
|
|
|
|
¶ms,
|
|
|
|
sizeof(params),
|
|
|
|
1);
|
|
|
|
if (vas)
|
|
|
|
return vas;
|
|
|
|
|
|
|
|
vas = vaQueryVideoProcPipelineCaps(vpp_ctx->hwctx->display,
|
|
|
|
vpp_ctx->va_context,
|
|
|
|
&vpp_ctx->filter_buffers[0], 1,
|
2017-02-19 17:23:07 +00:00
|
|
|
&ctx->pipeline_caps);
|
|
|
|
if (vas != VA_STATUS_SUCCESS) {
|
|
|
|
av_log(avctx, AV_LOG_ERROR, "Failed to query pipeline "
|
|
|
|
"caps: %d (%s).\n", vas, vaErrorStr(vas));
|
|
|
|
return AVERROR(EIO);
|
|
|
|
}
|
|
|
|
|
2017-02-27 21:29:46 +00:00
|
|
|
ctx->extra_delay_for_timestamps = ctx->field_rate == 2 &&
|
|
|
|
ctx->pipeline_caps.num_backward_references == 0;
|
|
|
|
|
2017-02-19 17:23:07 +00:00
|
|
|
ctx->queue_depth = ctx->pipeline_caps.num_backward_references +
|
2017-02-27 21:29:46 +00:00
|
|
|
ctx->pipeline_caps.num_forward_references +
|
|
|
|
ctx->extra_delay_for_timestamps + 1;
|
2017-02-19 17:23:07 +00:00
|
|
|
if (ctx->queue_depth > MAX_REFERENCES) {
|
|
|
|
av_log(avctx, AV_LOG_ERROR, "Pipeline requires too many "
|
|
|
|
"references (%u forward, %u back).\n",
|
|
|
|
ctx->pipeline_caps.num_forward_references,
|
|
|
|
ctx->pipeline_caps.num_backward_references);
|
|
|
|
return AVERROR(ENOSYS);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int deint_vaapi_config_output(AVFilterLink *outlink)
|
|
|
|
{
|
2018-01-08 08:07:38 +00:00
|
|
|
AVFilterLink *inlink = outlink->src->inputs[0];
|
|
|
|
AVFilterContext *avctx = outlink->src;
|
|
|
|
DeintVAAPIContext *ctx = avctx->priv;
|
2017-02-19 17:23:07 +00:00
|
|
|
int err;
|
|
|
|
|
2018-01-08 08:07:38 +00:00
|
|
|
err = ff_vaapi_vpp_config_output(outlink);
|
2017-02-19 17:23:07 +00:00
|
|
|
if (err < 0)
|
2018-01-08 08:07:38 +00:00
|
|
|
return err;
|
2017-02-27 21:29:46 +00:00
|
|
|
outlink->time_base = av_mul_q(inlink->time_base,
|
|
|
|
(AVRational) { 1, ctx->field_rate });
|
|
|
|
outlink->frame_rate = av_mul_q(inlink->frame_rate,
|
|
|
|
(AVRational) { ctx->field_rate, 1 });
|
2017-02-19 17:23:07 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame)
|
|
|
|
{
|
|
|
|
AVFilterContext *avctx = inlink->dst;
|
|
|
|
AVFilterLink *outlink = avctx->outputs[0];
|
2018-01-08 08:07:38 +00:00
|
|
|
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
|
|
|
DeintVAAPIContext *ctx = avctx->priv;
|
|
|
|
AVFrame *output_frame = NULL;
|
2019-03-31 14:39:35 +00:00
|
|
|
VASurfaceID input_surface;
|
2017-02-19 17:23:07 +00:00
|
|
|
VASurfaceID backward_references[MAX_REFERENCES];
|
|
|
|
VASurfaceID forward_references[MAX_REFERENCES];
|
|
|
|
VAProcPipelineParameterBuffer params;
|
|
|
|
VAProcFilterParameterBufferDeinterlacing *filter_params;
|
|
|
|
VAStatus vas;
|
|
|
|
void *filter_params_addr = NULL;
|
2017-02-27 21:29:46 +00:00
|
|
|
int err, i, field, current_frame_index;
|
2017-02-19 17:23:07 +00:00
|
|
|
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, "Filter input: %s, %ux%u (%"PRId64").\n",
|
|
|
|
av_get_pix_fmt_name(input_frame->format),
|
|
|
|
input_frame->width, input_frame->height, input_frame->pts);
|
|
|
|
|
|
|
|
if (ctx->queue_count < ctx->queue_depth) {
|
|
|
|
ctx->frame_queue[ctx->queue_count++] = input_frame;
|
|
|
|
if (ctx->queue_count < ctx->queue_depth) {
|
|
|
|
// Need more reference surfaces before we can continue.
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
av_frame_free(&ctx->frame_queue[0]);
|
|
|
|
for (i = 0; i + 1 < ctx->queue_count; i++)
|
|
|
|
ctx->frame_queue[i] = ctx->frame_queue[i + 1];
|
|
|
|
ctx->frame_queue[i] = input_frame;
|
|
|
|
}
|
|
|
|
|
2017-02-27 21:29:46 +00:00
|
|
|
current_frame_index = ctx->pipeline_caps.num_forward_references;
|
|
|
|
|
|
|
|
input_frame = ctx->frame_queue[current_frame_index];
|
2017-02-19 17:23:07 +00:00
|
|
|
input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3];
|
|
|
|
for (i = 0; i < ctx->pipeline_caps.num_forward_references; i++)
|
|
|
|
forward_references[i] = (VASurfaceID)(uintptr_t)
|
2017-02-27 21:29:46 +00:00
|
|
|
ctx->frame_queue[current_frame_index - i - 1]->data[3];
|
|
|
|
for (i = 0; i < ctx->pipeline_caps.num_backward_references; i++)
|
|
|
|
backward_references[i] = (VASurfaceID)(uintptr_t)
|
|
|
|
ctx->frame_queue[current_frame_index + i + 1]->data[3];
|
2017-02-19 17:23:07 +00:00
|
|
|
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for "
|
|
|
|
"deinterlace input.\n", input_surface);
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, "Backward references:");
|
|
|
|
for (i = 0; i < ctx->pipeline_caps.num_backward_references; i++)
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, " %#x", backward_references[i]);
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, "\n");
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, "Forward references:");
|
|
|
|
for (i = 0; i < ctx->pipeline_caps.num_forward_references; i++)
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, " %#x", forward_references[i]);
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, "\n");
|
|
|
|
|
2017-02-27 21:29:46 +00:00
|
|
|
for (field = 0; field < ctx->field_rate; field++) {
|
2018-01-08 08:07:38 +00:00
|
|
|
output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width,
|
|
|
|
vpp_ctx->output_height);
|
2017-02-27 21:29:46 +00:00
|
|
|
if (!output_frame) {
|
|
|
|
err = AVERROR(ENOMEM);
|
|
|
|
goto fail;
|
|
|
|
}
|
2017-02-19 17:23:07 +00:00
|
|
|
|
2019-02-28 00:38:08 +00:00
|
|
|
err = av_frame_copy_props(output_frame, input_frame);
|
|
|
|
if (err < 0)
|
2019-09-29 16:46:04 +00:00
|
|
|
goto fail;
|
2019-02-28 00:38:08 +00:00
|
|
|
|
2019-03-31 14:39:35 +00:00
|
|
|
err = ff_vaapi_vpp_init_params(avctx, ¶ms,
|
|
|
|
input_frame, output_frame);
|
|
|
|
if (err < 0)
|
|
|
|
goto fail;
|
2017-02-27 21:29:46 +00:00
|
|
|
|
|
|
|
if (!ctx->auto_enable || input_frame->interlaced_frame) {
|
2018-01-08 08:07:38 +00:00
|
|
|
vas = vaMapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0],
|
2017-02-27 21:29:46 +00:00
|
|
|
&filter_params_addr);
|
|
|
|
if (vas != VA_STATUS_SUCCESS) {
|
|
|
|
av_log(avctx, AV_LOG_ERROR, "Failed to map filter parameter "
|
|
|
|
"buffer: %d (%s).\n", vas, vaErrorStr(vas));
|
|
|
|
err = AVERROR(EIO);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
filter_params = filter_params_addr;
|
|
|
|
filter_params->flags = 0;
|
|
|
|
if (input_frame->top_field_first) {
|
|
|
|
filter_params->flags |= field ? VA_DEINTERLACING_BOTTOM_FIELD : 0;
|
|
|
|
} else {
|
|
|
|
filter_params->flags |= VA_DEINTERLACING_BOTTOM_FIELD_FIRST;
|
|
|
|
filter_params->flags |= field ? 0 : VA_DEINTERLACING_BOTTOM_FIELD;
|
|
|
|
}
|
|
|
|
filter_params_addr = NULL;
|
2018-01-08 08:07:38 +00:00
|
|
|
vas = vaUnmapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0]);
|
2017-02-27 21:29:46 +00:00
|
|
|
if (vas != VA_STATUS_SUCCESS)
|
|
|
|
av_log(avctx, AV_LOG_ERROR, "Failed to unmap filter parameter "
|
|
|
|
"buffer: %d (%s).\n", vas, vaErrorStr(vas));
|
|
|
|
|
2018-01-08 08:07:38 +00:00
|
|
|
params.filters = &vpp_ctx->filter_buffers[0];
|
2017-02-27 21:29:46 +00:00
|
|
|
params.num_filters = 1;
|
|
|
|
|
|
|
|
params.forward_references = forward_references;
|
|
|
|
params.num_forward_references =
|
|
|
|
ctx->pipeline_caps.num_forward_references;
|
|
|
|
params.backward_references = backward_references;
|
|
|
|
params.num_backward_references =
|
|
|
|
ctx->pipeline_caps.num_backward_references;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
params.filters = NULL;
|
|
|
|
params.num_filters = 0;
|
|
|
|
}
|
2017-02-19 17:23:07 +00:00
|
|
|
|
2019-03-31 14:39:35 +00:00
|
|
|
err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_frame);
|
2018-01-08 08:07:38 +00:00
|
|
|
if (err < 0)
|
2017-02-27 21:29:46 +00:00
|
|
|
goto fail;
|
2017-02-19 17:23:07 +00:00
|
|
|
|
2017-02-27 21:29:46 +00:00
|
|
|
if (ctx->field_rate == 2) {
|
|
|
|
if (field == 0)
|
|
|
|
output_frame->pts = 2 * input_frame->pts;
|
|
|
|
else
|
|
|
|
output_frame->pts = input_frame->pts +
|
|
|
|
ctx->frame_queue[current_frame_index + 1]->pts;
|
2017-02-19 17:23:07 +00:00
|
|
|
}
|
2017-02-27 21:29:46 +00:00
|
|
|
output_frame->interlaced_frame = 0;
|
2017-02-19 17:23:07 +00:00
|
|
|
|
2017-02-27 21:29:46 +00:00
|
|
|
av_log(avctx, AV_LOG_DEBUG, "Filter output: %s, %ux%u (%"PRId64").\n",
|
|
|
|
av_get_pix_fmt_name(output_frame->format),
|
|
|
|
output_frame->width, output_frame->height, output_frame->pts);
|
2017-02-19 17:23:07 +00:00
|
|
|
|
2017-02-27 21:29:46 +00:00
|
|
|
err = ff_filter_frame(outlink, output_frame);
|
|
|
|
if (err < 0)
|
|
|
|
break;
|
|
|
|
}
|
2017-02-19 17:23:07 +00:00
|
|
|
|
2017-02-27 21:29:46 +00:00
|
|
|
return err;
|
2017-02-19 17:23:07 +00:00
|
|
|
|
|
|
|
fail:
|
|
|
|
if (filter_params_addr)
|
2018-01-08 08:07:38 +00:00
|
|
|
vaUnmapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0]);
|
2017-02-19 17:23:07 +00:00
|
|
|
av_frame_free(&output_frame);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static av_cold int deint_vaapi_init(AVFilterContext *avctx)
|
|
|
|
{
|
2018-01-08 08:07:38 +00:00
|
|
|
VAAPIVPPContext *vpp_ctx = avctx->priv;
|
2017-02-19 17:23:07 +00:00
|
|
|
|
2018-01-08 08:07:38 +00:00
|
|
|
ff_vaapi_vpp_ctx_init(avctx);
|
|
|
|
vpp_ctx->pipeline_uninit = deint_vaapi_pipeline_uninit;
|
|
|
|
vpp_ctx->build_filter_params = deint_vaapi_build_filter_params;
|
|
|
|
vpp_ctx->output_format = AV_PIX_FMT_NONE;
|
2017-02-19 17:23:07 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define OFFSET(x) offsetof(DeintVAAPIContext, x)
|
|
|
|
#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM)
|
|
|
|
static const AVOption deint_vaapi_options[] = {
|
|
|
|
{ "mode", "Deinterlacing mode",
|
|
|
|
OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = VAProcDeinterlacingNone },
|
|
|
|
VAProcDeinterlacingNone, VAProcDeinterlacingCount - 1, FLAGS, "mode" },
|
|
|
|
{ "default", "Use the highest-numbered (and therefore possibly most advanced) deinterlacing algorithm",
|
2018-01-16 14:44:02 +00:00
|
|
|
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingNone }, 0, 0, FLAGS, "mode" },
|
2017-02-19 17:23:07 +00:00
|
|
|
{ "bob", "Use the bob deinterlacing algorithm",
|
2018-01-16 14:44:02 +00:00
|
|
|
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingBob }, 0, 0, FLAGS, "mode" },
|
2017-02-19 17:23:07 +00:00
|
|
|
{ "weave", "Use the weave deinterlacing algorithm",
|
2018-01-16 14:44:02 +00:00
|
|
|
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingWeave }, 0, 0, FLAGS, "mode" },
|
2017-02-19 17:23:07 +00:00
|
|
|
{ "motion_adaptive", "Use the motion adaptive deinterlacing algorithm",
|
2018-01-16 14:44:02 +00:00
|
|
|
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionAdaptive }, 0, 0, FLAGS, "mode" },
|
2017-02-19 17:23:07 +00:00
|
|
|
{ "motion_compensated", "Use the motion compensated deinterlacing algorithm",
|
2018-01-16 14:44:02 +00:00
|
|
|
0, AV_OPT_TYPE_CONST, { .i64 = VAProcDeinterlacingMotionCompensated }, 0, 0, FLAGS, "mode" },
|
2017-02-27 21:29:46 +00:00
|
|
|
|
|
|
|
{ "rate", "Generate output at frame rate or field rate",
|
|
|
|
OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 1 }, 1, 2, FLAGS, "rate" },
|
|
|
|
{ "frame", "Output at frame rate (one frame of output for each field-pair)",
|
2018-01-16 14:44:02 +00:00
|
|
|
0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "rate" },
|
2017-02-27 21:29:46 +00:00
|
|
|
{ "field", "Output at field rate (one frame of output for each field)",
|
2018-01-16 14:44:02 +00:00
|
|
|
0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, FLAGS, "rate" },
|
2017-02-27 21:29:46 +00:00
|
|
|
|
|
|
|
{ "auto", "Only deinterlace fields, passing frames through unchanged",
|
|
|
|
OFFSET(auto_enable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS },
|
|
|
|
|
2017-02-19 17:23:07 +00:00
|
|
|
{ NULL },
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVClass deint_vaapi_class = {
|
|
|
|
.class_name = "deinterlace_vaapi",
|
|
|
|
.item_name = av_default_item_name,
|
|
|
|
.option = deint_vaapi_options,
|
|
|
|
.version = LIBAVUTIL_VERSION_INT,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVFilterPad deint_vaapi_inputs[] = {
|
|
|
|
{
|
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
|
|
|
.filter_frame = &deint_vaapi_filter_frame,
|
2018-01-08 08:07:38 +00:00
|
|
|
.config_props = &ff_vaapi_vpp_config_input,
|
2017-02-19 17:23:07 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVFilterPad deint_vaapi_outputs[] = {
|
|
|
|
{
|
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
|
|
|
.config_props = &deint_vaapi_config_output,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-04-19 16:33:56 +00:00
|
|
|
const AVFilter ff_vf_deinterlace_vaapi = {
|
2017-02-19 17:23:07 +00:00
|
|
|
.name = "deinterlace_vaapi",
|
|
|
|
.description = NULL_IF_CONFIG_SMALL("Deinterlacing of VAAPI surfaces"),
|
|
|
|
.priv_size = sizeof(DeintVAAPIContext),
|
|
|
|
.init = &deint_vaapi_init,
|
2018-01-08 08:07:38 +00:00
|
|
|
.uninit = &ff_vaapi_vpp_ctx_uninit,
|
|
|
|
.query_formats = &ff_vaapi_vpp_query_formats,
|
2021-08-12 11:05:31 +00:00
|
|
|
FILTER_INPUTS(deint_vaapi_inputs),
|
|
|
|
FILTER_OUTPUTS(deint_vaapi_outputs),
|
2017-02-19 17:23:07 +00:00
|
|
|
.priv_class = &deint_vaapi_class,
|
2017-04-01 14:32:17 +00:00
|
|
|
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
|
2017-02-19 17:23:07 +00:00
|
|
|
};
|