--- motion.c.orig 2005-01-29 15:08:50.515458080 +0100 +++ motion.c 2005-01-29 17:07:14.983414784 +0100 @@ -146,12 +146,20 @@ " pxor %%mm7 , %%mm7; /* clear mm7 */\n" " /* */\n" " movl %1 , %%eax; /* load frameadress into eax */\n" +#ifdef __PIC__ + " movl %2 , %%esi; /* load frameadress into esi */\n" +#else " movl %2 , %%ebx; /* load frameadress into ebx */\n" +#endif " movl %3 , %%ecx; /* load width into ecx */\n" " /* */\n" ".rept 8 ; /* Loop for 8 lines */\n" " movq (%%eax), %%mm1; /* 8 Pixels from filtered frame to mm1 */\n" +#ifdef __PIC__ + " movq (%%esi), %%mm2; /* 8 Pixels from reference frame to mm2 */\n" +#else " movq (%%ebx), %%mm2; /* 8 Pixels from reference frame to mm2 */\n" +#endif " movq %%mm2 , %%mm3; /* hold a copy of mm2 in mm3 */\n" " psubusb %%mm1 , %%mm3; /* positive differences between mm2 and mm1 */\n" " psubusb %%mm2 , %%mm1; /* positive differences between mm1 and mm3 */\n" @@ -162,13 +170,21 @@ " paddusw %%mm1 , %%mm0; /* add mm1 (stored in mm1 and mm2...) */\n" " paddusw %%mm2 , %%mm0; /* to mm0 */\n" " addl %%ecx , %%eax; /* add framewidth to frameaddress */\n" +#ifdef __PIC__ + " addl %%ecx , %%esi; /* add framewidth to frameaddress */\n" +#else " addl %%ecx , %%ebx; /* add framewidth to frameaddress */\n" +#endif " .endr /* end loop */\n" " /* */\n" " movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n" :"=m" (a) :"m" (frm), "m" (ref), "m" (denoiser.frame.w) +#ifdef __PIC__ + :"%eax", "%esi", "%ecx" +#else :"%eax", "%ebx", "%ecx" +#endif ); #endif @@ -191,21 +207,37 @@ ( " pxor %%mm0 , %%mm0; /* clear mm0 */\n" " movl %1 , %%eax; /* load frameadress into eax */\n" +#ifdef __PIC__ + " movl %2 , %%esi; /* load frameadress into esi */\n" +#else " movl %2 , %%ebx; /* load frameadress into ebx */\n" +#endif " movl %3 , %%ecx; /* load width into ecx */\n" " ; /* */\n" " .rept 8 ; /* */\n" " movq (%%eax), %%mm1; /* 8 Pixels from filtered frame to mm1 */\n" +#ifdef __PIC__ + " psadbw (%%esi), %%mm1; /* 8 Pixels difference to mm1 */\n" +#else " psadbw (%%ebx), %%mm1; /* 8 Pixels difference to mm1 */\n" +#endif " paddusw %%mm1 , %%mm0; /* add result to mm0 */\n" " addl %%ecx , %%eax; /* add framewidth to frameaddress */\n" +#ifdef __PIC__ + " addl %%ecx , %%esi; /* add framewidth to frameaddress */\n" +#else " addl %%ecx , %%ebx; /* add framewidth to frameaddress */\n" +#endif " .endr ; /* */\n" " /* */\n" " movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n" :"=m" (a) :"m" (frm), "m" (ref), "m" (denoiser.frame.w) +#ifdef __PIC__ + :"%eax", "%esi", "%ecx" +#else :"%eax", "%ebx", "%ecx" +#endif ); #endif return a; @@ -254,12 +286,20 @@ " pxor %%mm7 , %%mm7; /* clear mm7 */\n" " /* */\n" " movl %1 , %%eax; /* load frameadress into eax */\n" +#ifdef __PIC__ + " movl %2 , %%esi; /* load frameadress into esi */\n" +#else " movl %2 , %%ebx; /* load frameadress into ebx */\n" +#endif " movl %3 , %%ecx; /* load width into ecx */\n" " /* */\n" ".rept 4 ; /* Loop for 4 lines */\n" " movd (%%eax), %%mm1; /* 4 Pixels from filtered frame to mm1 */\n" +#ifdef __PIC__ + " movd (%%esi), %%mm2; /* 4 Pixels from reference frame to mm2 */\n" +#else " movd (%%ebx), %%mm2; /* 4 Pixels from reference frame to mm2 */\n" +#endif " movq %%mm2 , %%mm3; /* hold a copy of mm2 in mm3 */\n" " psubusb %%mm1 , %%mm3; /* positive differences between mm2 and mm1 */\n" " psubusb %%mm2 , %%mm1; /* positive differences between mm1 and mm3 */\n" @@ -270,13 +310,21 @@ " paddusw %%mm1 , %%mm2; /* add mm1 (stored in mm1 and mm2...) */\n" " paddusw %%mm2 , %%mm0; /* to mm0 */\n" " addl %%ecx , %%eax; /* add framewidth to frameaddress */\n" +#ifdef __PIC__ + " addl %%ecx , %%esi; /* add framewidth to frameaddress */\n" +#else " addl %%ecx , %%ebx; /* add framewidth to frameaddress */\n" +#endif " .endr /* end loop */\n" " /* */\n" " movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n" :"=m" (a) :"m" (frm), "m" (ref), "m" (halfwidth) +#ifdef __PIC__ + :"%eax", "%esi", "%ecx" +#else :"%eax", "%ebx", "%ecx" +#endif ); #endif return (uint32_t)(a[0]+a[1]+a[2]+a[3]); @@ -300,13 +348,21 @@ " pxor %%mm7 , %%mm7; /* clear mm7 */\n" " /* */\n" " movl %1 , %%eax; /* load frameadress into eax */\n" +#ifdef __PIC__ + " movl %2 , %%esi; /* load frameadress into esi */\n" +#else " movl %2 , %%ebx; /* load frameadress into ebx */\n" +#endif " movl %3 , %%ecx; /* load width into ecx */\n" " /* */\n" ".rept 8 ; /* Loop for 8 lines */\n" " movw (%%eax), %%dx; /* */\n" " movd %%edx , %%mm1; /* 2 Pixels from filtered frame to mm1 */\n" +#ifdef __PIC__ + " movw (%%esi), %%dx; /* */\n" +#else " movw (%%ebx), %%dx; /* */\n" +#endif " movd %%edx , %%mm2; /* 2 Pixels from reference frame to mm2 */\n" " movq %%mm2 , %%mm3; /* hold a copy of mm2 in mm3 */\n" " psubusb %%mm1 , %%mm3; /* positive differences between mm2 and mm1 */\n" @@ -318,13 +374,21 @@ " paddusw %%mm1 , %%mm2; /* add mm1 (stored in mm1 and mm2...) */\n" " paddusw %%mm2 , %%mm0; /* to mm0 */\n" " addl %%ecx , %%eax; /* add framewidth to frameaddress */\n" +#ifdef __PIC__ + " addl %%ecx , %%esi; /* add framewidth to frameaddress */\n" +#else " addl %%ecx , %%ebx; /* add framewidth to frameaddress */\n" +#endif " .endr /* end loop */\n" " /* */\n" " movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n" :"=m" (a) :"m" (frm), "m" (ref), "m" (W2) +#ifdef __PIC__ + :"%eax", "%esi", "%ecx" +#else :"%eax", "%ebx", "%ecx" +#endif ); #endif return (uint32_t)(a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]); @@ -348,22 +412,38 @@ ( " pxor %%mm0 , %%mm0; /* clear mm0 */\n" " movl %1 , %%eax; /* load frameadress into eax */\n" +#ifdef __PIC__ + " movl %2 , %%esi; /* load frameadress into esi */\n" +#else " movl %2 , %%ebx; /* load frameadress into ebx */\n" +#endif " movl %3 , %%ecx; /* load width into ecx */\n" " ; /* */\n" " .rept 4 ; /* */\n" " movd (%%eax), %%mm1; /* 4 Pixels from filtered frame to mm1 */\n" +#ifdef __PIC__ + " movd (%%esi), %%mm2; /* 4 Pixels from filtered frame to mm2 */\n" +#else " movd (%%ebx), %%mm2; /* 4 Pixels from filtered frame to mm2 */\n" +#endif " psadbw %%mm2 , %%mm1; /* 4 Pixels difference to mm1 */\n" " paddusw %%mm1 , %%mm0; /* add result to mm0 */\n" " addl %%ecx , %%eax; /* add framewidth to frameaddress */\n" +#ifdef __PIC__ + " addl %%ecx , %%esi; /* add framewidth to frameaddress */\n" +#else " addl %%ecx , %%ebx; /* add framewidth to frameaddress */\n" +#endif " .endr ; /* */\n" " /* */\n" " movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n" :"=m" (a) :"m" (frm), "m" (ref), "m" (halfwidth) +#ifdef __PIC__ + :"%eax", "%esi", "%ecx" +#else :"%eax", "%ebx", "%ecx" +#endif ); #endif return a; @@ -385,24 +465,40 @@ ( " pxor %%mm0 , %%mm0; /* clear mm0 */\n" " movl %1 , %%eax; /* load frameadress into eax */\n" +#ifdef __PIC__ + " movl %2 , %%esi; /* load frameadress into esi */\n" +#else " movl %2 , %%ebx; /* load frameadress into ebx */\n" +#endif " movl %3 , %%ecx; /* load width into ecx */\n" " ; /* */\n" " .rept 8 ; /* */\n" " movw (%%eax), %%dx; /* */\n" " movd %%edx , %%mm1; /* 2 Pixels from filtered frame to mm1 */\n" +#ifdef __PIC__ + " movw (%%esi), %%dx; /* */\n" +#else " movw (%%ebx), %%dx; /* */\n" +#endif " movd %%edx , %%mm2; /* 2 Pixels from filtered frame to mm2 */\n" " psadbw %%mm2 , %%mm1; /* 2 Pixels difference to mm1 */\n" " paddusw %%mm1 , %%mm0; /* add result to mm0 */\n" " addl %%ecx , %%eax; /* add framewidth to frameaddress */\n" +#ifdef __PIC__ + " addl %%ecx , %%esi; /* add framewidth to frameaddress */\n" +#else " addl %%ecx , %%ebx; /* add framewidth to frameaddress */\n" +#endif " .endr ; /* */\n" " /* */\n" " movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n" :"=m" (a) :"m" (frm), "m" (ref), "m" (W2) +#ifdef __PIC__ + :"%eax", "%esi", "%ecx" +#else :"%eax", "%ebx", "%ecx" +#endif ); #endif return a; @@ -448,13 +544,21 @@ ( " pxor %%mm0 , %%mm0; /* clear mm0 */" " movl %1 , %%eax; /* load frameadress into eax */" +#ifdef __PIC__ + " movl %2 , %%esi; /* load frameadress into esi */" +#else " movl %2 , %%ebx; /* load frameadress into ebx */" +#endif " movl %3 , %%ecx; /* load frameadress into ecx */" " movl %4 , %%edx; /* load width into edx */" " ; /* */" " .rept 8 ; /* */" " movq (%%eax), %%mm1; /* 8 Pixels from filtered frame to mm1 */" +#ifdef __PIC__ + " movq (%%esi), %%mm2; /* 8 Pixels from filtered frame to mm2 (displaced) */" +#else " movq (%%ebx), %%mm2; /* 8 Pixels from filtered frame to mm2 (displaced) */" +#endif " movq (%%ecx), %%mm3; /* reference to mm3 */" " psrlq $1 , %%mm1; /* average source pixels */" " psrlq $1 , %%mm2; /* shift right by one (divide by two) */" @@ -468,14 +572,22 @@ " paddusb %%mm3 , %%mm1; /* mm1 now contains abs(mm1-mm2) */" " paddusw %%mm1 , %%mm0; /* add result to mm0 */" " addl %%edx , %%eax; /* add framewidth to frameaddress */" +#ifdef __PIC__ + " addl %%edx , %%esi; /* add framewidth to frameaddress */" +#else " addl %%edx , %%ebx; /* add framewidth to frameaddress */" +#endif " addl %%edx , %%ecx; /* add framewidth to frameaddress */" " .endr ; /* */" " /* */" " movq %%mm0 , %0 ; /* make mm0 available to gcc ... */" :"=m" (a) :"m" (frm1),"m" (frm2), "m" (ref), "m" (denoiser.frame.w), "m" (*bit_mask) +#ifdef __PIC__ + :"%eax", "%esi", "%ecx", "%edx" +#else :"%eax", "%ebx", "%ecx", "%edx" +#endif ); #endif return a; @@ -497,26 +609,42 @@ ( " pxor %%mm0 , %%mm0; /* clear mm0 */\n" " movl %1 , %%eax; /* load frameadress into eax */\n" +#ifdef __PIC__ + " movl %2 , %%esi; /* load frameadress into esi */\n" +#else " movl %2 , %%ebx; /* load frameadress into ebx */\n" +#endif " movl %3 , %%ecx; /* load frameadress into ecx */\n" " movl %4 , %%edx; /* load width into edx */\n" " ; /* */\n" " .rept 8 ; /* */\n" " movq (%%eax), %%mm1; /* 8 Pixels from filtered frame to mm1 */\n" +#ifdef __PIC__ + " movq (%%esi), %%mm2; /* 8 Pixels from filtered frame to mm2 (displaced) */\n" +#else " movq (%%ebx), %%mm2; /* 8 Pixels from filtered frame to mm2 (displaced) */\n" +#endif " movq (%%ecx), %%mm3; /* 8 Pixels from reference frame to mm3 */\n" " pavgb %%mm2 , %%mm1; /* average source pixels */\n" " psadbw %%mm3 , %%mm1; /* 8 Pixels difference to mm1 */\n" " paddusw %%mm1 , %%mm0; /* add result to mm0 */\n" " addl %%edx , %%eax; /* add framewidth to frameaddress */\n" +#ifdef __PIC__ + " addl %%edx , %%esi; /* add framewidth to frameaddress */\n" +#else " addl %%edx , %%ebx; /* add framewidth to frameaddress */\n" +#endif " addl %%edx , %%ecx; /* add framewidth to frameaddress */\n" " .endr ; /* */\n" " /* */\n" " movq %%mm0 , %0 ; /* make mm0 available to gcc ... */\n" :"=m" (a) :"m" (frm1),"m" (frm2), "m" (ref), "m" (denoiser.frame.w) +#ifdef __PIC__ + :"%eax", "%esi", "%ecx", "%edx" +#else :"%eax", "%ebx", "%ecx", "%edx" +#endif ); #endif return a;