writeup-2010

writeup-2010 - CSCI 2400 Fall 2010 Lab Assignment L4 Code...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI 2400, Fall 2010 Lab Assignment L4: Code Optimization 1 Introduction This assignment deals with optimizing memory intensive code. Image processing offers many examples of functions that can benefit from optimization. In this lab, you’ll be improving the overall performance of an “image processing” application by a factor of about twenty. The application you’ll be modifying reads in an “image” (a picture) and a “filter”. An image is represented as a three-dimensional array, described in cs1300bmp.h . Each pixel is repre- sented as a combination of (red, green, blue) values, each 8-bits in length. The code in cs1300bmp.cpp provides routines for reading and writing images in the BMP format. You shouldn’t have to modify that code, although you’re free to do so. The “filter” is an n × n array of numbers. We’ll go through the logistics of how a “filter” works in recitation and in class and briefly summarize it here. Basically, you an cause a number of visual affects by applying a filter to an image. The filter is implemented as a “convolution”, which means that elements of the filter ma- trix are multiplied by the image matrix to compute a new value for the image. Pictorially, this is represented as: Computationally, this is structured as five nested “for” loops (three to go over the colors, row and columns and two more to apply the filter). In the solution provided to you, filters are represented using the Filter class, implemented in Filter.h and Filter.cpp . The majority of the work performed by the filter application is in the routine shown in Figure 2. This routine is “instrumented” using the rdscll function. This inline function records the starting and finish times in terms of CPU cycles. We use this to determine the “cycles per element” needed to apply the filter to a given image. A sample of the output for the provided setup code looks like the following when run on the machine elra-01.cs.colorado.edu . Took 142673424.000000 cycles to process, or 2700.715984 cycles per pixel
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

writeup-2010 - CSCI 2400 Fall 2010 Lab Assignment L4 Code...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online