HDR Tone Mapping with CUDA 5

In this example, for the sake of learning, we are going to butcher some great images. Let's describe the problem first.We are going to take some HDR images and modify their luminosity to lighten them. We could also darken the images, or apply changes only to parts of the images,

C++ (117.3 MB)
 
 
 
 
 
(0)
2,781 times
Add to favorites
3/8/2013
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C++
//-----------------------------------------------------------------------------
// File: GpuTimer.h
//
// Desc: Allows to measure GPU elapsed time.
//
//-----------------------------------------------------------------------------

#pragma once

namespace Bisque
{
	class GpuTimer
	{
	public:
		GpuTimer(void)
		{
			cudaEventCreate(&m_start);
			cudaEventCreate(&m_stop);
		}

		~GpuTimer(void)
		{
			cudaEventDestroy(m_start);
			cudaEventDestroy(m_stop);
		}

		// Starts timer
		void Start()
		{
			cudaEventRecord(m_start, 0);
		}

		// Stops timer
		void Stop()
		{
			cudaEventRecord(m_stop, 0);
		}

		// Returns elapsed time in milliseconds
		float Elapsed()
		{
			float elapsed;
			cudaEventSynchronize(m_stop);
			cudaEventElapsedTime(&elapsed, m_start, m_stop);
			return elapsed;
		}

	private:
		cudaEvent_t m_start;
		cudaEvent_t m_stop;
	};
}