[x264-devel] Fix plane_copy_deinterleave_v210 on big-endian
Alexandra Hájková
git at videolan.org
Tue Jan 24 21:14:11 CET 2017
x264 | branch: master | Alexandra Hájková <alexandra at khirnov.net> | Wed Jan 18 09:13:39 2017 +0000| [2ebe09a4f583d108c6ec1caf70b2a7a289a8820d] | committer: Henrik Gramner
Fix plane_copy_deinterleave_v210 on big-endian
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=2ebe09a4f583d108c6ec1caf70b2a7a289a8820d
---
common/mc.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/common/mc.c b/common/mc.c
index dc39c5e..bc16355 100644
--- a/common/mc.c
+++ b/common/mc.c
@@ -353,6 +353,15 @@ static void x264_plane_copy_deinterleave_rgb_c( pixel *dsta, intptr_t i_dsta,
}
}
+#if WORDS_BIGENDIAN
+static ALWAYS_INLINE uint32_t v210_endian_fix32( uint32_t x )
+{
+ return (x<<24) + ((x<<8)&0xff0000) + ((x>>8)&0xff00) + (x>>24);
+}
+#else
+#define v210_endian_fix32(x) (x)
+#endif
+
void x264_plane_copy_deinterleave_v210_c( pixel *dsty, intptr_t i_dsty,
pixel *dstc, intptr_t i_dstc,
uint32_t *src, intptr_t i_src, int w, int h )
@@ -365,14 +374,14 @@ void x264_plane_copy_deinterleave_v210_c( pixel *dsty, intptr_t i_dsty,
for( int n = 0; n < w; n += 3 )
{
- *(dstc0++) = *src0 & 0x03FF;
- *(dsty0++) = ( *src0 >> 10 ) & 0x03FF;
- *(dstc0++) = ( *src0 >> 20 ) & 0x03FF;
- src0++;
- *(dsty0++) = *src0 & 0x03FF;
- *(dstc0++) = ( *src0 >> 10 ) & 0x03FF;
- *(dsty0++) = ( *src0 >> 20 ) & 0x03FF;
- src0++;
+ uint32_t s = v210_endian_fix32( *src0++ );
+ *dstc0++ = s & 0x03FF;
+ *dsty0++ = (s >> 10) & 0x03FF;
+ *dstc0++ = (s >> 20) & 0x03FF;
+ s = v210_endian_fix32( *src0++ );
+ *dsty0++ = s & 0x03FF;
+ *dstc0++ = (s >> 10) & 0x03FF;
+ *dsty0++ = (s >> 20) & 0x03FF;
}
dsty += i_dsty;
More information about the x264-devel
mailing list