Author: post
Date: 2012-01-31 17:22:10 +0100 (Tue, 31 Jan 2012)
New Revision: 4113

Modified:
   trunk/plugins/resample/resample-avx.c
   trunk/plugins/resample/resample-sse4.c
   trunk/plugins/resample/resample.c
Log:
Resampler: Fix and enable SSE4+AVX code.

Modified: trunk/plugins/resample/resample-avx.c
===================================================================
--- trunk/plugins/resample/resample-avx.c       2012-01-29 15:29:03 UTC (rev 
4112)
+++ trunk/plugins/resample/resample-avx.c       2012-01-31 16:22:10 UTC (rev 
4113)
@@ -141,7 +141,7 @@
                for (k=0; k<fir_filter_size; ++k)
                {
                        gfloat total3 = total2 + lanczos_weight((start_pos+k - 
ok_pos) * filter_step) / total;
-                       weights[i*fir_filter_size+k] = ((gint) 
(total3*FPScale+0.5) - (gint) (total2*FPScale+0.5)) & 0xffff;
+                       weights[i*fir_filter_size+k] = ((gint) 
(total3*FPScale+0.5) - (gint) (total2*FPScale+0.5));
                        
                        total2 = total3;
                }
@@ -210,7 +210,7 @@
                                acc3 = _mm_add_epi32(acc3, src3i);
                        }
                        
-                       /* Add rounder and subtract 32768 */
+                       /* Add rounder*/
                        acc1_h = _mm_add_epi32(acc1_h, add_32);
                        acc2_h = _mm_add_epi32(acc2_h, add_32);
                        acc3_h = _mm_add_epi32(acc3_h, add_32);
@@ -317,7 +317,7 @@
                for (k=0; k<fir_filter_size; ++k)
                {
                        gfloat total3 = total2 + lanczos_weight((start_pos+k - 
ok_pos) * filter_step) / total;
-                       weights[i*fir_filter_size+k] = ((gint) 
(total3*FPScale+0.5) - (gint) (total2*FPScale+0.5)) & 0xffff;
+                       weights[i*fir_filter_size+k] = ((gint) 
(total3*FPScale+0.5) - (gint) (total2*FPScale+0.5));
                        
                        total2 = total3;
                }

Modified: trunk/plugins/resample/resample-sse4.c
===================================================================
--- trunk/plugins/resample/resample-sse4.c      2012-01-29 15:29:03 UTC (rev 
4112)
+++ trunk/plugins/resample/resample-sse4.c      2012-01-31 16:22:10 UTC (rev 
4113)
@@ -141,7 +141,7 @@
                for (k=0; k<fir_filter_size; ++k)
                {
                        gfloat total3 = total2 + lanczos_weight((start_pos+k - 
ok_pos) * filter_step) / total;
-                       weights[i*fir_filter_size+k] = ((gint) 
(total3*FPScale+0.5) - (gint) (total2*FPScale+0.5)) & 0xffff;
+                       weights[i*fir_filter_size+k] = ((gint) 
(total3*FPScale+0.5) - (gint) (total2*FPScale+0.5));
                        
                        total2 = total3;
                }
@@ -210,7 +210,7 @@
                                acc3 = _mm_add_epi32(acc3, src3i);
                        }
                        
-                       /* Add rounder and subtract 32768 */
+                       /* Add rounder */
                        acc1_h = _mm_add_epi32(acc1_h, add_32);
                        acc2_h = _mm_add_epi32(acc2_h, add_32);
                        acc3_h = _mm_add_epi32(acc3_h, add_32);
@@ -317,7 +317,7 @@
                for (k=0; k<fir_filter_size; ++k)
                {
                        gfloat total3 = total2 + lanczos_weight((start_pos+k - 
ok_pos) * filter_step) / total;
-                       weights[i*fir_filter_size+k] = ((gint) 
(total3*FPScale+0.5) - (gint) (total2*FPScale+0.5)) & 0xffff;
+                       weights[i*fir_filter_size+k] = ((gint) 
(total3*FPScale+0.5) - (gint) (total2*FPScale+0.5));
                        
                        total2 = total3;
                }

Modified: trunk/plugins/resample/resample.c
===================================================================
--- trunk/plugins/resample/resample.c   2012-01-29 15:29:03 UTC (rev 4112)
+++ trunk/plugins/resample/resample.c   2012-01-31 16:22:10 UTC (rev 4113)
@@ -328,20 +328,16 @@
        if (t->input->h != t->output->h)
        {
                gboolean sse2_available = !!(rs_detect_cpu_features() & 
RS_CPU_FLAG_SSE2);
-#if 0  // FIXME: Test and enable
                gboolean sse4_available = !!(rs_detect_cpu_features() & 
RS_CPU_FLAG_SSE4_1);
                gboolean avx_available = !!(rs_detect_cpu_features() & 
RS_CPU_FLAG_AVX);
-#endif
                if (t->use_fast)
                        ResizeV_fast(t);
                else if (t->use_compatible)
                        ResizeV_compatible(t);
-#if 0  // FIXME: Test and enable
                else if (avx_available)
                        ResizeV_AVX(t);
                else if (sse4_available)
                        ResizeV_SSE4(t);
-#endif
                else if (sse2_available)
                        ResizeV_SSE2(t);
                else


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to