| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1, | 443 static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1, |
| 444 uint32_t c2) { | 444 uint32_t c2) { |
| 445 const uint32_t ave = Average2(c0, c1); | 445 const uint32_t ave = Average2(c0, c1); |
| 446 const int a = AddSubtractComponentHalf(ave >> 24, c2 >> 24); | 446 const int a = AddSubtractComponentHalf(ave >> 24, c2 >> 24); |
| 447 const int r = AddSubtractComponentHalf((ave >> 16) & 0xff, (c2 >> 16) & 0xff); | 447 const int r = AddSubtractComponentHalf((ave >> 16) & 0xff, (c2 >> 16) & 0xff); |
| 448 const int g = AddSubtractComponentHalf((ave >> 8) & 0xff, (c2 >> 8) & 0xff); | 448 const int g = AddSubtractComponentHalf((ave >> 8) & 0xff, (c2 >> 8) & 0xff); |
| 449 const int b = AddSubtractComponentHalf((ave >> 0) & 0xff, (c2 >> 0) & 0xff); | 449 const int b = AddSubtractComponentHalf((ave >> 0) & 0xff, (c2 >> 0) & 0xff); |
| 450 return ((uint32_t)a << 24) | (r << 16) | (g << 8) | b; | 450 return ((uint32_t)a << 24) | (r << 16) | (g << 8) | b; |
| 451 } | 451 } |
| 452 | 452 |
| 453 static WEBP_INLINE int Sub3(int a, int b, int c) { | 453 // gcc-4.9 on ARM generates incorrect code in Select() when Sub3() is inlined. |
| 454 #if defined(__arm__) && LOCAL_GCC_VERSION == 0x409 |
| 455 # define LOCAL_INLINE __attribute__ ((noinline)) |
| 456 #else |
| 457 # define LOCAL_INLINE WEBP_INLINE |
| 458 #endif |
| 459 |
| 460 static LOCAL_INLINE int Sub3(int a, int b, int c) { |
| 454 const int pb = b - c; | 461 const int pb = b - c; |
| 455 const int pa = a - c; | 462 const int pa = a - c; |
| 456 return abs(pb) - abs(pa); | 463 return abs(pb) - abs(pa); |
| 457 } | 464 } |
| 458 | 465 |
| 466 #undef LOCAL_INLINE |
| 467 |
| 459 static WEBP_INLINE uint32_t Select(uint32_t a, uint32_t b, uint32_t c) { | 468 static WEBP_INLINE uint32_t Select(uint32_t a, uint32_t b, uint32_t c) { |
| 460 const int pa_minus_pb = | 469 const int pa_minus_pb = |
| 461 Sub3((a >> 24) , (b >> 24) , (c >> 24) ) + | 470 Sub3((a >> 24) , (b >> 24) , (c >> 24) ) + |
| 462 Sub3((a >> 16) & 0xff, (b >> 16) & 0xff, (c >> 16) & 0xff) + | 471 Sub3((a >> 16) & 0xff, (b >> 16) & 0xff, (c >> 16) & 0xff) + |
| 463 Sub3((a >> 8) & 0xff, (b >> 8) & 0xff, (c >> 8) & 0xff) + | 472 Sub3((a >> 8) & 0xff, (b >> 8) & 0xff, (c >> 8) & 0xff) + |
| 464 Sub3((a ) & 0xff, (b ) & 0xff, (c ) & 0xff); | 473 Sub3((a ) & 0xff, (b ) & 0xff, (c ) & 0xff); |
| 465 return (pa_minus_pb <= 0) ? a : b; | 474 return (pa_minus_pb <= 0) ? a : b; |
| 466 } | 475 } |
| 467 | 476 |
| 468 //------------------------------------------------------------------------------ | 477 //------------------------------------------------------------------------------ |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 #endif | 1630 #endif |
| 1622 #if defined(WEBP_USE_MIPS32) | 1631 #if defined(WEBP_USE_MIPS32) |
| 1623 if (VP8GetCPUInfo(kMIPS32)) { | 1632 if (VP8GetCPUInfo(kMIPS32)) { |
| 1624 VP8LDspInitMIPS32(); | 1633 VP8LDspInitMIPS32(); |
| 1625 } | 1634 } |
| 1626 #endif | 1635 #endif |
| 1627 } | 1636 } |
| 1628 } | 1637 } |
| 1629 | 1638 |
| 1630 //------------------------------------------------------------------------------ | 1639 //------------------------------------------------------------------------------ |
| OLD | NEW |