2012/2/16 Maksym Veremeyenko <ve...@m1stereo.tv>: > Hi, > > during working with line compositing function i faced a strange value for > *weight* parameter - 65534 > > that value is a rounding problem that flag fast-math used. > > i prepared small code: > > #include <stdio.h> > int main() > { > float mix = 100.0f; > int r1 = ((1 << 16) - 1) * mix / 100; > int r2 = (((1 << 16) - 1) * mix + 50 ) / 100; > int r3 = 65535.0f * mix / 100.0f; > printf("r1=%d, r2=%d, r3=%d\n", r1, r2, r3); > }; > > compiling running examples: > > [root@dev-5 core]# gcc -o q -ffast-math q.c > [root@dev-5 core]# ./q > r1=65534, r2=65535, r3=65534 > > [root@dev-5 core]# ./q > r1=65535, r2=65535, r3=65535 > > may be it has a sense to fix such rounding issues: > > - int weight = ( ( 1 << 16 ) - 1 ) * geometry.item.mix / 100; > - uint32_t luma_step = ( ( 1 << 16 ) - 1 ) * geometry.item.mix / 100 * > ( 1.0 + softness ); > + int weight = ( ( ( 1 << 16 ) - 1 ) * geometry.item.mix + 50)/ 100; > + uint32_t luma_step = ( ( ( 1 << 16 ) - 1 ) * geometry.item.mix + 50 > ) / 100 * ( 1.0 + softness ); >
OK, I applied this change in my branch holding your sse2 commit. I created the commit it in your name. Also, in that branch, I refactored the dissolve function in transition_luma.c to use the composite_line_yuv() from transition_composite.c to benefit from that improvement. -- +-DRD-+ ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel