Skip to content

Commit

Permalink
Eliminate a few allocations in PngMetadataReader
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcarbon committed Jan 31, 2024
1 parent 5d34c55 commit 189d66f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MetadataExtractor/Formats/Png/PngMetadataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private static IEnumerable<Directory> ProcessChunk(PngChunk chunk)
}
else if (chunkType == PngChunkType.tIME)
{
var reader = new SequentialByteArrayReader(bytes);
var reader = new BufferReader(bytes, isBigEndian: true);
var year = reader.GetUInt16();
var month = reader.GetByte();
int day = reader.GetByte();
Expand All @@ -316,7 +316,7 @@ private static IEnumerable<Directory> ProcessChunk(PngChunk chunk)
}
else if (chunkType == PngChunkType.pHYs)
{
var reader = new SequentialByteArrayReader(bytes);
var reader = new BufferReader(bytes, isBigEndian: true);
var pixelsPerUnitX = reader.GetInt32();
var pixelsPerUnitY = reader.GetInt32();
var unitSpecifier = reader.GetSByte();
Expand Down

0 comments on commit 189d66f

Please sign in to comment.