Commit 5a761713 authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

lavc/jrevdct: Avoid an aliasing violation.

Fixes fate on different PowerPC systems with some compilers.

Analyzed-by: Lauri Kasanen
parent fd2d6f37
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
*/ */
#include "libavutil/common.h" #include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "dct.h" #include "dct.h"
#include "idctdsp.h" #include "idctdsp.h"
...@@ -234,7 +235,7 @@ void ff_j_rev_dct(DCTBLOCK data) ...@@ -234,7 +235,7 @@ void ff_j_rev_dct(DCTBLOCK data)
* row DCT calculations can be simplified this way. * 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 /* WARNING: we do the same permutation as MMX idct to simplify the
video core */ video core */
...@@ -254,10 +255,10 @@ void ff_j_rev_dct(DCTBLOCK data) ...@@ -254,10 +255,10 @@ void ff_j_rev_dct(DCTBLOCK data)
int16_t dcval = (int16_t) (d0 * (1 << PASS1_BITS)); int16_t dcval = (int16_t) (d0 * (1 << PASS1_BITS));
register int v = (dcval & 0xffff) | ((dcval * (1 << 16)) & 0xffff0000); register int v = (dcval & 0xffff) | ((dcval * (1 << 16)) & 0xffff0000);
idataptr[0] = v; AV_WN32A(&idataptr[ 0], v);
idataptr[1] = v; AV_WN32A(&idataptr[ 4], v);
idataptr[2] = v; AV_WN32A(&idataptr[ 8], v);
idataptr[3] = v; AV_WN32A(&idataptr[12], v);
} }
dataptr += DCTSIZE; /* advance pointer to next row */ dataptr += DCTSIZE; /* advance pointer to next row */
...@@ -974,7 +975,7 @@ void ff_j_rev_dct4(DCTBLOCK data) ...@@ -974,7 +975,7 @@ void ff_j_rev_dct4(DCTBLOCK data)
* row DCT calculations can be simplified this way. * row DCT calculations can be simplified this way.
*/ */
register int *idataptr = (int*)dataptr; register uint8_t *idataptr = (uint8_t*)dataptr;
d0 = dataptr[0]; d0 = dataptr[0];
d2 = dataptr[1]; d2 = dataptr[1];
...@@ -988,8 +989,8 @@ void ff_j_rev_dct4(DCTBLOCK data) ...@@ -988,8 +989,8 @@ void ff_j_rev_dct4(DCTBLOCK data)
int16_t dcval = (int16_t) (d0 << PASS1_BITS); int16_t dcval = (int16_t) (d0 << PASS1_BITS);
register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000); register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
idataptr[0] = v; AV_WN32A(&idataptr[0], v);
idataptr[1] = v; AV_WN32A(&idataptr[4], v);
} }
dataptr += DCTSTRIDE; /* advance pointer to next row */ dataptr += DCTSTRIDE; /* advance pointer to next row */
......
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