aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-05-08 21:55:40 +0300
committerMartin Storsjö <martin@martin.st>2016-05-10 09:41:07 +0300
commit283226e11ccf50a71d25d150fbbf1743f74c6c49 (patch)
treed03f77a0fb7aa3eb1fcc099cd626de6ea714e189
parente9443105ea4e8bc1d826ddceeba2816488c6ce92 (diff)
downloadffmpeg-283226e11ccf50a71d25d150fbbf1743f74c6c49.tar.gz
simple_idct_template: Fix strict aliasing violation
This fixes fate-wmv8-intrax8 in certain configurations, e.g. gcc 4.4. Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavcodec/simple_idct_template.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libavcodec/simple_idct_template.c b/libavcodec/simple_idct_template.c
index 9a5e38ac71..171cdf65ff 100644
--- a/libavcodec/simple_idct_template.c
+++ b/libavcodec/simple_idct_template.c
@@ -91,7 +91,7 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
#if HAVE_FAST_64BIT
#define ROW0_MASK (0xffffLL << 48 * HAVE_BIGENDIAN)
- if (((((uint64_t *)row)[0] & ~ROW0_MASK) | ((uint64_t *)row)[1]) == 0) {
+ if (((AV_RN64A(row) & ~ROW0_MASK) | AV_RN64A(row+4)) == 0) {
uint64_t temp;
if (DC_SHIFT - extra_shift > 0) {
temp = (row[0] * (1 << (DC_SHIFT - extra_shift))) & 0xffff;
@@ -100,14 +100,14 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
}
temp += temp * (1 << 16);
temp += temp * ((uint64_t) 1 << 32);
- ((uint64_t *)row)[0] = temp;
- ((uint64_t *)row)[1] = temp;
+ AV_WN64A(row, temp);
+ AV_WN64A(row + 4, temp);
return;
}
#else
- if (!(((uint32_t*)row)[1] |
- ((uint32_t*)row)[2] |
- ((uint32_t*)row)[3] |
+ if (!(AV_RN32A(row+2) |
+ AV_RN32A(row+4) |
+ AV_RN32A(row+6) |
row[1])) {
uint32_t temp;
if (DC_SHIFT - extra_shift > 0) {
@@ -116,8 +116,10 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
temp = (row[0] >> (extra_shift - DC_SHIFT)) & 0xffff;
}
temp += temp * (1 << 16);
- ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
- ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp;
+ AV_WN32A(row, temp);
+ AV_WN32A(row+2, temp);
+ AV_WN32A(row+4, temp);
+ AV_WN32A(row+6, temp);
return;
}
#endif