Commit 5df703aa authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/simple_idct_template: Fix strict aliasing violation

Fixes intrax8 test
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent b6c207f5
...@@ -118,7 +118,7 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift) ...@@ -118,7 +118,7 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
#if HAVE_FAST_64BIT #if HAVE_FAST_64BIT
#define ROW0_MASK (0xffffLL << 48 * HAVE_BIGENDIAN) #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; uint64_t temp;
if (DC_SHIFT - extra_shift >= 0) { if (DC_SHIFT - extra_shift >= 0) {
temp = (row[0] * (1 << (DC_SHIFT - extra_shift))) & 0xffff; temp = (row[0] * (1 << (DC_SHIFT - extra_shift))) & 0xffff;
...@@ -127,14 +127,14 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift) ...@@ -127,14 +127,14 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
} }
temp += temp * (1 << 16); temp += temp * (1 << 16);
temp += temp * ((uint64_t) 1 << 32); temp += temp * ((uint64_t) 1 << 32);
((uint64_t *)row)[0] = temp; AV_WN64A(row, temp);
((uint64_t *)row)[1] = temp; AV_WN64A(row+4, temp);
return; return;
} }
#else #else
if (!(((uint32_t*)row)[1] | if (!(AV_RN32A(row+2) |
((uint32_t*)row)[2] | AV_RN32A(row+4) |
((uint32_t*)row)[3] | AV_RN32A(row+6) |
row[1])) { row[1])) {
uint32_t temp; uint32_t temp;
if (DC_SHIFT - extra_shift >= 0) { if (DC_SHIFT - extra_shift >= 0) {
...@@ -143,8 +143,10 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift) ...@@ -143,8 +143,10 @@ static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift)
temp = ((row[0] + (1<<(extra_shift - DC_SHIFT-1))) >> (extra_shift - DC_SHIFT)) & 0xffff; temp = ((row[0] + (1<<(extra_shift - DC_SHIFT-1))) >> (extra_shift - DC_SHIFT)) & 0xffff;
} }
temp += temp * (1 << 16); temp += temp * (1 << 16);
((uint32_t*)row)[0]=((uint32_t*)row)[1] = AV_WN32A(row, temp);
((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp; AV_WN32A(row+2, temp);
AV_WN32A(row+4, temp);
AV_WN32A(row+6, temp);
return; return;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment