Skip to content

Commit 8fb91fe

Browse files
committed
improve parallel support
1 parent c3a5a52 commit 8fb91fe

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Spectrogram/Spectrogram.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public Bitmap GetBitmap(double multiplier = 1, bool dB = false, bool roll = fals
100100
int stride = bitmapData.Stride;
101101

102102
byte[] bytes = new byte[bitmapData.Stride * bmp.Height];
103-
for (int col = 0; col < Width; col++)
103+
Parallel.For(0, Width, col =>
104104
{
105105
int sourceCol = col;
106106
if (roll)
@@ -120,7 +120,7 @@ public Bitmap GetBitmap(double multiplier = 1, bool dB = false, bool roll = fals
120120
int bytePosition = (Height - 1 - row) * stride + col;
121121
bytes[bytePosition] = (byte)value;
122122
}
123-
}
123+
});
124124

125125
Marshal.Copy(bytes, 0, bitmapData.Scan0, bytes.Length);
126126
bmp.UnlockBits(bitmapData);

0 commit comments

Comments
 (0)