Further small speedup for vignette and gradient
This commit is contained in:
parent
2c7325b2fd
commit
db2c01af02
@ -444,7 +444,7 @@ static float calcGradientFactor(const struct grad_params& gp, int x, int y)
|
|||||||
val = 1.f - val;
|
val = 1.f - val;
|
||||||
}
|
}
|
||||||
|
|
||||||
val *= (M_PI / 2);
|
val *= M_PIf_2;
|
||||||
|
|
||||||
if (gp.scale < 1.f) {
|
if (gp.scale < 1.f) {
|
||||||
val = pow3(xsinf(val));
|
val = pow3(xsinf(val));
|
||||||
@ -468,7 +468,7 @@ static float calcGradientFactor(const struct grad_params& gp, int x, int y)
|
|||||||
|
|
||||||
val = gp.bright_top ? 1.f - val : val;
|
val = gp.bright_top ? 1.f - val : val;
|
||||||
|
|
||||||
val *= (M_PI / 2);
|
val *= M_PIf_2;
|
||||||
|
|
||||||
if (gp.scale < 1.f) {
|
if (gp.scale < 1.f) {
|
||||||
val = pow3(xsinf(val));
|
val = pow3(xsinf(val));
|
||||||
@ -590,7 +590,7 @@ static float calcPCVignetteFactor(const struct pcv_params& pcv, int x, int y)
|
|||||||
std::swap(a, b);
|
std::swap(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
float dist = sqrtf(a * a + b * b);
|
float dist = normn(a, b, 2);
|
||||||
float dist_oe, dist_ie;
|
float dist_oe, dist_ie;
|
||||||
float2 sincosval;
|
float2 sincosval;
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ static float calcPCVignetteFactor(const struct pcv_params& pcv, int x, int y)
|
|||||||
if (dist >= dist_oe) {
|
if (dist >= dist_oe) {
|
||||||
val = pcv.scale;
|
val = pcv.scale;
|
||||||
} else {
|
} else {
|
||||||
val = (M_PI / 2) * (dist - dist_ie) / (dist_oe - dist_ie);
|
val = M_PIf_2 * (dist - dist_ie) / (dist_oe - dist_ie);
|
||||||
|
|
||||||
if (pcv.scale < 1.f) {
|
if (pcv.scale < 1.f) {
|
||||||
val = pow4(xcosf(val));
|
val = pow4(xcosf(val));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user