summaryrefslogtreecommitdiffstats
path: root/libavcodec/jrevdct.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>2018-11-26 00:43:46 +0100
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2018-11-27 01:16:28 +0100
commit5a7617136ab68e3fc35a6ea1094f6629109336d3 (patch)
tree9b1360b6859b9abfb137b6c4be6fa2b707693a71 /libavcodec/jrevdct.c
parentfd2d6f376d84f1cf1a1fc2daf0560b72a8203901 (diff)
downloadffmpeg-streaming-5a7617136ab68e3fc35a6ea1094f6629109336d3.zip
ffmpeg-streaming-5a7617136ab68e3fc35a6ea1094f6629109336d3.tar.gz
lavc/jrevdct: Avoid an aliasing violation.
Fixes fate on different PowerPC systems with some compilers. Analyzed-by: Lauri Kasanen
Diffstat (limited to 'libavcodec/jrevdct.c')
-rw-r--r--libavcodec/jrevdct.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavcodec/jrevdct.c b/libavcodec/jrevdct.c
index 3b15a52..a1a0f57 100644
--- a/libavcodec/jrevdct.c
+++ b/libavcodec/jrevdct.c
@@ -63,6 +63,7 @@
*/
#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
#include "dct.h"
#include "idctdsp.h"
@@ -234,7 +235,7 @@ void ff_j_rev_dct(DCTBLOCK data)
* row DCT calculations can be simplified this way.
*/
- register int *idataptr = (int*)dataptr;
+ register uint8_t *idataptr = (uint8_t*)dataptr;
/* WARNING: we do the same permutation as MMX idct to simplify the
video core */
@@ -254,10 +255,10 @@ void ff_j_rev_dct(DCTBLOCK data)
int16_t dcval = (int16_t) (d0 * (1 << PASS1_BITS));
register int v = (dcval & 0xffff) | ((dcval * (1 << 16)) & 0xffff0000);
- idataptr[0] = v;
- idataptr[1] = v;
- idataptr[2] = v;
- idataptr[3] = v;
+ AV_WN32A(&idataptr[ 0], v);
+ AV_WN32A(&idataptr[ 4], v);
+ AV_WN32A(&idataptr[ 8], v);
+ AV_WN32A(&idataptr[12], v);
}
dataptr += DCTSIZE; /* advance pointer to next row */
@@ -974,7 +975,7 @@ void ff_j_rev_dct4(DCTBLOCK data)
* row DCT calculations can be simplified this way.
*/
- register int *idataptr = (int*)dataptr;
+ register uint8_t *idataptr = (uint8_t*)dataptr;
d0 = dataptr[0];
d2 = dataptr[1];
@@ -988,8 +989,8 @@ void ff_j_rev_dct4(DCTBLOCK data)
int16_t dcval = (int16_t) (d0 << PASS1_BITS);
register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
- idataptr[0] = v;
- idataptr[1] = v;
+ AV_WN32A(&idataptr[0], v);
+ AV_WN32A(&idataptr[4], v);
}
dataptr += DCTSTRIDE; /* advance pointer to next row */
OpenPOWER on IntegriCloud