nodeca/pica — pull request #9 by llacroix (2014-10-13 18:18:41+00:00)
Title: Added blur filter

Here's a better blur filter. Greyscale filter is separated from the unsharp mask filter to make it easier to benchmark the blur filter.

It's not possible to effectively measure the speed of the blur filter inside the unsharp mask as the unsharp mask benchmark doesn't measure only the blur filter. The greyscale filter is also benchmarked as the blur filter depends on the greyscale filter.

Here are the results on my machine:

##### Old benchmark:
> Sample: sample-3264x2448.jpg (31961088 bytes raw / [3264x2448]px)
> pica-1.0.2 x 2.35 ops/sec ±0.58% (9 runs sampled)
> pica-current x 2.97 ops/sec ±1.80% (11 runs sampled)
> pica-current-blur x 2.49 ops/sec ±0.52% (10 runs sampled)
> pica-current-greyscale x 47.79 ops/sec ±3.61% (56 runs sampled)
> pica-current-unsharp x 0.26 ops/sec ±11.13% (4 runs sampled)

##### New benchmark:
> Sample: sample-3264x2448.jpg (31961088 bytes raw / [3264x2448]px)
> pica-1.0.2 x 2.31 ops/sec ±0.40% (9 runs sampled)
> pica-current x 3.02 ops/sec ±0.69% (11 runs sampled)
> pica-current-blur x 2.51 ops/sec ±0.40% (10 runs sampled)
> pica-current-greyscale x 47.20 ops/sec ±3.52% (56 runs sampled)
> pica-current-unsharp x 0.94 ops/sec ±1.97% (6 runs sampled)

The results of the benchmark proves that a lot of time is spent inside the unsharp mask even
though the blur filter works fast. Memory allocation play a big role in the speed of algorithms.