OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTextureCompressor_ASTC.h" | 8 #include "SkTextureCompressor_ASTC.h" |
9 #include "SkTextureCompressor_Blitter.h" | 9 #include "SkTextureCompressor_Blitter.h" |
10 | 10 |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 break; | 1701 break; |
1702 | 1702 |
1703 default: | 1703 default: |
1704 SkDEBUGFAIL("Internal ASTC decoding error."); | 1704 SkDEBUGFAIL("Internal ASTC decoding error."); |
1705 break; | 1705 break; |
1706 } | 1706 } |
1707 | 1707 |
1708 // The rest of the CEM config will be between the dual plane bit selecto
r | 1708 // The rest of the CEM config will be between the dual plane bit selecto
r |
1709 // and the texel weight grid. | 1709 // and the texel weight grid. |
1710 const int lowCEM = static_cast<int>(read_astc_bits(fBlock, 23, 29)); | 1710 const int lowCEM = static_cast<int>(read_astc_bits(fBlock, 23, 29)); |
1711 SkASSERT(lastWeight >= dualPlaneBitLoc); | 1711 SkASSERT(lastWeight - dualPlaneBitLoc > 31); |
1712 SkASSERT(lastWeight - dualPlaneBitLoc < 31); | |
1713 int fullCEM = static_cast<int>(read_astc_bits(fBlock, dualPlaneBitLoc, l
astWeight)); | 1712 int fullCEM = static_cast<int>(read_astc_bits(fBlock, dualPlaneBitLoc, l
astWeight)); |
1714 | 1713 |
1715 // Attach the config at the end of the weight grid to the CEM values | 1714 // Attach the config at the end of the weight grid to the CEM values |
1716 // in the beginning of the block. | 1715 // in the beginning of the block. |
1717 fullCEM = (fullCEM << 6) | lowCEM; | 1716 fullCEM = (fullCEM << 6) | lowCEM; |
1718 | 1717 |
1719 // Ignore the two least significant bits, since those are our baseCEM ab
ove. | 1718 // Ignore the two least significant bits, since those are our baseCEM ab
ove. |
1720 fullCEM = fullCEM >> 2; | 1719 fullCEM = fullCEM >> 2; |
1721 | 1720 |
1722 int C[kMaxPartitions]; // Next, decode C and M from the spec (Table C.2.
12) | 1721 int C[kMaxPartitions]; // Next, decode C and M from the spec (Table C.2.
12) |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 read_astc_block(&data, src); | 2032 read_astc_block(&data, src); |
2034 decompress_astc_block(reinterpret_cast<uint8_t*>(colorPtr + x), dstR
owBytes, data); | 2033 decompress_astc_block(reinterpret_cast<uint8_t*>(colorPtr + x), dstR
owBytes, data); |
2035 | 2034 |
2036 // ASTC encoded blocks are 16 bytes (128 bits) large. | 2035 // ASTC encoded blocks are 16 bytes (128 bits) large. |
2037 src += 16; | 2036 src += 16; |
2038 } | 2037 } |
2039 } | 2038 } |
2040 } | 2039 } |
2041 | 2040 |
2042 } // SkTextureCompressor | 2041 } // SkTextureCompressor |
OLD | NEW |