[XviD-devel] [BUG] CheckCandidateBits8/16

Edouard Gomez ed.gomez at free.fr
Fri Mar 28 09:14:41 CET 2003


Syskin, you can't use fdct on unaligned data, that's probably one of the
many causes to SSE2 failures. Please have a review of your code, and fix
things like the one in attachment.

Oh yeah, and please, don't use "static" variables, it breaks Reentrancy.

Index: motion_est.c
===================================================================
RCS file: /xvid/xvidcore/src/motion/motion_est.c,v
retrieving revision 1.58.2.4
diff -u -r1.58.2.4 motion_est.c
--- motion_est.c	27 Mar 2003 17:09:59 -0000	1.58.2.4
+++ motion_est.c	28 Mar 2003 08:11:45 -0000
@@ -661,7 +661,8 @@
 CheckCandidateBits16(const int x, const int y, const int Direction, int * const dir, const SearchData * const data)
 {
 
-	static int16_t in[64], coeff[64];
+	DECLARE_ALIGNED_MATRIX(in,    64, 1, int16_t, CACHE_LINE);
+	DECLARE_ALIGNED_MATRIX(coeff, 64, 1, int16_t, CACHE_LINE);
 	int32_t bits = 0, sum;
 	VECTOR * current;
 	const uint8_t * ptr;
@@ -746,7 +747,8 @@
 CheckCandidateBits8(const int x, const int y, const int Direction, int * const dir, const SearchData * const data)
 {
 
-	static int16_t in[64], coeff[64];
+	DECLARE_ALIGNED_MATRIX(in,    64, 1, int16_t, CACHE_LINE);
+	DECLARE_ALIGNED_MATRIX(coeff, 64, 1, int16_t, CACHE_LINE);
 	int32_t sum, bits;
 	VECTOR * current;
 	const uint8_t * ptr;

-- 
Edouard Gomez-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://edu.bnhof.de/pipermail/xvid-devel/attachments/20030328/e73a22f3/attachment.bin


More information about the XviD-devel mailing list