[Ffmpeg-devel] Seg fault

g. the_ether
Mon Nov 21 00:13:25 CET 2005

I am getting a segmentation fault in ByteSwap32 of bswap.h

All I did was exchange the diff_pixels_mmx routine with a new one and now I 
get the segemntation fault in a totally unrelated area. On my test sequence it 
occurs in the 7th frame, so all is okay for over 8,000 thousand blocks.

It occurs from put_bits being called from mpeg1_encode_block and occurs on 
block number 5 of the macroblock.

It is either a subtle bug with ByteSwap32 or a compiler / linker problem. I 
changed the optimisation level down to 1 and deleted the frame pointer removal 
option but that didn't fix it. The new pixel_diff routine I am using is being 
linked in from a Windows library but if there was some weird linker error I 
doubt I would have managed to get through 8,000+ blocks before encountering a 
problem that resulted from bad linkage.

The src of the ffmpeg code I crash in is:

static inline uint32_t ByteSwap32(uint32_t x)
#if __CPU__ > 386
 __asm("bswap	%0":
      "=r" (x)     :
 __asm("xchgb	%b0,%h0\n"
      "	rorl	$16,%0\n"
      "	xchgb	%b0,%h0":
      LEGACY_REGS (x)		:
      "0" (x));
  return x;

I am using a P4 HT and gcc version 3.4.2 under MinGW.


More information about the ffmpeg-devel mailing list