avutil/hwcontext_vulkan: fixed incorrect memory offset

This commit fixed hwupload in Vulkan:

ffmpeg -init_hw_device vulkan -i test.jpg -vf hwupload,hwdownload,format=yuv420p -y out.jpg

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
This commit is contained in:
Wu Jianhua 2022-01-05 14:33:30 +08:00 committed by Lynne
parent ce4d459db1
commit c4ecc643bb
1 changed files with 7 additions and 5 deletions

View File

@ -1872,12 +1872,14 @@ static int alloc_bind_mem(AVHWFramesContext *hwfc, AVVkFrame *f,
f->size[0] = cont_memory_requirements.size;
for (int i = 0; i < planes; i++) {
bind_info[i].sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO;
bind_info[i].image = f->img[i];
bind_info[i].memory = f->mem[0];
bind_info[i].memoryOffset = !i ? 0 : cont_mem_size_list[i - 1];
for (int i = 0, offset = 0; i < planes; i++) {
bind_info[i].sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO;
bind_info[i].image = f->img[i];
bind_info[i].memory = f->mem[0];
bind_info[i].memoryOffset = offset;
f->offset[i] = bind_info[i].memoryOffset;
offset += cont_mem_size_list[i];
}
}