1e0bf33b00d4eac02e228e6002b430a8ddffa302
IMB_transform is used by Sequencer (and other places) to do image translation/rotation/scale on the CPU. This PR speeds up parts of it, particularly when bilinear filtering is used. No behavior changes are expected. - Don't use virtual function calls inside inner loop. The code was using class hierarchies with virtual calls just to do equivalent of "outside of image? ignore" and "wrap UV coordinates or not?" decisions. Make those use non-virtual function based code. - Simplify pixel sampling functions to only do the work as needed by anything within Blender codebase. For example, bilinear sampling of uchar images always uses 4 RGBA channels and never does "UV wrap" logic. - Bilinear interpolation uchar: completely branchless SIMD code now. - Bilinear interpolation float: 2x floor() calls instead of 4x floor() + 2x ceil(), and final sample blending is done with SIMD. Sequencer at 4K UHD resolution, with two image strips that need a transform, playback framerate: - Windows Ryzen 5950X: 18.7fps -> 26.2fps (IMB_transform time per frame goes 26.3ms -> 11.2ms) - Mac M1 Max: 27.3fps -> 31.4fps At that point the IMB_transform is not the slowest part of where playback takes time (but rather sequencer effect application etc.). Note: the amount of _actual code_ got a bit smaller. But I've added 100 lines of unit tests in BLI_math_interp_test.cc, the bilinear interpolation functions were only tested very indirectly by CPU compositor template image tests. Pull Request: https://projects.blender.org/blender/blender/pulls/115653
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
