Re: [hatari-devel] scaling in AVI recording and rouding error

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Am Mon, 2 Jan 2017 11:50:54 +0100
schrieb Nicolas Pomarède <npomarede@xxxxxxxxxxxx>:

> Hi Thomas,
> 
> I see you commited some changes to scale the video while recording
> it, but I think the scaling method you used will give bad result :
> 
> for example in PixelConvert_16to24Bits_BGR :
> 
> sval = src[dx * surf->w / dw];
> 
> the problem is that "dx * surf->w / dw" will be truncated, not
> rounded to the closest integer. So for example, 5.9 will give 5, not
> 6, and the bitmap result will be less than optimal.
> 
> You should use sthg like :
> 
> ( dx * surf->w / dw ) + 0.5  (using float)
> 
> which gives :
> 
> (dx * surf->w + dw>>1 ) / dw  (using only integer)

True, that might be better. I've committed a fix for this now. Thanks a
lot for the hint!

 Thomas



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/