aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrBicubicEffect.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2016-12-06 11:53:06 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-06 17:54:37 +0000
commit864f6bde37273f1f66a74acf0a19eee1210919e1 (patch)
treeba6a49ced9835df8351e80a93eaa3eeec631214a /src/gpu/effects/GrBicubicEffect.cpp
parent886cf53447a7f78a80476742d50424a5d45c3108 (diff)
Add comment explaining the derivation of our Mitchell coefficients
BUG=skia: Change-Id: I8866df425ee9837e75f0b2f76777f7e5d68fb21d Reviewed-on: https://skia-review.googlesource.com/5624 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/gpu/effects/GrBicubicEffect.cpp')
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 8d16f1dd54..5be39c1ea1 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -15,6 +15,22 @@
#define DS(x) SkDoubleToScalar(x)
+/*
+ * Filter weights come from Don Mitchell & Arun Netravali's 'Reconstruction Filters in Computer
+ * Graphics', ACM SIGGRAPH Computer Graphics 22, 4 (Aug. 1988).
+ * ACM DL: http://dl.acm.org/citation.cfm?id=378514
+ * Free : http://www.cs.utexas.edu/users/fussell/courses/cs384g/lectures/mitchell/Mitchell.pdf
+ *
+ * The authors define a family of cubic filters with two free parameters (B and C):
+ *
+ * { (12 - 9B - 6C)|x|^3 + (-18 + 12B + 6C)|x|^2 + (6 - 2B) if |x| < 1
+ * k(x) = 1/6 { (-B - 6C)|x|^3 + (6B + 30C)|x|^2 + (-12B - 48C)|x| + (8B + 24C) if 1 <= |x| < 2
+ * { 0 otherwise
+ *
+ * Various well-known cubic splines can be generated, and the authors select (1/3, 1/3) as their
+ * favorite overall spline - this is now commonly known as the Mitchell filter, and is the source
+ * of the specific weights below.
+ */
const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = {
DS( 1.0 / 18.0), DS(-9.0 / 18.0), DS( 15.0 / 18.0), DS( -7.0 / 18.0),
DS(16.0 / 18.0), DS( 0.0 / 18.0), DS(-36.0 / 18.0), DS( 21.0 / 18.0),