X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fvf_transpose_vaapi.c;h=3b29767c8d332d5806d24245051066b7a3ce1e17;hb=0814610ee35614e417d6942784f7b299f2414a9b;hp=0e2acc9983c2d26672a36a0e5add7cc84bdae438;hpb=b8ebce4f84b653b8a50a23398e3d12a607b5cddb;p=ffmpeg diff --git a/libavfilter/vf_transpose_vaapi.c b/libavfilter/vf_transpose_vaapi.c index 0e2acc9983c..3b29767c8d3 100644 --- a/libavfilter/vf_transpose_vaapi.c +++ b/libavfilter/vf_transpose_vaapi.c @@ -123,9 +123,6 @@ static int transpose_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_fra VAAPIVPPContext *vpp_ctx = avctx->priv; TransposeVAAPIContext *ctx = avctx->priv; AVFrame *output_frame = NULL; - VASurfaceID input_surface, output_surface; - VARectangle input_region, output_region; - VAProcPipelineParameterBuffer params; int err; @@ -139,10 +136,6 @@ static int transpose_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_fra if (vpp_ctx->va_context == VA_INVALID_ID) return AVERROR(EINVAL); - input_surface = (VASurfaceID)(uintptr_t)input_frame->data[3]; - av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for transpose vpp input.\n", - input_surface); - output_frame = ff_get_video_buffer(outlink, vpp_ctx->output_width, vpp_ctx->output_height); if (!output_frame) { @@ -150,46 +143,22 @@ static int transpose_vaapi_filter_frame(AVFilterLink *inlink, AVFrame *input_fra goto fail; } - output_surface = (VASurfaceID)(uintptr_t)output_frame->data[3]; - av_log(avctx, AV_LOG_DEBUG, "Using surface %#x for transpose vpp output.\n", - output_surface); - memset(¶ms, 0, sizeof(params)); - input_region = (VARectangle) { - .x = 0, - .y = 0, - .width = input_frame->width, - .height = input_frame->height, - }; - - output_region = (VARectangle) { - .x = 0, - .y = 0, - .width = output_frame->width, - .height = output_frame->height, - }; - - params.rotation_state = ctx->rotation_state; - params.mirror_state = ctx->mirror_state; - - params.filters = &vpp_ctx->filter_buffers[0]; - params.num_filters = vpp_ctx->nb_filter_buffers; - - params.surface = input_surface; - params.surface_region = &input_region; - params.surface_color_standard = - ff_vaapi_vpp_colour_standard(input_frame->colorspace); - - params.output_region = &output_region; - 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; - err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_surface); + err = ff_vaapi_vpp_init_params(avctx, ¶ms, + input_frame, output_frame); if (err < 0) goto fail; - err = av_frame_copy_props(output_frame, input_frame); + params.rotation_state = ctx->rotation_state; + params.mirror_state = ctx->mirror_state; + + err = ff_vaapi_vpp_render_picture(avctx, ¶ms, output_frame); if (err < 0) goto fail; + av_frame_free(&input_frame); av_log(avctx, AV_LOG_DEBUG, "Filter output: %s, %ux%u (%"PRId64").\n", @@ -305,7 +274,7 @@ static const AVFilterPad transpose_vaapi_outputs[] = { { NULL } }; -AVFilter ff_vf_transpose_vaapi = { +const AVFilter ff_vf_transpose_vaapi = { .name = "transpose_vaapi", .description = NULL_IF_CONFIG_SMALL("VAAPI VPP for transpose"), .priv_size = sizeof(TransposeVAAPIContext),