# Fast Gaussian Filter Approximations Comparison on SIMD Computing Platforms
## 6 Quantization and SIMD Implementation  
Modern computers employ either integer or floating-point format to store numbers. Both formats use a specific number of bits for value storage, with more bits equating to higher precision. In integer representation, the discrete values are evenly spaced. In floating-point methods, the discrete values near one another are uniform; however, the step size increases exponentially as the value's magnitude increases. This results in a vast dynamic range, enabling storage of both very large and very small values in memory. While floating-point representation is prevalent, it does come with a computational cost. A floating-point processing unit requires more logic and transistors than an integer one. So, using an integer format can be advantageous: the resulting values require less memory storage and can be processed faster. Furthermore, quantization enables the implementation on devices with no floating point unit support. We conducted our experiments with floating-point and low-precision integer representations. Let us describe our quantization approach. In running sums and PcParab methods, the coefficients are real-valued, and we quantized them to round them into integer ones. Mathematically, it is written as  
\[\hat{a}=\text{round}(a\cdot 2^{b}), \tag{60}\]  
where \(a\in[0;1]\) is the coefficient to be rounded and \(b\) denotes the number of bits in fixed-point representation. We ran the experiments on Intel Core i9-9900 KF (with x86_64 architecture) and ARM Cortex-A73 (with ARMv8 architecture) CPUs. For DFT-based convolution, we used the implementation from fftw3 open-source library [33]. Methods except DFT-based convolution and direct Gaussian filtering were vectorized. We utilized SIMD vectorization using intrinsics of SSE family for x86_64 and NEON intrinsics for ARMv8. We operated with 128-bit registers storing 4 single-precision floating-point values or 16 unsigned integer values. Approximations except for the running sums method compute the answer recurrently; i.e., the result for the current element is based on the result for the previous one. Thus, direct vectorization would not be efficient and meaningful. In vectorized implementations, the image was preliminarily transposed (Figure 7) so that we go through the columns of the original image, writing the answer in 4 or 16 elements at a time if 32-bit floating-point or 8-bit unsigned integer types, correspondingly, were used. Figure 7: Image processing scheme in sequential and vector implementations when pixel intensities are stored as 32-bit floating points. Details of quantized implementations can be clarified below. The division to normalize the result for all the quantized implementations is performed in integers with appropriate rounding to the nearest value. * Stack blur and Bell blur These are the only approximations that do not involve multiplications and construct the answer by special summation of the input image pixels. Their only parameter is the radius, which defines the lengths of the summation regions. So, there is nothing to apply Equation (60) to. Obtained sums for outgoing and incoming pixels stored in \(s^{out}\) and \(s^{in}\) accumulators, correspondingly, may be negative, so we use 32-bit integer type for operating on them. The normalizing factor was not modified. * Running sums The method sequentially sums the pixels and stores them in an array called an integral row. The range of possible intensity values for the 8-bit image is \([0;2^{8}-1]\); hence, the values of the integral row are greater than or equal to 0. We stored them in 32-bit unsigned integer type. Real-valued steps of piecewise constant functions were quantized by specifying \(b=8\) in Equation (60). The normalizing factor was modified in the same way. * PcParab The method operates with arrays \(y^{C},y^{F}\), and \(y^{F2}\) accumulating integer linear combinations of image pixels and then multiplies their elements on real coefficients of the parabolas.