1
edit
Changes
→Progress
This is the function that takes most of the time. As you can see it it a single nested for loop that calculates a value from Matrix ui and stores it in Matrix u. Because the first matrix is never changed in each step, the result can therefore be calculated in independent threads safely. this means that this code should be relatively simple to parallelize and should see large speed increases.
==== James's Research ====
An image processing code was found here: http://www.dreamincode.net/forums/topic/76816-image-processing-tutorial/
This program takes in an image and processes in various ways. I chose to look at the reflection function (flipping) by editing the code to omit the other sections. Below are the results from profiling where n is the size of the image in files.
n
writeImage(char*, Image&)
readImage(char*, Image&)
Image::reflectImage(bool, Image&)
Image::Image(int, int, int)
Image::operator=(Image const&)
Image::Image(Image const&)
Elapsed Time
10077713
0.01
0.01
0.02
0.01
0.01
0.07
0.11
25435697
0.02
0.02
0.03
0.05
0.05
0.09
0.26
117430458
0.13
0.1
0.15
0.18
0.2
0.6
1.36
What takes the longest running function is the function that copies the old image into the new output image. Below is the code for the function.
Image::Image(const Image& oldImage)
{
N = oldImage.N;
M = oldImage.M;
Q = oldImage.Q;
pixelVal = new int* [N];
for(int i = 0; i < N; i++)
{
pixelVal[i] = new int [M];
for(int j = 0; j < M; j++)
pixelVal[i][j] = oldImage.pixelVal[i][j];
}
}
=== Assignment 2 ===
=== Assignment 3 ===
== Chadd's Research ==