-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix animation compression going the wrong way #97290
Fix animation compression going the wrong way #97290
Conversation
Video of the mrp of animation compression with the fix applied. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is fine as far as testing with MRP.
The pointing out that there is a precision problem (slight errors due to differences in algorithms) when truncating by int makes sense as the cause of the problem.
I'll rewrite the commit message to be slightly better. |
fdae966
to
f32d87c
Compare
When compressing animation key frame indices the truncation breaks the animation near the border of pages. We use banker's rounding (FE_TONEAREST) as implemented by fast_ftoi to get the nearest integer frame.
f32d87c
to
dd9525b
Compare
I think this is the right way to go, since it seems right to use round(nearest) at least for bit sampling, and this PR is appropriate as However, note that this fix eliminates glitching, it still causes the stutter in the same as stutter.mp4For example, it might be possible to do something like blending the prev page's last few bits and next page's first few bits when decoding to make it smooth like anti-aliasing. Or it may simply be that there is still a boundary error lurking somewhere, as I commented in there. |
Would it work to use a cubic interpolation for blending the prev page's last few bits and next page's first few bits? |
Since this stutter does not occur unless we use a |
Should this be merged as is, or should some more work be done first to work on the other problem identified? |
There is definitely still work to be done, but IMO the stutter still looks better than the glitch, so I think it is acceptable to merge this PR and postpone the work to eliminate the stutter in the later. |
Thanks! |
On the compression page break breaks the animation rotates wrongly.
Fixes: #96882
See also https://stackoverflow.com/a/47190699/381724 discussion about rint() and nearbyint().
Math::fast_ftoi
uses rint which appears to be usingFE_TONEAREST
.See https://stackoverflow.com/questions/311696/why-does-net-use-bankers-rounding-as-default about discussion about banker's rounding which is
FE_TONEAREST
.