[vlc-commits] commit: Fixed potential unaligned access in vaapi/dxva2 picture copy. ( Laurent Aimar )

git at videolan.org git at videolan.org
Sun Jun 13 01:32:38 CEST 2010


vlc/vlc-1.1 | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Jun 13 01:25:43 2010 +0200| [3e949628bdd9fd17a6b43d612f70902a48d92804] | committer: Jean-Baptiste Kempf 

Fixed potential unaligned access in vaapi/dxva2 picture copy.

It (probably) happens only when the video is non mod 16, or non mod 32
with YV12 hardware surface.
(cherry picked from commit 957409b26fea130c93c740dbb1a032b1e7624794)

Close #3606

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=3e949628bdd9fd17a6b43d612f70902a48d92804
---

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

diff --git a/modules/codec/avcodec/copy.c b/modules/codec/avcodec/copy.c
index 6bc0d82..9c9a44b 100644
--- a/modules/codec/avcodec/copy.c
+++ b/modules/codec/avcodec/copy.c
@@ -63,7 +63,6 @@
  */
 static void CopyFromUswc(uint8_t *dst, size_t dst_pitch,
                          const uint8_t *src, size_t src_pitch,
-                         unsigned unaligned,
                          unsigned width, unsigned height,
                          unsigned cpu)
 {
@@ -71,6 +70,7 @@ 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;
 
         for (x = 0; x < unaligned; x++)
@@ -237,13 +237,11 @@ static void CopyPlane(uint8_t *dst, size_t dst_pitch, const uint8_t *src, size_t
     assert(hstep > 0);
 
     for (unsigned y = 0; y < height; y += hstep) {
-        const unsigned unaligned = (intptr_t)src & 0x0f;
         const unsigned hblock =  __MIN(hstep, height - y);
 
         /* Copy a bunch of line into our cache */
         CopyFromUswc(cache, w16,
                      src, src_pitch,
-                     unaligned,
                      width, hblock, cpu);
 
         /* Copy from our cache to the destination */
@@ -270,13 +268,11 @@ static void SplitPlanes(uint8_t *dstu, size_t dstu_pitch,
     assert(hstep > 0);
 
     for (unsigned y = 0; y < height; y += hstep) {
-        const unsigned unaligned = (intptr_t)src & 0x0f;
         const unsigned hblock =  __MIN(hstep, height - y);
 
         /* Copy a bunch of line into our cache */
         CopyFromUswc(cache, w2_16,
                      src, src_pitch,
-                     unaligned,
                      2*width, hblock, cpu);
 
         /* Copy from our cache to the destination */



More information about the vlc-commits mailing list