Basically avoid redundant computations. Gives ~1-4% speedup in the compositor depending on the use case.
For more info see: http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
Differential D596
Optimisation to rgb <-> hsv/l conversion Authored by Kévin Dietrich (kevindietrich) on Jun 14 2014, 8:12 AM.
Details Basically avoid redundant computations. Gives ~1-4% speedup in the compositor depending on the use case. For more info see: http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv
Diff Detail
Event TimelineComment Actions minor tweaks @Antonis Ryakiotakis (psy-fi) & @Kévin Dietrich (kevindietrich) Suggest we have some comprehensive tests first in tests/gtests/blenlib/BLI_math_color_test.cc, basics are already there, but worth adding checks for corner cases too. Comment Actions Quick testing here seems to be OK. I'd also like to convert rgb to HSL calculation but that can be done later too. Comment Actions Hi guys, Just to let you know that my hard drive decided to "retire" over the night, well, it's dead now... :/ At the moment I'm on a live session of Crunchbang that I managed to make work. And I've got some exams too, so I won't really be able to make further coding on this, at least for the upcoming week. But we have time. As per the rgb_to_hsl calculation: I did try to convert it, similarly to the rgb_to_hsv, but somehow the hue always ended up being slightly off, generally by 180° (or 0.5 in the 0...1 range). I might give it another try with fresh eyes when my computer issue is resolved. And for the tests: I haven't had the chance to look at how things are going there yet (and browsing the source on this here website is a PITA). Comment Actions I took the time to reset my work space up. I also set up arcanist, which could be useful for the future. Will arc let me update this one ? Because I would like to convert Cycles' and GLSL's ones too (by making use of their branchless capabilities, perhaps OSL too, will check). By going over the code I noticed there are rgb <-> hsv conversions in the fluid systems (dafuq) ?! I guess they can be removed ? See: I will probably hit you guys on IRC (when I have my IRC client setup and running) for the tests part, I'm a little confused as to how to operate for this kind of work (but it seems pretty much straight forward). Comment Actions @Antonis Ryakiotakis (psy-fi), seems reasonable change. Shall you go ahead and commit? Comment Actions Aaargh! Commited with arc land, but arc changed my amended commit message where I included who the author is :/. Sorry for that, I will surely avoid arc land in the future. And thanks for the patch! |