av_log(avctx, AV_LOG_ERROR, "Deinterlacing mode %d (%s) is "
"not supported.\n", ctx->mode,
deint_vaapi_mode_name(ctx->mode));
+ return AVERROR(EINVAL);
}
}
VAAPIVPPContext *vpp_ctx = avctx->priv;
DeintVAAPIContext *ctx = avctx->priv;
AVFrame *output_frame = NULL;
- VASurfaceID input_surface, output_surface;
+ VASurfaceID input_surface;
VASurfaceID backward_references[MAX_REFERENCES];
VASurfaceID forward_references[MAX_REFERENCES];
VAProcPipelineParameterBuffer params;
VAProcFilterParameterBufferDeinterlacing *filter_params;
- VARectangle input_region;
VAStatus vas;
void *filter_params_addr = NULL;
int err, i, field, current_frame_index;
goto fail;
}
- output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3];
- av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for "
- "deinterlace output.\n", output_surface);
-
- memset(¶ms, 0, sizeof(params));
-
- input_region = (VARectangle) {
- .x = 0,
- .y = 0,
- .width = input_frame->width,
- .height = input_frame->height,
- };
-
- params.surface = input_surface;
- params.surface_region = &input_region;
- params.surface_color_standard =
- ff_vaapi_vpp_colour_standard(input_frame->colorspace);
-
- params.output_region = NULL;
- params.output_background_color = 0xff000000;
- params.output_color_standard = params.surface_color_standard;
+ err = av_frame_copy_props(output_frame, input_frame);
+ if (err < 0)
+ goto fail;
- params.pipeline_flags = 0;
- params.filter_flags = VA_FRAME_PICTURE;
+ err = ff_vaapi_vpp_init_params(avctx, ¶ms,
+ input_frame, output_frame);
+ if (err < 0)
+ goto fail;
if (!ctx->auto_enable || input_frame->interlaced_frame) {
vas = vaMapBuffer(vpp_ctx->hwctx->display, vpp_ctx->filter_buffers[0],
params.num_filters = 0;
}
- err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface);
- if (err < 0)
- goto fail;
-
- err = av_frame_copy_props(output_frame, input_frame);
+ err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_frame);
if (err < 0)
goto fail;
{ NULL }
};
-AVFilter ff_vf_deinterlace_vaapi = {
+const AVFilter ff_vf_deinterlace_vaapi = {
.name = "deinterlace_vaapi",
.description = NULL_IF_CONFIG_SMALL("Deinterlacing of VAAPI surfaces"),
.priv_size = sizeof(DeintVAAPIContext),