I am testing JPEG decompression on a bunch of computers with different versions of Windows. All of these computers have .NET 4 installed and I am compiling against .NET 2 and the "Any CPU" platform target. The following code produces different output on different systems.
Bitmap bmp = (Bitmap)Image.FromFile("test.jpg");
long datasum = 0;
for (int y = 0; y < bmp.Height; y++)
for (int x = 0; x < bmp.Width; x++)
datasum = datasum + bmp.GetPixel(x, y).R + bmp.GetPixel(x, y).G + bmp.GetPixel(x, y).B;
Console.WriteLine(datasum);
All the Win7 64-bit and WinXP 32-bit machines produce one result. And all the Win7 32-bit machines produce another result.
Any ideas why the output would be different?
It's implemented by gdiplus.dll. Check which versions are actually loaded on different system, and bitness.
There may be floating-point issue, MMX instructions allowed on one machine, not the other.
Can be related to this.
Try setting useEmbeddedColorManagement parameter to true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With