-
Notifications
You must be signed in to change notification settings - Fork 633
Add support for writing Gaussian forward and inverse transform lookup tables #3159
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
Add support for writing Gaussian forward and inverse transform lookup tables #3159
Conversation
src/libOpenImageIO/maketexture.cpp
Outdated
CDF.data()); | ||
} | ||
|
||
configspec.attribute("CDF_bits", TypeDesc("int"), &bits); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More compactly as
configspec.attribute("CDF_bits", bits);
(If bits is an int, it knows what to do.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, just FYI, for these simple cases there is yet another syntax (which may or may not be to your taste):
configspec["CDF_bits"] = bits;
a576b77
to
72b4502
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, thanks.
Were you planning at any point to add documentation or any tests? Or did you want me to try to do that after this gets merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a bunch of the CI tests are failing their builds, can you fix?
* fix signed/unsigned compares * replace min/max with clamp * reformat some comments to conform to 80 char margin conventions
I took the liberty of pushing fixes for the signed/unsigned comparison warnings, and a few minor formatting fixes. |
@olegul I merged this so that we can do builds this week that include it, but I think it needs a touch-up to actually document it (i.e., amend the comments for make_texture in imagebufalgo.h, where it explains all the controls it responds to). I can do this if you don't have the time. And ideally -- though perhaps on the OSL side -- we should publish a small example shader that shows how to use this information to do the thing it's designed for. |
Also, fixed the fact that direct calls to make_texture() were not given proper defaults for the cdfsigma and cdfbits options. Related to PR #3159
…ion#3206) Also, fixed the fact that direct calls to make_texture() were not given proper defaults for the cdfsigma and cdfbits options. Related to PR AcademySoftwareFoundation#3159
This patch is an attempt to implement the pre-processing parts from Brent Burley's Histogram-Preserving Blending paper. It generates two float array lookup tables - one for transforming each image channel to a Gaussian distribution (the invCDF float array) and one for transforming from the Gaussian distribution back to the image's distribution (the CDF array).
This will let whoever is consuming the image (like a shader) do the blending on Gaussian distributed data and transform the blended result back to the image distribution, preserving details better than a regular blend.