Skip to content

Conversation

@brianpopow
Copy link
Collaborator

@brianpopow brianpopow commented Aug 6, 2021

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 float pixel data.

  • Add support for decoding tiff's with 32bit float rgb pixel data
  • Add support for decoding tiff's with 32bit float gray pixel data with min is black
  • Add support for decoding tiff's with 32bit float gray pixel data with min is white

@codecov
Copy link

codecov bot commented Aug 6, 2021

Codecov Report

Merging #1727 (556fbf8) into master (25dadda) will increase coverage by 0.04%.
The diff coverage is 94.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1727      +/-   ##
==========================================
+ Coverage   84.38%   84.43%   +0.04%     
==========================================
  Files         830      833       +3     
  Lines       36288    36390     +102     
  Branches     4241     4257      +16     
==========================================
+ Hits        30621    30725     +104     
+ Misses       4850     4845       -5     
- Partials      817      820       +3     
Flag Coverage Δ
unittests 84.43% <94.64%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...icInterpretation/BlackIsZero32TiffColor{TPixel}.cs 100.00% <ø> (ø)
...icInterpretation/WhiteIsZero24TiffColor{TPixel}.cs 0.00% <0.00%> (ø)
...icInterpretation/WhiteIsZero32TiffColor{TPixel}.cs 68.75% <50.00%> (-31.25%) ⬇️
...mageSharp/Formats/Tiff/TiffDecoderOptionsParser.cs 66.66% <82.35%> (+3.03%) ⬆️
...erpretation/BlackIsZero32FloatTiffColor{TPixel}.cs 100.00% <100.00%> (ø)
...cInterpretation/RgbFloat323232TiffColor{TPixel}.cs 100.00% <100.00%> (ø)
...cInterpretation/TiffColorDecoderFactory{TPixel}.cs 79.41% <100.00%> (+1.99%) ⬆️
...erpretation/WhiteIsZero32FloatTiffColor{TPixel}.cs 100.00% <100.00%> (ø)
...ricInterpretation/WhiteIsZero8TiffColor{TPixel}.cs 100.00% <100.00%> (ø)
src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs 89.62% <100.00%> (+0.07%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25dadda...556fbf8. Read the comment docs.

@brianpopow brianpopow changed the title WIP: Add support for decoding tiff's with float pixel data Add support for decoding tiff's with float pixel data Aug 7, 2021
for (int x = 0; x < pixelRow.Length; x++)
{
data.Slice(offset, 4).CopyTo(buffer);
Array.Reverse(buffer);
Copy link
Member

Choose a reason for hiding this comment

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

Can we not use BinaryPrimitives.ReadSingleBigEndian here and elsewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ReadSingleBigEndian is only available with net5.0 and above

Copy link
Member

Choose a reason for hiding this comment

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

Didn't know that. Looking at the source we could only polyfill back to .NET Core 2.0 also. We'll leave it like this for now.

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.

Great stuff 👍

@brianpopow brianpopow merged commit a6c708f into master Aug 11, 2021
@brianpopow brianpopow deleted the bp/tiff32float branch August 11, 2021 07:34
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.

3 participants