[FFmpeg-devel] [PATCH] Fix unaligned casts in mlp

Jeff Downs heydowns
Fri Jun 12 00:07:18 CEST 2009


FATE mlp decoding test currently crashes on sparc partially due to an 
unaligned blind cast in ff_mlp_calculate_parity().

Attached fixes this by doing bytewise access until aligned, then 
continuing in 32-bit quantities.

(64-bit blocks were also tried under HAVE_FAST_64BIT, but was not 
significantly faster on the test machine -- marginally slower, actually)

Patch credit: Ramiro

	-Jeff
-------------- next part --------------
Index: libavcodec/mlp.c
===================================================================
--- libavcodec/mlp.c	(revision 19157)
+++ libavcodec/mlp.c	(working copy)
@@ -96,6 +96,8 @@
     uint32_t scratch = 0;
     const uint8_t *buf_end = buf + buf_size;
 
+    for (; ((intptr_t) buf & 3) && buf < buf_end; buf++)
+        scratch ^= *buf;
     for (; buf < buf_end - 3; buf += 4)
         scratch ^= *((const uint32_t*)buf);
 



More information about the ffmpeg-devel mailing list