Open main menu

CDOT Wiki β

Changes

TudyBert

501 bytes removed, 09:33, 19 April 2013
Assignment 1 Revisted
Here's the flat profile for 50 runs of enlarging a 512px x 512px image 4 times:
 
 
% cumulative self self total
19.64 2.75 0.55 Image::enlargeImage(int, Image&)
1.07 2.78 0.03 4194304 0.00 0.00 Image::getPixelVal(int, int)
 
The code for enlargeImage():
 
int rows, cols, gray;
}
oldImage = tempImage;
 
The four for loops look like they could be parallelized since they just serve as counters. From the flat file, it seems that the majority of the time is spent in the overloaded operator=() method. The code for this is:
 
 
 
 
void Image::operator=(const Image& oldImage)
 
/*copies oldImage into whatever you = it to*/
 
{
 
N = oldImage.N;
 
M = oldImage.M;
 
Q = oldImage.Q;
 
 
if(dim1 != NULL)
 
{
 
delete[] dim1;
 
}
 
 
 
pixelVal = new int* [N];
 
dim1 = new int[N*M];
 
 
 
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];
 
dim1[i*N + j] = oldImage.dim1[i*N + j];
 
}
 
}
 
}
=== Assignment 3 ===
1
edit