Browse Source

Change AddSinglePixOrCopy to accept 'in PixOrCopy'

pull/2940/head
Maxim Shipko 11 months ago
parent
commit
0faf614b07
  1. 2
      src/ImageSharp/Formats/Webp/Lossless/CostModel.cs
  2. 2
      src/ImageSharp/Formats/Webp/Lossless/HistogramEncoder.cs
  3. 4
      src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs

2
src/ImageSharp/Formats/Webp/Lossless/CostModel.cs

@ -42,7 +42,7 @@ internal class CostModel
// The following code is similar to HistogramCreate but converts the distance to plane code.
foreach (PixOrCopy v in backwardRefs)
{
histogram.AddSinglePixOrCopy(v, true, xSize);
histogram.AddSinglePixOrCopy(in v, true, xSize);
}
ConvertPopulationCountTableToBitEstimates(histogram.NumCodes(), histogram.Literal, this.Literal);

2
src/ImageSharp/Formats/Webp/Lossless/HistogramEncoder.cs

@ -113,7 +113,7 @@ internal static class HistogramEncoder
foreach (PixOrCopy v in backwardRefs)
{
int ix = ((y >> histoBits) * histoXSize) + (x >> histoBits);
histograms[ix].AddSinglePixOrCopy(v, false);
histograms[ix].AddSinglePixOrCopy(in v, false);
x += v.Len;
while (x >= xSize)
{

4
src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs

@ -140,7 +140,7 @@ internal abstract unsafe class Vp8LHistogram
{
foreach (PixOrCopy v in refs)
{
this.AddSinglePixOrCopy(v, false);
this.AddSinglePixOrCopy(in v, false);
}
}
@ -150,7 +150,7 @@ internal abstract unsafe class Vp8LHistogram
/// <param name="v">The token to add.</param>
/// <param name="useDistanceModifier">Indicates whether to use the distance modifier.</param>
/// <param name="xSize">xSize is only used when useDistanceModifier is true.</param>
public void AddSinglePixOrCopy(PixOrCopy v, bool useDistanceModifier, int xSize = 0)
public void AddSinglePixOrCopy(in PixOrCopy v, bool useDistanceModifier, int xSize = 0)
{
if (v.IsLiteral())
{

Loading…
Cancel
Save