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

BMP: fix reading 16bpp images (#2808) #3592

Merged
merged 1 commit into from
Oct 8, 2022
Merged

BMP: fix reading 16bpp images (#2808) #3592

merged 1 commit into from
Oct 8, 2022

Conversation

aras-p
Copy link
Contributor

@aras-p aras-p commented Oct 7, 2022

Description

16 bit per pixel (e.g. 555, 565, 444) formats probably have never worked. One part of the code was assuming 5 bits in the mask, another was shifting by 4 bits, and the 16-bit pixel fetch code was reading just one byte. Fixes #2808.

Tests

The test suited added back in #2976 already had a TODO: seems broken: g16bf555.bmp, g16bf565.bmp, g16def555.bmp comment, which is exactly 16 bpp test cases. So I've uncommented them here, and made them work.

Also removed one g32bf.bmp from the tests lists; it was listed there twice (looked more like a copy-paste accident than on purpose).

Checklist:

  • I have read the contribution guidelines.
  • If this is more extensive than a small change to existing code, I
    have previously submitted a Contributor License Agreement
    (individual, and if there is any way my
    employers might think my programming belongs to them, then also
    corporate).
  • I have updated the documentation, if applicable.
  • I have ensured that the change is tested somewhere in the testsuite
    (adding new test cases if necessary).
  • My code follows the prevailing code style of this project.

16 bit per pixel (e.g. 555, 565, 444) formats probably have never
worked. One part of the code was assuming 5 bits in the mask, another
was shifting by 4 bits, and the 16-bit pixel fetch code was reading just
one byte.
@aras-p aras-p marked this pull request as ready for review October 7, 2022 20:09
Copy link
Collaborator

@lgritz lgritz left a comment

Choose a reason for hiding this comment

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

LGTM

@lgritz lgritz merged commit afaaf6d into AcademySoftwareFoundation:master Oct 8, 2022
lgritz pushed a commit to lgritz/OpenImageIO that referenced this pull request Oct 8, 2022
…mySoftwareFoundation#3592)

16 bit per pixel (e.g. 555, 565, 444) formats probably have never
worked. One part of the code was assuming 5 bits in the mask, another
was shifting by 4 bits, and the 16-bit pixel fetch code was reading just
one byte.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] 565 bmp doesn't import correctly
2 participants