Commit 2999d0e0 authored by Tobias Ellinghaus's avatar Tobias Ellinghaus

Fix some SSE coding style

- no operator overloading
- explicitly call _mm_set{,r}_ps()
parent 80e35b73
......@@ -169,18 +169,22 @@ void process_sse2(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, c
const int ch = piece->colors;
// these are RGB values!
const __m128 lift = { 2.0 - (d->lift[CHANNEL_RED] * d->lift[CHANNEL_FACTOR]),
2.0 - (d->lift[CHANNEL_GREEN] * d->lift[CHANNEL_FACTOR]),
2.0 - (d->lift[CHANNEL_BLUE] * d->lift[CHANNEL_FACTOR]) },
gamma = { d->gamma[CHANNEL_RED] * d->gamma[CHANNEL_FACTOR],
d->gamma[CHANNEL_GREEN] * d->gamma[CHANNEL_FACTOR],
d->gamma[CHANNEL_BLUE] * d->gamma[CHANNEL_FACTOR] },
gamma_inv = { (gamma[0] != 0.0) ? 1.0 / gamma[0] : 1000000.0,
(gamma[1] != 0.0) ? 1.0 / gamma[1] : 1000000.0,
(gamma[2] != 0.0) ? 1.0 / gamma[2] : 1000000.0 },
gain = { d->gain[CHANNEL_RED] * d->gain[CHANNEL_FACTOR],
d->gain[CHANNEL_GREEN] * d->gain[CHANNEL_FACTOR],
d->gain[CHANNEL_BLUE] * d->gain[CHANNEL_FACTOR] };
const __m128 lift = _mm_setr_ps(2.0 - (d->lift[CHANNEL_RED] * d->lift[CHANNEL_FACTOR]),
2.0 - (d->lift[CHANNEL_GREEN] * d->lift[CHANNEL_FACTOR]),
2.0 - (d->lift[CHANNEL_BLUE] * d->lift[CHANNEL_FACTOR]),
0.0f);
const __m128 gamma = _mm_setr_ps(d->gamma[CHANNEL_RED] * d->gamma[CHANNEL_FACTOR],
d->gamma[CHANNEL_GREEN] * d->gamma[CHANNEL_FACTOR],
d->gamma[CHANNEL_BLUE] * d->gamma[CHANNEL_FACTOR],
0.0f);
const __m128 gamma_inv = _mm_setr_ps((gamma[0] != 0.0) ? 1.0 / gamma[0] : 1000000.0,
(gamma[1] != 0.0) ? 1.0 / gamma[1] : 1000000.0,
(gamma[2] != 0.0) ? 1.0 / gamma[2] : 1000000.0,
0.0f);
const __m128 gain = _mm_setr_ps(d->gain[CHANNEL_RED] * d->gain[CHANNEL_FACTOR],
d->gain[CHANNEL_GREEN] * d->gain[CHANNEL_FACTOR],
d->gain[CHANNEL_BLUE] * d->gain[CHANNEL_FACTOR],
0.0f);
#ifdef _OPENMP
#pragma omp parallel for default(none) schedule(static)
......@@ -200,7 +204,7 @@ void process_sse2(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, c
// do the calculation in RGB space
__m128 one = _mm_set1_ps(1.0);
__m128 tmp = (((rgb - one) * lift) + one) * gain;
__m128 tmp = _mm_mul_ps(_mm_add_ps(_mm_mul_ps(_mm_sub_ps(rgb, one), lift),one), gain);
tmp = _mm_max_ps(tmp, _mm_setzero_ps());
rgb = _mm_pow_ps(tmp, gamma_inv);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment