-
-
Notifications
You must be signed in to change notification settings - Fork 888
Fix for Issue 1416 #1418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for Issue 1416 #1418
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1418 +/- ##
=======================================
Coverage 83.08% 83.08%
=======================================
Files 707 707
Lines 31839 31839
Branches 3590 3590
=======================================
+ Hits 26454 26455 +1
+ Misses 4668 4667 -1
Partials 717 717
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
| int luminance = ImageMaths.GetBT709Luminance(ref vector, levels); | ||
| Unsafe.Add(ref histogramBase, luminance)++; | ||
| ref int histogramAtLuminance = ref MemoryMarshal.GetReference(this.histogramBuffer.Slice(luminance)); | ||
| Interlocked.Increment(ref histogramAtLuminance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this have been
Interlocked.Increment(ref Unsafe.Add(ref histogramBase, luminance))There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes right, dont know why i did it so over complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why net472 tests are failing now. Its not the histogram tests:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at ImageMagick.PixelCollection.NativeMethods.X86.PixelCollection_ToByteArray(IntPtr Instance, UIntPtr x, UIntPtr y, UIntPtr width, UIntPtr height, IntPtr mapping, IntPtr& exception) at ImageMagick.PixelCollection.NativePixelCollection.ToByteArray(Int32 x, Int32 y, Int32 width, Int32 height, String mapping) ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an intermittent issue with ImageMagick. Maybe caused by OOM but I'm not sure. I just reset when I see it.
Prerequisites
Description
This is a fix for #1416. Calculation of the histogram was done in parallel without locking.