| OLD | NEW |
| 1 // Copyright 2011 Google Inc. All Rights Reserved. | 1 // Copyright 2011 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 // Speed-critical encoding functions. | 10 // Speed-critical encoding functions. |
| 11 // | 11 // |
| 12 // Author: Skal (pascal.massimino@gmail.com) | 12 // Author: Skal (pascal.massimino@gmail.com) |
| 13 | 13 |
| 14 #include <assert.h> | 14 #include <assert.h> |
| 15 #include <stdlib.h> // for abs() | 15 #include <stdlib.h> // for abs() |
| 16 | 16 |
| 17 #include "./dsp.h" | 17 #include "./dsp.h" |
| 18 #include "../enc/vp8enci.h" | 18 #include "../enc/vp8i_enc.h" |
| 19 | 19 |
| 20 static WEBP_INLINE uint8_t clip_8b(int v) { | 20 static WEBP_INLINE uint8_t clip_8b(int v) { |
| 21 return (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255; | 21 return (!(v & ~0xff)) ? v : (v < 0) ? 0 : 255; |
| 22 } | 22 } |
| 23 | 23 |
| 24 static WEBP_INLINE int clip_max(int v, int max) { | 24 static WEBP_INLINE int clip_max(int v, int max) { |
| 25 return (v > max) ? max : v; | 25 return (v > max) ? max : v; |
| 26 } | 26 } |
| 27 | 27 |
| 28 //------------------------------------------------------------------------------ | 28 //------------------------------------------------------------------------------ |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 static int SSE16x8(const uint8_t* a, const uint8_t* b) { | 544 static int SSE16x8(const uint8_t* a, const uint8_t* b) { |
| 545 return GetSSE(a, b, 16, 8); | 545 return GetSSE(a, b, 16, 8); |
| 546 } | 546 } |
| 547 static int SSE8x8(const uint8_t* a, const uint8_t* b) { | 547 static int SSE8x8(const uint8_t* a, const uint8_t* b) { |
| 548 return GetSSE(a, b, 8, 8); | 548 return GetSSE(a, b, 8, 8); |
| 549 } | 549 } |
| 550 static int SSE4x4(const uint8_t* a, const uint8_t* b) { | 550 static int SSE4x4(const uint8_t* a, const uint8_t* b) { |
| 551 return GetSSE(a, b, 4, 4); | 551 return GetSSE(a, b, 4, 4); |
| 552 } | 552 } |
| 553 | 553 |
| 554 static void Mean16x4(const uint8_t* ref, uint32_t dc[4]) { |
| 555 int k, x, y; |
| 556 for (k = 0; k < 4; ++k) { |
| 557 uint32_t avg = 0; |
| 558 for (y = 0; y < 4; ++y) { |
| 559 for (x = 0; x < 4; ++x) { |
| 560 avg += ref[x + y * BPS]; |
| 561 } |
| 562 } |
| 563 dc[k] = avg; |
| 564 ref += 4; // go to next 4x4 block. |
| 565 } |
| 566 } |
| 567 |
| 554 //------------------------------------------------------------------------------ | 568 //------------------------------------------------------------------------------ |
| 555 // Texture distortion | 569 // Texture distortion |
| 556 // | 570 // |
| 557 // We try to match the spectral content (weighted) between source and | 571 // We try to match the spectral content (weighted) between source and |
| 558 // reconstructed samples. | 572 // reconstructed samples. |
| 559 | 573 |
| 560 // Hadamard transform | 574 // Hadamard transform |
| 561 // Returns the weighted sum of the absolute value of transformed coefficients. | 575 // Returns the weighted sum of the absolute value of transformed coefficients. |
| 562 // w[] contains a row-major 4 by 4 symmetric matrix. | 576 // w[] contains a row-major 4 by 4 symmetric matrix. |
| 563 static int TTransform(const uint8_t* in, const uint16_t* w) { | 577 static int TTransform(const uint8_t* in, const uint16_t* w) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 } | 663 } |
| 650 | 664 |
| 651 static int Quantize2Blocks(int16_t in[32], int16_t out[32], | 665 static int Quantize2Blocks(int16_t in[32], int16_t out[32], |
| 652 const VP8Matrix* const mtx) { | 666 const VP8Matrix* const mtx) { |
| 653 int nz; | 667 int nz; |
| 654 nz = VP8EncQuantizeBlock(in + 0 * 16, out + 0 * 16, mtx) << 0; | 668 nz = VP8EncQuantizeBlock(in + 0 * 16, out + 0 * 16, mtx) << 0; |
| 655 nz |= VP8EncQuantizeBlock(in + 1 * 16, out + 1 * 16, mtx) << 1; | 669 nz |= VP8EncQuantizeBlock(in + 1 * 16, out + 1 * 16, mtx) << 1; |
| 656 return nz; | 670 return nz; |
| 657 } | 671 } |
| 658 | 672 |
| 659 static int QuantizeBlockWHT(int16_t in[16], int16_t out[16], | |
| 660 const VP8Matrix* const mtx) { | |
| 661 int n, last = -1; | |
| 662 for (n = 0; n < 16; ++n) { | |
| 663 const int j = kZigzag[n]; | |
| 664 const int sign = (in[j] < 0); | |
| 665 const uint32_t coeff = sign ? -in[j] : in[j]; | |
| 666 assert(mtx->sharpen_[j] == 0); | |
| 667 if (coeff > mtx->zthresh_[j]) { | |
| 668 const uint32_t Q = mtx->q_[j]; | |
| 669 const uint32_t iQ = mtx->iq_[j]; | |
| 670 const uint32_t B = mtx->bias_[j]; | |
| 671 int level = QUANTDIV(coeff, iQ, B); | |
| 672 if (level > MAX_LEVEL) level = MAX_LEVEL; | |
| 673 if (sign) level = -level; | |
| 674 in[j] = level * (int)Q; | |
| 675 out[n] = level; | |
| 676 if (level) last = n; | |
| 677 } else { | |
| 678 out[n] = 0; | |
| 679 in[j] = 0; | |
| 680 } | |
| 681 } | |
| 682 return (last >= 0); | |
| 683 } | |
| 684 | |
| 685 //------------------------------------------------------------------------------ | 673 //------------------------------------------------------------------------------ |
| 686 // Block copy | 674 // Block copy |
| 687 | 675 |
| 688 static WEBP_INLINE void Copy(const uint8_t* src, uint8_t* dst, int w, int h) { | 676 static WEBP_INLINE void Copy(const uint8_t* src, uint8_t* dst, int w, int h) { |
| 689 int y; | 677 int y; |
| 690 for (y = 0; y < h; ++y) { | 678 for (y = 0; y < h; ++y) { |
| 691 memcpy(dst, src, w); | 679 memcpy(dst, src, w); |
| 692 src += BPS; | 680 src += BPS; |
| 693 dst += BPS; | 681 dst += BPS; |
| 694 } | 682 } |
| 695 } | 683 } |
| 696 | 684 |
| 697 static void Copy4x4(const uint8_t* src, uint8_t* dst) { | 685 static void Copy4x4(const uint8_t* src, uint8_t* dst) { |
| 698 Copy(src, dst, 4, 4); | 686 Copy(src, dst, 4, 4); |
| 699 } | 687 } |
| 700 | 688 |
| 701 static void Copy16x8(const uint8_t* src, uint8_t* dst) { | 689 static void Copy16x8(const uint8_t* src, uint8_t* dst) { |
| 702 Copy(src, dst, 16, 8); | 690 Copy(src, dst, 16, 8); |
| 703 } | 691 } |
| 704 | 692 |
| 705 //------------------------------------------------------------------------------ | 693 //------------------------------------------------------------------------------ |
| 694 // SSIM / PSNR |
| 706 | 695 |
| 707 static void SSIMAccumulateClipped(const uint8_t* src1, int stride1, | 696 // hat-shaped filter. Sum of coefficients is equal to 16. |
| 708 const uint8_t* src2, int stride2, | 697 static const uint32_t kWeight[2 * VP8_SSIM_KERNEL + 1] = { |
| 709 int xo, int yo, int W, int H, | 698 1, 2, 3, 4, 3, 2, 1 |
| 710 VP8DistoStats* const stats) { | 699 }; |
| 700 static const uint32_t kWeightSum = 16 * 16; // sum{kWeight}^2 |
| 701 |
| 702 static WEBP_INLINE double SSIMCalculation( |
| 703 const VP8DistoStats* const stats, uint32_t N /*num samples*/) { |
| 704 const uint32_t w2 = N * N; |
| 705 const uint32_t C1 = 20 * w2; |
| 706 const uint32_t C2 = 60 * w2; |
| 707 const uint32_t C3 = 8 * 8 * w2; // 'dark' limit ~= 6 |
| 708 const uint64_t xmxm = (uint64_t)stats->xm * stats->xm; |
| 709 const uint64_t ymym = (uint64_t)stats->ym * stats->ym; |
| 710 if (xmxm + ymym >= C3) { |
| 711 const int64_t xmym = (int64_t)stats->xm * stats->ym; |
| 712 const int64_t sxy = (int64_t)stats->xym * N - xmym; // can be negative |
| 713 const uint64_t sxx = (uint64_t)stats->xxm * N - xmxm; |
| 714 const uint64_t syy = (uint64_t)stats->yym * N - ymym; |
| 715 // we descale by 8 to prevent overflow during the fnum/fden multiply. |
| 716 const uint64_t num_S = (2 * (uint64_t)(sxy < 0 ? 0 : sxy) + C2) >> 8; |
| 717 const uint64_t den_S = (sxx + syy + C2) >> 8; |
| 718 const uint64_t fnum = (2 * xmym + C1) * num_S; |
| 719 const uint64_t fden = (xmxm + ymym + C1) * den_S; |
| 720 const double r = (double)fnum / fden; |
| 721 assert(r >= 0. && r <= 1.0); |
| 722 return r; |
| 723 } |
| 724 return 1.; // area is too dark to contribute meaningfully |
| 725 } |
| 726 |
| 727 double VP8SSIMFromStats(const VP8DistoStats* const stats) { |
| 728 return SSIMCalculation(stats, kWeightSum); |
| 729 } |
| 730 |
| 731 double VP8SSIMFromStatsClipped(const VP8DistoStats* const stats) { |
| 732 return SSIMCalculation(stats, stats->w); |
| 733 } |
| 734 |
| 735 static double SSIMGetClipped_C(const uint8_t* src1, int stride1, |
| 736 const uint8_t* src2, int stride2, |
| 737 int xo, int yo, int W, int H) { |
| 738 VP8DistoStats stats = { 0, 0, 0, 0, 0, 0 }; |
| 711 const int ymin = (yo - VP8_SSIM_KERNEL < 0) ? 0 : yo - VP8_SSIM_KERNEL; | 739 const int ymin = (yo - VP8_SSIM_KERNEL < 0) ? 0 : yo - VP8_SSIM_KERNEL; |
| 712 const int ymax = (yo + VP8_SSIM_KERNEL > H - 1) ? H - 1 | 740 const int ymax = (yo + VP8_SSIM_KERNEL > H - 1) ? H - 1 |
| 713 : yo + VP8_SSIM_KERNEL; | 741 : yo + VP8_SSIM_KERNEL; |
| 714 const int xmin = (xo - VP8_SSIM_KERNEL < 0) ? 0 : xo - VP8_SSIM_KERNEL; | 742 const int xmin = (xo - VP8_SSIM_KERNEL < 0) ? 0 : xo - VP8_SSIM_KERNEL; |
| 715 const int xmax = (xo + VP8_SSIM_KERNEL > W - 1) ? W - 1 | 743 const int xmax = (xo + VP8_SSIM_KERNEL > W - 1) ? W - 1 |
| 716 : xo + VP8_SSIM_KERNEL; | 744 : xo + VP8_SSIM_KERNEL; |
| 717 int x, y; | 745 int x, y; |
| 718 src1 += ymin * stride1; | 746 src1 += ymin * stride1; |
| 719 src2 += ymin * stride2; | 747 src2 += ymin * stride2; |
| 720 for (y = ymin; y <= ymax; ++y, src1 += stride1, src2 += stride2) { | 748 for (y = ymin; y <= ymax; ++y, src1 += stride1, src2 += stride2) { |
| 721 for (x = xmin; x <= xmax; ++x) { | 749 for (x = xmin; x <= xmax; ++x) { |
| 722 const int s1 = src1[x]; | 750 const uint32_t w = kWeight[VP8_SSIM_KERNEL + x - xo] |
| 723 const int s2 = src2[x]; | 751 * kWeight[VP8_SSIM_KERNEL + y - yo]; |
| 724 stats->w += 1; | 752 const uint32_t s1 = src1[x]; |
| 725 stats->xm += s1; | 753 const uint32_t s2 = src2[x]; |
| 726 stats->ym += s2; | 754 stats.w += w; |
| 727 stats->xxm += s1 * s1; | 755 stats.xm += w * s1; |
| 728 stats->xym += s1 * s2; | 756 stats.ym += w * s2; |
| 729 stats->yym += s2 * s2; | 757 stats.xxm += w * s1 * s1; |
| 758 stats.xym += w * s1 * s2; |
| 759 stats.yym += w * s2 * s2; |
| 730 } | 760 } |
| 731 } | 761 } |
| 762 return VP8SSIMFromStatsClipped(&stats); |
| 732 } | 763 } |
| 733 | 764 |
| 734 static void SSIMAccumulate(const uint8_t* src1, int stride1, | 765 static double SSIMGet_C(const uint8_t* src1, int stride1, |
| 735 const uint8_t* src2, int stride2, | 766 const uint8_t* src2, int stride2) { |
| 736 VP8DistoStats* const stats) { | 767 VP8DistoStats stats = { 0, 0, 0, 0, 0, 0 }; |
| 737 int x, y; | 768 int x, y; |
| 738 for (y = 0; y <= 2 * VP8_SSIM_KERNEL; ++y, src1 += stride1, src2 += stride2) { | 769 for (y = 0; y <= 2 * VP8_SSIM_KERNEL; ++y, src1 += stride1, src2 += stride2) { |
| 739 for (x = 0; x <= 2 * VP8_SSIM_KERNEL; ++x) { | 770 for (x = 0; x <= 2 * VP8_SSIM_KERNEL; ++x) { |
| 740 const int s1 = src1[x]; | 771 const uint32_t w = kWeight[x] * kWeight[y]; |
| 741 const int s2 = src2[x]; | 772 const uint32_t s1 = src1[x]; |
| 742 stats->w += 1; | 773 const uint32_t s2 = src2[x]; |
| 743 stats->xm += s1; | 774 stats.xm += w * s1; |
| 744 stats->ym += s2; | 775 stats.ym += w * s2; |
| 745 stats->xxm += s1 * s1; | 776 stats.xxm += w * s1 * s1; |
| 746 stats->xym += s1 * s2; | 777 stats.xym += w * s1 * s2; |
| 747 stats->yym += s2 * s2; | 778 stats.yym += w * s2 * s2; |
| 748 } | 779 } |
| 749 } | 780 } |
| 781 return VP8SSIMFromStats(&stats); |
| 750 } | 782 } |
| 751 | 783 |
| 752 VP8SSIMAccumulateFunc VP8SSIMAccumulate; | 784 //------------------------------------------------------------------------------ |
| 753 VP8SSIMAccumulateClippedFunc VP8SSIMAccumulateClipped; | 785 |
| 786 static uint32_t AccumulateSSE(const uint8_t* src1, |
| 787 const uint8_t* src2, int len) { |
| 788 int i; |
| 789 uint32_t sse2 = 0; |
| 790 assert(len <= 65535); // to ensure that accumulation fits within uint32_t |
| 791 for (i = 0; i < len; ++i) { |
| 792 const int32_t diff = src1[i] - src2[i]; |
| 793 sse2 += diff * diff; |
| 794 } |
| 795 return sse2; |
| 796 } |
| 797 |
| 798 //------------------------------------------------------------------------------ |
| 799 |
| 800 VP8SSIMGetFunc VP8SSIMGet; |
| 801 VP8SSIMGetClippedFunc VP8SSIMGetClipped; |
| 802 VP8AccumulateSSEFunc VP8AccumulateSSE; |
| 803 |
| 804 extern void VP8SSIMDspInitSSE2(void); |
| 754 | 805 |
| 755 static volatile VP8CPUInfo ssim_last_cpuinfo_used = | 806 static volatile VP8CPUInfo ssim_last_cpuinfo_used = |
| 756 (VP8CPUInfo)&ssim_last_cpuinfo_used; | 807 (VP8CPUInfo)&ssim_last_cpuinfo_used; |
| 757 | 808 |
| 758 WEBP_TSAN_IGNORE_FUNCTION void VP8SSIMDspInit(void) { | 809 WEBP_TSAN_IGNORE_FUNCTION void VP8SSIMDspInit(void) { |
| 759 if (ssim_last_cpuinfo_used == VP8GetCPUInfo) return; | 810 if (ssim_last_cpuinfo_used == VP8GetCPUInfo) return; |
| 760 | 811 |
| 761 VP8SSIMAccumulate = SSIMAccumulate; | 812 VP8SSIMGetClipped = SSIMGetClipped_C; |
| 762 VP8SSIMAccumulateClipped = SSIMAccumulateClipped; | 813 VP8SSIMGet = SSIMGet_C; |
| 814 |
| 815 VP8AccumulateSSE = AccumulateSSE; |
| 816 if (VP8GetCPUInfo != NULL) { |
| 817 #if defined(WEBP_USE_SSE2) |
| 818 if (VP8GetCPUInfo(kSSE2)) { |
| 819 VP8SSIMDspInitSSE2(); |
| 820 } |
| 821 #endif |
| 822 } |
| 763 | 823 |
| 764 ssim_last_cpuinfo_used = VP8GetCPUInfo; | 824 ssim_last_cpuinfo_used = VP8GetCPUInfo; |
| 765 } | 825 } |
| 766 | 826 |
| 767 //------------------------------------------------------------------------------ | 827 //------------------------------------------------------------------------------ |
| 768 // Initialization | 828 // Initialization |
| 769 | 829 |
| 770 // Speed-critical function pointers. We have to initialize them to the default | 830 // Speed-critical function pointers. We have to initialize them to the default |
| 771 // implementations within VP8EncDspInit(). | 831 // implementations within VP8EncDspInit(). |
| 772 VP8CHisto VP8CollectHistogram; | 832 VP8CHisto VP8CollectHistogram; |
| 773 VP8Idct VP8ITransform; | 833 VP8Idct VP8ITransform; |
| 774 VP8Fdct VP8FTransform; | 834 VP8Fdct VP8FTransform; |
| 775 VP8Fdct VP8FTransform2; | 835 VP8Fdct VP8FTransform2; |
| 776 VP8WHT VP8FTransformWHT; | 836 VP8WHT VP8FTransformWHT; |
| 777 VP8Intra4Preds VP8EncPredLuma4; | 837 VP8Intra4Preds VP8EncPredLuma4; |
| 778 VP8IntraPreds VP8EncPredLuma16; | 838 VP8IntraPreds VP8EncPredLuma16; |
| 779 VP8IntraPreds VP8EncPredChroma8; | 839 VP8IntraPreds VP8EncPredChroma8; |
| 780 VP8Metric VP8SSE16x16; | 840 VP8Metric VP8SSE16x16; |
| 781 VP8Metric VP8SSE8x8; | 841 VP8Metric VP8SSE8x8; |
| 782 VP8Metric VP8SSE16x8; | 842 VP8Metric VP8SSE16x8; |
| 783 VP8Metric VP8SSE4x4; | 843 VP8Metric VP8SSE4x4; |
| 784 VP8WMetric VP8TDisto4x4; | 844 VP8WMetric VP8TDisto4x4; |
| 785 VP8WMetric VP8TDisto16x16; | 845 VP8WMetric VP8TDisto16x16; |
| 846 VP8MeanMetric VP8Mean16x4; |
| 786 VP8QuantizeBlock VP8EncQuantizeBlock; | 847 VP8QuantizeBlock VP8EncQuantizeBlock; |
| 787 VP8Quantize2Blocks VP8EncQuantize2Blocks; | 848 VP8Quantize2Blocks VP8EncQuantize2Blocks; |
| 788 VP8QuantizeBlockWHT VP8EncQuantizeBlockWHT; | 849 VP8QuantizeBlockWHT VP8EncQuantizeBlockWHT; |
| 789 VP8BlockCopy VP8Copy4x4; | 850 VP8BlockCopy VP8Copy4x4; |
| 790 VP8BlockCopy VP8Copy16x8; | 851 VP8BlockCopy VP8Copy16x8; |
| 791 | 852 |
| 792 extern void VP8EncDspInitSSE2(void); | 853 extern void VP8EncDspInitSSE2(void); |
| 793 extern void VP8EncDspInitSSE41(void); | 854 extern void VP8EncDspInitSSE41(void); |
| 794 extern void VP8EncDspInitAVX2(void); | 855 extern void VP8EncDspInitAVX2(void); |
| 795 extern void VP8EncDspInitNEON(void); | 856 extern void VP8EncDspInitNEON(void); |
| 796 extern void VP8EncDspInitMIPS32(void); | 857 extern void VP8EncDspInitMIPS32(void); |
| 797 extern void VP8EncDspInitMIPSdspR2(void); | 858 extern void VP8EncDspInitMIPSdspR2(void); |
| 859 extern void VP8EncDspInitMSA(void); |
| 798 | 860 |
| 799 static volatile VP8CPUInfo enc_last_cpuinfo_used = | 861 static volatile VP8CPUInfo enc_last_cpuinfo_used = |
| 800 (VP8CPUInfo)&enc_last_cpuinfo_used; | 862 (VP8CPUInfo)&enc_last_cpuinfo_used; |
| 801 | 863 |
| 802 WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInit(void) { | 864 WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInit(void) { |
| 803 if (enc_last_cpuinfo_used == VP8GetCPUInfo) return; | 865 if (enc_last_cpuinfo_used == VP8GetCPUInfo) return; |
| 804 | 866 |
| 805 VP8DspInit(); // common inverse transforms | 867 VP8DspInit(); // common inverse transforms |
| 806 InitTables(); | 868 InitTables(); |
| 807 | 869 |
| 808 // default C implementations | 870 // default C implementations |
| 809 VP8CollectHistogram = CollectHistogram; | 871 VP8CollectHistogram = CollectHistogram; |
| 810 VP8ITransform = ITransform; | 872 VP8ITransform = ITransform; |
| 811 VP8FTransform = FTransform; | 873 VP8FTransform = FTransform; |
| 812 VP8FTransform2 = FTransform2; | 874 VP8FTransform2 = FTransform2; |
| 813 VP8FTransformWHT = FTransformWHT; | 875 VP8FTransformWHT = FTransformWHT; |
| 814 VP8EncPredLuma4 = Intra4Preds; | 876 VP8EncPredLuma4 = Intra4Preds; |
| 815 VP8EncPredLuma16 = Intra16Preds; | 877 VP8EncPredLuma16 = Intra16Preds; |
| 816 VP8EncPredChroma8 = IntraChromaPreds; | 878 VP8EncPredChroma8 = IntraChromaPreds; |
| 817 VP8SSE16x16 = SSE16x16; | 879 VP8SSE16x16 = SSE16x16; |
| 818 VP8SSE8x8 = SSE8x8; | 880 VP8SSE8x8 = SSE8x8; |
| 819 VP8SSE16x8 = SSE16x8; | 881 VP8SSE16x8 = SSE16x8; |
| 820 VP8SSE4x4 = SSE4x4; | 882 VP8SSE4x4 = SSE4x4; |
| 821 VP8TDisto4x4 = Disto4x4; | 883 VP8TDisto4x4 = Disto4x4; |
| 822 VP8TDisto16x16 = Disto16x16; | 884 VP8TDisto16x16 = Disto16x16; |
| 885 VP8Mean16x4 = Mean16x4; |
| 823 VP8EncQuantizeBlock = QuantizeBlock; | 886 VP8EncQuantizeBlock = QuantizeBlock; |
| 824 VP8EncQuantize2Blocks = Quantize2Blocks; | 887 VP8EncQuantize2Blocks = Quantize2Blocks; |
| 825 VP8EncQuantizeBlockWHT = QuantizeBlockWHT; | 888 VP8EncQuantizeBlockWHT = QuantizeBlock; |
| 826 VP8Copy4x4 = Copy4x4; | 889 VP8Copy4x4 = Copy4x4; |
| 827 VP8Copy16x8 = Copy16x8; | 890 VP8Copy16x8 = Copy16x8; |
| 828 | 891 |
| 829 // If defined, use CPUInfo() to overwrite some pointers with faster versions. | 892 // If defined, use CPUInfo() to overwrite some pointers with faster versions. |
| 830 if (VP8GetCPUInfo != NULL) { | 893 if (VP8GetCPUInfo != NULL) { |
| 831 #if defined(WEBP_USE_SSE2) | 894 #if defined(WEBP_USE_SSE2) |
| 832 if (VP8GetCPUInfo(kSSE2)) { | 895 if (VP8GetCPUInfo(kSSE2)) { |
| 833 VP8EncDspInitSSE2(); | 896 VP8EncDspInitSSE2(); |
| 834 #if defined(WEBP_USE_SSE41) | 897 #if defined(WEBP_USE_SSE41) |
| 835 if (VP8GetCPUInfo(kSSE4_1)) { | 898 if (VP8GetCPUInfo(kSSE4_1)) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 851 #if defined(WEBP_USE_MIPS32) | 914 #if defined(WEBP_USE_MIPS32) |
| 852 if (VP8GetCPUInfo(kMIPS32)) { | 915 if (VP8GetCPUInfo(kMIPS32)) { |
| 853 VP8EncDspInitMIPS32(); | 916 VP8EncDspInitMIPS32(); |
| 854 } | 917 } |
| 855 #endif | 918 #endif |
| 856 #if defined(WEBP_USE_MIPS_DSP_R2) | 919 #if defined(WEBP_USE_MIPS_DSP_R2) |
| 857 if (VP8GetCPUInfo(kMIPSdspR2)) { | 920 if (VP8GetCPUInfo(kMIPSdspR2)) { |
| 858 VP8EncDspInitMIPSdspR2(); | 921 VP8EncDspInitMIPSdspR2(); |
| 859 } | 922 } |
| 860 #endif | 923 #endif |
| 924 #if defined(WEBP_USE_MSA) |
| 925 if (VP8GetCPUInfo(kMSA)) { |
| 926 VP8EncDspInitMSA(); |
| 927 } |
| 928 #endif |
| 861 } | 929 } |
| 862 enc_last_cpuinfo_used = VP8GetCPUInfo; | 930 enc_last_cpuinfo_used = VP8GetCPUInfo; |
| 863 } | 931 } |
| OLD | NEW |