Improvements to Apple CgBI PNG handling#3137
Conversation
|
Curious to hear your thoughts. The changes should all be relatively self-contained per commit in case there are sections that you don't think should be included. |
|
This looks like a lot of changes. Will take time to review |
|
Understood. As I mentioned in the description, each commit is fairly self contained but I could also break up the PR into a couple of smaller units if that would be helpful? |
| [InlineData(32)] | ||
| [InlineData(33)] | ||
| [InlineData(64)] | ||
| public void ApplyTransformVector512_MatchesScalar(int pixelCount) => |
There was a problem hiding this comment.
We have FeatureTestRunner that we use for this kind of stuff, so we are not running tests unnecessarily
| }; | ||
|
|
||
| // CgBI premultiplied BGRA: c' = c * a / 255 | ||
| byte r = (byte)((p * 13) & 0xFF); |
There was a problem hiding this comment.
This is screaming AI to me. random numbers with no explanation.
| [MemberNotNullWhen(true, nameof(CompressedStream))] | ||
| private bool InitializeInflateStream(bool isCriticalChunk) | ||
| { | ||
| // Apple CgBI IDATs omit the zlib CMF/FLG header and the Adler-32 trailer, |
There was a problem hiding this comment.
Why do we no longer return early?
| /// Adler-32 trailer is not validated. | ||
| /// </summary> | ||
| internal sealed class ZlibInflateStream : Stream | ||
| internal sealed class ZlibInflateStream : IDisposable |
There was a problem hiding this comment.
I'm not sure I'm comfortable with a type suffixed Stream that is no longer inherits Stream. This feels like we're violating runtime design guidelines.
|
Prerequisites
Description
Following on from #3136 , this attempts to streamline and improve the related code as well as improve test coverage.