46 float tx,
float ty, int16_t p00, int16_t p10, int16_t p01, int16_t p11) {
48 double dtx(tx), dty(ty);
50 double top = (1.0 - dtx) * p00 + dtx * p10;
51 double bottom = (1.0 - dtx) * p01 + dtx * p11;
53 return (1.0 - dty) * top + dty * bottom;
57 float tx,
float ty, int16_t p00, int16_t p10, int16_t p01, int16_t p11) {
58 int32_t ftx(floor(tx * 65536.0f + 0.5f));
59 int64_t top = ftx * (p10 - p00) + 65536 * p00;
60 int64_t bottom = ftx * (p11 - p01) + 65536 * p01;
62 int64_t fty(floor(ty * 65536.0f + 0.5f));
63 int64_t temp = fty * (bottom - top) + top * 65536LL;
64 int64_t rounded = temp + (1LL << 31);
69static int16_t
bilerp_1(
float tx,
float ty, int16_t p00, int16_t p10, int16_t p01, int16_t p11) {
70 const int logPixelScale = 7;
71 const int16_t half = 1 << logPixelScale;
72 I16 qtx = floor(tx * 65536.0f - 32768.0f + 0.5f);
73 I16 qw = (p10 - p00) << logPixelScale;
74 U16 qm = (p10 + p00) << logPixelScale;
77 qw = (p11 - p01) << logPixelScale;
78 qm = (p11 + p01) << logPixelScale;
82 I16 qty = floor(ty * 65536.0f - 32768.0f + 0.5f);
85 qm = (
U16)bottom + (
U16)top;
88 return (scaledAnswer[0] + half) >> (logPixelScale + 1);
95 auto interesting = {0, 1, 2, 3, 4, 5, 6, 7, 8, 60, 61, 62, 63, 64, 65, 66, 67, 68, 124, 125,
96 126, 127, 128, 129, 130, 131, 132, 188, 189, 190, 191, 192, 193, 194,
97 195, 196, 248, 249, 250, 251, 252, 253, 254, 255};
98 for (
float tx : {0.0f, 0.25f, 0.5f, 0.75f, 1.0f - 1.0f/65536.0f})
99 for (
float ty : {0.0f, 0.25f, 0.5f, 0.75f, 1.0f - 1.0f/65536.0f})
100 for (
int p00 : interesting)
101 for (
int p01 : interesting)
102 for (
int p10 : interesting)
103 for (
int p11 : interesting) {
106 int16_t golden = floor(l + 0.5);
109 int16_t candidate =
bilerp(tx, ty, p00, p10, p01, p11);
110 stats.log(golden, candidate);
static SkScalar bilerp(SkScalar tx, SkScalar ty, SkScalar c00, SkScalar c10, SkScalar c01, SkScalar c11)
static double golden_bilerp2(float tx, float ty, int16_t p00, int16_t p10, int16_t p01, int16_t p11)
static int16_t full_res_bilerp(float tx, float ty, int16_t p00, int16_t p10, int16_t p01, int16_t p11)
static float golden_bilerp(float tx, float ty, int16_t p00, int16_t p10, int16_t p01, int16_t p11)
static int16_t bilerp_1(float tx, float ty, int16_t p00, int16_t p10, int16_t p01, int16_t p11)