diff --git a/src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs b/src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs
index 8369e92366..8015d160a0 100644
--- a/src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpeg/GolangPort/OrigJpegDecoderCore.cs
@@ -361,7 +361,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
break;
case OrigJpegConstants.Markers.APP0:
- this.ProcessApplicationHeader(remaining);
+ this.ProcessApplicationHeaderMarker(remaining);
break;
case OrigJpegConstants.Markers.APP1:
this.ProcessApp1Marker(remaining);
@@ -558,7 +558,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
/// Processes the application header containing the JFIF identifier plus extra data.
///
/// The remaining bytes in the segment block.
- private void ProcessApplicationHeader(int remaining)
+ private void ProcessApplicationHeaderMarker(int remaining)
{
if (remaining < 5)
{
@@ -569,14 +569,16 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort
this.InputProcessor.ReadFull(this.Temp, 0, 13);
remaining -= 13;
- // TODO: We should be using constants for this.
- this.isJfif = this.Temp[0] == 'J' && this.Temp[1] == 'F' && this.Temp[2] == 'I' && this.Temp[3] == 'F'
- && this.Temp[4] == '\x00';
+ this.isJfif = this.Temp[0] == OrigJpegConstants.JFif.J &&
+ this.Temp[1] == OrigJpegConstants.JFif.F &&
+ this.Temp[2] == OrigJpegConstants.JFif.I &&
+ this.Temp[3] == OrigJpegConstants.JFif.F &&
+ this.Temp[4] == OrigJpegConstants.JFif.Null;
if (this.isJfif)
{
- this.horizontalResolution = (short)(this.Temp[9] + (this.Temp[8] << 8));
- this.verticalResolution = (short)(this.Temp[11] + (this.Temp[10] << 8));
+ this.horizontalResolution = (short)((this.Temp[8] << 8) | this.Temp[9]);
+ this.verticalResolution = (short)((this.Temp[10] << 8) | this.Temp[11]);
}
if (remaining > 0)
diff --git a/tests/ImageSharp.Tests/FileTestBase.cs b/tests/ImageSharp.Tests/FileTestBase.cs
index bbb5c7bfab..8e8b966674 100644
--- a/tests/ImageSharp.Tests/FileTestBase.cs
+++ b/tests/ImageSharp.Tests/FileTestBase.cs
@@ -70,17 +70,17 @@ namespace SixLabors.ImageSharp.Tests
protected static readonly List Files = new List
{
TestFile.Create(TestImages.Jpeg.Baseline.Calliphora),
- // TestFile.Create(TestImages.Jpeg.Baseline.Turtle), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Baseline.Ycck), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Baseline.Cmyk), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Baseline.Floorplan), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Progressive.Festzug), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Baseline.Bad.MissingEOF), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Baseline.Bad.ExifUndefType), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Progressive.Fb), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Progressive.Progress), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Baseline.GammaDalaiLamaGray), // Perf: Enable for local testing only
- // TestFile.Create(TestImages.Jpeg.Progressive.Bad.BadEOF), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Baseline.Turtle), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Baseline.Ycck), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Baseline.Cmyk), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Baseline.Floorplan), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Progressive.Festzug), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Baseline.Bad.BadEOF), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Baseline.Bad.ExifUndefType), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Progressive.Fb), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Progressive.Progress), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Baseline.GammaDalaiLamaGray), // Perf: Enable for local testing only
+ TestFile.Create(TestImages.Jpeg.Progressive.Bad.BadEOF), // Perf: Enable for local testing only
TestFile.Create(TestImages.Bmp.Car),
// TestFile.Create(TestImages.Bmp.NegHeight), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Bmp.CoreHeader), // Perf: Enable for local testing only