On Mon, Dec 01, 2003 at 08:37:14AM -0800, Steven M. Schultz wrote: > > On Mon, 1 Dec 2003, Ronald Bultje wrote: > > > On Mon, 2003-12-01 at 00:06, Steven M. Schultz wrote: > > > As a temporary measure you can try editing the compat function > > > posix_memalign to return an aligned address. NOTE: this will result > > > > Is this function called often? If not, it can be easily worked around by > > creating a linked list of allocated pointers from posix_memalign(). > > Then, return (ret + 3) &~ 3. In posix_memalign_free, check the given > > pointer against each value in the list (listval + 3) &~ 3 and free > > > Well, it'd be either 16 or 64 byte alignment but the same thing > could be done of course. > > That is what I suggested Nicolas try as an experiment - adjust the > value returned from the compatibility posix_memalign() function to > see if the problem goes away. That would be the conclusive proof > that the alignment is indeed the cause of the problem.
I just tried an experiment. I added a printf just after the assignment to the piqf pointer in quant_non_intra_sse to print out the value of the address being passed into the line: mulps_m2r( *(mmx_t*)&piqf[0], xmm2 ); where it is segfaulting for me. The value of &piqf[0] for my setup was 0x40eb7008, which is 8 byte aligned, but not 16 byte aligned. So, then I just tried hardwiring the mulps_m2r line to say: mulps_m2r( *(mmx_t*)0x40eb7010, xmm2 ); where 0x40eb7010 is 16 byte aligned. Yes, I realize this will produce garbage output from mpeg2enc, I just wanted to see if changing the alignment of the pointer fixed it. Well, when I recompiled mpeg2enc, with the hardwired 0x40eb7010 pointer value, it ran like charm, running through all the frames in the test yuv stream I sent Andrew about a month ago so he could test and see if it was input data causing the trouble. So it looks like the address for the piqf pointer needs to be 16 byte aligned, and at least with glibc 2.1.2 it's only getting 8 byte alignment from glibc. PS - I tested the hardwired setup with 0x40eb7008, and it segfaulted with that value hardwired in. ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Mjpeg-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mjpeg-users