diff options
author | 2016-07-22 14:06:27 -0700 | |
---|---|---|
committer | 2016-07-22 14:06:27 -0700 | |
commit | 86a6c6d8bdb1055ee2d0689eeaa4a814402e69dd (patch) | |
tree | a38062e21f41537ddb99178b164e08278ff3de45 /src/core/SkLinearBitmapPipeline_core.h | |
parent | 9c1d45d986f3c58593fde0fd62ab22e056dd3881 (diff) |
In the current code, tiling and bilerp sampling are strongly tied together. They can be separated by taking advantage of observation that translating a sample point into filter points in the bilerp stage the filter points will be at most 0.5 outside the tile. This allows simplified repositioning for the various tiling modes; clamp and mirror use min and max while repeat has max -> 0 and 0-> max. This allows bilerp to simply treat the filter points that fall off the tile. This allows tiling and bilerp sampling to be totally separate.
This CL has several parts that are intertwined:
* move pin/wrap functionality into BilerpSampler.
* remove the nearest neighbor and bilerp tilers
* create a simplified general tiler
* remove the pipeline virtual calls bilerpEdge and bilerpSpan because everything works of sample points now.
* redo all the bilerp sampling to use the new local to methods to wrap/pin.
* introduce a new medium rate sample that handles spans with 1 < |dx| < 2.
This change improves the performance as displayed below:
Most of top 25 desktop improves or are the same. A few are worse, but close to the noise floor. In addition, this change has about 3% smaller code.
old time new time new/old
13274693 8414645 0.633886 top25desk_google_com_search_q_c.skp_1
4946466 3258018 0.658656 top25desk_wordpress.skp_1
6977187 5737584 0.822335 top25desk_youtube_com.skp_1
3770021 3296831 0.874486 top25desk_google_com__hl_en_q_b.skp_1
8890813 8600143 0.967307 top25desk_answers_yahoo_com.skp_1
3178974 3094300 0.973364 top25desk_facebook.skp_1
8871835 8711260 0.981901 top25desk_twitter.skp_1
838509 829290 0.989005 top25desk_blogger.skp_1
2821870 2801111 0.992644 top25desk_plus_google_com_11003.skp_1
511978 509530 0.995219 top25desk_techcrunch_com.skp_1
2408588 2397435 0.995369 top25desk_ebay_com.skp_1
4446919 4448004 1.00024 top25desk_espn.skp_1
2863241 2875696 1.00435 top25desk_google_com_calendar_.skp_1
7170086 7208447 1.00535 top25desk_booking_com.skp_1
7356109 7417776 1.00838 top25desk_pinterest.skp_1
5265591 5340392 1.01421 top25desk_weather_com.skp_1
5675244 5774144 1.01743 top25desk_sports_yahoo_com_.skp_1
1048531 1067663 1.01825 top25desk_games_yahoo_com.skp_1
2075501 2115131 1.01909 top25desk_amazon_com.skp_1
4262170 4370441 1.0254 top25desk_news_yahoo_com.skp_1
3789319 3897996 1.02868 top25desk_docs___1_open_documen.skp_1
919336 949979 1.03333 top25desk_wikipedia__1_tab_.skp_1
4274454 4489369 1.05028 top25desk_mail_google_com_mail_.skp_1
4149326 4376556 1.05476 top25desk_linkedin.skp_1
BUG=skia:5566
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2134893002
CQ_INCLUDE_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot;master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/8602ede5fdfa721dcad4dcb11db028c1c24265f1
Review-Url: https://codereview.chromium.org/2134893002
Diffstat (limited to 'src/core/SkLinearBitmapPipeline_core.h')
-rw-r--r-- | src/core/SkLinearBitmapPipeline_core.h | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/core/SkLinearBitmapPipeline_core.h b/src/core/SkLinearBitmapPipeline_core.h index 2c39a38320..5ef6fcab5b 100644 --- a/src/core/SkLinearBitmapPipeline_core.h +++ b/src/core/SkLinearBitmapPipeline_core.h @@ -178,6 +178,15 @@ void span_fallback(Span span, Stage* stage) { stage->pointListFew(count, xs, ys); } } + +inline Sk4f SK_VECTORCALL check_pixel(const Sk4f& pixel) { + SkASSERTF(0.0f <= pixel[0] && pixel[0] <= 1.0f, "pixel[0]: %f", pixel[0]); + SkASSERTF(0.0f <= pixel[1] && pixel[1] <= 1.0f, "pixel[1]: %f", pixel[1]); + SkASSERTF(0.0f <= pixel[2] && pixel[2] <= 1.0f, "pixel[2]: %f", pixel[2]); + SkASSERTF(0.0f <= pixel[3] && pixel[3] <= 1.0f, "pixel[3]: %f", pixel[3]); + return pixel; +} + } // namespace class SkLinearBitmapPipeline::PointProcessorInterface { @@ -201,26 +210,6 @@ public: // Used for nearest neighbor when scale factor is 1.0. The span can just be repeated with no // edge pixel alignment problems. This is for handling a very common case. virtual void repeatSpan(Span span, int32_t repeatCount) = 0; - - // The x's and y's are setup in the following order: - // +--------+--------+ - // | | | - // | px00 | px10 | - // | 0 | 1 | - // +--------+--------+ - // | | | - // | px01 | px11 | - // | 2 | 3 | - // +--------+--------+ - // These pixels coordinates are arranged in the following order in xs and ys: - // px00 px10 px01 px11 - virtual void SK_VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) = 0; - - // A span represents sample points that have been mapped from destination space to source - // space. Each sample point is then expanded to the four bilerp points by add +/- 0.5. The - // resulting Y values my be off the tile. When y +/- 0.5 are more than 1 apart because of - // tiling, the second Y is used to denote the retiled Y value. - virtual void bilerpSpan(Span span, SkScalar y) = 0; }; class SkLinearBitmapPipeline::DestinationInterface { @@ -243,10 +232,10 @@ class SkLinearBitmapPipeline::PixelAccessorInterface { public: virtual ~PixelAccessorInterface() { } virtual void SK_VECTORCALL getFewPixels( - int n, Sk4s xs, Sk4s ys, Sk4f* px0, Sk4f* px1, Sk4f* px2) const = 0; + int n, Sk4i xs, Sk4i ys, Sk4f* px0, Sk4f* px1, Sk4f* px2) const = 0; virtual void SK_VECTORCALL get4Pixels( - Sk4s xs, Sk4s ys, Sk4f* px0, Sk4f* px1, Sk4f* px2, Sk4f* px3) const = 0; + Sk4i xs, Sk4i ys, Sk4f* px0, Sk4f* px1, Sk4f* px2, Sk4f* px3) const = 0; virtual void get4Pixels( const void* src, int index, Sk4f* px0, Sk4f* px1, Sk4f* px2, Sk4f* px3) const = 0; |