Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: src/utils/SkTextureCompressor.cpp

Issue 390453002: Add support for NEON intrinsics to speed up texture compression. We can (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix arm and neon compatibility Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/SkTextureCompressor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkTextureCompressor.cpp
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp
index c4a6293ed26f6a4407a0f20332e088a8119b8319..2b9234746091bc64ef94af123369154dc799088f 100644
--- a/src/utils/SkTextureCompressor.cpp
+++ b/src/utils/SkTextureCompressor.cpp
@@ -11,6 +11,8 @@
#include "SkData.h"
#include "SkEndian.h"
+#include "SkTextureCompression_opts.h"
+
////////////////////////////////////////////////////////////////////////////////
//
// Utility Functions
@@ -586,15 +588,14 @@ static inline uint64_t interleave6(uint64_t topRows, uint64_t bottomRows) {
// x: b f 00 00 00 a e c g i m 00 00 00 d h j n 00 k o 00 l p
- x |= ((x << 52) & (0x3FULL << 52));
- x = (x | ((x << 20) & (0x3FULL << 28))) >> 16;
+ x = (x | ((x << 52) & (0x3FULL << 52)) | ((x << 20) & (0x3FULL << 28))) >> 16;
-#if defined (SK_CPU_BENDIAN)
// x: 00 00 00 00 00 00 00 00 b f l p a e c g i m k o d h j n
t = (x ^ (x >> 6)) & 0xFC0000ULL;
x = x ^ t ^ (t << 6);
+#if defined (SK_CPU_BENDIAN)
// x: 00 00 00 00 00 00 00 00 b f l p a e i m c g k o d h j n
t = (x ^ (x >> 36)) & 0x3FULL;
@@ -610,11 +611,6 @@ static inline uint64_t interleave6(uint64_t topRows, uint64_t bottomRows) {
#else
// If our CPU is little endian, then the above logic will
// produce the following indices:
- // x: 00 00 00 00 00 00 00 00 c g i m d h b f l p j n a e k o
-
- t = (x ^ (x >> 6)) & 0xFC0000ULL;
- x = x ^ t ^ (t << 6);
-
// x: 00 00 00 00 00 00 00 00 c g i m d h l p b f j n a e k o
t = (x ^ (x >> 36)) & 0xFC0ULL;
@@ -770,19 +766,37 @@ static inline size_t get_compressed_data_size(Format fmt, int width, int height)
}
}
-typedef bool (*CompressBitmapProc)(uint8_t* dst, const uint8_t* src,
- int width, int height, int rowBytes);
-
bool CompressBufferToFormat(uint8_t* dst, const uint8_t* src, SkColorType srcColorType,
- int width, int height, int rowBytes, Format format) {
+ int width, int height, int rowBytes, Format format, bool opt) {
+ CompressionProc proc = NULL;
+ if (opt) {
+ proc = SkTextureCompressorGetPlatformProc(srcColorType, format);
+ }
- CompressBitmapProc kProcMap[kFormatCnt][kLastEnum_SkColorType + 1];
- memset(kProcMap, 0, sizeof(kProcMap));
+ if (NULL == proc) {
+ switch (srcColorType) {
+ case kAlpha_8_SkColorType:
+ {
+ switch (format) {
+ case kLATC_Format:
+ proc = compress_a8_to_latc;
+ break;
+ case kR11_EAC_Format:
+ proc = compress_a8_to_r11eac;
+ break;
+ default:
+ // Do nothing...
+ break;
+ }
+ }
+ break;
- kProcMap[kLATC_Format][kAlpha_8_SkColorType] = compress_a8_to_latc;
- kProcMap[kR11_EAC_Format][kAlpha_8_SkColorType] = compress_a8_to_r11eac;
+ default:
+ // Do nothing...
+ break;
+ }
+ }
- CompressBitmapProc proc = kProcMap[format][srcColorType];
if (NULL != proc) {
return proc(dst, src, width, height, rowBytes);
}
« no previous file with comments | « src/utils/SkTextureCompressor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698