X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fvf_deinterlace_vaapi.c;h=0e645f50f249cc980299451ea90239383703f496;hb=b9fff6e15e73dc995695db9be8db084238cca14c;hp=f67a1c8e7967572190ee18cc5d29dbff8c3d6dbc;hpb=fbd607dd560afe44c3b90de1e6cbe5265cac8f1e;p=ffmpeg diff --git a/libavfilter/vf_deinterlace_vaapi.c b/libavfilter/vf_deinterlace_vaapi.c index f67a1c8e796..0e645f50f24 100644 --- a/libavfilter/vf_deinterlace_vaapi.c +++ b/libavfilter/vf_deinterlace_vaapi.c @@ -181,12 +181,11 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) 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; @@ -238,30 +237,14 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) 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 = VAAPI_VPP_BACKGROUND_BLACK; - 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], @@ -301,11 +284,7 @@ static int deint_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_frame) 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; @@ -404,7 +383,7 @@ static const AVFilterPad deint_vaapi_outputs[] = { { 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),