Optimized, parallelized Blur effect #423
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR optimizes the Blur effect (by far our slowest effect), streamlining the code and (most importantly) adding OMP
#pragma
s to multi-thread the execution where the operations can be cleanly parallelized.It still won't win any speed trophies (in fact, it's still slow as fuck), but testing on my 4-core Intel i5 system, during an export of an 11-second Big Buck Bunny clip with a default-settings Blur applied:4m37s
— so, again, more than twice as fast.Results appear identical, at least to my eye.I took a second run at this, after re-re-rereading the OpenMP docs, and improved the parallelization significantly. Now, exporting a slightly different clip than my previous tests, the results
on my 4-core Intel Core i5 system are:
Note
You may notice that in my new code, I don't use
initBoxes
, and thesigma
property does nothing. In fact, I removed theinitBoxes
function (and all references to it) completely.The reason for this is simple: In the current (old) Blur effect, the results of
initBoxes
are never used, and thesigma
property does nothing.I don't know if that was intentional or a bug, but in the existing Blur code,
initBoxes()
is a useless function — even though it's called, the results are never used in the code. So as things stood, there was no point in having it in the code. Which is why I removed it.