hw_base_encode: allocate DPB image upfront

Vulkan requires this, as it needs to initialize state upfront.
release/7.1
Lynne 3 months ago
parent 034e25e1a4
commit e6019ed075
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
  1. 6
      libavcodec/d3d12va_encode.c
  2. 6
      libavcodec/hw_base_encode.c
  3. 5
      libavcodec/vaapi_encode.c

@ -264,12 +264,6 @@ static int d3d12va_encode_issue(AVCodecContext *avctx,
av_log(avctx, AV_LOG_DEBUG, "Input surface is %p.\n", pic->input_surface->texture); av_log(avctx, AV_LOG_DEBUG, "Input surface is %p.\n", pic->input_surface->texture);
err = av_hwframe_get_buffer(base_ctx->recon_frames_ref, base_pic->recon_image, 0);
if (err < 0) {
err = AVERROR(ENOMEM);
goto fail;
}
pic->recon_surface = (AVD3D12VAFrame *)base_pic->recon_image->data[0]; pic->recon_surface = (AVD3D12VAFrame *)base_pic->recon_image->data[0];
av_log(avctx, AV_LOG_DEBUG, "Recon surface is %p.\n", av_log(avctx, AV_LOG_DEBUG, "Recon surface is %p.\n",
pic->recon_surface->texture); pic->recon_surface->texture);

@ -446,6 +446,12 @@ static int hw_base_encode_send_frame(AVCodecContext *avctx, FFHWBaseEncodeContex
goto fail; goto fail;
} }
err = av_hwframe_get_buffer(ctx->recon_frames_ref, pic->recon_image, 0);
if (err < 0) {
err = AVERROR(ENOMEM);
goto fail;
}
pic->priv = av_mallocz(ctx->op->priv_size); pic->priv = av_mallocz(ctx->op->priv_size);
if (!pic->priv) { if (!pic->priv) {
err = AVERROR(ENOMEM); err = AVERROR(ENOMEM);

@ -313,11 +313,6 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
av_log(avctx, AV_LOG_DEBUG, "Input surface is %#x.\n", pic->input_surface); av_log(avctx, AV_LOG_DEBUG, "Input surface is %#x.\n", pic->input_surface);
err = av_hwframe_get_buffer(base_ctx->recon_frames_ref, base_pic->recon_image, 0);
if (err < 0) {
err = AVERROR(ENOMEM);
goto fail;
}
pic->recon_surface = (VASurfaceID)(uintptr_t)base_pic->recon_image->data[3]; pic->recon_surface = (VASurfaceID)(uintptr_t)base_pic->recon_image->data[3];
av_log(avctx, AV_LOG_DEBUG, "Recon surface is %#x.\n", pic->recon_surface); av_log(avctx, AV_LOG_DEBUG, "Recon surface is %#x.\n", pic->recon_surface);

Loading…
Cancel
Save