| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/raster/texture_compressor_etc1_sse.h" | 5 #include "cc/raster/texture_compressor_etc1_sse.h" |
| 6 | 6 |
| 7 #include <emmintrin.h> | 7 #include <emmintrin.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 void TextureCompressorETC1SSE::Compress(const uint8_t* src, | 783 void TextureCompressorETC1SSE::Compress(const uint8_t* src, |
| 784 uint8_t* dst, | 784 uint8_t* dst, |
| 785 int width, | 785 int width, |
| 786 int height, | 786 int height, |
| 787 Quality quality) { | 787 Quality quality) { |
| 788 DCHECK_GE(width, 4); | 788 DCHECK_GE(width, 4); |
| 789 DCHECK_EQ((width & 3), 0); | 789 DCHECK_EQ((width & 3), 0); |
| 790 DCHECK_GE(height, 4); | 790 DCHECK_GE(height, 4); |
| 791 DCHECK_EQ((height & 3), 0); | 791 DCHECK_EQ((height & 3), 0); |
| 792 | 792 |
| 793 ALIGNAS(16) uint8_t block[64]; | 793 alignas(16) uint8_t block[64]; |
| 794 __m128i packed[4]; | 794 __m128i packed[4]; |
| 795 __m128i red[4], green[4], blue[4], alpha[4]; | 795 __m128i red[4], green[4], blue[4], alpha[4]; |
| 796 __sse_data data; | 796 __sse_data data; |
| 797 | 797 |
| 798 for (int y = 0; y < height; y += 4, src += width * 4 * 4) { | 798 for (int y = 0; y < height; y += 4, src += width * 4 * 4) { |
| 799 for (int x = 0; x < width; x += 4, dst += 8) { | 799 for (int x = 0; x < width; x += 4, dst += 8) { |
| 800 ExtractBlock(block, src + x * 4, width); | 800 ExtractBlock(block, src + x * 4, width); |
| 801 if (TransposeBlock(block, packed) == false) { | 801 if (TransposeBlock(block, packed) == false) { |
| 802 CompressSolid(dst, block); | 802 CompressSolid(dst, block); |
| 803 } else { | 803 } else { |
| 804 UnpackBlock(packed, blue, green, red, alpha); | 804 UnpackBlock(packed, blue, green, red, alpha); |
| 805 | 805 |
| 806 data.block = block; | 806 data.block = block; |
| 807 data.packed = packed; | 807 data.packed = packed; |
| 808 data.red = red; | 808 data.red = red; |
| 809 data.blue = blue; | 809 data.blue = blue; |
| 810 data.green = green; | 810 data.green = green; |
| 811 | 811 |
| 812 CompressBlock(dst, &data); | 812 CompressBlock(dst, &data); |
| 813 } | 813 } |
| 814 } | 814 } |
| 815 } | 815 } |
| 816 } | 816 } |
| 817 | 817 |
| 818 } // namespace cc | 818 } // namespace cc |
| OLD | NEW |