File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/ImageSharp/Processing/Processors/Normalization Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ public GrayscaleLevelsRowOperation(
115115#endif
116116 public void Invoke ( int y )
117117 {
118+ ref int histogramBase = ref MemoryMarshal . GetReference ( this . histogramBuffer . GetSpan ( ) ) ;
118119 ref TPixel pixelBase = ref MemoryMarshal . GetReference ( this . source . GetPixelRowSpan ( y ) ) ;
119120 int levels = this . luminanceLevels ;
120121
@@ -123,8 +124,7 @@ public void Invoke(int y)
123124 // TODO: We should bulk convert here.
124125 var vector = Unsafe . Add ( ref pixelBase , x ) . ToVector4 ( ) ;
125126 int luminance = ImageMaths . GetBT709Luminance ( ref vector , levels ) ;
126- ref int histogramAtLuminance = ref MemoryMarshal . GetReference ( this . histogramBuffer . Slice ( luminance ) ) ;
127- Interlocked . Increment ( ref histogramAtLuminance ) ;
127+ Interlocked . Increment ( ref Unsafe . Add ( ref histogramBase , luminance ) ) ;
128128 }
129129 }
130130 }
You can’t perform that action at this time.
0 commit comments