Effects of Improved Floor Function on the Accuracy of Bilinear Interpolation Algorithm

In this study, the standard IEEE 754 2008 and modulo-based floor functions for rounding non-integers have been presented. Their effects on the accuracy of the bilinear interpolation algorithm have been demonstrated. The improved floor uses the modulo operator in an effort to make each non-integer addend an integer when the remainder between the multiplicative inverse of the fractional factor and the numerator is greater than zero. The experiments demonstrated relatively positive effects with the improved floor function and the alternativeness to the standard round function.


Introduction
In many computational fields, the bid for optimal accuracy remains an unsolved problem. For example, improving the accuracy of spatially image interpolation algorithms generally involves the use of many adjacent pixels to compute the missing pixel values in high resolution (H.R) images. However, the processing time involved is more when adjacent pixels are used. Furthermore, the low-computational complexity emerges as another important requirement, since in many cases, the wide-spread use depends on how accurately fast and low-cost the algorithms are (Rukundo & Cao, 2012, pp. 25-30, Ramponi, 1999, pp. 629-639, Rukundo & Maharaj, 2014. In fact, this arbitrary selection or use of just 'many adjacent pixels' does not even consider the negative effects of the numerical errors on the overall performance of the numerical scheme. Therefore, this study focuses on the effects of the numerical errors, particularly the effects of the improved-floor function against the standard round-off functions on the bilinear image interpolation algorithm. The bilinear algorithm has an advantage of producing reasonably realistic images with only four adjacent pixels, at an acceptable computational complexity compared to other linear function-based image interpolation algorithms. In this study, the finite precisions of computations are not the main concern. However, only the negative effects of the round-off errors have been studied (Higham, 1996). Therefore, the improved floor rounding scheme or function has been developed to adapt to the cases with relatively large or small number of half-integers in H.R image interpolation. Note that, a half-integer is a number of the form n +1/2, where n is an integer. Previously, the standard IEEE 754-2008 defined five rounding rules in the homogeneous general computational operations, as shown with examples of only half-integers in Table 1.  Subsequently, Maxfield published, in his book and website, a simplified diagram of main rounding modes (see Table 2) and he also included the examples of 'non-half-integers' (Maxfield & Brown, 2005). Here, a non-half-integer is a non-integer other than a half-integer. According to Maxfield, the round-toward-nearest encompasses both the R-H-U and R-H-D modes. For arithmetic Rounding or R-H-U, there can be both symmetric and asymmetric versions. Round-up may be equated to R-C or R-A-T-Z depending on the application/implementation. Truncation is identical to R-T-Z. However, in any case, the rule or mode perceived the best and has always been dependent on the number of half-integers encountered in the rounding process. Therefore, each rule has been working better in one case and worse in the other; thus raising the problematic question about a scheme that would best fit in all the cases (yielding results perceivable optimal). In this effort, the modulo operator has been used to deal with the whole and fractional factor of each addend, in the conventional bilinear interpolation equation (1). Furthermore, the obtained sum is technically rounded towards negative infinity. Since the dimensions between the reference and interpolated images must be identical at various scaling ratios, in the experiments, the reference images were downsampled to match the dimensions of the interpolated images, and the ACDsee software has been used for the respective scenarios.  One of the best structural and pixel based IQA metrics as well as the linear correlation metrics have been used to quantify the effects of the compared rounding schemes as well as the Matlab tic-toc commands for run-time overhead (Wang, Bovik & Lu, 2002, pp. IV-3313 -IV-3316, Martin & Bill, 2011. This paper is organized as follows. Section 1 describes the background followed by section 2 that demonstrates the non-integerness found in the process of bilinear interpolation. Section 3 presents the improved floor rounding scheme. Section 4 gives the experimental results and section 5 gives the conclusion.

Non-integer cases in bilinear interpolation
Numerous studies that clearly explain how the bilinear interpolation algorithm works and that demonstrate its wide application in the literature exist. Therefore, the redundant explanations and demonstrations are not included in this study. The mathematical expression for the bilinear interpolation is shown in equation (1 where, r , c , r  and c  represent the distances between the pixels, as shown in Figure 1 are linearly distributed weights. In this study, the improvement made was based on turning the equation (1)'s non-integer-addends into integers. Figure 1 illustrates how the pixel values are calculated at the H.R. locations shown in red, green, purple, yellow and orange. Further details can be found in (Rukundo & Maharaj, 2014, pp. 641-647). As mentioned earlier, there is a possibility of the periodic appearances of the non-integer cases according to the type of data being processed. Tables 3, 4, 5 and 6 show the circumstances in which such cases of half-integers, non-half-integers and integers occur. The existing strategies do not effectively adapt to such periodic appearances in a manner that is unquestionable. Furthermore, this encourages the need for finding the most effective round-off operation capable of effectively reducing the negative effects of such cases on the accuracy of bilinear image interpolation algorithm. Note that, in this manner, the final objective remains making the interpolated image quality as much artefact-free as possible. The results shown in Tables 3, 4, 5 and 6 have been obtained using the equation (1) with reference to the coordinate values mentioned. Figure 1. I (row, column) describe generally the L.R image pixels. (r, c), (r+1, c), (r, c+1) and (r+1, c+1) represent the L.R pixels, in blue circles. J (row', column') generally represents the interpolated H.R pixels. In this figure, they are shown in red, yellow and green circles. Their values are systematically calculated using the four L.R. pixels, encircled by a dashed-blue circle  Table 3 shows the four arbitrary-selected pixels/values to represent the L.R. image pixels. Their locations can be approximated as shown in Figure 1. The values shown in the squares coloured in red, yellow, orange and purple are interpolated values at those H.R. locations. These H.R. values are all half-integers. This implies that the effects of the round-off errors would likely be higher than in any other cases.  In Table 4, the four arbitrary selected pixel values are different from those in Table 3. The selected values have led to integer output at all the H.R pixel locations. This implies that the negative effects of round-off errors will not exacerbate the calculation-errors in the same manner as in the different cases. Furthermore, this situation would to some extent save the interpolated data. In Table 5, the four arbitrary-selected pixels/values are different from those in Tables 3 and 4. The output obtained comprises half-integers, integers and non-half-integers-with-the-fractional-part greater than a half. The round-off errors would not be at the same degree as if only half-integers were obtained. In Table 6, the four arbitrary selected pixels/values differ from those in the previous tables in type by a non-half-integer-with-the-fractional-part less than a half. The round-off effects will not be the same depending on the rounding scheme used. Note that a half of an integer is not always a half-integer. For example, a half of an even integer is an integer but not a half-integer (Sabin, 2010, pp. 218).

The Floor Improvement Scheme
As mentioned earlier, the modulo operator is applicable to the fractional factors and to apply the modulo operator it is necessary to simplify equation (1) to clearly distinguish between the pixel (integer) and weight (integer or non-integer) parts, as shown in the equation (2). (2), the integer factor ( N ) is clearly distinguishable from the weight factor (W ), and therefore can be dealt with separately. Given that the weight factor (W ) can be more non-integer (many times) than of integer type, one can make it a multiplicative inverse to maximize chances of using the denominator of integer type in the calculations. Furthermore, with reference to the r  and c  values shown in Tables 3, 4, 5 and 6, one of the two integers W can be zero, and if 0 = W , this would lead to the 'undesired' indeterminate case; therefore, a small positive number L is added to the denominator of multiplicative inverse of the weight factor (W ).  (3) gives the following equation (4).
1 . Now, let us simplify the equation (4) by generalizing it as shown in the equation (5).
Here, the   (1) In Figure 2, the improved-floor produced less round-off errors than the standard floor function. It also performed better than the standard ceil and fix functions, except the standard round function where they remained tied. However, separate experiments showed that the round function increased the corrupting noise that negatively affected the fidelity of the images interpolated contrary to the improved-floor scheme. Figure 3 shows the round-off absolute errors produced by each scheme but after adding together all the addends. In this manner, only the ceil function produced more errors than the remaining functions. This suggests that the rounding scheme has to be appreciated according to its wide effective application rather than how it produces the least round-off errors. In conclusion, the round-off operation performed initially generates more errors than that performed later. Considering real data examples, unlike the nearest neighbour selected pixels, the bilinear interpolation pixel locations simultaneously tend to occupy more than one pixel location, which allow them to be evenly distributed over the H.R. image. To evaluate these effects, one can find the case in which pixels correlate better.
It is possible by exchanging only the C and D positions of the integer factor 3 N and 4 N of equation (6), attempting to achieve higher pixel correlation, as shown in equation (7). Figure 3. The round-off errors produced by each rounding scheme after adding all the addends of equation (1)

Experimental results
The exemplary standard rounding schemes have been selected to be tested against the improved-floor or modulo scheme. Equations (8) and (9) show the mathematical expressions on which the BAF and BAR have been implemented. Note that BAM is an abbreviation of the bilinear algorithm with the modulo or improved-floor scheme. Bilinear algorithms with the floor (round towards negative infinity) and round (rounds away from zero) are abbreviated as BAF and BAR, respectively.

( )
The feature similarity index (FSIM) is one of the structural based IQA metrics used with the signal-to-noise-ratio (SNR), peak-signal-to-noise-ratio (PSNR), pixel-based IQA metrics as well as the linear correlation (CORR2).  Table 7 shows the BAM, BAF and BAR results at different scale ratios of Lena image as indicated in the caption. In all the cases presented, the BAM provided the results superior to those given by BAR and BAF. This was due to the advantage BAM has over the BAR and BAF of adaptable divisors. Similarly, the BAR and BAF produced exactly the same results. This occurred because (as shown in Figure 3) when the addends containing non-integers were all added before being rounded both the schemes produced the same errors. Note that the accuracy in the calculations can also be negatively biased by the round-off effects of the 8-bits unsigned integer function (UINT8) required to display the grayscale values. In Figure 4, the (d) image interpolated using BAM appears sharper. However, it shows slight jaggedness on the edge features compared with the (b) and (d) images interpolated using the BAF (b) BAR (c). Moreover, the edge features remained equally blurred. BAM's superior results remained same also with the Baboon image (see Table 8). Furthermore, the edge features of the (d) image produced by the BAM do not appear jagged, instead tends to be blurred with slight increase in sharpness.
Also, as can be seen in Table 9, with the Cameraman images, the BAM output remained superior in all the scenarios presented. With the (d) output of BAM (see Figure 6), the image appears sharper although there seems to be a slight increase in what can be perceived as jaggedness of edge features compared to the blurred BAF and BAR cases.
In Table 10, the effects of BAM remained positive even with the Pepper images. The IQA metrics values produced by the BAM remained higher than those of the BAF and BAR. As can be seen in Figure 7, the interpolated or images produced by BAM appear only slightly sharper than by BAF and BAR.  Tables 11, 12 and 13, with the lake, house and girl images the BAM performances remained comparatively higher than others. In each set, the IQA metrics values obtained by the BAM remained superior to those of the BAF and BAR. The sharpness remained high, but debatable, with the images produced by BAM than those produced by both BAF and BAR (Figures 8, 9 and 10).      For short computations, the tic-toc commands have been used for measuring the absolute elapsed time or Matlab execution time (Martin & Bill, 2011).  As can be seen, the average time it takes for executing the BAM algorithm is almost equal to that of BAF, which is in fact the same as that of the standard bilinear interpolation algorithm. The BAR took more time than both BAF and BAM in all the scenarios.

Conclusion
The effects of improved-floor scheme against the standard IEEE 754-2008 rounding schemes have been studied for improvements to bilinear interpolation algorithm accuracy. The cases with relatively large or small number of half-integers in H.R image interpolation have been studied by introducing and applying the new rounding scheme based on the modulo operator. The modulo operator dealt with the whole and fractional components of the bilinear equation's addends in an effort to force them to become integer-type. Furthermore, the rounding towards negative infinity was needed due to a small positive number L added to the multiplicative inverse denominator to avoid the occurrence of the indeterminate cases, while dealing with or interpolating real data. The image quality assessment metrics values produced by BAM were higher than that produced by BAF and BAR cases. Moreover, in the same scenarios presented, the BAM output images proved to look sharper instead of more blurred. Furthermore, the execution time taken by the BAM and BAF remained almost tied and shorter than that by the BAR. Further efforts are to be dedicated to studying the effects of performing the rounding operations focusing separately on a pre-determined range of the pixels/values.