diff options
author | Lynne <dev@lynne.ee> | 2023-06-20 03:37:34 +0200 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2023-06-22 18:17:54 +0200 |
commit | ba8a80323615cd297e3cfe077aa2dcb5bca0fc44 (patch) | |
tree | c1337a2117b1a1bae3b843bad61d2c31e10db935 /libavcodec/vulkan_decode.c | |
parent | 237c400727c9bfb7b0c50221bcd17864b2b8ade3 (diff) | |
download | ffmpeg-ba8a80323615cd297e3cfe077aa2dcb5bca0fc44.tar.gz |
vulkan_decode: clean up slice handling
Move the slice offsets buffer to the thread decode context.
It isn't part of the resources for frame decoding, the driver
has to process and finish with it at submission time.
That way, it doesn't need to be alloc'd + freed on every frame.
Diffstat (limited to 'libavcodec/vulkan_decode.c')
-rw-r--r-- | libavcodec/vulkan_decode.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index d4395e32e4..685e300e8a 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -207,12 +207,12 @@ int ff_vk_decode_add_slice(AVCodecContext *avctx, FFVulkanDecodePicture *vp, ctx->caps.minBitstreamBufferSizeAlignment; new_size = FFALIGN(new_size, ctx->caps.minBitstreamBufferSizeAlignment); - slice_off = av_fast_realloc(vp->slice_off, &vp->slice_off_max, + slice_off = av_fast_realloc(dec->slice_off, &dec->slice_off_max, (nb + 1)*sizeof(slice_off)); if (!slice_off) return AVERROR(ENOMEM); - *offsets = vp->slice_off = slice_off; + *offsets = dec->slice_off = slice_off; slice_off[nb] = vp->slices_size; vkbuf = vp->slices_buf ? (FFVkVideoBuffer *)vp->slices_buf->data : NULL; @@ -538,9 +538,6 @@ void ff_vk_decode_free_frame(AVHWDeviceContext *dev_ctx, FFVulkanDecodePicture * /* Free slices data */ av_buffer_unref(&vp->slices_buf); - /* TODO: use a pool in the decode context instead to avoid per-frame allocs. */ - av_freep(&vp->slice_off); - /* Destroy image view (out) */ if (vp->img_view_out && vp->img_view_out != vp->img_view_dest) destroy_image_view(hwctx->act_dev, vp->img_view_out, hwctx->alloc); @@ -1035,6 +1032,7 @@ int ff_vk_decode_uninit(AVCodecContext *avctx) av_buffer_pool_uninit(&dec->tmp_pool); av_buffer_unref(&dec->session_params); av_buffer_unref(&dec->shared_ref); + av_freep(&dec->slice_off); return 0; } |