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

Fix ImageBuf::read bug for images of mixed per-channel data types #3088

Merged

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Sep 2, 2021

When it comes time to read_image() into the ImageBuf's internal
memory, we should have said to convert to m_spec.format, which
describes the buffer we allocated. Instead, we asked for convert,
which is the user request, which at that time can still be UNKNOWN,
which indicates to preserve the file's data format, which in fact does
not necessarily match the internal buffer.

This becomes especially troublesome for images with mixed per-channel
data types, which will obviously never match the internal buffer since
ImageBuf only internally stores one data format for all channels.

Fixes #2691

When it comes time to read_image() into the ImageBuf's internal
memory, we should have said to convert to `m_spec.format`, which
describes the buffer we allocated. Instead, we asked for `convert`,
which is the user request, which at that time can still be UNKNOWN,
which indicates to preserve the file's data format, which in fact does
not necessarily match the internal buffer.

This becomes especially troublesome for images with mixed per-channel
data types, which will obviously never match the internal buffer since
ImageBuf only internally stores one data format for all channels.
@lgritz lgritz merged commit 9dc2f97 into AcademySoftwareFoundation:master Sep 15, 2021
@lgritz lgritz deleted the lg-broken-make_writable branch September 15, 2021 17:26
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Sep 15, 2021
…ademySoftwareFoundation#3088)

When it comes time to read_image() into the ImageBuf's internal
memory, we should have said to convert to `m_spec.format`, which
describes the buffer we allocated. Instead, we asked for `convert`,
which is the user request, which at that time can still be UNKNOWN,
which indicates to preserve the file's data format, which in fact does
not necessarily match the internal buffer.

This becomes especially troublesome for images with mixed per-channel
data types, which will obviously never match the internal buffer since
ImageBuf only internally stores one data format for all channels.
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Feb 1, 2022
…ademySoftwareFoundation#3088)

When it comes time to read_image() into the ImageBuf's internal
memory, we should have said to convert to `m_spec.format`, which
describes the buffer we allocated. Instead, we asked for `convert`,
which is the user request, which at that time can still be UNKNOWN,
which indicates to preserve the file's data format, which in fact does
not necessarily match the internal buffer.

This becomes especially troublesome for images with mixed per-channel
data types, which will obviously never match the internal buffer since
ImageBuf only internally stores one data format for all channels.
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]Python ImageBuf.make_writeable() + write() causes bad values for image with mixed depth channels
1 participant