[FFmpeg-cvslog] Fix VP8 aliasing problems.

Ronald S. Bultje git
Sun Jan 30 04:15:54 CET 2011


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri Jan 28 09:51:34 2011 -0500| [6642a1793511fcd510d39d1a598b127a536b48c9] | committer: Michael Niedermayer

Fix VP8 aliasing problems.

Replace * (uint32_t *) buf accesses with AV_WN32A/AV_COPY32.
(cherry picked from commit 9d4bdcb714f85b5d90ebf9704784a31c88dfb360)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6642a1793511fcd510d39d1a598b127a536b48c9
---

 libavcodec/vp8.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 3691f15..66a7c4d 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -1132,9 +1132,9 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
                         linesize = 8;
                         if (!(mb_y + y)) {
                             copy_dst[3] = 127U;
-                            * (uint32_t *) (copy_dst + 4) = 127U * 0x01010101U;
+                            AV_WN32A(copy_dst+4, 127U * 0x01010101U);
                         } else {
-                            * (uint32_t *) (copy_dst + 4) = * (uint32_t *) (ptr+4*x-s->linesize);
+                            AV_COPY32(copy_dst+4, ptr+4*x-s->linesize);
                             if (!(mb_x + x)) {
                                 copy_dst[3] = 129U;
                             } else {
@@ -1158,10 +1158,10 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
                 }
                 s->hpc.pred4x4[mode](dst, topright, linesize);
                 if (copy) {
-                    * (uint32_t *) (ptr+4*x)               = * (uint32_t *) (copy_dst + 12);
-                    * (uint32_t *) (ptr+4*x+s->linesize)   = * (uint32_t *) (copy_dst + 20);
-                    * (uint32_t *) (ptr+4*x+s->linesize*2) = * (uint32_t *) (copy_dst + 28);
-                    * (uint32_t *) (ptr+4*x+s->linesize*3) = * (uint32_t *) (copy_dst + 36);
+                    AV_COPY32(ptr+4*x              , copy_dst+12);
+                    AV_COPY32(ptr+4*x+s->linesize  , copy_dst+20);
+                    AV_COPY32(ptr+4*x+s->linesize*2, copy_dst+28);
+                    AV_COPY32(ptr+4*x+s->linesize*3, copy_dst+36);
                 }
 
                 nnz = s->non_zero_count_cache[y][x];




More information about the ffmpeg-cvslog mailing list