# Effective Implementation of Edge-Preserving Filtering on CPU Microarchitectures
## 7 Experimental Results
### Effective Implementation on CPU Microarchitectures
If the ratio exceeds one, the implementation is faster than a scalar implementation for all CPU microarchitectures. Note that the scalar implementation is parallelized using multi-core. \(\sigma_{r}=4\), \(\sigma_{s}=6\) and \(r=3\sigma_{s}\). Image size is \(768\times 512\). Figure 15: Speedup ratio of non-local means filter in various CPU microarchitectures: (**a**) SSE; (**b**) AVX/AVX2; (**c**) AVX/AVX2 with FMA3; (**d**) AVX512; (**e**) AVX512 with FMA3. If the ratio exceeds one, the implementation is faster than a scalar implementation for each CPU microarchitecture. Note that the scalar implementation is parallelized using multi-core. \(h=4\sqrt{2}\); template window size is \((3,3)\); and search window size is \((37,37)\). Image size is \(768\times 512\). We discuss the relationship between accuracy and computational time for various types of implementation involving the use of the quantization LUT. Figure 16 shows the relationship between calculation time and accuracy of the RqL and the MqL implementation. In this figure, we changed the quantization functions and the size of the quantization range/merged LUTs. The quantization functions were square root function (sqrt) and division (div). Note that the maximal value in the case of the RqLSL/RqL implementation is commensurate with that of the non-quantized cases. In the RqLSL/RqL and MqL implementation, the accuracy and computational time have a trade-off. These implementations accelerate these filters while maintaining high accuracy, when the LUT size is practical. The characteristics of the performance depend on the quantization functions. Therefore, we must choose the functions and the LUT size by considering the required accuracy and computational time. Figure 17 shows the computational time of using unsigned char (8U) and float (32F) in the MC/RC implementation. Note that the computational time is plotted on a logarithmic scale. The 8U implementation of the bilateral filter is faster than the 32F implementation, when \(r\) is small. By contrast, when \(r\) is large, the 8U implementation is slower than the 32F implementation. If the cost of the conversion process in 8U is low, the arithmetic intensity of the 8U implementation would be larger than that of the 32F implementation. However, in the 8U implementation, the conversion cost increases owing to the redundant conversion of the pixels as the amount of processing increases. In the non-local means filter, when the template window size is \((3,3)\), the 8U implementation is always faster than the 32F implementation. When the template window size is \((5,5)\), the 8U implementation is slower than the 32F implementation in the case of the large search window. The arithmetic intensity of the non-local means filter is low because many pixels are accessed. Therefore, we can improve the arithmetic intensity by using the 8U implementation. However, if the amount of processing is large, we should use 32F. As a result, the speeds of the 8U and 32F implementation depend on the amount of processing, which are changed by the filtering kernel size and arithmetic intensity. Figure 16: PSNR vs. computational time in quantization range/merged LUT; (**a**) bilateral filter; (**b**) non-local mean filter (template window size \(=(3,3)\)); (**c**) non-local mean filter (template window size \(=(5,5)\)). In sqrt and div, the quantization function is square root and division, respectively. These results were obtained on an Intel Core i9 7980 XE. \(\sigma_{7}=4\), \(\sigma_{8}=6\), \(h=4\sqrt{2}\); and search window size is \((37,37)\). Image size is \(768\times 512\). Figure 18 shows the speedup ratio of each implementation of the proposed methods for prevention of denormalized numbers. If the speedup ratio exceeds one, the implementation is faster than the scalar implementation. All types of implementation were parallelized by multi-core threading. The figure shows that the fastest implementation of the bilateral filter and the non-local means filter is 152- and 216-times faster than the scalar implementation, respectively.