[vlc-commits] copy: do one big memcpy when possible
Steve Lhomme
git at videolan.org
Fri Jul 29 00:35:47 CEST 2016
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Jul 28 14:45:39 2016 +0200| [1bea49c20dfff725bf238f336c7b9d8c82d7408d] | committer: Jean-Baptiste Kempf
copy: do one big memcpy when possible
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1bea49c20dfff725bf238f336c7b9d8c82d7408d
---
modules/video_chroma/copy.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/modules/video_chroma/copy.c b/modules/video_chroma/copy.c
index cdeb96c..fa0a212 100644
--- a/modules/video_chroma/copy.c
+++ b/modules/video_chroma/copy.c
@@ -270,6 +270,9 @@ static void SSE_CopyPlane(uint8_t *dst, size_t dst_pitch,
const unsigned hstep = cache_size / w16;
assert(hstep > 0);
+ if (src_pitch == dst_pitch)
+ memcpy(dst, src, width * height);
+ else
for (unsigned y = 0; y < height; y += hstep) {
const unsigned hblock = __MIN(hstep, height - y);
@@ -407,6 +410,9 @@ static void CopyPlane(uint8_t *dst, size_t dst_pitch,
const uint8_t *src, size_t src_pitch,
unsigned width, unsigned height)
{
+ if (src_pitch == dst_pitch)
+ memcpy(dst, src, width * height);
+ else
for (unsigned y = 0; y < height; y++) {
memcpy(dst, src, width);
src += src_pitch;
More information about the vlc-commits
mailing list