Skip to content

Commit

Permalink
Merge pull request #6 from radarhere/bc6h_gamma
Browse files Browse the repository at this point in the history
Removed gamma correction
  • Loading branch information
ShadelessFox committed Oct 10, 2022
2 parents 93cafc8 + 78d258f commit 00d59a9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
Binary file modified Tests/images/bc6h.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Tests/images/bc6h_sf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 3 additions & 8 deletions src/libImaging/BcnDecode.c
Expand Up @@ -688,21 +688,16 @@ bc6_clamp(float value) {
}
}

static float
bc6_gamma_correct(float value, float gamma) {
return powf(1.0f - expf(-value), 1.0f / gamma);
}

static void
bc6_lerp(rgba *col, int *e0, int *e1, int s, int sign) {
int r, g, b;
int t = 64 - s;
r = (e0[0] * t + e1[0] * s) >> 6;
g = (e0[1] * t + e1[1] * s) >> 6;
b = (e0[2] * t + e1[2] * s) >> 6;
col->r = bc6_clamp(bc6_gamma_correct(bc6_finalize(r, sign), 2.2f));
col->g = bc6_clamp(bc6_gamma_correct(bc6_finalize(g, sign), 2.2f));
col->b = bc6_clamp(bc6_gamma_correct(bc6_finalize(b, sign), 2.2f));
col->r = bc6_clamp(bc6_finalize(r, sign));
col->g = bc6_clamp(bc6_finalize(g, sign));
col->b = bc6_clamp(bc6_finalize(b, sign));
}

static void
Expand Down

0 comments on commit 00d59a9

Please sign in to comment.