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

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


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)


Nicolas



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