X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fvf_transpose_vaapi.c;h=a4c654266de4712c1eb699172cb5395a58ce55fa;hb=05a6d82d5cc3e5c5b0ea97b9a6f4778c1c82d71c;hp=0e2acc9983c2d26672a36a0e5add7cc84bdae438;hpb=39278ff0de5b5e3397c22538978bffbb38ee099b;p=ffmpeg diff --git a/libavfilter/vf_transpose_vaapi.c b/libavfilter/vf_transpose_vaapi.c index 0e2acc9983c..a4c654266de 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",