diff --git a/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs b/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs index da92e6a63..fadfc1ec6 100644 --- a/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageProcessorCore/Formats/Bmp/BmpDecoderCore.cs @@ -51,7 +51,7 @@ namespace ImageProcessorCore.Formats /// /// The image, where the data should be set to. /// Cannot be null (Nothing in Visual Basic). - /// The this._stream, where the image should be + /// The stream, where the image should be /// decoded from. Cannot be null (Nothing in Visual Basic). /// /// is null. diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegConstants.cs b/src/ImageProcessorCore/Formats/Jpg/JpegConstants.cs index 22c6a8c9b..4df086f29 100644 --- a/src/ImageProcessorCore/Formats/Jpg/JpegConstants.cs +++ b/src/ImageProcessorCore/Formats/Jpg/JpegConstants.cs @@ -143,6 +143,24 @@ namespace ImageProcessorCore.Formats /// public const byte DRI = 0xdd; + /// + /// Define First Restart + /// + /// Inserted every r macroblocks, where r is the restart interval set by a DRI marker. + /// Not used if there was no DRI marker. The low three bits of the marker code cycle in value from 0 to 7. + /// + /// + public const byte RST0 = 0xd0; + + /// + /// Define Eigth Restart + /// + /// Inserted every r macroblocks, where r is the restart interval set by a DRI marker. + /// Not used if there was no DRI marker. The low three bits of the marker code cycle in value from 0 to 7. + /// + /// + public const byte RST7 = 0xd7; + /// /// Start of Scan /// @@ -168,6 +186,7 @@ namespace ImageProcessorCore.Formats /// /// Application specific marker for marking the jpeg format. + /// /// public const byte APP0 = 0xe0; @@ -175,6 +194,16 @@ namespace ImageProcessorCore.Formats /// Application specific marker for marking where to store metadata. /// public const byte APP1 = 0xe1; + + /// + /// Application specific marker used by Adobe for storing encoding information for DCT filters. + /// + public const byte APP14 = 0xee; + + /// + /// Application specific marker used by GraphicConverter to store JPEG quality. + /// + public const byte APP15 = 0xef; } } } \ No newline at end of file diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs b/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs index 34e0932dc..89aa4e001 100644 --- a/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs +++ b/src/ImageProcessorCore/Formats/Jpg/JpegDecoder.cs @@ -7,7 +7,6 @@ namespace ImageProcessorCore.Formats { using System; using System.IO; - using System.Threading.Tasks; /// /// Image decoder for generating an image out of a jpg stream. @@ -96,39 +95,6 @@ namespace ImageProcessorCore.Formats JpegDecoderCore decoder = new JpegDecoderCore(); decoder.Decode(stream, image, false); - - // TODO: When nComp is 3 we set the ImageBase pixels internally, Eventually we should - // do the same here - if (decoder.nComp == 1) - { - int pixelWidth = decoder.width; - int pixelHeight = decoder.height; - - float[] pixels = new float[pixelWidth * pixelHeight * 4]; - - Parallel.For( - 0, - pixelHeight, - y => - { - var yoff = decoder.img1.get_row_offset(y); - for (int x = 0; x < pixelWidth; x++) - { - int offset = ((y * pixelWidth) + x) * 4; - - pixels[offset + 0] = decoder.img1.pixels[yoff + x] / 255f; - pixels[offset + 1] = decoder.img1.pixels[yoff + x] / 255f; - pixels[offset + 2] = decoder.img1.pixels[yoff + x] / 255f; - pixels[offset + 3] = 1; - } - }); - - image.SetPixels(pixelWidth, pixelHeight, pixels); - } - else if (decoder.nComp != 3) - { - throw new NotSupportedException("JpegDecoder only supports RGB and Grayscale color spaces."); - } } /// diff --git a/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id b/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id index 72b7f5308..a5c139745 100644 --- a/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id +++ b/src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id @@ -1 +1 @@ -b643c4d82973c427e30384f20fdc46b29d913782 \ No newline at end of file +7a5076971068e0f389da2fb1e8b25216f4049718 \ No newline at end of file diff --git a/tests/ImageProcessorCore.Tests/FileTestBase.cs b/tests/ImageProcessorCore.Tests/FileTestBase.cs index 100e74d0f..f5c83cd71 100644 --- a/tests/ImageProcessorCore.Tests/FileTestBase.cs +++ b/tests/ImageProcessorCore.Tests/FileTestBase.cs @@ -19,17 +19,17 @@ namespace ImageProcessorCore.Tests /// protected static readonly List Files = new List { - //"TestImages/Formats/Jpg/Floorplan.jpeg", // Perf: Enable for local testing only + "TestImages/Formats/Jpg/Floorplan.jpeg", // Perf: Enable for local testing only "TestImages/Formats/Jpg/Calliphora.jpg", - //"TestImages/Formats/Jpg/fb.jpg", // Perf: Enable for local testing only - //"TestImages/Formats/Jpg/progress.jpg", // Perf: Enable for local testing only + "TestImages/Formats/Jpg/fb.jpg", // Perf: Enable for local testing only + "TestImages/Formats/Jpg/progress.jpg", // Perf: Enable for local testing only //"TestImages/Formats/Jpg/gamma_dalai_lama_gray.jpg", // Perf: Enable for local testing only - "TestImages/Formats/Bmp/Car.bmp", + //"TestImages/Formats/Bmp/Car.bmp", // "TestImages/Formats/Bmp/neg_height.bmp", // Perf: Enable for local testing only //"TestImages/Formats/Png/blur.png", // Perf: Enable for local testing only //"TestImages/Formats/Png/indexed.png", // Perf: Enable for local testing only - "TestImages/Formats/Png/splash.png", - "TestImages/Formats/Gif/rings.gif", + //"TestImages/Formats/Png/splash.png", + //"TestImages/Formats/Gif/rings.gif", //"TestImages/Formats/Gif/giphy.gif" // Perf: Enable for local testing only };