From 864f6bde37273f1f66a74acf0a19eee1210919e1 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Tue, 6 Dec 2016 11:53:06 -0500 Subject: [PATCH] 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 Reviewed-by: Mike Klein --- src/gpu/effects/GrBicubicEffect.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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),