近年來,HDR影像越來越普遍。許多手機或數位相機均具備拍攝HDR影像的功能。然而,當我們要顯示HDR影像時經常會碰上顯示的問題,若顯示裝置只能顯示有限動態範圍的影像,我們就必須將HDR影做處理來轉變為LDR影像,這個方法就是大眾所知的tone mapping。 本篇論文主要是修改一種local tone-mapping演算法,Adaptive Local Histogram Adjustment (ALHA),來顯示HDR影像。為了要保留較好的細節與對比,使用local tone mapping演算法會比使用global tone mapping演算法來的好。但是,為了保留細節與對比,local tone mapping演算法通常會需要較大量的計算,在顯示一張HDR影像時需要花更多時間。不過,在近幾年,對於GPU的應用越來越多,不僅僅是拿來繪圖而已,使用GPU來做大量計算處理也能得到不少加速。因此,將ALHA這個演算法做平行化並使用GPU來做計算將更容易達到即時顯示HDR影像。 對GPU的使用,目前主要分為兩個主流,CUDA與OpenCL。由於異質系統架構越來越多,我們選擇OpenCL來將ALHA這個演算法實作而不是使用CUDA。因為CUDA僅能使用Nvidia的GPU,而OpenCL則能使用不同平台的CPU或是GPU,在硬體選擇上就顯得彈性許多。 由於ALHA這個演算法能夠被高度平行化,當我們使用GPU來做計算時,能得到不少的加速。以1280*960的影像為例,單純使用CPU做計算跟使用GPU做計算來比較,我們能得到將近63倍的加速。然而,在檔案的輸入與輸出上無法做平行化,這部分成了目前的瓶頸。
Recently, HDR images are becoming more prevalent. Lots of mobile phone or digital camera could take HDR images. However, there is usually a problem when displaying HDR images. The display devices could only display an image with limit dynamic range. Therefore, people develop some methods to transfer HDR images to low dynamic range, which are known as tone mapping. This work is revised from a local tone-mapping algorithm, Adaptive Local Histogram Adjustment (ALHA), to display high dynamic range (HDR) images. In order to reproduce images with better details and contrast, using the local tone-mapping operators is better than global operators. However, local tone mapping algorithm usually needs a huge amount of computation, it takes a long time to display a HDR image. Designing a highly parallel method and use Graphics Processing Unit (GPU) to accelerate computation would be the possible solutions to achieve a real-time display. In order to run on different heterogeneous systems, we choose OpenCL to implement instead of CUDA. Since CUDA could only use GPUs made by Nvidia, this limits system on choice of hardware. Since the algorithm (ALHA) could be highly paralleled, we can gain a huge speedup when using GPU as accelerator. For a 1280X960 image, we can gain up to 63x. However, the final bottleneck of speedup is limited to the input and output an image.