Skip to content

Commit d181b77

Browse files
authored
Merge branch 'main' into af/contiguous-load
2 parents f387d4a + a1da24a commit d181b77

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal class HuffmanScanDecoder
3131
/// <summary>
3232
/// Number of component in the current scan.
3333
/// </summary>
34-
private int componentsCount;
34+
private int scanComponentCount;
3535

3636
/// <summary>
3737
/// The reset interval determined by RST markers.
@@ -112,11 +112,12 @@ public int ResetInterval
112112
/// <summary>
113113
/// Decodes the entropy coded data.
114114
/// </summary>
115-
public void ParseEntropyCodedData(int componentCount)
115+
/// <param name="scanComponentCount">Component count in the current scan.</param>
116+
public void ParseEntropyCodedData(int scanComponentCount)
116117
{
117118
this.cancellationToken.ThrowIfCancellationRequested();
118119

119-
this.componentsCount = componentCount;
120+
this.scanComponentCount = scanComponentCount;
120121

121122
this.scanBuffer = new HuffmanScanBuffer(this.stream);
122123

@@ -148,7 +149,7 @@ public void InjectFrameData(JpegFrame frame, IRawJpegData jpegData)
148149

149150
private void ParseBaselineData()
150151
{
151-
if (this.componentsCount != 1)
152+
if (this.scanComponentCount != 1)
152153
{
153154
this.ParseBaselineDataInterleaved();
154155
this.spectralConverter.CommitConversion();
@@ -180,7 +181,7 @@ private void ParseBaselineDataInterleaved()
180181
{
181182
// Scan an interleaved mcu... process components in order
182183
int mcuCol = mcu % mcusPerLine;
183-
for (int k = 0; k < this.componentsCount; k++)
184+
for (int k = 0; k < this.scanComponentCount; k++)
184185
{
185186
int order = this.frame.ComponentOrder[k];
186187
JpegComponent component = this.components[order];
@@ -228,9 +229,6 @@ ref Unsafe.Add(ref blockRef, blockCol),
228229
// Convert from spectral to actual pixels via given converter
229230
this.spectralConverter.ConvertStrideBaseline();
230231
}
231-
232-
// Stride conversion must be sealed for stride conversion approach
233-
this.spectralConverter.CommitConversion();
234232
}
235233

236234
private void ParseBaselineDataNonInterleaved()
@@ -336,7 +334,7 @@ private void CheckProgressiveData()
336334
}
337335

338336
// AC scans may have only one component.
339-
if (this.componentsCount != 1)
337+
if (this.scanComponentCount != 1)
340338
{
341339
invalid = true;
342340
}
@@ -368,7 +366,7 @@ private void ParseProgressiveData()
368366
{
369367
this.CheckProgressiveData();
370368

371-
if (this.componentsCount == 1)
369+
if (this.scanComponentCount == 1)
372370
{
373371
this.ParseProgressiveDataNonInterleaved();
374372
}
@@ -393,7 +391,7 @@ private void ParseProgressiveDataInterleaved()
393391
// Scan an interleaved mcu... process components in order
394392
int mcuRow = mcu / mcusPerLine;
395393
int mcuCol = mcu % mcusPerLine;
396-
for (int k = 0; k < this.componentsCount; k++)
394+
for (int k = 0; k < this.scanComponentCount; k++)
397395
{
398396
int order = this.frame.ComponentOrder[k];
399397
JpegComponent component = this.components[order];

0 commit comments

Comments
 (0)