[babl] sse2-float: don't modify input data during rgba -> rgbA conversion



commit a02a1f227e7dd68da84544236a0fb3d68560619c
Author: Ell <ell_se yahoo com>
Date:   Fri Sep 21 20:15:14 2018 -0400

    sse2-float: don't modify input data during rgba -> rgbA conversion

 extensions/sse2-float.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/extensions/sse2-float.c b/extensions/sse2-float.c
index 02a8c2d..d2bc50b 100644
--- a/extensions/sse2-float.c
+++ b/extensions/sse2-float.c
@@ -57,16 +57,16 @@ conv_rgbaF_linear_rgbAF_linear (const Babl *conversion,const float *src, float *
           if (alpha0 < BABL_ALPHA_FLOOR)
           {
             if (alpha0 >= 0.0f)
-              ((float *)s)[3] = BABL_ALPHA_FLOOR;
+              alpha0 = BABL_ALPHA_FLOOR;
             else
-              ((float *)s)[3] = -BABL_ALPHA_FLOOR;
+              alpha0 = -BABL_ALPHA_FLOOR;
           }
           if (alpha1 < BABL_ALPHA_FLOOR)
           {
             if (alpha1 >= 0.0f)
-              ((float *)s)[7] = BABL_ALPHA_FLOOR;
+              alpha1 = BABL_ALPHA_FLOOR;
             else
-              ((float *)s)[7] = -BABL_ALPHA_FLOOR;
+              alpha1 = -BABL_ALPHA_FLOOR;
           }
          {
           __v4sf rbaa0, rbaa1;
@@ -76,8 +76,8 @@ conv_rgbaF_linear_rgbAF_linear (const Babl *conversion,const float *src, float *
 
 
           /* Expand alpha */
-          __v4sf aaaa0 = (__v4sf)_mm_shuffle_epi32((__m128i)rgba0, _MM_SHUFFLE(3, 3, 3, 3));
-          __v4sf aaaa1 = (__v4sf)_mm_shuffle_epi32((__m128i)rgba1, _MM_SHUFFLE(3, 3, 3, 3));
+          __v4sf aaaa0 = (__v4sf)_mm_set1_ps(alpha0);
+          __v4sf aaaa1 = (__v4sf)_mm_set1_ps(alpha1);
           
           /* Premultiply */
           rgba0 = rgba0 * aaaa0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]