[XviD-devel] GME

elcabesa elcabesa at inwind.it
Sat Jul 12 17:37:02 CEST 2003


thank you Radek for reply, i already know this problem and i use motion vector 
form previous frame (i hope they will not change too much between 2 frame)
i write some code but i had some problem

i add 

	static int* my_vector=NULL;
	if(my_vector==NULL)
	{
	my_vector=malloc(sizeof(int)*2*mb_width*mb_height);
	}
just after 
FrameCodeP(Encoder * pEnc,
		   Bitstream * bs,
		   bool force_inter,
		   bool vol_header)

then  

	
	for(x=0;x<mb_width;x++)
	{
		for(y=0;y<mb_height;y++)
		{
	//	printf("x %d y %d dx %d dy %d\n",x,y, 
my_vector[2*(x+mb_width*y)],my_vector[2*(x+mb_width*y)+1]);
			
        		MACROBLOCK * pMB = &current->mbs[y*mb_width + x];
			if((y*16)+my_vector[2*(x+mb_width*y)+1]<0)
			{
			
			//printf("up x %d y %d \n",x,y);
			pMB->dquant=-2;
			}
			if(((y+1)*16)+my_vector[2*(x+mb_width*y)+1]>16*mb_height)
			{
			//printf("down x %d y %d \n",x,y);
			pMB->dquant=-2;
			}
			if((x*16)+my_vector[2*(x+mb_width*y)]<0)
			{
			//printf("left x %d y %d dx %d dy %d\n",x,y, 
my_vector[2*(x+mb_width*y)],my_vector[2*(x+mb_width*y)+1]);
			pMB->dquant=-2;
			}
			if(((x+1)*16)+my_vector[2*(x+mb_width*y)]>16*mb_width)
			{
			//printf("right x %d y %d \n",x,y);
			pMB->dquant=-2;
			}
			
		}
	}
	
	int* quant;
	quant=malloc(sizeof(int)*mb_width*mb_height);
	for(x=0;x<mb_width;x++)
	{
		for(y=0;y<mb_height;y++)
		{
		MACROBLOCK * pMB = &current->mbs[y*mb_width + x];
		quant[x+mb_width*y]=pMB->dquant;
		}
	}
	for(x=0;x<mb_width;x++)
	{
		for(y=0;y<mb_height;y++)
		{
		MACROBLOCK * pMB = &current->mbs[y*mb_width + x];
		if((x+mb_width*y-1)>=0)
		pMB->dquant=quant[x+mb_width*y]-quant[x+mb_width*y-1];
		}
	}
	
just before

	SetMacroblockQuants(&pEnc->mbParam, current);
	

end finally  after MotionEstimation
	
	
	for(x=0;x<mb_width;x++)
	{
		for(y=0;y<mb_height;y++)
		{
		
        		MACROBLOCK * pMB = &current->mbs[y*mb_width + x];
			my_vector[2*(x+mb_width*y)]=pMB->mvs[0].x;
			my_vector[2*(x+mb_width*y)+1]=pMB->mvs[0].y;
			
		}
	}
	

i tested it and it found the rigth macrobloc but i think that some error are 
inside code just because lots of macroblock stop properly working

how can i set quantizer for a mblock withou having problem??


More information about the XviD-devel mailing list