OLD | NEW |
1 // Copyright 2012 Google Inc. All Rights Reserved. | 1 // Copyright 2012 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 // Image transforms and color space conversion methods for lossless decoder. | 10 // Image transforms and color space conversion methods for lossless decoder. |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "../utils/endian_inl.h" | 21 #include "../utils/endian_inl.h" |
22 #include "./lossless.h" | 22 #include "./lossless.h" |
23 | 23 |
24 #define MAX_DIFF_COST (1e30f) | 24 #define MAX_DIFF_COST (1e30f) |
25 | 25 |
26 //------------------------------------------------------------------------------ | 26 //------------------------------------------------------------------------------ |
27 // Image transforms. | 27 // Image transforms. |
28 | 28 |
29 // In-place sum of each component with mod 256. | 29 // In-place sum of each component with mod 256. |
30 static WEBP_INLINE void AddPixelsEq(uint32_t* a, uint32_t b) { | 30 static WEBP_INLINE void AddPixelsEq(uint32_t* a, uint32_t b) { |
31 const uint32_t alpha_and_green = (*a & 0xff00ff00u) + (b & 0xff00ff00u); | 31 *a = VP8LAddPixels(*a, b); |
32 const uint32_t red_and_blue = (*a & 0x00ff00ffu) + (b & 0x00ff00ffu); | |
33 *a = (alpha_and_green & 0xff00ff00u) | (red_and_blue & 0x00ff00ffu); | |
34 } | 32 } |
35 | 33 |
36 static WEBP_INLINE uint32_t Average2(uint32_t a0, uint32_t a1) { | 34 static WEBP_INLINE uint32_t Average2(uint32_t a0, uint32_t a1) { |
37 return (((a0 ^ a1) & 0xfefefefeu) >> 1) + (a0 & a1); | 35 return (((a0 ^ a1) & 0xfefefefeu) >> 1) + (a0 & a1); |
38 } | 36 } |
39 | 37 |
40 static WEBP_INLINE uint32_t Average3(uint32_t a0, uint32_t a1, uint32_t a2) { | 38 static WEBP_INLINE uint32_t Average3(uint32_t a0, uint32_t a1, uint32_t a2) { |
41 return Average2(Average2(a0, a2), a1); | 39 return Average2(Average2(a0, a2), a1); |
42 } | 40 } |
43 | 41 |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 #if defined(WEBP_USE_MIPS_DSP_R2) | 624 #if defined(WEBP_USE_MIPS_DSP_R2) |
627 if (VP8GetCPUInfo(kMIPSdspR2)) { | 625 if (VP8GetCPUInfo(kMIPSdspR2)) { |
628 VP8LDspInitMIPSdspR2(); | 626 VP8LDspInitMIPSdspR2(); |
629 } | 627 } |
630 #endif | 628 #endif |
631 } | 629 } |
632 lossless_last_cpuinfo_used = VP8GetCPUInfo; | 630 lossless_last_cpuinfo_used = VP8GetCPUInfo; |
633 } | 631 } |
634 | 632 |
635 //------------------------------------------------------------------------------ | 633 //------------------------------------------------------------------------------ |
OLD | NEW |