Image Autoregressive Interpolation Model Using
Image Autoregressive Interpolation Model Using
fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 1
Abstract—With the growth in the consumer electronics indus- proposed. To preserve edge structures in interpolation, Li and
try, it is vital to develop an algorithm for ultra high definition Orchard [3] proposed to estimate the covariance of HR images
(HD) products that is more effective and has lower time com- from the covariance of LR images, and to then interpolate the
plexity. Image interpolation, which is based on an autoregressive
model, has achieved significant improvements compared with the missing pixels based on the estimated covariance. In recently
traditional algorithm with respect to image reconstruction, in- years, one of the most promising algorithms introduced was
cluding a better peak signal-to-noise ratio (PSNR) and improved autoregressive modeling image interpolation, as proposed by
subjective visual quality of the reconstructed image. However, the Zhang and Wu [6], in which a piecewise 2-D autoregressive
time-consuming computation involved has become a bottleneck in (PAR) model is used to recover the HR image block by block
those autoregressive algorithms. Because of the high time cost,
image autoregressive-based interpolation algorithms are rarely in a soft-decision way (SAI, soft-decision adaptive interpo-
used in industry for actual production. In this study, in order lation). This technique is also used in image compression
to meet the requirements of real-time reconstruction, we use and has yielded promising results [8]. Inspired by Zhang
diverse CUDA optimization strategies to make full use of the GPU and Wu, a number of optimization approaches have been
(NVIDIA Tesla K80), including a shared memory and register proposed, based on autoregressive modeling [9], [10]. In [9],
and multi-GPU optimization. To be more suitable for GPU-
parallel optimization, we modify the training window to obtain a the authors used the Gauss Seidel method to further optimize
more concise matrix operation. Experimental results show that, the SAI model. In [10], the SAI model was applied to arbitrary
while maintaining a high PSNR and subjective visual quality and factor image interpolation, and achieved promising results.
taking into account the I/O transfer time, our algorithm achieves In [11], the authors used an autoregressive model in sparse
a high speedup of 147.3 times for a Lena image and 174.8 times representation for image interpolation. But the core of all these
for a 720p video, compared to the original single-threaded C
CPU code with -O2 compiling optimization. autoregressive models was a time-cost approach, which makes
it difficult to meet the requirements of real-time reconstruction
Index Terms—Image interpolation, autoregressive model, par- in actual production. This is the main reason that GPU-parallel
allel optimization, CUDA, GPU
optimization is needed for those algorithms.
With the development of high-performance parallel com-
I. I NTRODUCTION puting technology, GPU-based acceleration has been used in
aspects of scientific computing [12-18] for their low cost and
Due to their high video quality, ultra high-definition (HD)
efficient power usage. Mussi and Daolio used the CUDA
products are becoming increasingly popular. However, ultra
computing platform to optimize particle swarms [12]. In [14],
HD resolution requires a more effective algorithm that has
the authors used a GPU-based model for the infrared atmo-
lower time complexity for real-time reconstruction. Interpola-
spheric sounding interferometer (IASI). In [17], CUDA was
tion is an important method in image processing and is a basic
used to optimize deep learning algorithms and also played
requirement for ultra HD products for using low resolution
an important role in computed tomography (CT) reconstruc-
(LR) images to generate high resolution (HR) images. This
tion [16]. With the increasing capacity of cores and memory
method is widely used in image magnification, deinterlacing,
in GPU architecture, it is now possible to solve more complex
and denoising. Conventional bilinear interpolation, cubic con-
computing problems. CUDA is a general purpose parallel
volution interpolation [1], and cubic spline interpolation [2]
computing platform and programming model that leverages
are widely used for real-time applications because of their
the parallel computing engine in NVIDIA GPUs to solve
relatively low complexity. However, these classical algorithms
many complex computational problems. As the pixels to be
can lead to interpolation artifacts such as blurring, ringing,
interpolated are independent from each other in diagonal or
jaggies, and zippering. To satisfy the demand to better dis-
vertical interpolations in autoregressive models, these models
play resolution, many excellent algorithms [3-7] have been
are suitable for optimization in parallel by CUDA.
Manuscript received July 30, 2016; revised February 23, 2017. This work is One of the key aspects in the autoregressive modeling
supported by National Natural Science Foundation of China (No. 61377011), image interpolation method is the use of a suitable training
Shaanxi Science and Technology Department (No. 2016KTCQ01-116), and window. To capture greater detail of the interpolated pixels
NRF Grant funded by the Korean Government (2015R1D1A1A01058171).
J. Wu and L. Deng are with the School of Electronic Engineering, Xidian while reducing the computation required, we can use the
University, Xi’an, China, 710071, China (email: wujj@[Link], training windows of Zhang and Wu [6], which are large
ldeng@[Link]). octagonal windows, with four pixels estimated simultaneously
G. Jeon is with the School of Electronic Engineering, Xidian University,
Xi’an, China, 710071, China and Department of Embedded Systems Engineer- in a larger slip window, and which is significant for serial
ing, Incheon National University, 22012, Korea (email: ggjeon@[Link]). computing. Considering the register, shared memory, and other
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 2
Fig. 1. Two interpolation steps based on the autoregressive model. The white
dots are the LR image pixels, and the dark and gray dots are the missing HR
pixels, interpolated in two steps.
Fig. 2. Spatial configuration of SAI. The white dots are existing LR pixels, the
resource limitations of GPUs, if the load of each thread is dark dots are missing HR pixels. − →
a is the 8-connected neighbors directional
too large, the concurrency will drop dramatically. To calculate −
→
coefficients of the pixels and b is the 4-connected neighbors directional
the interpolated pixels, a large number of matrix operations coefficients of the pixels. W is the training window.
must be performed, including multiple matrix transposition,
matrix multiplication, and matrix inversion. So, in this study,
we modified the training window to obtain a more concise autoregressive coefficient for the (m, n)th neighbor of pixel
matrix operation. Our experimental results show that while X(i, j). Let xi ∈ Il and yi ∈ Ih be the pixels of images
maintaining a high PSNR and subjective visual quality our Il and Ih , and yit (t = 1, 2, . . .) be the neighbors of pixel
algorithm achieves a high speedup in a GPU (NVIDIA Tesla location i in the HR image. The main idea of the image
K80). autoregressive interpolation model is that known pixels can
The remainder of this paper is organized as follows. In be described by unknown pixels, and unknown pixels can also
section II, we review the SAI model and describe the specific be described by known pixels according to geometric duality.
implementation of our algorithm, including some mathemat- The parameters α(m, n) remain constant or near constant in
ical optimizations for matrix operations. In section III, we a small locality. Structures such as edges and textures can
present GPU/CUDA parallel optimization, which is used in be learned by fitting samples of a local window. The image
many optimization strategies based on CUDA, and which autoregressive interpolation model has two parts: diagonal
we used in our experiment with the NVIDIA Tesla K80. In interpolation and vertical interpolation. Diagonal interpolation
section IV, we present our experimental results in terms of the is used to calculate the HR pixels whose neighboring pixels
PSNRs for the test images. In section V, we use our algorithm are known. In vertical interpolation, the pixels estimated in
for image interpolation with an arbitrary factor and for a 720p the diagonal interpolation are regarded as “known” in the HR
video. Finally, we draw our conclusions in section VI. image. First, we obtain the LR image from a HR image by
down-sampling. The white dots in Fig. 2 are the LR image
II. I MAGE AUTOREGRESSIVE I NTERPOLATION M ODEL pixels and the gray and dark dots are the missing HR pixels.
Then, the dark dots are interpolated by diagonal interpolation.
As the spatial details and edge sharpness of autoregressive Finally, the gray dots are interpolated by vertical interpolation.
interpolation model-based interpolated images are better than As vertical interpolation is performed in a similar way, we only
those produced by traditional methods [1], [2], [3], this model explain diagonal interpolation in the following.
produces results that are significantly better with respect to
Figure 2 shows the training window of our algorithm where
both PSNR and subjective visual quality. Fig. 1 shows the
the white dots are LR pixels denoted by x, and the dark dots,
interpolation model. Let Ih be the HR image to be estimated,
denoted by y, are the missing HR pixels to be interpolated by
Il be the observed LR image, which is a down-sampled version
vertical interpolation. The interpolation is formulated to follow
of the HR image by a factor of two. The arbitrary factor image
the square problem, where parameter λ is the Lagrangian
interpolation method is described in section V.
factor, as follows:
Similar to the method used in [6], in this study we propose
→
− (8)
X X
to model an image as follows: y = arg min{
c kyi − at xit k
X {y,a,b} i∈W t
X(i, j) = α(m, n)X(i + m, j + n) + υi,j , (1) X X (8)
X X (4)
(m,n)∈W + kxi − at yit k +λ kyi − bt yit k},
i∈W t i∈W t
where W is a local window shown in Fig. 2, containing 4 × 4 (2)
unknown pixels, υi,j is a random perturbation independent P P (4) P P (4)
of spatial location and the image signal. α(m, n) is the subject to i∈W kyi − t bt yit ≈ i∈W kxi − t bt xit k.
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 3
TABLE I
S AMPLE I MAGES SIZE ( FACTOR = 2)
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 4
TABLE II
C OMPARISON OF PSNR AND RUNNING TIMES ON CPU
TABLE III
D EVICE INFORMATION
Tesla K80
Compute Capability 3.7
Framework Kepler
Number of Cores 2 × 2496
Memory 2 × 12 GB
Default Shared Memory per Block 49,152 B
Register File per Block 65,536
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 5
limited space and bank conflict. The largest size of the shared
memory in every block is 49,152 bytes. Any read or write
requests made to memory with n addresses, and that fall
into n distinct memory banks, can therefore be accessed
simultaneously [19], [20], so it is important to avoid bank
conflicts as much as possible. The register memory is private
with respect to certain threads. That is, there is no bank conflict
in the register, so it is usually faster than shared memory. In
the Tesla K80, the L1 cache and shared memory share a 128-
KB configurable on-chip cache in each SMX. All SMXs share
an L2 cache with a maximum size of 1.5 MB. In our program,
the number of registers available per block is 65,536 and the
size of each register file is 32 bits, which is very valuable. In
the following optimization process, these operations on small
matrixes are completed in the register, as shown in Fig. 5. The
basic idea of the parallel scheme in our experiment is to use
Fig. 5. Correspondence between the data and CUDA threads. one thread to process one slide window. Since the L1 cache
can be used to deal with register spills, we use the command
“cudaFuncCachePerferL1” to set more of the L1 cache, which
part is relatively simple, almost no impact on the program, we means that the L1 cache will be set to 48 KB in each SMX.
will not focus on this part. As vertical interpolation involves The correspondence between the data and the thread is shown
the same process as diagonal interpolation, here we introduce in Fig. 5. Coordinating the shared memory with the register
only the diagonal interpolation case, as shown in Fig. 4. is a classic optimization technique in the CUDA program.
As the simple method, such as bicubic interpolation, suffice Through this effort, we obtained a significant speedup of
to interpolate smooth area. If the local variances estimated 79.3 for Lena.
from LR pixels is above a threshold, it will be interpolated In this version, there are 8 × 8 threads in one block, so
based on autoregressive. If the local variance is below a we must deal with 8 × 8 unknown pixels in a block. For
threshold, it will be interpolated based on bicubic, which each unknown pixel, we need to build a 6 × 6 slide window,
can reduce the amount of computing, without sacrificing the so the image data in one block is then 13 × 13 with the
effectiveness. And we empirically find that the determinants boundary overlap, as shown in Fig. 5. Since we do not know
of the training Matrix A in Eq. (3) and the training matrix B the C code details of SAI and have an executable program
in Eq. (4) play a key role. The above is the implementation only, here we only compare our single-threaded CPU program
details of this paper. But the core problem of this optimization with our GPU program in this GPU-parallel optimization
has not changed, we have to solve the Eq. (10). section. The parallel matrix optimization has many excellent
algorithms [26], [27], [28]. Considering various matrix sizes
in our algorithm, including 4 × 4, 5 × 9, and 1 × 14, methods
C. Optimization based on CUDA based on a fine-grained model are too complicated for our
1) Optimization with Shared Memory and Register: GPU method, as the matrix size is not fixed, causing the fine-grained
memory plays an important role in the CUDA optimization thread division becomes very difficult, but will be considered
processes. The latency associated with reading and writing in our follow-up work. Table IV shows time comparisons to
data from global memory is a bottleneck in some massively single-threaded C CPU code after using the shared memory
CUDA-dependent programs. Compared with the global mem- and register with the 8 × 8 block size.
ory, the shared memory and register have a higher memory Considering various matrix sizes in our algorithm, including
bandwidth and lower access latency. For faster access, the 4×4, 5×9, and 1×14, methods based on a fine-grained model
original LR image data down-sampled from the HR image are too complicated for our method, but will be considered in
is first translated to shared memory. The correspondence our follow-up work. Table III shows time comparisons after
between the data and CUDA threads are shown in Fig. 5. We using the shared memory and register with the 8 × 8 block
copy the data in each block to shared memory, as shown in size.
Fig. 5. The image data in each block will firstly be copied to 2) Finding the Most Suitable Block Size: From subsec-
__shared__ Image[13][13]. According to these data, tion III.C.1, we know that the resources of shared memory and
64 pixels will be estimated with the block size of 8 × 8 in register in the Tesla K80 are scarce and expensive. As such,
this version. In order not to form a boundary, there is a data the number of threads per block must be reasonable. If the
overlap between blocks. Coordinating the shared memory with block size is too small, resources will not be fully utilized.
the register is a classic optimization technique in the CUDA However, if the block size is too large, this will reduce the
program. degree of parallelism. Usually, the CUDA program achieves
All threads in the same block can communicate with each good performance when the number of threads per block is a
other, so all threads can share the LR data in one block. multiple of 16. But we must also consider that the optimal
However, we must take into account the shared memory’s block size is not always the same, and is closely related
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 6
TABLE IV TABLE V
S PEEDUP FROM USING SHARED MEMORY AND REGISTER WITH THE 8×8 S PEEDUP USING ADT
BLOCK SIZE
Sample PSNR (dB) Running Time Speed
Sample PSNR (dB) Running Time Speed Images CPU GPU CPU GPU Up
Images CPU GPU CPU GPU Up
Lena 34.59 34.59 0.682 s 7.72 ms 88.3
Lena 34.59 34.59 0.682 s 8.60 ms 79.3 Peppers 32.32 32.32 0.702 s 8.11 ms 86.5
Peppers 32.32 32.32 0.702 s 9.12 ms 76.9 Pentagon 29.26 29.26 4.294 s 46.55 ms 92.2
Pentagon 29.26 29.26 4.294 s 51.93 ms 82.6 Airport 28.41 28.41 4.228 s 46.21 ms 91.4
Airport 28.41 28.41 4.228 s 51.87 ms 81.5
to all the GPU resources. To obtain the best performance, engine). With this architecture, ADT can be managed through
we conducted numerous experiments with respect to speedup streams, where a stream is a sequence of commands that are
using different block sizes. As shown in Fig. 6, a block size executed in order. In this version, the LR image data is divided
of 128 achieved the best performance in our program, with a into four pieces and four streams are created accordingly, with
speedup of 86.4 for Lena, 83.9 for Peppers, 87.6 for Pentagon, one stream responsible for one piece of data. Data transfer and
and 87.2 for Airport. data computing can be performed simultaneously with the two
3) Further Optimization Using Asynchronous Data Trans- different engines. If the volume of data is large but the required
fer: In our program, LR image data must be copied from the computing is not complicated, the effect of optimization by
host device to the GPU device, and then the HR image data ADT will be significant, as shown in Fig. 7. In this version,
is stored back in the host memory, which involves a relatively four streams are created in the GPU.
large overhead when the volume of image data is large. However, ADT is not suitable for use with all programs.
Using asynchronous data transfer (ADT), we can effectively If the transmission time between the host and the device is
hide the host-device transmission time in our program. There insufficient to hide the time management for the streams, ADT
are two memory copy engines in the Tesla K80: a host-to- is useless. In our method, the data transfer time is smaller than
device engine (H2D engine) and a device-to-host engine (D2H the kernel execution time and when streams are being used the
new edges must be mirrored. In this case, the speed is only
slightly improved to an 88.3 speedup for Lena, as shown in
Table V.
4) Optimization using a Multi-GPU: There are two GPUs
in the Tesla K80. A multi-GPU is suitable for single-node
desktop systems with multiple computing devices. So we can
fully use the hardware resources afforded by multi-GPU tech-
nology. As the ADT strategies introduced in subsection III.C.3
did not achieve the desired performance, we cannot use this
optimization approach to simplify the programming. However,
since one GPU relies on one stream, we create only two
streams in this version. The core code for a multi-GPU is
Fig. 7. Asynchronous data transmission using the Tesla K80. shown in Fig. 8. Each GPU handles half of the image data,
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 7
TABLE VI
S PEEDUP USING A MULTI -GPU
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 8
TABLE VIII
C OMPARISON BETWEEN MULTI - THREAD ON CPU AND K80 WITH OUR METHOD
core. Table VI and Table VIII show that the speedup of our
method is maintained at about 140 times compared to the
single-threaded and about 40 times compared to eight-threaded
C code running time on the CPU. According to the results,
performance improvement based on eight-thread compared to
one-thread on CPU is very obvious, but its performance is
still far less than multi-core GPU. From Table VII, we can
see that the PSNR results of our method are slightly worse
than those of SAI, as it misses a few details in the smaller
training window. But for the Peppers image, we achieved a
higher PSNR result, as the SAI may result in over fitting in this
image. A more reasonable approach is to select the training
window adaptively. In different small localities, the size of the Fig. 13. Image interpolation (scaling factor of 2.5) based on our proposed
training window can be changed adaptively according to the method.
LR pixel covariance. But if the size of the training window
is unfixed, it will lead to an imbalance in the thread load
in the GPU-parallel optimization. Further research is needed
to develop a GPU-based fine-grained implementation for the
autoregressive interpolation algorithm that balances the thread load.
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 9
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.
This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2017.2724205, IEEE
Transactions on Industrial Informatics
IEEE TRANSACTIONS ON INDUSTRIAL INFORMATICS (ACCEPTED MANUSCRIPT: TII-17-0340) 10
TABLE IX
S PEEDUP FOR IMAGE INTERPOLATION ( SCALING FACTOR OF 2.5) BASED ON OUR PROPOSED METHOD
TABLE X
S PEEDUP FOR RGB IMAGE OF L ENA
1551-3203 (c) 2017 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See [Link] for more information.