Commit 375c0f74 authored by Michael Niedermayer's avatar Michael Niedermayer

av_samples_copy: support overlapping copies

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 19ff479f
...@@ -208,8 +208,13 @@ int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, ...@@ -208,8 +208,13 @@ int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
dst_offset *= block_align; dst_offset *= block_align;
src_offset *= block_align; src_offset *= block_align;
if((dst[0] < src[0] ? src[0] - dst[0] : dst[0] - src[0]) >= data_size) {
for (i = 0; i < planes; i++) for (i = 0; i < planes; i++)
memcpy(dst[i] + dst_offset, src[i] + src_offset, data_size); memcpy(dst[i] + dst_offset, src[i] + src_offset, data_size);
} else {
for (i = 0; i < planes; i++)
memmove(dst[i] + dst_offset, src[i] + src_offset, data_size);
}
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment