1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-09-01 14:06:45 +02:00

hwcontext_vulkan: fix uploading and downloading from/to flipped images

We want to copy the lowest amount of bytes per line, but while the buffer
stride is sanitized, the src/dst stride can be negative, and negative numbers
of bytes do not make a lot of sense.
This commit is contained in:
Lynne 2020-05-26 12:01:54 +01:00
parent 2502e13b07
commit 64b12624e2
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464

View File

@ -3063,7 +3063,8 @@ static int vulkan_transfer_data_from_mem(AVHWFramesContext *hwfc, AVFrame *dst,
av_image_copy_plane(tmp.data[i], tmp.linesize[i], av_image_copy_plane(tmp.data[i], tmp.linesize[i],
(const uint8_t *)src->data[i], src->linesize[i], (const uint8_t *)src->data[i], src->linesize[i],
FFMIN(tmp.linesize[i], src->linesize[i]), p_height); FFMIN(tmp.linesize[i], FFABS(src->linesize[i])),
p_height);
} }
if ((err = unmap_buffers(dev_ctx, bufs, planes, 1))) if ((err = unmap_buffers(dev_ctx, bufs, planes, 1)))
@ -3251,7 +3252,8 @@ static int vulkan_transfer_data_to_mem(AVHWFramesContext *hwfc, AVFrame *dst,
av_image_copy_plane(dst->data[i], dst->linesize[i], av_image_copy_plane(dst->data[i], dst->linesize[i],
(const uint8_t *)tmp.data[i], tmp.linesize[i], (const uint8_t *)tmp.data[i], tmp.linesize[i],
FFMIN(tmp.linesize[i], dst->linesize[i]), p_height); FFMIN(tmp.linesize[i], FFABS(dst->linesize[i])),
p_height);
} }
err = unmap_buffers(dev_ctx, bufs, planes, 0); err = unmap_buffers(dev_ctx, bufs, planes, 0);