[XviD-devel] bug in the XviD encoder about full pixel precision ?

zhouxiao xvid-devel@xvid.org
Thu, 19 Dec 2002 19:36:1 +0800


I am a starter on XviD and It seems like a bug in the XviD encoder about full pixel precision.

The possible bug exists in this way: 

In xvid_encraw.c, we can specify the encoder quanlity between [ 0, 6]. 
the quanlity determines the working mode of encoder. 
According to the general_preset[], if we specify quanlity be 0 ~2, encoder will work in full pixel precision , and if specify quanlity be 3 ~ 6, in half pixel precision. 

Now assume encoder quanlity be 1, that is, encoder works in full pixel precision. 

Thus, during encodeing a P-frame , encoder will not interpolate this frame because of full pixel precision. that is, in function FrameCodeP(), this if-sentence wil be skipped: 

if ((pEnc->current->global_flags & XVID_HALFPEL)) 
{ 
image_interpolate ( pRef, &pEnc->vInterH, &pEnc->vInterV, 
&pEnc->vInterHV, pEnc->mbParam.edged_width, 
pEnc->mbParam.edged_height, 
pEnc->current->rounding_type); 
} 

thus, vInterH, vInterV, vInterHV image buffers are all void. 

then, encoder begin to do Motion estimation for this P-frame. that is:: 
bIntra = 
MotionEstimation(&pEnc->mbParam, pEnc->current, pEnc->reference, 
&pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV, 
iLimit); 

while, In this function, encoder first do MB motion search for finding SAD16 and MV16. 
Hmm, the bug just is here! 
when encoder caculates SAD between current MB and target MB, because the MV is in half-pixel resolution and it maybe lies in half-pixel position, encoder is likely to fetch image data of target MV from vInterH or vInterV or vInterHV buffer. 
But at this time, these buffer are all void !! 

Can someone help me? 

Please help me! 


zxjan

janzx@163.com