Skip to content

Commit

Permalink
Updated ReadMe.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Fig1024 committed Jun 16, 2017
1 parent 9da9ecb commit 92dfc2c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ Optimization is based on 3 categories: reducing memory usage, adding multithread

It's important to mention that this optimized implementation has some fundamental differences with the original. Those are:

*) Only images with 4 bytes per pixel are accepted, this means RGB32 or RGBA. With some light modifications, it would be possible to adapt it to work with RGB24, single channel, or YUV 422 (2 pixels in 4 bytes)
* Only images with 4 bytes per pixel are accepted, this means RGB32 or RGBA. With some light modifications, it would be possible to adapt it to work with RGB24, single channel, or YUV 422 (2 pixels in 4 bytes)

*) Edge detection algorithm is different. In original version, 3 components (RBG) of 2 adjacent pixels are evaluated for absolute difference, then 2 of those absolute differences are divided by 4 and added together, 3rd component is divided by 2 and added to the sum. The goal is to get absolute difference between 2 pixels in 0-255 range, but this solution makes one of the components have 2x significance of other 2. Optimized solution offers 2 alternative options (chosen which compiler flag): either get maximum of absolute differences between 3 components (stronger blur) or get 255 saturated sum of absolute differences of 3 components (weaker blur). Both methods have equal cost. The value of 4th component (alpha) is not taken into account, but it would be easy to do so if needed
* Edge detection algorithm is different. In original version, 3 components (RBG) of 2 adjacent pixels are evaluated for absolute difference, then 2 of those absolute differences are divided by 4 and added together, 3rd component is divided by 2 and added to the sum. The goal is to get absolute difference between 2 pixels in 0-255 range, but this solution makes one of the components have 2x significance of other 2. Optimized solution offers 2 alternative options (chosen which compiler flag): either get maximum of absolute differences between 3 components (stronger blur) or get 255 saturated sum of absolute differences of 3 components (weaker blur). Both methods have equal cost. The value of 4th component (alpha) is not taken into account, but it would be easy to do so if needed

*) Sigma Spatial: in original implementation, sigma spatial, one of the 2 blur parameters, has depedency on image width and height. That means the same value would yield different amount of blur based on size of the image. Optimized solution removes that dependency by anchoring sigma spatiel to arbitrary value of 255, making it uniform for both width and height.
* Sigma Spatial: in original implementation, sigma spatial, one of the 2 blur parameters, has depedency on image width and height. That means the same value would yield different amount of blur based on size of the image. Optimized solution removes that dependency by anchoring sigma spatiel to arbitrary value of 255, making it uniform for both width and height.

For testing purposes, 3 images were chosen:

Expand All @@ -33,3 +33,15 @@ Here's what built 64 bit application output looks like on Intel i7-4700HQ (~2.4

Image paths and blur strength (sigma) values are hardcoded, at top of RecursiveBilateralFilter.cpp
When application runs, it saves filtered image under generated name in same folder as original images

Here is the same data in chart form, so it's easier to understand:

![alt text](./RBF_chart64.png "64 bit chart")

It's interesting to note that the same application compiled as 32 bit performs significantly slower, especially for the original function

![alt text](./RBF_chart32.png "32 bit chart")

Here's direct comparison of 64 bit vs 32 bit for full HD image

![alt text](./RBF_chart64vs32.png "64 vs 32 bit chart")

0 comments on commit 92dfc2c

Please sign in to comment.