| OLD | NEW |
| 1 // Copyright 2015 Google Inc. All Rights Reserved. | 1 // Copyright 2015 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
| 4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
| 5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
| 6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
| 7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
| 8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
| 9 // | 9 // |
| 10 // SSE4.1 variant of methods for lossless encoder | 10 // SSE4.1 variant of methods for lossless encoder |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 int i; | 25 int i; |
| 26 const __m128i kCstShuffle = _mm_set_epi8(-1, 13, -1, 13, -1, 9, -1, 9, | 26 const __m128i kCstShuffle = _mm_set_epi8(-1, 13, -1, 13, -1, 9, -1, 9, |
| 27 -1, 5, -1, 5, -1, 1, -1, 1); | 27 -1, 5, -1, 5, -1, 1, -1, 1); |
| 28 for (i = 0; i + 4 <= num_pixels; i += 4) { | 28 for (i = 0; i + 4 <= num_pixels; i += 4) { |
| 29 const __m128i in = _mm_loadu_si128((__m128i*)&argb_data[i]); | 29 const __m128i in = _mm_loadu_si128((__m128i*)&argb_data[i]); |
| 30 const __m128i in_0g0g = _mm_shuffle_epi8(in, kCstShuffle); | 30 const __m128i in_0g0g = _mm_shuffle_epi8(in, kCstShuffle); |
| 31 const __m128i out = _mm_sub_epi8(in, in_0g0g); | 31 const __m128i out = _mm_sub_epi8(in, in_0g0g); |
| 32 _mm_storeu_si128((__m128i*)&argb_data[i], out); | 32 _mm_storeu_si128((__m128i*)&argb_data[i], out); |
| 33 } | 33 } |
| 34 // fallthrough and finish off with plain-C | 34 // fallthrough and finish off with plain-C |
| 35 VP8LSubtractGreenFromBlueAndRed_C(argb_data + i, num_pixels - i); | 35 if (i != num_pixels) { |
| 36 VP8LSubtractGreenFromBlueAndRed_C(argb_data + i, num_pixels - i); |
| 37 } |
| 36 } | 38 } |
| 37 | 39 |
| 38 //------------------------------------------------------------------------------ | 40 //------------------------------------------------------------------------------ |
| 39 // Entry point | 41 // Entry point |
| 40 | 42 |
| 41 extern void VP8LEncDspInitSSE41(void); | 43 extern void VP8LEncDspInitSSE41(void); |
| 42 | 44 |
| 43 WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitSSE41(void) { | 45 WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitSSE41(void) { |
| 44 VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed; | 46 VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed; |
| 45 } | 47 } |
| 46 | 48 |
| 47 #else // !WEBP_USE_SSE41 | 49 #else // !WEBP_USE_SSE41 |
| 48 | 50 |
| 49 WEBP_DSP_INIT_STUB(VP8LEncDspInitSSE41) | 51 WEBP_DSP_INIT_STUB(VP8LEncDspInitSSE41) |
| 50 | 52 |
| 51 #endif // WEBP_USE_SSE41 | 53 #endif // WEBP_USE_SSE41 |
| OLD | NEW |