Ok, I've finally brought ffmpeg to build cleanly here (i386). As said before, I've removed the ebx clobber, since ebx isn't clobbered anyway.
The second problem was transpose4x4(), where gcc screwed up (the problem I described earlier). The patch proposed by Steve fixes a simmilar problem about 50 lines later. I've made simmilar changes to transpose4x4(), which made it compile finally. The last problem was with dct_quantize(), which I've finally fixed with some help of the gcc people. "m" operands must have their address calculateable, which wasn't possible here. I was told that this might actually be a gcc bug, but they weren't sure. A patch that fixes all these problems is attatched. HTH, Christian Aichinger
diff -Nur ffmpeg-0.cvs20050626/libavcodec/libpostproc/postprocess_template.c ffmpeg/libavcodec/libpostproc/postprocess_template.c --- ffmpeg-0.cvs20050626/libavcodec/libpostproc/postprocess_template.c 2005-08-07 09:54:10.000000000 +0200 +++ ffmpeg/libavcodec/libpostproc/postprocess_template.c 2005-08-07 10:26:47.000000000 +0200 @@ -3289,7 +3289,6 @@ "r" ((long)srcStride), "r" ((long)dstStride) #if defined(PIC) && !defined(ARCH_X86_64) - : "%"REG_b #else : "%"REG_d #endif @@ -3343,7 +3342,7 @@ "r" ((long)srcStride), "r" ((long)dstStride) #if defined(PIC) && !defined(ARCH_X86_64) - : "%"REG_a, "%"REG_b + : "%"REG_a #else : "%"REG_a, "%"REG_d #endif --- ffmpeg-0.cvs20050626/libavcodec/i386/dsputil_mmx.c 2005-08-07 15:16:20.000000000 +0200 +++ ffmpeg/libavcodec/i386/dsputil_mmx.c 2005-08-07 15:15:21.000000000 +0200 @@ -616,30 +616,31 @@ static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){ asm volatile( //FIXME could save 1 instruction if done as 8x4 ... - "movd %4, %%mm0 \n\t" - "movd %5, %%mm1 \n\t" - "movd %6, %%mm2 \n\t" - "movd %7, %%mm3 \n\t" + "push %2 \n\t" + "push %0 \n\t" + "movd (%2), %%mm0 \n\t" + "movd (%2,%3), %%mm1 \n\t" + "lea (%2, %3, 2), %2 \n\t" + "movd (%2), %%mm2 \n\t" + "movd (%2,%3), %%mm3 \n\t" "punpcklbw %%mm1, %%mm0 \n\t" "punpcklbw %%mm3, %%mm2 \n\t" "movq %%mm0, %%mm1 \n\t" "punpcklwd %%mm2, %%mm0 \n\t" "punpckhwd %%mm2, %%mm1 \n\t" - "movd %%mm0, %0 \n\t" + "movd %%mm0, (%0) \n\t" "punpckhdq %%mm0, %%mm0 \n\t" - "movd %%mm0, %1 \n\t" - "movd %%mm1, %2 \n\t" + "movd %%mm0, (%0,%1) \n\t" + "lea (%0, %1, 2), %0 \n\t" + "movd %%mm1, (%0) \n\t" "punpckhdq %%mm1, %%mm1 \n\t" - "movd %%mm1, %3 \n\t" - - : "=m" (*(uint32_t*)(dst + 0*dst_stride)), - "=m" (*(uint32_t*)(dst + 1*dst_stride)), - "=m" (*(uint32_t*)(dst + 2*dst_stride)), - "=m" (*(uint32_t*)(dst + 3*dst_stride)) - : "m" (*(uint32_t*)(src + 0*src_stride)), - "m" (*(uint32_t*)(src + 1*src_stride)), - "m" (*(uint32_t*)(src + 2*src_stride)), - "m" (*(uint32_t*)(src + 3*src_stride)) + "movd %%mm1, (%0,%1) \n\t" + "popl %0 \n\t" + "popl %2 \n\t" + :: "r" (dst), + "r" (dst_stride), + "r" (src), + "r" (src_stride) ); } --- ffmpeg-0.cvs20050626/libavcodec/i386/mpegvideo_mmx_template.c 2005-08-07 16:46:56.000000000 +0200 +++ ffmpeg/libavcodec/i386/mpegvideo_mmx_template.c 2005-08-07 16:46:38.000000000 +0200 @@ -153,6 +153,7 @@ : "g" (s->max_qcoeff) ); }else{ // FMT_H263 + const uint16_t *qmat2 = qmat+64; asm volatile( "movd %%"REG_a", %%mm3 \n\t" // last_non_zero_p1 SPREADW(%%mm3) @@ -198,7 +199,7 @@ "movzb %%al, %%"REG_a" \n\t" // last_non_zero_p1 : "+a" (last_non_zero_p1) #if defined(PIC) && !defined(ARCH_X86_64) - : "r" (block+64), "m" (qmat+64), "r" (bias+64), + : "r" (block+64), "m" (qmat2), "r" (bias+64), #else : "r" (block+64), "r" (qmat+64), "r" (bias+64), #endif
signature.asc
Description: Digital signature