Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JpegEncoder producing incorrect output on linux-arm (since Beta006) #871

Closed
5 tasks done
qdraw opened this issue Apr 1, 2019 · 27 comments
Closed
5 tasks done

JpegEncoder producing incorrect output on linux-arm (since Beta006) #871

qdraw opened this issue Apr 1, 2019 · 27 comments

Comments

@qdraw
Copy link

qdraw commented Apr 1, 2019

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported
  • I have discussed this on gitter

Description

I have some Image encoding issues on linux-arm. This code bellow works with beta-0005, but not beta-0006 or newer. I have also tested it with the latest nightly build 1.0.0-dev002459 The issues are only visible on linux-arm, on other platforms it is working well

UPDATE (22/05/2019, @antonfirsov)

Resizing is not relevant here, it's the issue of the jpeg encoder.

TL;DR:

  • load jpeg -> resize -> save jpeg [PINK]
  • load jpeg -> save jpeg [PINK]
  • load png -> save jpeg [PINK]
  • load gif -> save jpeg [PINK]
  • load jpeg -> resize -> save png [OK]
  • load jpeg -> save png [OK]

The images are looking like this, I have tried it with multiple jpeg images
QZNU6ZQ3I6C7WV76TUB2X7C57E
Source of the image:
https://raw.githubusercontent.com/SixLabors/ImageSharp/master/tests/Images/Input/Jpg/baseline/Lake.jpg

Steps to Reproduce

I'm initially used it for resizing but it happens also when you write the image:
I'm using the following code:

using (var inputStream = _iStorage.ReadStream(subPath))
using (var image = Image.Load(inputStream))
{
	image.Save(outputStream, new JpegEncoder{
		Quality = 100,
	});
						
	_iStorage.WriteStream(outputStream, outputHash);  
}

public Stream ReadStream(string path, int maxRead = -1)
{
	if ( ! ExistFile(path) ) throw new FileNotFoundException(path);
	
	FileStream fileStream;
	fileStream = new FileStream(path, FileMode.Open, FileAccess.Read,FileShare.Read, maxRead, false);
	return fileStream;
}

public bool WriteStream(Stream stream, string path)
{
	if ( !stream.CanRead ) return false;
	
	stream.Seek(0, SeekOrigin.Begin);
				
	using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write))
	{
		stream.CopyTo(fileStream);
	}
	stream.Dispose();
	return true;
}

System Configuration

When running on linux-arm as release and debug

  • ImageSharp version: 0006 and newer
  • Other ImageSharp packages and versions:
  • Environment (Operating system, version and so on): linux-arm
  • .NET Framework version: build as: 2.2.104, runtime: 2.1.8
  • Additional information: running on a Raspberry Pi 2 or 3

--
Edit: tested based on the feedback of @JimBobSquarePants:, this produces a 'normal' image

image.Save(outputStream, new PngEncoder{
    ColorType = PngColorType.Rgb, 
   CompressionLevel = 9, 
});
@antonfirsov antonfirsov changed the title ResizeProcessor not working since Beta006 JpegEncoder producing incorrect output on linux-arm (since Beta006) Apr 2, 2019
@antonfirsov
Copy link
Member

antonfirsov commented Apr 2, 2019

info from gitter discussions:
resizing is not necessary to reproduce the issue, PNG -> Jpeg also fails, which indicates an issue with JpegEncoder

@qdraw
Copy link
Author

qdraw commented Apr 13, 2019

I have tried some things based on the release notes:

[x] commit: 8f3658da6c0040198c01dbf892a9ea77d0556407  PR: #804 - pink - 2019-01-09
[x] commit: f62f6e82e13310e0e625d40d9eb9653f874895d8 PR: (#722) - good (<Rgb24> + default) - 2018-10-04
[x] commit: 63ee5970220c6889177749dc14228cac035fcee9 PR (#724) - good - 2018-10-06
--[x]  commit: 537dbcf78bf83ef62c5be11fe8bd2db1c598867d PR (#784) - pink - 2018-12-30-- UPDATED
[x] commit: 2db6bd2e2a9a887dd9b7379e80d36908f5c089d7 PR: (#698) - good - 2018-09-12

added:
[x] commit: 93bb37394a484c03ba84d59d60e39f90677240c7 PR: (#804) - pink - 2019-01-09
[x] commit:  59d76a0f7b465c27330af6717df479146be3dda9 PR: (#801)  - pink - 2019-01-05
[x] commit:  575c23d929ff81b41d89ef3499125c1899ec2e72 PR: (#801)  - pink - 2019-01-04
[x] commit:  db0fc0dd7df4b23236120312419f21916b6c6d8a PR: (#874) - pink - 2018-12-31
[x] commit:  537dbcf78bf83ef62c5be11fe8bd2db1c598867d PR (#784) - pink - 2018-12-30
[x] commit:  133c85489daa305a0c5db9662e070329d8c60989 - pink - 2018-12-21
[x] commit: 8cba23f42dcd8bde55a011cd382a394fe7a69b78 - pink - 2018-12-21
[x] commit: abaf5581b6e230a14f9765433ca74f234ba01cdd - pink - 2018-12-20
[x] commit: 0f5df545be7d314f25fb6cb3d96bbf4c382ed053 - pink - 2018-12-18
[x] commit: 4568a4bfceeb3aaa242314daa11d6c2c86f0c379 - PR (#783)- pink - 2018-12-12 
[x] commit: ffba817bcae3a2895534c037798bf8e30232e06d - pink 2018-11-26
[x] commit: 43b227638931a02867c28ec8cf7fa4eb5bae8a71 - pink 2018-11-23
[x] commit: 321cca6e815ff0abb73d3a7b2168bfa9a670fdf3 #771:  - pink 2018-11-07
[x] commit: 7e25ecd4564169d1531b08a130d5517775a9deba #768 - pink 2018-11-05

@JimBobSquarePants
Copy link
Member

#804 is all decoder work which we know is fine so the change must have taken place between #784 and there.

@antonfirsov
Copy link
Member

We are getting close! However it's very strange, that no PR between 784 and 804 touches anything related to Jpeg encoding. What is the state after merging #801 ?

@JimBobSquarePants
Copy link
Member

I’m smelling a jit issue here...

@qdraw
Copy link
Author

qdraw commented Apr 14, 2019

The state after #801 is a pink image

@antonfirsov
Copy link
Member

Only 6 PR-s left to binary search ... if we did no mistake so far. Are you super sure, that #784 is OK?
If yes, let's point to the middle .. #789?

@qdraw
Copy link
Author

qdraw commented Apr 14, 2019

I have #784 checked again, and I was wrong this one is also pink. I have updated the comment above

@antonfirsov
Copy link
Member

Another idea:

What if you wire out the pooling memory allocator? Configuration.Default.MemoryAllocator = new SimpleGcMemoryAllocator()

Should I provide a detailed plan to track down the breaking PR? (Or are you alredy doing it? :) )

@qdraw
Copy link
Author

qdraw commented Apr 14, 2019

@antonfirsov I'm currently checking PR's using a very simple application that only convert the image ('Lake.jpg' from the examples) to a image on device. Do you have suggestions which PR I should track?

@qdraw
Copy link
Author

qdraw commented Apr 14, 2019

What if you wire out the pooling memory allocator? Configuration.Default.MemoryAllocator = new SimpleGcMemoryAllocator()

How should I do to test this?

@antonfirsov
Copy link
Member

antonfirsov commented Apr 14, 2019

What should I do to test this?

Same thing: pink/not pink. (Just make sure you switch the allocator before running other code.)

Re tracking down the PR-s:
It should be between 724-801 now. Try pointing to the middle (binary search FTW).

@antonfirsov
Copy link
Member

A search tree that might be useful:

            #727 
        #729 
    #731 
            #742
        #744
#746 
            #747 
        #751
    #768
        #771
            #783

PR-s that are more to the left, should be checked first. PR-s which leave JpegEncoder unaffected (in theory) are not listed. You should be able to track down the breaking PR in <=4 further checks!

@qdraw
Copy link
Author

qdraw commented Apr 14, 2019

@antonfirsov thanks for the list, I will binary search the commits and update this comment

            #727 - ccfabf8fe7ccdb6c7cd8ca13b5fa153365f39ec2 - normal image
        #729
    #731
            #742 - 90c7153a6ebd8e4c8d0c24a0837d1f7aa7c340c2 - normal image
        #744     - 15415ef3c4bb6f34856eba961fd28c438ba58db5 - pink image 2018-10-24 <==== focus 
#746             - cd68f80e6c23825ebed252d32895e6cfd9743edb - pink image 2018-10-24 
            #747 - 47037b4fb1a578d4e4171d4cfafc7dbf46459b7b - pink image
        #751
    #768
        #771
            #783

@qdraw
Copy link
Author

qdraw commented Apr 14, 2019

@antonfirsov
Q1: what is the value of Vector.IsHardwareAccelerated on your device?

Vector.IsHardwareAccelerated ->
False

Q2: [EDITED] what if you undefine SUPPORTS_EXTENDED_INTRINSICS in ImageSharp.csproj?
I can't find this value. How does this work?

@antonfirsov
Copy link
Member

@qdraw open ImageSharp.csproj with a text editor (or in VS: right click -> edit csproj), and delete this PropertyGroup.

@qdraw
Copy link
Author

qdraw commented Apr 14, 2019

@antonfirsov Ah I see f52be32#diff-e8ae3d9cc22f149b899610bb6fe4a5cb, lets get back to the latest master. This created the same pink image

@qdraw
Copy link
Author

qdraw commented Apr 14, 2019

now our focus is on #744
commit: 0dedf86b0b403c2da244b40993ae749f9d36b297 is [PINK]
commit: d4be172dcc44f19136e286cce5b855985a58ffba [PINK]
commit: 45c5e87fa4f3314cdd6583bb62105fc393907d7f [PINK]
commit: c0aa91d232862852f60d0dfe47ab8a3a5a1a5218 - build failing
commit: ee1ad0c01e75756a156348ed3d099422fd319e59 is [PINK]
commit: 6289a87e6d0ad5e4d1fda4385ea7fc722d1d56cb [PINK]
commit: 6f5ebbbd6f233486ed6fb600121aba5319ccf7c5 is [OK]
commit: d65cf676fafccd1285ba42bb05fba4750976e3d0 is [PINK]
commit: 0abb99b884700bd892f7a56a7ae722b58e2e52af is [OK]
commit: c23dbcd33088bf3054eee8dc1869d42f1a79aae5 is [PINK]
commit 891a1c57f855c4630b7724735b71d2819704e922 is [OK]
commit: b14c35ffafe2f762f0ee19cbca34982d638ed039 is [PINK]

@qdraw
Copy link
Author

qdraw commented Apr 14, 2019

The combination when loading Rgb24 images with has been changed in: b14c35ffafe2f762f0ee19cbca34982d638ed039 I have tested this on the latest master build (2019-04-14)

The client
using (var image = Image.Load<Rgb24>(inputStream))

The change reverted

        public Rgb24 Rgb
        {
            // If this is changed to ShortMethod then several jpeg encoding tests fail
            // on 32 bit Net 4.6.2 and NET 4.7.1
            [MethodImpl(InliningOptions.ShortMethod)]
            get => Unsafe.As<Rgba32, Rgb24>(ref this);

            [MethodImpl(InliningOptions.ShortMethod)]
            set => Unsafe.As<Rgba32, Rgb24>(ref this) = value;
        }

However this is not working on with the default client parameter
using (var inputStream = ReadStream(inputPath)) -> Pink image
and the comments are describing issues with .NET Framework and x86-Windows

@brianpopow
Copy link
Collaborator

brianpopow commented May 24, 2019

As mentioned in gitter, i was able to reproduce this issue with docker. I have create a branch in my fork, so others can reproduce that too: Issue871

This adds an additional Project ImageSharp.DockerSandbox which will load and save the images from #871 and #914. To execute this with docker just use following commands in the root directory of ImageSharp:

docker-compose build
docker-compose up

This will execute the ImageSharp.DockerSandbox project inside docker with a arm32 runtime image.
The output images will be in docker_output folder.

Changing the Rgb24 property in Rgba32.cs seems to fix this issue:

public Rgb24 Rgb
{
	get => new Rgb24(this.R, this.G, this.B);

	set
	{
		this.R = value.R;
		this.G = value.G;
		this.B = value.B;
	}
}

brianpopow added a commit to brianpopow/ImageSharp that referenced this issue May 24, 2019
@brianpopow
Copy link
Collaborator

brianpopow commented May 24, 2019

@qdraw it seems you are able to run tests on a real device. Would it be possible for you to run my changes from pull/915 on real hardware? It would be great to verify, that this change indeed fixes the issue.

@dlemstra
Copy link
Member

I wonder if this can also be reproduced in a super small sample so we can report this as a bug upstream.

JimBobSquarePants pushed a commit that referenced this issue May 25, 2019
@JimBobSquarePants
Copy link
Member

Would be wise to do it, raising an issue at least would make them aware.

@dontspeak
Copy link

dontspeak commented May 25, 2019

Nice that there is progress with this issue. I tried to debug into the issue on my rasperry, but as of now I did not got it managed to create a valid linux-arm compile with visual studio using the ImageSharp source code.

Is this issue completely fixed or do we only have a workaround? If the root cause really only was the RGB24 Contructur, why then we not have these issues all over ImageSharp, but only when encoding JPEGs.

Is there still testing needed? I can support.

@JimBobSquarePants
Copy link
Member

It should be absolutely fixed.

It's not the Rgb24 constructor that is the issue at all but rather how the jitter on Linux ARM handles the use of Unsafe.As on a non-inlined property when used in combination with bulk operations. It only affected the jpeg encoder because that was the only area in which we call Rgba32 to Rgb24 in that manner.

Is there still testing needed? I can support.

If you could download the latest build from MyGet and test that we'd really appreciate it. 👍

@dontspeak
Copy link

MyGet Package works perfect now on my Raspberry. Thanks!

@JimBobSquarePants
Copy link
Member

Hooray!

JimBobSquarePants pushed a commit that referenced this issue Aug 25, 2019
* Nits - Benchmarks (#884)

* Update metadata names

* Use WithIterationCount

* Format Benchmark documents

* Update copyright assignment to Six Labors & Contributors

* Update deps

* React to Benchmark library update

* ResizeWindowOld

* ResizeWindow refactor 1

* ResizeWindow refactor 2

* ResizeWindow refactor 3

* ResizeWindow refactor 4

* basic sliding window implementation (semi-stable state)

* fix ResizeWithCropHeightMode

* reference output for Resize_BasicSmall

* minor optimization

* Handle incorrect colorspace metadata. Fix #882 (#885)

* refactor
- ResizeWindow -> ResizeWorker
- Most logic moved to ResizeWorker

* refactor stuff + implement CalculateResizeWorkerWindowCount()

* utilize CalculateResizeWorkerHeightInWindowBands()
which has been renamed from CalculateResizeWorkerWindowCount()

* improve benchmark: ArrayCopy -> CopyBuffers

* moar RowInterval stuff

* buffer.CopyColumns(...)

* simplify ResizeWorker logic

* WorkingBufferSizeHintInBytes_IsAppliedCorrectly

* more robust tests

* ResizeTests.LargeImage

* optimized sliding works!

* reapply unsafe optimizations

* moar unsafe optimization

* benchmark WorkingBufferSizeHint effects

* memory profiling with Sandbox46

* add ResizeWorker.pptx

* refine ResizeWorker.pptx

* xmldoc for ResizeWorker

* update ResizeWorker.pptx [skip CI]

* fix tests

* fix license text in CopyBuffers benchmark

* update travis.yml

* I'm terrible copy-paster

* extend the CopyBuffers benchmark

* use HashCode.Combine()

* Pass correct output size in ResizeMode.Min #892 (#893)

* Cleanup General Convolution (#887)

* Remove multiple premultiplication.

* Use in DenseMatrix everywhere.

* Make private

* Dont convert vector row on first pass

* Remove incorrectly assigned alpha.

* Remove boxing.

* Use correct min row.

* Reorder parameters

* Correctly handle alpha component.

* Update tests

* Use dedicated methods over branching.

* Faster Jpeg Huffman Decoding. (#894)

* Read from underlying stream less often

* Update benchmark dependencies

* Experimental mango port

Currently broken

* Populate table, 64byte buffer

Still broken.

* Baseline, non RST works

* 15/19 baseline tests pass now.

* Optimize position change.

* 18/19 pass

* 19/19 baseline decoded

* Can now decode all images.

* Now faster and much cleaner.

* Cleanup

* Fix reader, update benchmarks

* Update dependencies

* Remove unused method

* No need to clean initial buffer

* Remove bounds check on ReadByte()

* Refactor from feedback

* Feature: adaptive histogram equalization (#673)

* first version of sliding window adaptive histogram equalization

* going now from top to bottom of the image, added more comments

* using memory allocator to create the histogram and the cdf

* mirroring rows which exceeds the borders

* mirroring also left and right borders

* gridsize and cliplimit are now parameters of the constructor

* using Parallel.For

* only applying clipping once, effect applying it multiple times is neglectable

* added abstract base class for histogram equalization, added option to enable / disable clipping

* small improvements

* clipLimit now in percent of the total number of pixels in the grid

* optimization: only calculating the cdf until the maximum histogram index

* fix: using configuration from the parameter instead of the default

* removed unnecessary loops in CalculateCdf, fixed typo in method name AddPixelsToHistogram

* added different approach for ahe: image is split up in tiles, cdf is computed for each tile. Grey value will be determined by interpolating between 4 tiles

* simplified interpolation between the tiles

* number of tiles is now fixed and depended on the width and height of the image

* moved calculating LUT's into separate method

* number of tiles is now part of the options and will be used with the sliding window approach also, so both methods are comparable

* removed no longer valid xml comment

* attempt fixing the borders

* refactoring to improve readability

* linear interpolation in the border tiles

* refactored processing the borders into separate methods

* fixing corner tiles

* fixed build errors

* fixing mistake during merge from upstream: setting test images to "update Resize reference output because of improved ResizeKernelMap calculations"

* using Parallel.ForEach for all inner tile calculations

* using Parallel.ForEach to calculate the lookup tables

* re-using pre allocated pixel row in GetPixelRow

* fixed issue with the border tiles, when tile width != tile height

* changed default value for ClipHistogram to false again

* alpha channel from the original image is now preserved

* added unit tests for adaptive histogram equalization

* Update External

* 2x faster adaptive tiled processor

* Remove double indexing and bounds checks

* Begin optimizing the global histogram

* Parallelize GlobalHistogramEqualizationProcessor

* Moving sliding window from left to right instead of from top to bottom

* The tile width and height is again depended on the image width: image.Width / Tiles

* Removed keeping track of the maximum histogram position

* Updated reference image for sliding window AHE for moving the sliding window from left to right

* Removed unnecessary call to Span.Clear(), all values are overwritten anyway

* Revert "Moving sliding window from left to right instead of from top to bottom"

This reverts commit 8f19e5e.

# Conflicts:
#	src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistEqualizationSWProcessor.cs

* Split GetPixelRow in two version: one which mirrors the edges (only needed in the borders of the images) and one which does not

* Refactoring and cleanup sliding window processor

* Added an upper limit of 100 tiles

* Performance tweaks

* Update External

* ImageBrush shouldn't Dispose of the image it is using. (#883)

Fixes #881

* Now throws a better excpetion DrawImage source does not overlap target (#877)

* No longer throws when DrawImage source does not overlap target

Previously, when DrawImage was used to overlay an image, in cases where the source image did not overlap the target image, a very confusing error was reported: "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: MaxDegreeOfParallelism"

Now, when this case happens, the DrawImage method will simply not affect the target image, which is the same way FillRegionProcessor handles such cases.

ParallelHelper.IterRows also now does more validation of the input rectangle so that any further cases of this kind of problem throw a more relvant exception. Note I switched from DebugGuard to Guard because IterRows is a public API and thus should always validate its inputs.

Fixes #875

* Refines DrawImage non-overlap error logic

Adresses PR feedback in #877.

Changes DrawImage shortcut to be less than or equal to. Also changes maxX calculation to use `Right` over `Width`. This is a semantic change that reflects intention better. No actual change because Top,Left for that rectanngle should always be 0,0.

And adds more informative argument names to ParallelHelper.IterRows error message.

* Non-overlapping DrawImage now throws

Adressing PR feedback from #877

DrawImage now throws when the source image does not overlap, with a useful error message.

Also improved the error messages for IterRows (and added validation to the other IterRows method)

* DrawImage overlap test changed to support RELEASE

The tests on the CI server are run in RELEASE which wrap the expected exception with an ImageProcessingException.

* Adress feedback for DrawImage exception

DrawImage throws an ImageProcessor exception which makes it easier to catch.

And reverted IterRows to use Guard helpers

* Bitmap encoder writes V3 header as default (#889)

* Bitmap encoder will now write a V3 header as default.

Introduces a new encoder option `SupportTransparency`: With this option a V4 header will be written with BITFIELDS compression.

* Add 4 and 16 bit images to the Identify test

* Add some useful links for bitmap documentation

* Add 32 bpp images to the Identify test

* Added further information on what will change for the encoder, if SupportTransparency is used.

* Add support for encoding 16 bit per pixel bitmaps (#899)

* Implemented encoding of 16 bits per pixel bitmaps

* Add unit tests for 16 bit encoding and Bgra5551 conversion

* Add additional Bgra5551 pixel conversion tests

* Add Bgra5551 tests for Short2/4 and HalfVector2/4

* Use scaled vector conversion

* define IImageVisitor

* pixel agnostic Mutate/Clone defined

* pixel-agnostic ResizeProcessor

* pixel-agnostic decoder API

* refactor FilterProcessor stuff

* basic fixes after rebase + temporarily comment out target frameworks

* refactor the rest of the FilterProcessor code

* reached a fully compiling state

* fix processor invocation tests

* re-add and fix filter invocation tests

* fix warnings and improve xmldocs

* *ProcessorImplementation<T> ===> *Processor<T>,

add suppression of SA1413 to AssemblyInfo.cs

* validating tests for Convolution processors

* validating tests for Convolution processors

* mark FileTestBase obsolete

* improve DitherTests CQ

* extended diffusion + dither tests

* Add additional pixel conversion tests

* validating tests for Effects

* validating tests for AutoOrient

* validating tests for Skew and Entropy crop

* validating tests for Overlay processors

* Add more pixel conversion tests

* skip DitherTests on old 32 bit runtimes

* refactor BoxBlur and GaussianBlur

* making filters public

* Further refactor on Gaussian stuff

* drop IEdgeDetectorProcessor

* Refactor edge detection

* refactor Effects processors

* Finished refactoring transforms

* sealed everything

* refactor HistogramEqualization

* cache Image dimensions into a field + re-enable all target frameworks

* fix Image.FromStream() + add tests

* full coverage for Image.Load (I hope)

* fix changes applied by mistake

* Fix docs for processing extensions

* publish non-generic QuantizeProcessor

* temporarily disable multitargeting

* add skeleton for Color type

* add more Rgba64 constructor overloads

* basic Color methods

* Pixel-agnostic Binarization processors

* Implement WernerPalette and WebSafePalette for Color

* refactor dithering and error diffusion to use Color

* Add support for encoding 8-bit bitmaps

* Changed WuQuantizer to OctreeQuantizer

* Update Readme (#905)

A few minor grammatical corrections.

* Trying MagickReferenceDecoder for the 8bit greyscale image encoder tests

* Setting dither to false in the OctreeQuantizer

* verbose naming for Histogram Equalization stuff + make it public

* formatting

* refactor of Overlays

* made AutoOrientExtensions non-generic

* cleanup and document Color

* cleanup

* Switched back to the default reference decoder

* Made PaletteQuantizer non-generic all the way

* QuantizedFrame<T> using ReadOnlyMemory<T>

* Correct readonly-semantics for QuantizedFrame

* introduce IQuantizedFrame<T>

* move all extension methods under a subfolder

(non-namespace providing)

* re-enable all target frameworks

* Using tolerant comparer for the Bit8Gs image

* More docs for Color, correct naming in ColorBuilder<TPixel>

* temporarily disable target frameworks

* Enabled dither again

* validating tests for: DrawPath, FillComplexPolygon

* validation in DrawImageTest

* RecolorImageTests

* FillPolygonTests

* DrawPolygonTests, DrawLinesTests

* DrawBeziersTests, DrawComplexPolygonTests

* move implicit Color conversion to pixel types,

add micro-optimizations

* fix merge issues

* DrawImageTests: add tolerance to make all test configurations happy

* Review changes

* started the refactor

* Pen, Brush & Processors refactored

* ImageSharp.Drawing compiles

* everything builds

* tests are passing

* fix new 8bit bmp code

* move drawing extensions to a (non-namespace-provider) subfolder

* rename files

* ImageBrush can apply a source image of a different pixel type than the target

* non-generic DrawImageProcessor

* DrawImageOfDifferentPixelType test cases

* clean-up drawing processors

* fix remaining stylecop issues

* Rgba32.Definitions: use Color instead of NamedColors<T>

* Remove NamedColors<T> usages

* Not using quantization for Grey8 images when encoding 8Bit Bitmaps

* Refactor Write8Bit into two methods: one for gray and one for color

* drop unnecessary generic IImageProcessorContext<TPixel> usages

* drop almost all usages of FileTestBase

* fix tests

* re-enable target frameworks

* Add tests for quantization of 32 bit bitmap to 8 bit color image

* Renamed DrawImageTest to DrawImageTests, fixed namespace

* Using tolerant comparer for the Encode_8BitColor tests

* Removed the Encode_8BitColor, because of the quantization differences with net472 and netcore

* Re-enabled Encode_8BitColor tests, if its 64 bit process

* Using MemoryMarshal.AsBytes in Write8BitGray to get the bytes of a row

* Fix merge mistake: Using DrawImageTests from current master branch

* API cleanup (related to #907) (#911)

* temporarily disable target frameworks

* drop DelegateProcessor

* drop IImageProcessingContext<TPixel>

* drop NamedColors<T>

* drop ColorBuilder<T>

* drop the *Base postfix for clean class hierarchies

* re-enable target frameworks

* use MathF in gradient brushes

* Move PngFilterMethod to the correct namespace.

* Fix for Issue #871 and #914 (#915)

* Fix #466 (#916)

* Added funding file with a link to open collective.

* Removes usage of linq in several critical paths (#918)

* Remove linq usage from jpeg + formatting

* png

* ICC + formattiing

* Resize

* Fix base class comparison.

* Updating the repo to use Directory.Build.props/targets files (#920)

* Updating the repo to use Directory.Build.props/targets files

* Adding an InternalsVisibleTo for DynamicProxyGenAssembly2, PublicKeyToken=null

* Removing duplicate includes from the ImageSharp.csproj

* Updating the .gitattributes file to explicitly list the line endings

* Removing the ImageSharp.ruleset file, as the one from standards should be used instead

* Updating the package version management to use `PackageReference Update`

* Fix build/test (#923)

* Prevent zigzag overflow. Fix #922

* Add test image and use constants

* Improve robustness of huffman decoder.

* Fix missing "using PixelFormats" line in Readme example (#921)

* Fix missing PixelFormats line in first API example

"<Rgba32>" does not appear to be defined without the "using SixLabors.ImageSharp.PixelFormats;" line and causes a "The type or namespace name 'Rgba32' could not be found (are you missing a using directive or an assembly reference?) (CS0246)" error to occur.

* Remove stray newline

* Feature: Bitmap RLE undefined pixel handling (#927)

* Add bitmap decoder option, how to treat skipped pixels for RLE

* Refactored bitmap tests into smaller tests, instead of just one test which goes through all bitmap files

* Add another adobe v3 header bitmap testcase

* Using the constant from BmpConstants to Identify bitmaps

* Bitmap decoder now can handle oversized palette's

* Add test for invalid palette size

* Renamed RleUndefinedPixelHandling to RleSkippedPixelHandling

* Explicitly using SystemDrawingReferenceDecoder in some BitmapDecoder tests

* Add test cases for unsupported bitmaps

* Comparing RLE test images to reference decoder only on windows

* Add test case for decoding winv4 fast path

* Add another 8 Bit RLE test with magick reference decoder

* Optimize RLE skipped pixel handling

* Refactor RLE decoding to eliminate code duplication

* Using MagickReferenceDecoder for the 8-Bit RLE test

* Fix 925 (#929)

* Prevent overflow

* Cleanup huffman table

* Search for RST markers.

* Fix Benchmarks project

* Bitmap decoder now can decode bitmap arrays (#930)

* Bitmap Decoder can now decode BitmapArray

* Add tests for bitmap metadata decoing. Fix an issue that a bitmap with a v5 header would be set in the metadata as an v4 header.

* Fixed issue with decoding bitmap arrays: color map size was not determined correctly. Added more test images.

* Refactor colormap size duplicate declaration.

* Fixed an issue, that when an unsupported bitmap is loaded the typ marker was not correctly shown in the error message

* Throw UnkownFormatException on Image.Load  (#932)

* Throw ImageFormatException on load

* Unseal class and make constructor internal
- This is so that no one can new it up / inherit it outside of the assembly

* Add new exception for distinguish between different exception
- This will be used on image.load operations with invalid image streams

* ImageFormatException -> UnkownImageFormatException

* Add Image.Load throws exception tests

* Fix #937 (#938)

* Add support for decoding RLE24 Bitmaps (#939)

* Add support for decoding RLE24

* Simplified determining colorMapSize, OS/2 always has 3 bytes for each palette entry

* Enum value for RLE24 is remapped to a different value, to be clearly separate from valid windows values.

* Introduce non-generic ImageFrameCollection (#941)

* temporarily disable target frameworks

* drop DelegateProcessor

* drop IImageProcessingContext<TPixel>

* drop NamedColors<T>

* drop ColorBuilder<T>

* drop the *Base postfix for clean class hierarchies

* adding basic skeletons

* non-generic ImageFrameCollection API definition

* non-generic ImageFrameCollection tests

* cleanup + docs + more tests

* implement ImageFrameCollection methods

* tests for generic PixelOperations.To<TDest>()

* experimental implementation

* fix .ttinclude

* generate generic From<TSourcePixel>(...)

* fix RgbaVector <--> BT709 Gray pixel conversion

* Gray8 and Gray16 using ConvertFromRgbaScaledVector4() by default

* fixed all conversion tests

* ConstructGif_FromDifferentPixelTypes

* fix xmldoc and other StyelCop findings

* re-enable all target frameworks

* fix NonGenericAddFrame() and NonGenericInsertFrame()

* fix remaining bugs

* #946: AoT compiler fixes and hid Seed methods

* #946: fixed StyleCop errors

* Master cleanup (#952)

* Fix gitignore and line endings

* Update README.md

* Bokeh blur implementation (#842)

* Added base BokehBlurProcessor class, and kernel parameters

* Added method to calculate the kernel parameters

* Switched to float, added method to create the 1D kernels

* Added complex kernels normalization

* Added BokehBlurExtensions class

* Added the Complex64 struct type

* Switched to Complex64 in the BokehBlurProcessor

* Added caching system for the bokeh processor parameters

* Added WeightedSum method to the Complex64 type

* Added IEquatable<T> interface to the Complex64 type

* New complex types added

* Added method to reshape a DenseMatrix<T> with no copies

* Added bokeh convolution first pass (WIP)

* Added second bokeh convolution pass (WIP)

* Added image sum pass to the bokeh processor (WIP)

* Minor bug fixes (WIP)

* Switched to Vector4 processing in the bokeh computation

* Minor tweaks

* Added Unit test for the bokeh kernel components

* Minor performance improvements

* Minor code refactoring, added gamma parameter (WIP)

* Removed unused temp buffers in the bokeh processing

* Gamma highlight processing implemented

* Speed optimizations, fixed partials computations in target rectangle

* Increased epsilon value in the unit tests

* Fixed for alpha transparency blur

* Fixed a bug when only blurring a target rectangle

* Added bokeh blur image tests (WIP)

* Added IXunitSerializable interface to the test info class

* culture independent parsing in BokehBlurTest.cs

* Performance optimizations in the bokeh processor

* Reduced number of memory allocations, fixed bug with multiple components

* Initialization and other speed improvements

* More initialization speed improvements

* Replaced LINQ with manual loop

* Added BokehBlur overload to just specify the target bounds

* Speed optimizations to the bokeh 1D convolutions

* More speed optimizations to the bokeh processor

* Fixed code style and Complex64.ToString method

* Fixed processing buffer initialization

* Minor performance improvements

* FIxed issue when applying bokeh blur to specific bounds

* Minor speed optimizaations

* Minor code refactoring

* Fixed convolution upper bound in second 1D pass

* improve BokehBlurTest coverage

* use Gray8 instead of Alpha8

* Adjusted guard position in bokeh processor constructor

* Added BokehBlurParameters struct

* Added BokehBlurKernelData struct

* Minor code refactoring

* Fixed API change build errors

* Bug fixes with the pixel premultiplication steps

* Removed unwanted unpremultiplication pass

* Removed unused using directives

* Fixed missing using directives in conditional branches

* Update from latest upstream master

* Update Block8x8F.Generated.cs

* Update GenericBlock8x8.Generated.cs

* Manual checking for files with LF (see gitter)

* Removed unused using directive

* Added IEquatable<ComplexVector4> interface

* Added IEquatable<BokehBlurParameters> interface

* Moved bokeh blur parameters types

* Added reference to original source code

* Complex convolution methods moved to another class

* Switched to MathF in the bokeh blur processor

* Switched to Vector4.Clamp

* Added Buffer2D<T>.Slice API

* Added BokehBlurExecutionMode enum

* Added new bokeh blur processor constructors

* Added new bokeh blur extension overloads with execution mode

* Code refactoring in preparation for the execution mode switch

* Implemented execution mode switch in the bokeh processor

* Moved BokehBlurExecutionMode struct

* Removed unused using directives

* Minor code refactoring

* More minor code refactoring

* Update External

* Fix undisposed buffers

* Bokeh blur processor cache switched to concurrent dictionary

* Minor code refactoring

* remove duplicate props from csproj

* Add support for read and write tEXt, iTXt and zTXt chunks (#951)

* Add support for writing tEXt chunks

* Add support for reading zTXt chunks

* Add check, if keyword is valid

* Add support for reading iTXt chunks

* Add support for writing iTXt chunks

* Remove Test Decode_TextEncodingSetToUnicode_TextIsReadWithCorrectEncoding: Assertion is wrong, the correct keyword name is "Software"

* Add support for writing zTXt chunk

* Add an encoder Option to enable compression when the string is larger than a given threshold

* Moved uncompressing text into separate method

* Remove textEncoding option from png decoder options: the encoding is determined by the specification: https://www.w3.org/TR/PNG/#11zTXt

* Removed invalid compressed zTXt chunk from test image

* Revert accidentally committed changes to Sandbox Program.cs

* Review adjustments

* Using 1024 bytes as a limit when to compress text as recommended by the spec

* Fix inconsistent line endings

* Trim leading and trailing whitespace on png keywords

* Move some metadata related tests into GifMetaDataTests.cs

* Add test case for gif with large text

* Gif text metadata is now a list of strings

* Encoder writes each comment as a separate block

* Adjustment of the Tests to the recent changes

* Move comments to GifMetadata

* Move Png TextData to format PngMetaData

* #244 Add support for interlaced PNG encoding (#955)

* #244 Implement interlaced PNG encoding

* #244 Update documentations

* #244 Remove comment

* Cleanup

* Update PngEncoderCore.cs

* fix some spelling (#957)

* fix some spelling

* more typos

* more typos

* more typos

* more typos

* more typos

* linearSegment

* fix "as" usage (#959)

* redundant usings (#960)

* use params where possible (#961)

* use params where possible

* use params

* fix some spelling (#962)

*  Add test illustrating issue

* Add test from issue #928

* Add possible fix

* remove unused variables and methods (#963)

* remove unused variables and methods

* remove some redundant variables

* remove some redundant variables

* redundant variables

* Update DrawTextOnImageTests.cs

* Minor optimizations

* cleanup

* Cleanup (#965)

* redundant ()

* redundant stirng interpolation

* use method groups

* redundant unsafe

* redundant qualifiers

* redundant ()

* redundant init

* redundant init

* redundant casts

* redundant casts

* Throw ObjectDisposedException when trying to operate on a disposed image (#968)

* disable multitargeting + TreatWarningsAsErrors to for fast development

* Check if image is disposed

in significant Image and Image<T> methods

* Mutate / Clone: ensure image is not disposed

* Revert "disable multitargeting + TreatWarningsAsErrors to for fast development"

This reverts commit 9ad74f7.

* remove some redundant variables and type params (#971)

* remove redundant variable init

* redundant variables

* remove redundant tileY variable

* remove redundant sum variable

* redundant mcu variable

* redundant type params

* Revert "remove redundant sum variable"

This reverts commit 21de86c.

* redundant comment

* remove redundant ParallelOptions

* aviod multiple array lookup

*  use var where apparent  (#972)

* use var where apparent

* use var where apparent

* should use Rgb24

* cache max in ConvertToRgba

* cache max value

* remove some redundant usings (#976)

* remove SteppedRange (#980)

* Implement decoder tests for debugging tests and add deflate bug output file

* Add TiffConfigurationModule to core Configuration. Implement simple unit-tests for Tiff decoder.

* Add benchmarks for big and medium tiff files

* Move Tiff classes to Formats.Tiff namespace

* Mark Tiff format tests with "Tiff" category, cleanup test classes

* Improve performance of Tiff decoders

* remove some redundant constructor overloads from exceptions (#979)

* remove some redundant constructor overloads from exceptions

* re add ImageProcessingException ctor

only used in release

* Fix of build error, cleanup.
Correct Metadata updated name (for Resolution properties), temporary disable tiff native metadata properties.

* Implement temporary tiff native metadata structures

* Mark missed tiff tests, exclude DecodeManual test

* Update test images submodule

* Explanations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants