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

zhouxiao xvid-devel@xvid.org
Mon, 23 Dec 2002 10:4:56 +0800


Just as I said, I am a beginner, So, until now I am not sure that MV will only have even values if encoder works in full pixel precision. 
But asssuming that it is true, there is still a problem in the encoder.

That is :
Because chrominance MV is derived by the division of luminance MVs by 2 , chrominance MV is likely to be on the half pixel postion even if luminance MVs all are on full pixel positions.
While, in MBMotionCompensation( ) function, whether encoder workis in full or half pixel precision, it will do chrominance component's image interpolation when chrominance MV is on half pixel position. 

Wish someone give some advice.

zxjan

>> 
>> 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. 
>
>The MV will only have even values, so only fullpel position will be
>searched.
>
>gruel
>
>
>> But at this time, these buffer are all void !! 
>> 
>> Can someone help me? 
>> 
>> Please help me! 
>> 
>> 
>> zxjan
>>