[FFmpeg-devel] [PATCH] fix add_bytes_mmx and add_bytes_l2_mmx for w <= 15

Reimar Döffinger Reimar.Doeffinger
Sat Jun 21 20:40:02 CEST 2008


Hello,
as noticeable when decoding small png images, these two functions do not
work correctly and cause a segfault.
Attached is one possible solution, I think another would be to change
the jb to js and jmp to the comparison before the first loop.

Greetings,
Reimar D?ffinger
-------------- next part --------------
Index: libavcodec/i386/dsputil_mmx.c
===================================================================
--- libavcodec/i386/dsputil_mmx.c	(revision 13854)
+++ libavcodec/i386/dsputil_mmx.c	(working copy)
@@ -481,6 +481,7 @@
 
 static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){
     x86_reg i=0;
+    if (w > 15)
     asm volatile(
         "1:                             \n\t"
         "movq  (%1, %0), %%mm0          \n\t"
@@ -503,6 +504,7 @@
 
 static void add_bytes_l2_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
     x86_reg i=0;
+    if (w > 15)
     asm volatile(
         "1:                             \n\t"
         "movq   (%2, %0), %%mm0         \n\t"



More information about the ffmpeg-devel mailing list