From c4e8733ac1214f507e7394bca3588bf104f055d9 Mon Sep 17 00:00:00 2001 From: Vitor Sessak Date: Fri, 12 Nov 2010 19:55:26 +0000 Subject: [PATCH] Fix visual artifacts in 4XM decoding on big-endian system Originally committed as revision 25734 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/4xm.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index b6a97aa187..23e8ca4420 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -260,6 +260,23 @@ static void init_mv(FourXContext *f){ } } +#if HAVE_BIGENDIAN +#define LE_CENTRIC_MUL(dst, src, scale, dc) \ + { \ + unsigned tmpval = AV_RN32(src); \ + tmpval = (tmpval << 16) | (tmpval >> 16); \ + tmpval = tmpval * (scale) + (dc); \ + tmpval = (tmpval << 16) | (tmpval >> 16); \ + AV_WN32A(dst, tmpval); \ + } +#else +#define LE_CENTRIC_MUL(dst, src, scale, dc) \ + { \ + unsigned tmpval = AV_RN32(src) * (scale) + (dc); \ + AV_WN32A(dst, tmpval); \ + } +#endif + static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stride, int scale, int dc){ int i; dc*= 0x10001; @@ -274,25 +291,25 @@ static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stri break; case 1: for(i=0; i