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

Unified Diff: skia/ext/image_operations.cc

Issue 6334070: SIMD implementation of Convolver for Lanczos filter etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try to fix win Created 9 years, 10 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
Index: skia/ext/image_operations.cc
diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc
index 51d2e4e252c26a690affc0a57232983df2228d72..e58f79d9d00604bbfead19d510a9cabdbea71467 100644
--- a/skia/ext/image_operations.cc
+++ b/skia/ext/image_operations.cc
@@ -316,6 +316,8 @@ void ResizeFilter::ComputeFilters(int src_size,
output->AddFilter(src_begin, &fixed_filter_values[0],
static_cast<int>(fixed_filter_values->size()));
}
+
+ output->PaddingForSIMD(8);
evannier 2011/02/14 23:45:13 At the API layer, this seems wrong to be visible f
fbarchard 2011/02/15 23:16:45 should be 16?
jiesun 2011/02/17 20:17:58 I agree this is ugly, but there is no "finalizefil
jiesun 2011/02/17 20:17:58 16 byte = 8 coefficient because Fixed is short(2by
}
ImageOperations::ResizeMethod ResizeMethodToAlgorithmMethod(
@@ -461,6 +463,32 @@ SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
#endif // OS_POSIX && !OS_MACOSX
}
+#ifdef ARCH_CPU_X86_FAMILY
+#ifdef _MSC_VER
+#include <intrin.h>
+#endif
+#endif
+
+bool ImageOperations::hasSSE2() {
+#ifdef ARCH_CPU_X86_FAMILY
+#ifdef _MSC_VER
+ int cpu_info[4] = {-1};
+ __cpuid(cpu_info, 0);
+ int num_ids = cpu_info[0];
fbarchard 2011/02/15 23:16:45 is this necessary? i thought everyone that suppor
jiesun 2011/02/17 20:17:58 Done.
+ if (num_ids > 0) {
+ __cpuid(cpu_info, 1);
+ return (cpu_info[3] & (1<<26)) != 0;
+ }
+ return false;
+#else
+ // TODO(jiesun): This has to be resolved. We could not use skia implementation.
+ return true;
+#endif
+#else
+ return false;
+#endif
+}
+
// static
SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source,
ResizeMethod method,
@@ -509,7 +537,7 @@ SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source,
BGRAConvolve2D(source_subset, static_cast<int>(source.rowBytes()),
!source.isOpaque(), filter.x_filter(), filter.y_filter(),
static_cast<int>(result.rowBytes()),
- static_cast<unsigned char*>(result.getPixels()));
+ static_cast<unsigned char*>(result.getPixels()), hasSSE2());
// Preserve the "opaque" flag for use as an optimization later.
result.setIsOpaque(source.isOpaque());

Powered by Google App Engine
This is Rietveld 408576698