Skip to content

Conversation

brianpopow
Copy link
Collaborator

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

This PR adds support for decoding Tiff images with UnassociatedAlphaData. This is the first step in supporting decoding tiff images with ExtraSamples.

/cc @IldarKhayrutdinov

var color = default(TPixel);
color.FromVector4(TiffUtils.Vector4Default);
int offset = 0;
byte[] buffer = new byte[4];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this allocation be avoided?
I.e. turn it into stackalloc and use it as Span<byte>. Maybe TiffUtils need to be updated also.

var color = default(TPixel);
color.FromVector4(TiffUtils.Vector4Default);
int offset = 0;
byte[] buffer = new byte[4];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@brianpopow brianpopow requested a review from a team March 7, 2022 18:46
{
data.Slice(offset, 4).CopyTo(buffer);
Array.Reverse(buffer);
float r = BitConverter.ToSingle(buffer, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll be nice when we can use BinaryPrimitives.ReadSingleBigEndian here.

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice job, very neat. Thanks!

@JimBobSquarePants JimBobSquarePants merged commit 8b2ebc5 into main Mar 8, 2022
@JimBobSquarePants JimBobSquarePants deleted the bp/extrasamples branch March 8, 2022 02:17
@IldarKhayrutdinov
Copy link
Contributor

sorry, I'm completely lost
great work @brianpopow

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

Successfully merging this pull request may close these issues.

4 participants