[Ffmpeg-devel] swscale and 64 bit problem (mmx code)

Reimar Döffinger Reimar.Doeffinger
Thu Mar 1 18:12:53 CET 2007


Hello,
On Thu, Mar 01, 2007 at 02:28:44PM +0100, Baptiste Coudurier wrote:
> Reimar D?ffinger wrote:
> > Well, the non-SWS_ACCURATE_RND case is trivial to fix I think, see attached
> > patch.
[...]
> > -			chrMmxFilter[4*i+0]= (int32_t)chrSrcPtr[i];
> > +			chrMmxFilter[4*i+0]= (uintptr_t)chrSrcPtr[i];
> > +			chrMmxFilter[4*i+1]= (uintptr_t)chrSrcPtr[i] >> 32;
[...]
> Isn't uintptr_t optional extended type in C99 ? I don't have specs,
> but Mans said last time those types were optional:
> http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-February/052196.html

Well, I originally intended to submit this only for testing, not for
inclusion since it is a hackish fix. Though probably no worse that it is
currently.
Attached is an alternative, since we can only support up to 64 bits that
way anyway, not using a *ptr_t type isn't a real loss.

Greetings,
Reimar D?ffinger
-------------- next part --------------
Index: libswscale/swscale_template.c
===================================================================
--- libswscale/swscale_template.c	(revision 22396)
+++ libswscale/swscale_template.c	(working copy)
@@ -3169,6 +3169,7 @@
 		for(i=0; i<vLumFilterSize; i++)
 		{
 			lumMmxFilter[4*i+0]= (int32_t)lumSrcPtr[i];
+			lumMmxFilter[4*i+1]= (uint64_t)lumSrcPtr[i] >> 32;
 			lumMmxFilter[4*i+2]= 
 			lumMmxFilter[4*i+3]= 
 				((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;
@@ -3176,6 +3177,7 @@
 		for(i=0; i<vChrFilterSize; i++)
 		{
 			chrMmxFilter[4*i+0]= (int32_t)chrSrcPtr[i];
+			chrMmxFilter[4*i+1]= (uint64_t)chrSrcPtr[i] >> 32;
 			chrMmxFilter[4*i+2]= 
 			chrMmxFilter[4*i+3]= 
 				((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001;



More information about the ffmpeg-devel mailing list