hw_base_encode: make recon_frames_ref optional

Vulkan supports some stupidly odd hardware, that unfortunately,
most modern GPUs happen to be.
The DPB images for encoders may be required to be preallocated
all at once, and rather than be individual frames, be layers of
a single frame.

As the hw_base_encode code is written with the thought that either
the driver or the device itself supports sane image allocation,
Vulkan does not leave us with this option.

So, in the case that the hardware does not support individual
frames to be used as DPBs, make the DBP frames context optional,
and let the subsystem manage this.
This commit is contained in:
Lynne 2024-08-30 22:02:39 +00:00
parent e6019ed075
commit 3de73f1262
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
1 changed files with 11 additions and 9 deletions

View File

@ -440,6 +440,7 @@ static int hw_base_encode_send_frame(AVCodecContext *avctx, FFHWBaseEncodeContex
goto fail; goto fail;
} }
if (ctx->recon_frames_ref) {
pic->recon_image = av_frame_alloc(); pic->recon_image = av_frame_alloc();
if (!pic->recon_image) { if (!pic->recon_image) {
err = AVERROR(ENOMEM); err = AVERROR(ENOMEM);
@ -451,6 +452,7 @@ static int hw_base_encode_send_frame(AVCodecContext *avctx, FFHWBaseEncodeContex
err = AVERROR(ENOMEM); err = AVERROR(ENOMEM);
goto fail; goto fail;
} }
}
pic->priv = av_mallocz(ctx->op->priv_size); pic->priv = av_mallocz(ctx->op->priv_size);
if (!pic->priv) { if (!pic->priv) {