Realization of Image Zooming in GPU Based on Bilinear Interpolation
-
摘要:
针对传统的在CPU上实现的基于双线性插值的图像缩放存在速度慢等问题, 利用GPU高性能并行计算优势, 实现了在GPU上基于双线性插值的快速缩放.此算法将目标图像的每个像素分配给GPU中每个线程同时执行, 提高插值效率.从实验结果可以看出, 此算法在放大图像时, 随着图像分辨率的增大, GPU的插值速度相对CPU单线程和多线程的插值速度显著提高, 能很好达到实时缩放图像的效果.
Abstract:The traditional image scaling algorithm in CPU based on bilinear interpolation has to confront with the problem of slow scaling. In this paper, GPU as a burgeoning high performance computing technique, implemented fast zooming on the GPU based on bilinear interpolation. In this algorithm, each pixel of the target image is allocated to each thread in GPU, and the interpolation efficiency is improved. The experimental results show that compared with the CPU single thread and multi thread, this algorithm significantly improved the interpolation speed of GPU, with the increase of the image resolution, and can achieve the effect of real-time image zooming.
-
Key words:
- GPU /
- bilinear interpolation /
- parallel algorithm /
- image zooming
-
表 1 试验环境软硬件参数
名称 内容 处理器 AMDAthlon (tm) Ⅱ X4 640 3.00 GHz 内存 10.0 GB 硬盘 1.0 TB 操作系统 Windows Server 2008 R2 Standard 开发环境和语言 Microsoft Visual Studio 2010,C++ 显卡 NVIDIA GTX580 CUDA版本 7.0版 表 2 不同尺寸图像双线性插值在CPU和GPU中的运行时间
实验图像大小(pixel) 平均运行时间/s 加速比/倍 CPU串行算法 GPU并行算法 256×256 0.062 0.001 605 38.63 512×512 0.271 0.005 505 49.23 1 024×1 024 2.387 0.031 183 76.55 2 048×2 048 8.982 6 0.084 689 106.07 4 096×4 096 37.699 0.315 850 119.36 5 120×5 120 62.744 0.509 055 123.26 8 192×8 192 155.108 1.233 329 125.76 9 216×9 216 201.738 1.582 770 127.46 表 3 本文算法与文献[5]中算法试验结果比较
实验图像大小(pixel) 平均运行时间/s 性能提升/倍 本文并行算法 文献[5]中并行算法 256×256 0.001 605 0.021 13.08 512×512 0.005 505 0.092 16.71 1 024×1 024 0.031 183 0.721 23.12 2 048×2 048 0.084 689 2.153 25.42 4 096×4 096 0.315 850 9.386 29.72 5 120×5 120 0.509 055 16.876 33.15 8 192×8 192 1.233 329 45.176 36.63 9 216×9 216 1.582 770 61.518 38.87 -
[1] Chen Liang, Gao Cheng-min. Fast discrete bilinear interpolation algorithm[J]. Computer Engineering and Desige, 2007, 28(15) : 3787-3790. [2] Gribbon K T, Bailey D G. A novel approach to real-time bilinear interpolation[C]//Second IEEE International Workshop on Electronic Design, Test and Applications. New Zealard: IEEE, 2004 : 126-131. [3] 胡敏, 张佑生. Newton Thiele插值方法在图像放大中的应用研究[J]. 计算机辅助设计与图形学学报, 2003, 15(8): 1004-1007. doi: 10.3321/j.issn:1003-9775.2003.08.016 [4] 陈建辉, 许卫全, 王博亮. 一种实时视频分辨率提升算法及其VLSI设计与实现[J]. 微电子学与计算机, 2005, 22(1), 148-151. https://www.cnki.com.cn/Article/CJFDTOTAL-WXYJ200501039.htm [5] 苗莎, 郑晓薇. 双线性插值图像放大并行算法的设计与实现[J]. 微电子学与计算机, 2011, 11(28), 182-184. https://www.cnki.com.cn/Article/CJFDTOTAL-WXYJ201111045.htm [6] 赖积保, 孟圆, 余涛. 一种基于Dual-GPU的三次卷积插值并行算法研究[J]. 计算机科学, 2013, 40(8), 24-27. https://www.cnki.com.cn/Article/CJFDTOTAL-JSJA201308005.htm [7] 邹贤才, 李建成, 汪海洪, 等. OpenMP并行计算在卫星重力数据处理中的应用[J]. 测绘学报, 2010, 39(6): 636-641. https://www.cnki.com.cn/Article/CJFDTOTAL-CHXB201006015.htm -