diff options
author | Lynne <dev@lynne.ee> | 2025-04-02 00:03:11 +0000 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2025-04-14 06:10:41 +0200 |
commit | 1f09b55c943a63c85a92761ccf63a2a99b9d16ea (patch) | |
tree | 58e7b238d77cdc07071508406de2115d2e104354 | |
parent | fc960dafef9f1b30433bbf6ead84fbdc8d492539 (diff) | |
download | ffmpeg-1f09b55c943a63c85a92761ccf63a2a99b9d16ea.tar.gz |
vulkan_ffv1: allocate just as much memory for slice state as needed
Rather than always using the maximum allowed slices, just use the number
of slices present in this frame.
-rw-r--r-- | libavcodec/vulkan_ffv1.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/vulkan_ffv1.c b/libavcodec/vulkan_ffv1.c index b6c9320ec2..9747721f0d 100644 --- a/libavcodec/vulkan_ffv1.c +++ b/libavcodec/vulkan_ffv1.c @@ -197,7 +197,7 @@ static int vk_ffv1_start_frame(AVCodecContext *avctx, &fp->slice_state, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, - NULL, f->max_slice_count*fp->slice_state_size, + NULL, f->slice_count*fp->slice_state_size, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); if (err < 0) return err; @@ -213,7 +213,7 @@ static int vk_ffv1_start_frame(AVCodecContext *avctx, &fp->tmp_data, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, - NULL, f->max_slice_count*CONTEXT_SIZE, + NULL, f->slice_count*CONTEXT_SIZE, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); if (err < 0) return err; @@ -223,7 +223,7 @@ static int vk_ffv1_start_frame(AVCodecContext *avctx, &fp->slice_offset_buf, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, - NULL, 2*f->max_slice_count*sizeof(uint32_t), + NULL, 2*f->slice_count*sizeof(uint32_t), VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); if (err < 0) @@ -234,7 +234,7 @@ static int vk_ffv1_start_frame(AVCodecContext *avctx, &fp->slice_status_buf, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, - NULL, f->max_slice_count*sizeof(uint32_t), + NULL, f->slice_count*sizeof(uint32_t), VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); if (err < 0) |