libFLAC/stream_encoder_intrin_*.c: More refactoring II
authorErik de Castro Lopo <erikd@mega-nerd.com>
Thu, 19 Nov 2015 07:32:31 +0000 (18:32 +1100)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Thu, 19 Nov 2015 07:32:35 +0000 (18:32 +1100)
Patch-from: lvqcl <lvqcl.mail@gmail.com>

src/libFLAC/stream_encoder_intrin_sse2.c

index b60a3db..ed01978 100644 (file)
@@ -81,20 +81,17 @@ void FLAC__precompute_partition_info_sums_intrin_sse2(const FLAC__int32 residual
 
                                /* assumption: residual[] is properly aligned so (residual + e1) is properly aligned too and _mm_loadu_si128() is fast */
                                for( ; residual_sample < e1; residual_sample++) {
 
                                /* assumption: residual[] is properly aligned so (residual + e1) is properly aligned too and _mm_loadu_si128() is fast */
                                for( ; residual_sample < e1; residual_sample++) {
-                                       __m128i mm_res = _mm_cvtsi32_si128(residual[residual_sample]);
-                                       mm_res = local_abs_epi32(mm_res);
+                                       __m128i mm_res = local_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample]));
                                        mm_sum = _mm_add_epi32(mm_sum, mm_res);
                                }
 
                                for( ; residual_sample < e3; residual_sample+=4) {
                                        mm_sum = _mm_add_epi32(mm_sum, mm_res);
                                }
 
                                for( ; residual_sample < e3; residual_sample+=4) {
-                                       __m128i mm_res = _mm_loadu_si128((const __m128i*)(residual+residual_sample));
-                                       mm_res = local_abs_epi32(mm_res);
+                                       __m128i mm_res = local_abs_epi32(_mm_loadu_si128((const __m128i*)(residual+residual_sample)));
                                        mm_sum = _mm_add_epi32(mm_sum, mm_res);
                                }
 
                                for( ; residual_sample < end; residual_sample++) {
                                        mm_sum = _mm_add_epi32(mm_sum, mm_res);
                                }
 
                                for( ; residual_sample < end; residual_sample++) {
-                                       __m128i mm_res = _mm_cvtsi32_si128(residual[residual_sample]);
-                                       mm_res = local_abs_epi32(mm_res);
+                                       __m128i mm_res = local_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample]));
                                        mm_sum = _mm_add_epi32(mm_sum, mm_res);
                                }
 
                                        mm_sum = _mm_add_epi32(mm_sum, mm_res);
                                }
 
@@ -113,21 +110,18 @@ void FLAC__precompute_partition_info_sums_intrin_sse2(const FLAC__int32 residual
                                FLAC__ASSERT(e1 <= end);
 
                                for( ; residual_sample < e1; residual_sample++) {
                                FLAC__ASSERT(e1 <= end);
 
                                for( ; residual_sample < e1; residual_sample++) {
-                                       __m128i mm_res = _mm_cvtsi32_si128(residual[residual_sample]); /*  0   0   0   r0 */
-                                       mm_res = local_abs_epi32(mm_res); /*  0   0   0  |r0|  ==   00   |r0_64| */
+                                       __m128i mm_res = local_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); /*  0   0   0  |r0|  ==   00   |r0_64| */
                                        mm_sum = _mm_add_epi64(mm_sum, mm_res);
                                }
 
                                for( ; residual_sample < e3; residual_sample+=2) {
                                        mm_sum = _mm_add_epi64(mm_sum, mm_res);
                                }
 
                                for( ; residual_sample < e3; residual_sample+=2) {
-                                       __m128i mm_res = _mm_loadl_epi64((const __m128i*)(residual+residual_sample)); /*  0   0   r1  r0 */
-                                       mm_res = local_abs_epi32(mm_res); /*  0   0  |r1|   |r0| */
+                                       __m128i mm_res = local_abs_epi32(_mm_loadl_epi64((const __m128i*)(residual+residual_sample))); /*  0   0  |r1|   |r0| */
                                        mm_res = _mm_shuffle_epi32(mm_res, _MM_SHUFFLE(3,1,2,0)); /* 0  |r1|  0  |r0|  ==  |r1_64|  |r0_64|  */
                                        mm_sum = _mm_add_epi64(mm_sum, mm_res);
                                }
 
                                for( ; residual_sample < end; residual_sample++) {
                                        mm_res = _mm_shuffle_epi32(mm_res, _MM_SHUFFLE(3,1,2,0)); /* 0  |r1|  0  |r0|  ==  |r1_64|  |r0_64|  */
                                        mm_sum = _mm_add_epi64(mm_sum, mm_res);
                                }
 
                                for( ; residual_sample < end; residual_sample++) {
-                                       __m128i mm_res = _mm_cvtsi32_si128(residual[residual_sample]);
-                                       mm_res = local_abs_epi32(mm_res);
+                                       __m128i mm_res = local_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample]));
                                        mm_sum = _mm_add_epi64(mm_sum, mm_res);
                                }
 
                                        mm_sum = _mm_add_epi64(mm_sum, mm_res);
                                }