diff --git a/Gauss.ASM/Gauss.ASM.vcxproj b/Gauss.ASM/Gauss.ASM.vcxproj
index ce64e48..d5cc762 100644
--- a/Gauss.ASM/Gauss.ASM.vcxproj
+++ b/Gauss.ASM/Gauss.ASM.vcxproj
@@ -76,6 +76,7 @@
true
true
true
+ false
diff --git a/Gauss.CPP/Gauss.CPP.cpp b/Gauss.CPP/Gauss.CPP.cpp
index 033875a..6aefd8d 100644
--- a/Gauss.CPP/Gauss.CPP.cpp
+++ b/Gauss.CPP/Gauss.CPP.cpp
@@ -16,7 +16,8 @@ Pixel** CopyPixels(Pixel** pixels, int height, int width)
return toReturn;
}
-int* ComputePascalRow(int n){
+int* ComputePascalRow(int n)
+{
int* row = new int[n + 1];
row[0] = 1; //First element is always 1
for (int i = 1; i GenerateBlurredImageAsync(GeneratorParameters generato
var tasks = new Task[generatorParams.NumberOfThreads];
var imgSizes = GetLoadedImageSizes();
- for (int threadNum = 0; threadNum < tasks.Length; threadNum++)
+ while (generatorParams.BlurLevel-- > 0)
{
- int num = threadNum;
- tasks[threadNum] = Task.Run(() =>
+ for (int threadNum = 0; threadNum < tasks.Length; threadNum++)
{
- var currentThreadParams = ComputeThreadParams(
- threadId: num,
- generatorParams: generatorParams,
- imageSizes: imgSizes);
+ int num = threadNum;
+ tasks[threadNum] = Task.Run(() =>
+ {
+ var currentThreadParams = ComputeThreadParams(
+ threadId: num,
+ generatorParams: generatorParams,
+ imageSizes: imgSizes);
+
+ Console.WriteLine(currentThreadParams.ToString());
+
+ RunUnsafeImageGenerationCode(currentThreadParams, generatorParams.GeneratingLibrary);
+ });
+ }
- RunUnsafeImageGenerationCode(currentThreadParams, generatorParams.GeneratingLibrary);
- });
+ await Task.WhenAll(tasks);
}
-
- await Task.WhenAll(tasks);
return SourceFile;
}
@@ -90,11 +95,9 @@ private ThreadParameters ComputeThreadParams(int threadId, GeneratorParameters g
if (i == threadId)
currentThreadImgHeight = numOfLinesOfCurrentThread;
else
- sumOfOffsetLines += numOfLinesOfCurrentThread;
+ sumOfOffsetLines += (numOfLinesOfCurrentThread - (generatorParams.GaussMaskSize - 1));
}
- sumOfOffsetLines -= threadId*(generatorParams.GaussMaskSize - 1);
-
return new ThreadParameters
{
CurrentImgOffset = sumOfOffsetLines * rowPadded,
diff --git a/Gauss.GUI/Gauss.GUI.csproj b/Gauss.GUI/Gauss.GUI.csproj
index 79c35d4..e74832d 100644
--- a/Gauss.GUI/Gauss.GUI.csproj
+++ b/Gauss.GUI/Gauss.GUI.csproj
@@ -34,6 +34,7 @@
TRACE
prompt
4
+ true
diff --git a/Gauss.GUI/Models/RunParameters/ThreadParameters.cs b/Gauss.GUI/Models/RunParameters/ThreadParameters.cs
index 4da8e93..41052ab 100644
--- a/Gauss.GUI/Models/RunParameters/ThreadParameters.cs
+++ b/Gauss.GUI/Models/RunParameters/ThreadParameters.cs
@@ -13,5 +13,10 @@ public struct ThreadParameters
public int ImgHeight;
public int IdOfImgPart;
public int NumOfImgParts;
+
+ public override string ToString()
+ {
+ return string.Format("ThreadID: {0}; Width: {1}; Height: {2}; NumOfParts: {3}; ThreadOffset: {4}", IdOfImgPart, ImgWidth, ImgHeight, NumOfImgParts, CurrentImgOffset);
+ }
}
}
\ No newline at end of file
diff --git a/Gauss.GUI/ViewModels/MainWindowViewModel.Commands.cs b/Gauss.GUI/ViewModels/MainWindowViewModel.Commands.cs
index b4b4698..0cff58d 100644
--- a/Gauss.GUI/ViewModels/MainWindowViewModel.Commands.cs
+++ b/Gauss.GUI/ViewModels/MainWindowViewModel.Commands.cs
@@ -48,7 +48,7 @@ private void InitializeGenerateBlurredImageCommand()
MainPanelImage = await ImageManager.GenerateBlurredImageAsync(new GeneratorParameters
{
NumberOfThreads = NumberOfThreads,
- BlurLevel = BlurLevel,
+ BlurLevel = BlurIterations,
GaussMaskSize = GaussMaskSize,
GeneratingLibrary = GeneratingLibrary,
});
diff --git a/Gauss.GUI/ViewModels/MainWindowViewModel.Main.cs b/Gauss.GUI/ViewModels/MainWindowViewModel.Main.cs
index 9a80dd5..21df624 100644
--- a/Gauss.GUI/ViewModels/MainWindowViewModel.Main.cs
+++ b/Gauss.GUI/ViewModels/MainWindowViewModel.Main.cs
@@ -94,17 +94,17 @@ public int NumberOfThreads
}
private int _numberOfThreads;
- public int BlurLevel
+ public int BlurIterations
{
- get { return _blurLevel; }
+ get { return _blurIterations; }
set
{
- if (value == _blurLevel) return;
- _blurLevel = value;
+ if (value == _blurIterations) return;
+ _blurIterations = value;
OnPropertyChanged();
}
}
- private int _blurLevel;
+ private int _blurIterations;
public GeneratingLibrary GeneratingLibrary
{
@@ -160,9 +160,9 @@ public MainWindowViewModel()
private void InitializeProperties()
{
NumberOfThreads = 2;
- BlurLevel = 40;
+ BlurIterations = 5;
GeneratingLibrary = GeneratingLibrary.CPP;
- GaussMaskSize = 25;
+ GaussMaskSize = 13;
SetDropImageZoneState(DropImagesZoneState.Idle);
InformationText = "Computing image...";
diff --git a/Gauss.GUI/Views/MainWindow.xaml b/Gauss.GUI/Views/MainWindow.xaml
index 75476c7..2902724 100644
--- a/Gauss.GUI/Views/MainWindow.xaml
+++ b/Gauss.GUI/Views/MainWindow.xaml
@@ -42,9 +42,9 @@
-
+
-
+