-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmemory.cpp
More file actions
36 lines (32 loc) · 978 Bytes
/
memory.cpp
File metadata and controls
36 lines (32 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "easyfg.h"
void MainWindow::AllocateMemory()
{
DataArray = (int**)malloc(MAX_WIDTH*sizeof(int*));
RefArray = (int**)malloc(MAX_WIDTH*sizeof(int*));
CorrectedArray = (int**)malloc(MAX_WIDTH*sizeof(int*));
for(int i=0; i<MAX_WIDTH; i++)
{
DataArray[i] = (int*)malloc(MAX_HEIGHT*sizeof(int));
RefArray[i] = (int*)malloc(MAX_HEIGHT*sizeof(int));
CorrectedArray[i] = (int*)malloc(MAX_HEIGHT*sizeof(int));
}
X = (float*)malloc(MAX_WIDTH*sizeof(float));
Y = (float*)malloc(MAX_HEIGHT*sizeof(float));
R = (float*)malloc((int)ceil(sqrt(pow(MAX_WIDTH,2)+pow(MAX_HEIGHT,2)))*sizeof(float));
//R = (float*)malloc(MAX_R*sizeof(float));
}
void MainWindow::ClearMemory()
{
for(int i=0; i<MAX_WIDTH; i++)
{
free(DataArray[i]);
free(RefArray[i]);
free(CorrectedArray[i]);
}
free(DataArray);
free(RefArray);
free(CorrectedArray);
free(X);
free(Y);
free(R);
}