[FFmpeg-devel] [PATCH] fix r18319

Reimar Döffinger Reimar.Doeffinger
Fri Apr 3 14:50:52 CEST 2009


Hello,
several fixes to be applied separately:
1) ff_vector128 is only used locally and via MANGLE, so it should use
DECLARE_ASM_CONST
2) all output operands are written before we finished using the input
operands so they must be early-clobber (&)
3) using av_uninit is a horrible hack instead the correct =& asm
constraint should have been used. I'd like to remind everyone to _think_
and think again before using av_uninit, it is _only_ for working around
when the compiler is wrong, not to hide that your code is broken!

Greetings,
Reimar D?ffinger
-------------- next part --------------
Index: libavcodec/x86/dsputil_mmx.c
===================================================================
--- libavcodec/x86/dsputil_mmx.c	(revision 18324)
+++ libavcodec/x86/dsputil_mmx.c	(working copy)
@@ -272,7 +272,7 @@
             :"memory");
 }
 
-DECLARE_ALIGNED_8(const unsigned char, ff_vector128[8]) =
+DECLARE_ASM_CONST(8, uint8_t, ff_vector128[8]) =
   { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
 
 #define put_signed_pixels_clamped_mmx_half(off) \
@@ -296,7 +296,7 @@
 void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
 {
     x86_reg line_skip = line_size;
-    x86_reg av_uninit(line_skip3);
+    x86_reg line_skip3;
 
     __asm__ volatile (
             "movq "MANGLE(ff_vector128)", %%mm0 \n\t"
@@ -304,7 +304,7 @@
             put_signed_pixels_clamped_mmx_half(0)
             "lea (%0, %3, 4), %0                \n\t"
             put_signed_pixels_clamped_mmx_half(64)
-            :"+r" (pixels), "+r" (line_skip3)
+            :"+&r" (pixels), "=&r" (line_skip3)
             :"r" (block), "r"(line_skip)
             :"memory");
 }



More information about the ffmpeg-devel mailing list