Graphics Reference
In-Depth Information
In fact, the compute shader threading model is easily mapped onto an image domain
by using the x and y global thread addresses to index the image's pixels (the threading
model itself is covered in detail in Chapter 5). This makes it simple to develop an imple-
mentation that can use the massively parallel processing capabilities of modern CPUs,
and that can provide a fairly significant performance improvement over traditional CPU
implementations. In addition, the compute shader provides HLSL atomic operations, group
shared memory, device memory resources, and synchronization intrinsic functions to fa-
cilitate communication between threads. If these additional tools are used in an appropriate
algorithm, even further performance increases can be achieved.
This chapter provides several sample image processing algorithms that attempt to
take advantage of the compute shader stage's capabilities. The first algorithm that we in-
spect is the well-known Gaussian blur operation. Due to its wide range of uses and its
desirable mathematical properties, it provides a good introduction to image processing
with the compute shader. Next, a second filter that has become popular recently is exam-
ined—the bilateral filter . This is an edge preserving blur filter that can be rather expensive
to compute on the CPU, which makes a GPU implementation a very desirable target.
10.1 Image Processing Primer
Before we begin the discussion of implementing image processing algorithms with the
compute shader, it would be beneficial to provide a brief introduction to the topic itself.
This section will provide some basic entry-level image processing concepts to frame the
discussion of the algorithms in this chapter. However, this is by no means an extensive or
complete overview of the subject. Many very good image processing topics have already
been written and are available if the reader would like to investigate the details of the topic
further, such as (Gonzalez, 2008).
Image processing is a general term for signal processing operations performed on an
image. In our context, the image is likely to be a 2D texture resource that has either been
generated in real time or loaded from a file. The input to an image processing algorithm
operation is always an image, and the result can be either another image or some informa-
tion extracted from the input image. In this chapter we will investigate a subset of these
algorithms that are used to perform image filtering, but the concepts that we see in this
chapter can also be applied to other domains of image processing as well.
10.1.1 Images as Functions
To manipulate the contents of an image, it is helpful to have a more precise definition of
what the input image represents. For our purposes, an image is a 2D digital representation
Search WWH ::




Custom Search