[vlc-commits] avcodec: fix unaligned USWC copy (fixes #6333)

Rémi Denis-Courmont git at videolan.org
Fri Oct 12 10:28:50 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 11 19:42:03 2012 +0300| [39dc439cf5e3fe83b87078bcf93c13d07fd02dac] | committer: Rémi Denis-Courmont

avcodec: fix unaligned USWC copy (fixes #6333)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=39dc439cf5e3fe83b87078bcf93c13d07fd02dac
---

 modules/codec/avcodec/copy.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/copy.c b/modules/codec/avcodec/copy.c
index b438287..15160ed 100644
--- a/modules/codec/avcodec/copy.c
+++ b/modules/codec/avcodec/copy.c
@@ -86,10 +86,10 @@ static void CopyFromUswc(uint8_t *dst, size_t dst_pitch,
 
     ASM_SSE2(cpu, "mfence");
     for (unsigned y = 0; y < height; y++) {
-        const unsigned unaligned = (intptr_t)src & 0x0f;
-        unsigned x;
+        const unsigned unaligned = (-(uintptr_t)src) & 0x0f;
+        unsigned x = 0;
 
-        for (x = 0; x < unaligned; x++)
+        for (; x < unaligned; x++)
             dst[x] = src[x];
 
 #ifdef CAN_COMPILE_SSE4_1



More information about the vlc-commits mailing list