[XviD-devel] GME speedup

Christoph Lampert chl at math.uni-bonn.de
Fri Dec 12 09:02:30 CET 2003


On Fri, 12 Dec 2003, Antonin Misek wrote:

> Hi Gruel,
> it is relic of development :-))) "var" is sufficient.
> 
> TonyMi

Hi Tony again,

With your code I get the same GME results, but I get no speedup at all,
rather a small slowdown. The code is of course shorter to read, so we
might want to switch nevertheless, but on the other hand, long macros are
never good, either.  Maybe an inlined function would do the job as well.

Can you check again if this is really beneficial for you? 

gruel




> > On Fri, 12 Dec 2003, Antonin Misek wrote:
> > > I studied the function estimation_gmc.c/GlobalMotionEstRefine more and
> > > prepared new version. The change is relatively small. Output is
> > very similar
> > > to original. But it uses about 30% less calls of
> > estimation_gmc.c/globalSAD.
> > > It is tested with MSVC and ARCH_IS_GENERIC without ProcesorPack
> > (I cannot
> > > install it, it breaks compilation of my other project).
> > >
> > > Sorry Gruel for my last mail. I now understand that the specific part of
> > > code is not bug but hack.
> >
> > Hi Toni,
> >
> > why do you use   ##var  in the macro? Is there any reason simply "var"
> > isn't enough?
> >
> > gruel
> >
> >
> >
> > > 	int direction=4096,oldDirection;
> > >
> > > #define TEST_ONE_CHANGE(var,dir)\
> > > 	if ((!direction)&&(dir*2>oldDirection)) break;\
> > > 	##var--;\
> > > 	if ((gmcSAD = globalSAD(&bestwp, pParam, pMBs, current, pRef, pCurr,
> > > GMCblock))<gmcminSAD)\
> > > 	{ \
> > > 		gmcminSAD = gmcSAD;\
> > > 		direction |= dir;\
> > > 	} else {\
> > > 		##var+=2;\
> > > 		if ((gmcSAD = globalSAD(&bestwp, pParam, pMBs,
> > current, pRef, pCurr,
> > > GMCblock))<gmcminSAD)\
> > > 		{ \
> > > 			gmcminSAD = gmcSAD;\
> > > 			direction |= dir*2;\
> > > 		} else {\
> > > 			##var--;}\
> > > 	}
> > >
> > > 	do {
> > > 		oldDirection=direction;
> > > 		direction = 0;
> > > 		TEST_ONE_CHANGE(bestwp.duv[0].x,1);
> > > 		TEST_ONE_CHANGE(bestwp.duv[0].y,4);
> > > 		TEST_ONE_CHANGE(bestwp.duv[1].x,16);
> > > 		TEST_ONE_CHANGE(bestwp.duv[1].y,64);
> > > 		TEST_ONE_CHANGE(bestwp.duv[2].x,256);
> > > 		TEST_ONE_CHANGE(bestwp.duv[2].y,1024);
> > > 	} while (direction);
> > >
> > >
> > > _______________________________________________
> > > XviD-devel mailing list
> > > XviD-devel at xvid.org
> > > http://list.xvid.org/mailman/listinfo/xvid-devel
> > >
> >
> > _______________________________________________
> > XviD-devel mailing list
> > XviD-devel at xvid.org
> > http://list.xvid.org/mailman/listinfo/xvid-devel
> >
> 
> 
> _______________________________________________
> XviD-devel mailing list
> XviD-devel at xvid.org
> http://list.xvid.org/mailman/listinfo/xvid-devel
> 



More information about the XviD-devel mailing list