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

Specialize integer implementation of YCoCg-R to use bitshifts #310

Merged
merged 2 commits into from
Feb 13, 2015

Conversation

Mokosha
Copy link

@Mokosha Mokosha commented Feb 13, 2015

It turns out that the current implementation of YCoCgR conversion is not reversible (f(g(x)) != x) for certain combinations of pixels, for example:

glm::ivec3 v(226, 124, 192);
// This fires, when it shouldn't if the implementations are reversible.
assert (v == YCoCgR2rgb(rgb2YCoCgR(v)));

I've added a patch that specializes the template instantiation for integer types to use bit shifts as outlined in Eqn (8) of this paper. This fixes the situation in the assert, yet leaves floating point implementations to work as they used to.

Groovounet added a commit that referenced this pull request Feb 13, 2015
Specialize integer implementation of YCoCg-R to use bitshifts #310
@Groovounet Groovounet merged commit c51422c into g-truc:master Feb 13, 2015
@Groovounet Groovounet added this to the GLM 0.9.7 milestone Feb 13, 2015
@Groovounet Groovounet self-assigned this Feb 13, 2015
@Groovounet
Copy link
Member

Thanks for contributing!
Christophe

Groovounet pushed a commit that referenced this pull request Feb 13, 2015
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.

2 participants