Use RasterPipeline to support full precision on 16-bit RGBA pngs

TODO: Support more precision on 16-bit RGB pngs

BUG=skia:

CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD

Change-Id: I89dfef3b4887b9c4895c17309933883ab90ffa4d
Reviewed-on: https://skia-review.googlesource.com/6260
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>
diff --git a/include/core/SkColorSpaceXform.h b/include/core/SkColorSpaceXform.h
index b750c09..299fe26 100644
--- a/include/core/SkColorSpaceXform.h
+++ b/include/core/SkColorSpaceXform.h
@@ -27,8 +27,12 @@
     enum ColorFormat {
         kRGBA_8888_ColorFormat,
         kBGRA_8888_ColorFormat,
-        kRGBA_F16_ColorFormat,
-        kRGBA_F32_ColorFormat,
+
+        // Unsigned, big-endian, 16-bit integer
+        kRGBA_U16_BE_ColorFormat,  // Src only
+
+        kRGBA_F16_ColorFormat,     // Dst only
+        kRGBA_F32_ColorFormat,     // Dst only
     };
 
     /**
@@ -42,7 +46,6 @@
      *  @param len            Number of pixels in the buffers
      *  @param dstColorFormat Describes color format of |dst|
      *  @param srcColorFormat Describes color format of |src|
-     *                        Must be kRGBA_8888 or kBGRA_8888
      *  @param alphaType      Describes alpha properties of the |dst| (and |src|)
      *                        kUnpremul preserves input alpha values
      *                        kPremul   performs a premultiplication and also preserves alpha values
diff --git a/infra/bots/assets/skimage/VERSION b/infra/bots/assets/skimage/VERSION
index 8e2afd3..25bf17f 100644
--- a/infra/bots/assets/skimage/VERSION
+++ b/infra/bots/assets/skimage/VERSION
@@ -1 +1 @@
-17
\ No newline at end of file
+18
\ No newline at end of file
diff --git a/infra/bots/tasks.json b/infra/bots/tasks.json
index 18813bd..b2af649 100644
--- a/infra/bots/tasks.json
+++ b/infra/bots/tasks.json
@@ -3443,7 +3443,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3492,7 +3492,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3541,7 +3541,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3590,7 +3590,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3639,7 +3639,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3688,7 +3688,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3737,7 +3737,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3786,7 +3786,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3835,7 +3835,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3884,7 +3884,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3933,7 +3933,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -3982,7 +3982,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4031,7 +4031,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4080,7 +4080,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4129,7 +4129,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4178,7 +4178,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4227,7 +4227,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4276,7 +4276,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4325,7 +4325,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4374,7 +4374,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4423,7 +4423,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4472,7 +4472,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4521,7 +4521,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4570,7 +4570,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4619,7 +4619,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4668,7 +4668,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4717,7 +4717,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4766,7 +4766,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4815,7 +4815,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4864,7 +4864,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -4913,7 +4913,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5040,7 +5040,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5088,7 +5088,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5136,7 +5136,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5185,7 +5185,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5234,7 +5234,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5282,7 +5282,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5330,7 +5330,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5378,7 +5378,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5427,7 +5427,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5481,7 +5481,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5535,7 +5535,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5584,7 +5584,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5633,7 +5633,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5686,7 +5686,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5735,7 +5735,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5784,7 +5784,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5833,7 +5833,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5932,7 +5932,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -5980,7 +5980,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6028,7 +6028,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6076,7 +6076,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6124,7 +6124,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6172,7 +6172,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6220,7 +6220,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6268,7 +6268,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6316,7 +6316,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6364,7 +6364,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6412,7 +6412,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6460,7 +6460,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6508,7 +6508,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6556,7 +6556,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6604,7 +6604,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6652,7 +6652,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6700,7 +6700,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6748,7 +6748,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6796,7 +6796,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6844,7 +6844,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6892,7 +6892,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6940,7 +6940,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -6988,7 +6988,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7036,7 +7036,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7084,7 +7084,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7132,7 +7132,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7180,7 +7180,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7228,7 +7228,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7276,7 +7276,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7324,7 +7324,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7372,7 +7372,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7420,7 +7420,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7468,7 +7468,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7517,7 +7517,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7566,7 +7566,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7615,7 +7615,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7664,7 +7664,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7712,7 +7712,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7760,7 +7760,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7809,7 +7809,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7858,7 +7858,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7907,7 +7907,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -7956,7 +7956,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8005,7 +8005,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8054,7 +8054,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8103,7 +8103,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8152,7 +8152,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8201,7 +8201,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8250,7 +8250,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8299,7 +8299,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8348,7 +8348,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8397,7 +8397,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8446,7 +8446,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8495,7 +8495,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8544,7 +8544,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8593,7 +8593,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8642,7 +8642,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8691,7 +8691,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8740,7 +8740,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8789,7 +8789,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8838,7 +8838,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8887,7 +8887,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8936,7 +8936,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -8985,7 +8985,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9034,7 +9034,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9083,7 +9083,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9132,7 +9132,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9181,7 +9181,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9230,7 +9230,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9279,7 +9279,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9328,7 +9328,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9377,7 +9377,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9425,7 +9425,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9473,7 +9473,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9522,7 +9522,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9571,7 +9571,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9619,7 +9619,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9667,7 +9667,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9715,7 +9715,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9764,7 +9764,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9818,7 +9818,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9872,7 +9872,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9921,7 +9921,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -9970,7 +9970,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10024,7 +10024,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10077,7 +10077,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10130,7 +10130,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10179,7 +10179,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10303,7 +10303,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10352,7 +10352,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10401,7 +10401,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10450,7 +10450,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10498,7 +10498,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10546,7 +10546,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10594,7 +10594,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10642,7 +10642,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10690,7 +10690,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10738,7 +10738,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10786,7 +10786,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10834,7 +10834,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10882,7 +10882,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10930,7 +10930,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -10978,7 +10978,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11026,7 +11026,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11074,7 +11074,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11122,7 +11122,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11170,7 +11170,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11218,7 +11218,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11266,7 +11266,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11314,7 +11314,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11362,7 +11362,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11410,7 +11410,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11458,7 +11458,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11506,7 +11506,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11554,7 +11554,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11602,7 +11602,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11650,7 +11650,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11698,7 +11698,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11746,7 +11746,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11794,7 +11794,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11842,7 +11842,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11890,7 +11890,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11938,7 +11938,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -11987,7 +11987,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -12036,7 +12036,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -12085,7 +12085,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -12134,7 +12134,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -12183,7 +12183,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -12232,7 +12232,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
@@ -12280,7 +12280,7 @@
         {
           "name": "skia/bots/skimage",
           "path": "skimage",
-          "version": "version:17"
+          "version": "version:18"
         },
         {
           "name": "skia/bots/skp",
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index ebd0b74..87904e5 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -427,8 +427,19 @@
     }
 }
 
+static SkColorSpaceXform::ColorFormat png_select_xform_format(const SkEncodedInfo& info) {
+    // We always use kRGBA because color PNGs are always RGB or RGBA.
+    // TODO (msarett): Support kRGB_U16 inputs as well.
+    if (16 == info.bitsPerComponent() && SkEncodedInfo::kRGBA_Color == info.color()) {
+        return SkColorSpaceXform::kRGBA_U16_BE_ColorFormat;
+    }
+
+    return SkColorSpaceXform::kRGBA_8888_ColorFormat;
+}
+
 void SkPngCodec::applyXformRow(void* dst, const void* src) {
-    const SkColorSpaceXform::ColorFormat srcColorFormat = select_xform_format(kXformSrcColorType);
+    const SkColorSpaceXform::ColorFormat srcColorFormat =
+            png_select_xform_format(this->getEncodedInfo());
     switch (fXformMode) {
         case kSwizzleOnly_XformMode:
             fSwizzler->swizzle(dst, (const uint8_t*) src);
@@ -1075,7 +1086,7 @@
 
     // If the image is 32-bit RGBA and we have a color xform, we can skip the swizzler.
     if (this->colorXform() && SkEncodedInfo::kRGBA_Color == this->getEncodedInfo().color() &&
-        8 == this->getEncodedInfo().bitsPerComponent() && !options.fSubset)
+        !options.fSubset)
     {
         fXformMode = kColorOnly_XformMode;
         return true;
@@ -1090,7 +1101,7 @@
     // Copy the color table to the client if they request kIndex8 mode.
     copy_color_table(dstInfo, fColorTable.get(), ctable, ctableCount);
 
-    this->initializeSwizzler(dstInfo, options);
+    this->initializeSwizzler(dstInfo, options, false);
     return true;
 }
 
@@ -1113,7 +1124,8 @@
     }
 }
 
-void SkPngCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) {
+void SkPngCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options,
+                                    bool skipFormatConversion) {
     SkImageInfo swizzlerInfo = dstInfo;
     Options swizzlerOptions = options;
     fXformMode = kSwizzleOnly_XformMode;
@@ -1135,7 +1147,7 @@
 
     const SkPMColor* colors = get_color_ptr(fColorTable.get());
     fSwizzler.reset(SkSwizzler::CreateSwizzler(this->getEncodedInfo(), colors, swizzlerInfo,
-                                               swizzlerOptions));
+                                               swizzlerOptions, nullptr, skipFormatConversion));
     SkASSERT(fSwizzler);
 }
 
@@ -1144,7 +1156,7 @@
         return fSwizzler.get();
     }
 
-    this->initializeSwizzler(this->dstInfo(), this->options());
+    this->initializeSwizzler(this->dstInfo(), this->options(), true);
     return fSwizzler.get();
 }
 
diff --git a/src/codec/SkPngCodec.h b/src/codec/SkPngCodec.h
index c246887..7d7547c 100644
--- a/src/codec/SkPngCodec.h
+++ b/src/codec/SkPngCodec.h
@@ -119,7 +119,7 @@
     // Helper to set up swizzler, color xforms, and color table. Also calls png_read_update_info.
     bool initializeXforms(const SkImageInfo& dstInfo, const Options&, SkPMColor* colorPtr,
                           int* colorCount);
-    void initializeSwizzler(const SkImageInfo& dstInfo, const Options&);
+    void initializeSwizzler(const SkImageInfo& dstInfo, const Options&, bool skipFormatConversion);
     void allocateStorage(const SkImageInfo& dstInfo);
     void destroyReadStruct();
 
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp
index 415f0f1..9a339d4 100644
--- a/src/codec/SkSwizzler.cpp
+++ b/src/codec/SkSwizzler.cpp
@@ -51,6 +51,16 @@
     }
 }
 
+static void sample8(void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset,
+        const SkPMColor ctable[]) {
+    src += offset;
+    uint64_t* dst64 = (uint64_t*) dst;
+    for (int x = 0; x < width; x++) {
+        dst64[x] = *((const uint64_t*) src);
+        src += deltaSrc;
+    }
+}
+
 // kBit
 // These routines exclusively choose between white and black
 
@@ -808,7 +818,9 @@
                 break;
             case kRGBA_8888_SkColorType:
             case kBGRA_8888_SkColorType:
-                proc = &sample4;
+                SkASSERT(16 == encodedInfo.bitsPerComponent() ||
+                          8 == encodedInfo.bitsPerComponent());
+                proc = (8 == encodedInfo.bitsPerComponent()) ? &sample4 : &sample8;
                 fastProc = &copy;
                 break;
             default:
diff --git a/src/core/SkColorSpaceXform.cpp b/src/core/SkColorSpaceXform.cpp
index b73a3cf..bdb3784 100644
--- a/src/core/SkColorSpaceXform.cpp
+++ b/src/core/SkColorSpaceXform.cpp
@@ -327,110 +327,14 @@
 
     switch (csm) {
         case kNone_ColorSpaceMatch:
-            switch (dstSpaceXYZ->gammaNamed()) {
-                case kSRGB_SkGammaNamed:
-                    if (srcSpaceXYZ->gammaIsLinear()) {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kLinear_SrcGamma, kSRGB_DstGamma, kNone_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    } else {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kTable_SrcGamma, kSRGB_DstGamma, kNone_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    }
-                case k2Dot2Curve_SkGammaNamed:
-                    if (srcSpaceXYZ->gammaIsLinear()) {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kLinear_SrcGamma, k2Dot2_DstGamma, kNone_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    } else {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kTable_SrcGamma, k2Dot2_DstGamma, kNone_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    }
-                case kLinear_SkGammaNamed:
-                    if (srcSpaceXYZ->gammaIsLinear()) {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kLinear_SrcGamma, kLinear_DstGamma, kNone_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    } else {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kTable_SrcGamma, kLinear_DstGamma, kNone_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    }
-                default:
-                    if (srcSpaceXYZ->gammaIsLinear()) {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kLinear_SrcGamma, kTable_DstGamma, kNone_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    } else {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kTable_SrcGamma, kTable_DstGamma, kNone_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    }
-            }
+            return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
+                    <kNone_ColorSpaceMatch>(srcSpaceXYZ, srcToDst, dstSpaceXYZ));
         case kGamut_ColorSpaceMatch:
-            switch (dstSpaceXYZ->gammaNamed()) {
-                case kSRGB_SkGammaNamed:
-                    if (srcSpaceXYZ->gammaIsLinear()) {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kLinear_SrcGamma, kSRGB_DstGamma, kGamut_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    } else {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kTable_SrcGamma, kSRGB_DstGamma, kGamut_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    }
-                case k2Dot2Curve_SkGammaNamed:
-                    if (srcSpaceXYZ->gammaIsLinear()) {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kLinear_SrcGamma, k2Dot2_DstGamma, kGamut_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    } else {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kTable_SrcGamma, k2Dot2_DstGamma, kGamut_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    }
-                case kLinear_SkGammaNamed:
-                    if (srcSpaceXYZ->gammaIsLinear()) {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kLinear_SrcGamma, kLinear_DstGamma, kGamut_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    } else {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kTable_SrcGamma, kLinear_DstGamma, kGamut_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    }
-                default:
-                    if (srcSpaceXYZ->gammaIsLinear()) {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kLinear_SrcGamma, kTable_DstGamma, kGamut_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    } else {
-                        return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                                <kTable_SrcGamma, kTable_DstGamma, kGamut_ColorSpaceMatch>
-                                (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                    }
-            }
+            return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
+                    <kGamut_ColorSpaceMatch>(srcSpaceXYZ, srcToDst, dstSpaceXYZ));
         case kFull_ColorSpaceMatch:
-            switch (dstSpaceXYZ->gammaNamed()) {
-                case kSRGB_SkGammaNamed:
-                    return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                            <kTable_SrcGamma, kSRGB_DstGamma, kFull_ColorSpaceMatch>
-                            (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                case k2Dot2Curve_SkGammaNamed:
-                    return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                            <kTable_SrcGamma, k2Dot2_DstGamma, kFull_ColorSpaceMatch>
-                            (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                case kLinear_SkGammaNamed:
-                    return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                            <kLinear_SrcGamma, kLinear_DstGamma, kFull_ColorSpaceMatch>
-                            (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-                default:
-                    return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-                            <kTable_SrcGamma, kTable_DstGamma, kFull_ColorSpaceMatch>
-                            (srcSpaceXYZ, srcToDst, dstSpaceXYZ));
-            }
+            return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
+                    <kFull_ColorSpaceMatch>(srcSpaceXYZ, srcToDst, dstSpaceXYZ));
         default:
             SkASSERT(false);
             return nullptr;
@@ -1065,8 +969,8 @@
     }
 }
 
-template <SrcGamma kSrc, DstGamma kDst, ColorSpaceMatch kCSM>
-SkColorSpaceXform_XYZ<kSrc, kDst, kCSM>
+template <ColorSpaceMatch kCSM>
+SkColorSpaceXform_XYZ<kCSM>
 ::SkColorSpaceXform_XYZ(SkColorSpace_XYZ* srcSpace, const SkMatrix44& srcToDst,
                         SkColorSpace_XYZ* dstSpace)
 {
@@ -1093,6 +997,29 @@
 
     const int numDstTables = num_tables(dstSpace);
     dstSpace->toDstGammaTables(fDstGammaTables, &fDstStorage, numDstTables);
+
+    if (srcSpace->gammaIsLinear()) {
+        fSrcGamma = kLinear_SrcGamma;
+    } else if (kSRGB_SkGammaNamed == srcSpace->gammaNamed()) {
+        fSrcGamma = kSRGB_SrcGamma;
+    } else {
+        fSrcGamma = kTable_SrcGamma;
+    }
+
+    switch (dstSpace->gammaNamed()) {
+        case kSRGB_SkGammaNamed:
+            fDstGamma = kSRGB_DstGamma;
+            break;
+        case k2Dot2Curve_SkGammaNamed:
+            fDstGamma = k2Dot2_DstGamma;
+            break;
+        case kLinear_SkGammaNamed:
+            fDstGamma = kLinear_DstGamma;
+            break;
+        default:
+            fDstGamma = kTable_DstGamma;
+            break;
+    }
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1119,27 +1046,28 @@
     }
 }
 
-template <SrcGamma kSrc, DstFormat kDst, ColorSpaceMatch kCSM>
+template <DstFormat kDst, ColorSpaceMatch kCSM>
 static AI bool apply_set_src(void* dst, const void* src, int len, SkAlphaType alphaType,
                              const float* const srcTables[3], const float matrix[13],
                              const uint8_t* const dstTables[3],
-                             SkColorSpaceXform::ColorFormat srcColorFormat) {
+                             SkColorSpaceXform::ColorFormat srcColorFormat,
+                             SrcGamma srcGamma) {
     switch (srcColorFormat) {
         case SkColorSpaceXform::kRGBA_8888_ColorFormat:
-            switch (kSrc) {
+            switch (srcGamma) {
                 case kLinear_SrcGamma:
                     return apply_set_alpha<kRGBA_8888_Linear_SrcFormat, kDst, kCSM>
                             (dst, src, len, alphaType, nullptr, matrix, dstTables);
-                case kTable_SrcGamma:
+                default:
                     return apply_set_alpha<kRGBA_8888_Table_SrcFormat, kDst, kCSM>
                             (dst, src, len, alphaType, srcTables, matrix, dstTables);
             }
         case SkColorSpaceXform::kBGRA_8888_ColorFormat:
-            switch (kSrc) {
+            switch (srcGamma) {
                 case kLinear_SrcGamma:
                     return apply_set_alpha<kBGRA_8888_Linear_SrcFormat, kDst, kCSM>
                             (dst, src, len, alphaType, nullptr, matrix, dstTables);
-                case kTable_SrcGamma:
+                default:
                     return apply_set_alpha<kBGRA_8888_Table_SrcFormat, kDst, kCSM>
                             (dst, src, len, alphaType, srcTables, matrix, dstTables);
             }
@@ -1150,8 +1078,8 @@
 
 #undef AI
 
-template <SrcGamma kSrc, DstGamma kDst, ColorSpaceMatch kCSM>
-bool SkColorSpaceXform_XYZ<kSrc, kDst, kCSM>
+template <ColorSpaceMatch kCSM>
+bool SkColorSpaceXform_XYZ<kCSM>
 ::onApply(ColorFormat dstColorFormat, void* dst, ColorFormat srcColorFormat, const void* src,
           int len, SkAlphaType alphaType) const
 {
@@ -1176,55 +1104,55 @@
         }
     }
 
-    if (kRGBA_F32_ColorFormat == dstColorFormat) {
+    if (kRGBA_F32_ColorFormat == dstColorFormat || kRGBA_U16_BE_ColorFormat == srcColorFormat) {
         return this->applyPipeline(dstColorFormat, dst, srcColorFormat, src, len, alphaType);
     }
 
     switch (dstColorFormat) {
         case kRGBA_8888_ColorFormat:
-            switch (kDst) {
+            switch (fDstGamma) {
                 case kLinear_DstGamma:
-                    return apply_set_src<kSrc, kRGBA_8888_Linear_DstFormat, kCSM>
+                    return apply_set_src<kRGBA_8888_Linear_DstFormat, kCSM>
                             (dst, src, len, alphaType, fSrcGammaTables, fSrcToDst, nullptr,
-                             srcColorFormat);
+                             srcColorFormat, fSrcGamma);
                 case kSRGB_DstGamma:
-                    return apply_set_src<kSrc, kRGBA_8888_SRGB_DstFormat, kCSM>
+                    return apply_set_src<kRGBA_8888_SRGB_DstFormat, kCSM>
                             (dst, src, len, alphaType, fSrcGammaTables, fSrcToDst, nullptr,
-                             srcColorFormat);
+                             srcColorFormat, fSrcGamma);
                 case k2Dot2_DstGamma:
-                    return apply_set_src<kSrc, kRGBA_8888_2Dot2_DstFormat, kCSM>
+                    return apply_set_src<kRGBA_8888_2Dot2_DstFormat, kCSM>
                             (dst, src, len, alphaType, fSrcGammaTables, fSrcToDst, nullptr,
-                             srcColorFormat);
+                             srcColorFormat, fSrcGamma);
                 case kTable_DstGamma:
-                    return apply_set_src<kSrc, kRGBA_8888_Table_DstFormat, kCSM>
+                    return apply_set_src<kRGBA_8888_Table_DstFormat, kCSM>
                             (dst, src, len, alphaType, fSrcGammaTables, fSrcToDst, fDstGammaTables,
-                             srcColorFormat);
+                             srcColorFormat, fSrcGamma);
             }
         case kBGRA_8888_ColorFormat:
-            switch (kDst) {
+            switch (fDstGamma) {
                 case kLinear_DstGamma:
-                    return apply_set_src<kSrc, kBGRA_8888_Linear_DstFormat, kCSM>
+                    return apply_set_src<kBGRA_8888_Linear_DstFormat, kCSM>
                             (dst, src, len, alphaType, fSrcGammaTables, fSrcToDst, nullptr,
-                             srcColorFormat);
+                             srcColorFormat, fSrcGamma);
                 case kSRGB_DstGamma:
-                    return apply_set_src<kSrc, kBGRA_8888_SRGB_DstFormat, kCSM>
+                    return apply_set_src<kBGRA_8888_SRGB_DstFormat, kCSM>
                             (dst, src, len, alphaType, fSrcGammaTables, fSrcToDst, nullptr,
-                             srcColorFormat);
+                             srcColorFormat, fSrcGamma);
                 case k2Dot2_DstGamma:
-                    return apply_set_src<kSrc, kBGRA_8888_2Dot2_DstFormat, kCSM>
+                    return apply_set_src<kBGRA_8888_2Dot2_DstFormat, kCSM>
                             (dst, src, len, alphaType, fSrcGammaTables, fSrcToDst, nullptr,
-                             srcColorFormat);
+                             srcColorFormat, fSrcGamma);
                 case kTable_DstGamma:
-                    return apply_set_src<kSrc, kBGRA_8888_Table_DstFormat, kCSM>
+                    return apply_set_src<kBGRA_8888_Table_DstFormat, kCSM>
                             (dst, src, len, alphaType, fSrcGammaTables, fSrcToDst, fDstGammaTables,
-                             srcColorFormat);
+                             srcColorFormat, fSrcGamma);
             }
         case kRGBA_F16_ColorFormat:
-            switch (kDst) {
+            switch (fDstGamma) {
                 case kLinear_DstGamma:
-                    return apply_set_src<kSrc, kF16_Linear_DstFormat, kCSM>
+                    return apply_set_src<kF16_Linear_DstFormat, kCSM>
                             (dst, src, len, alphaType, fSrcGammaTables, fSrcToDst, nullptr,
-                             srcColorFormat);
+                             srcColorFormat, fSrcGamma);
                 default:
                     return false;
             }
@@ -1242,8 +1170,8 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-template <SrcGamma kSrc, DstGamma kDst, ColorSpaceMatch kCSM>
-bool SkColorSpaceXform_XYZ<kSrc, kDst, kCSM>
+template <ColorSpaceMatch kCSM>
+bool SkColorSpaceXform_XYZ<kCSM>
 ::applyPipeline(ColorFormat dstColorFormat, void* dst, ColorFormat srcColorFormat,
                 const void* src, int len, SkAlphaType alphaType) const {
     SkRasterPipeline pipeline;
@@ -1251,10 +1179,10 @@
     LoadTablesContext loadTables;
     switch (srcColorFormat) {
         case kRGBA_8888_ColorFormat:
-            if (kLinear_SrcGamma == kSrc) {
+            if (kLinear_SrcGamma == fSrcGamma) {
                 pipeline.append(SkRasterPipeline::load_8888, &src);
             } else {
-                loadTables.fSrc = (const uint32_t*) src;
+                loadTables.fSrc = src;
                 loadTables.fR = fSrcGammaTables[0];
                 loadTables.fG = fSrcGammaTables[1];
                 loadTables.fB = fSrcGammaTables[2];
@@ -1263,10 +1191,10 @@
 
             break;
         case kBGRA_8888_ColorFormat:
-            if (kLinear_SrcGamma == kSrc) {
+            if (kLinear_SrcGamma == fSrcGamma) {
                 pipeline.append(SkRasterPipeline::load_8888, &src);
             } else {
-                loadTables.fSrc = (const uint32_t*) src;
+                loadTables.fSrc = src;
                 loadTables.fR = fSrcGammaTables[2];
                 loadTables.fG = fSrcGammaTables[1];
                 loadTables.fB = fSrcGammaTables[0];
@@ -1275,6 +1203,24 @@
 
             pipeline.append(SkRasterPipeline::swap_rb);
             break;
+        case kRGBA_U16_BE_ColorFormat:
+            switch (fSrcGamma) {
+                case kLinear_SrcGamma:
+                    pipeline.append(SkRasterPipeline::load_u16_be, &src);
+                    break;
+                case kSRGB_SrcGamma:
+                    pipeline.append(SkRasterPipeline::load_u16_be, &src);
+                    pipeline.append_from_srgb(kUnpremul_SkAlphaType);
+                    break;
+                case kTable_SrcGamma:
+                    loadTables.fSrc = src;
+                    loadTables.fR = fSrcGammaTables[0];
+                    loadTables.fG = fSrcGammaTables[1];
+                    loadTables.fB = fSrcGammaTables[2];
+                    pipeline.append(SkRasterPipeline::load_tables_u16_be, &loadTables);
+                    break;
+            }
+            break;
         default:
             return false;
     }
@@ -1296,7 +1242,7 @@
     }
 
     StoreTablesContext storeTables;
-    switch (kDst) {
+    switch (fDstGamma) {
         case kSRGB_DstGamma:
             pipeline.append(SkRasterPipeline::to_srgb);
             break;
@@ -1309,7 +1255,7 @@
 
     switch (dstColorFormat) {
         case kRGBA_8888_ColorFormat:
-            if (kTable_DstGamma == kDst) {
+            if (kTable_DstGamma == fDstGamma) {
                 storeTables.fDst = (uint32_t*) dst;
                 storeTables.fR = fDstGammaTables[0];
                 storeTables.fG = fDstGammaTables[1];
@@ -1321,7 +1267,7 @@
             }
             break;
         case kBGRA_8888_ColorFormat:
-            if (kTable_DstGamma == kDst) {
+            if (kTable_DstGamma == fDstGamma) {
                 storeTables.fDst = (uint32_t*) dst;
                 storeTables.fR = fDstGammaTables[2];
                 storeTables.fG = fDstGammaTables[1];
@@ -1335,17 +1281,19 @@
             }
             break;
         case kRGBA_F16_ColorFormat:
-            if (kLinear_DstGamma != kDst) {
+            if (kLinear_DstGamma != fDstGamma) {
                 return false;
             }
             pipeline.append(SkRasterPipeline::store_f16, &dst);
             break;
         case kRGBA_F32_ColorFormat:
-            if (kLinear_DstGamma != kDst) {
+            if (kLinear_DstGamma != fDstGamma) {
                 return false;
             }
             pipeline.append(SkRasterPipeline::store_f32, &dst);
             break;
+        default:
+            return false;
     }
 
     pipeline.run(0, 0, len);
@@ -1356,6 +1304,5 @@
 
 std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(SkColorSpace_XYZ* space) {
     return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_XYZ
-            <kTable_SrcGamma, kTable_DstGamma, kNone_ColorSpaceMatch>
-            (space, SkMatrix::I(), space));
+            <kNone_ColorSpaceMatch>(space, SkMatrix::I(), space));
 }
diff --git a/src/core/SkColorSpaceXform_A2B.cpp b/src/core/SkColorSpaceXform_A2B.cpp
index f65df4c..0f284e4 100644
--- a/src/core/SkColorSpaceXform_A2B.cpp
+++ b/src/core/SkColorSpaceXform_A2B.cpp
@@ -32,6 +32,9 @@
         case kRGBA_8888_ColorFormat:
             pipeline.append(SkRasterPipeline::load_8888, &src);
             break;
+        case kRGBA_U16_BE_ColorFormat:
+            pipeline.append(SkRasterPipeline::load_u16_be, &src);
+            break;
         default:
             SkCSXformPrintf("F16/F32 source color format not supported\n");
             return false;
@@ -63,6 +66,8 @@
             }
             pipeline.append(SkRasterPipeline::store_f32, &dst);
             break;
+        default:
+            return false;
     }
     pipeline.run(0,0, count);
 
diff --git a/src/core/SkColorSpaceXform_Base.h b/src/core/SkColorSpaceXform_Base.h
index e208573..48035c5 100644
--- a/src/core/SkColorSpaceXform_Base.h
+++ b/src/core/SkColorSpaceXform_Base.h
@@ -34,6 +34,7 @@
 enum SrcGamma {
     kLinear_SrcGamma,
     kTable_SrcGamma,
+    kSRGB_SrcGamma,
 };
 
 enum DstGamma {
@@ -49,7 +50,7 @@
     kFull_ColorSpaceMatch,
 };
 
-template <SrcGamma kSrc, DstGamma kDst, ColorSpaceMatch kCSM>
+template <ColorSpaceMatch kCSM>
 class SkColorSpaceXform_XYZ : public SkColorSpaceXform_Base {
 protected:
     bool onApply(ColorFormat dstFormat, void* dst, ColorFormat srcFormat, const void* src,
@@ -63,23 +64,26 @@
                           SkColorSpace_XYZ* dstSpace);
 
     // Contain pointers into storage or pointers into precomputed tables.
-    const float*              fSrcGammaTables[3];
-    SkAutoTMalloc<float>      fSrcStorage;
-    const uint8_t*            fDstGammaTables[3];
-    sk_sp<SkData>             fDstStorage;
+    const float*         fSrcGammaTables[3];
+    SkAutoTMalloc<float> fSrcStorage;
+    const uint8_t*       fDstGammaTables[3];
+    sk_sp<SkData>        fDstStorage;
 
     // Holds a 3x4 matrix.  Padding is useful for vector loading.
-    float                     fSrcToDst[13];
+    float                fSrcToDst[13];
+
+    SrcGamma             fSrcGamma;
+    DstGamma             fDstGamma;
 
     friend class SkColorSpaceXform;
     friend std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(SkColorSpace_XYZ* space);
 };
 
 struct LoadTablesContext {
-    const uint32_t* fSrc;
-    const float*    fR;
-    const float*    fG;
-    const float*    fB;
+    const void*  fSrc;
+    const float* fR;
+    const float* fG;
+    const float* fB;
 };
 
 struct StoreTablesContext {
diff --git a/src/core/SkRasterPipeline.h b/src/core/SkRasterPipeline.h
index d235b43..887e535 100644
--- a/src/core/SkRasterPipeline.h
+++ b/src/core/SkRasterPipeline.h
@@ -68,7 +68,8 @@
     M(load_565)  M(store_565)                                    \
     M(load_f16)  M(store_f16)                                    \
     M(load_8888) M(store_8888)                                   \
-    M(load_tables) M(store_tables)                               \
+    M(load_u16_be)                                               \
+    M(load_tables) M(load_tables_u16_be) M(store_tables)         \
     M(scale_u8) M(scale_1_float)                                 \
     M(lerp_u8) M(lerp_565) M(lerp_1_float)                       \
     M(dstatop) M(dstin) M(dstout) M(dstover)                     \
diff --git a/src/opts/SkNx_neon.h b/src/opts/SkNx_neon.h
index 6836a52..f39ef11 100644
--- a/src/opts/SkNx_neon.h
+++ b/src/opts/SkNx_neon.h
@@ -255,6 +255,8 @@
     AI SkNx operator + (const SkNx& o) const { return vadd_u16(fVec, o.fVec); }
     AI SkNx operator - (const SkNx& o) const { return vsub_u16(fVec, o.fVec); }
     AI SkNx operator * (const SkNx& o) const { return vmul_u16(fVec, o.fVec); }
+    AI SkNx operator & (const SkNx& o) const { return vand_u16(fVec, o.fVec); }
+    AI SkNx operator | (const SkNx& o) const { return vorr_u16(fVec, o.fVec); }
 
     AI SkNx operator << (int bits) const { return fVec << SkNx(bits).fVec; }
     AI SkNx operator >> (int bits) const { return fVec >> SkNx(bits).fVec; }
@@ -293,6 +295,8 @@
     AI SkNx operator + (const SkNx& o) const { return vaddq_u16(fVec, o.fVec); }
     AI SkNx operator - (const SkNx& o) const { return vsubq_u16(fVec, o.fVec); }
     AI SkNx operator * (const SkNx& o) const { return vmulq_u16(fVec, o.fVec); }
+    AI SkNx operator & (const SkNx& o) const { return vandq_u16(fVec, o.fVec); }
+    AI SkNx operator | (const SkNx& o) const { return vorrq_u16(fVec, o.fVec); }
 
     AI SkNx operator << (int bits) const { return fVec << SkNx(bits).fVec; }
     AI SkNx operator >> (int bits) const { return fVec >> SkNx(bits).fVec; }
diff --git a/src/opts/SkNx_sse.h b/src/opts/SkNx_sse.h
index 3dc60f7..1ff72d1 100644
--- a/src/opts/SkNx_sse.h
+++ b/src/opts/SkNx_sse.h
@@ -283,6 +283,8 @@
     AI SkNx operator + (const SkNx& o) const { return _mm_add_epi16(fVec, o.fVec); }
     AI SkNx operator - (const SkNx& o) const { return _mm_sub_epi16(fVec, o.fVec); }
     AI SkNx operator * (const SkNx& o) const { return _mm_mullo_epi16(fVec, o.fVec); }
+    AI SkNx operator & (const SkNx& o) const { return _mm_and_si128(fVec, o.fVec); }
+    AI SkNx operator | (const SkNx& o) const { return _mm_or_si128(fVec, o.fVec); }
 
     AI SkNx operator << (int bits) const { return _mm_slli_epi16(fVec, bits); }
     AI SkNx operator >> (int bits) const { return _mm_srli_epi16(fVec, bits); }
@@ -348,6 +350,8 @@
     AI SkNx operator + (const SkNx& o) const { return _mm_add_epi16(fVec, o.fVec); }
     AI SkNx operator - (const SkNx& o) const { return _mm_sub_epi16(fVec, o.fVec); }
     AI SkNx operator * (const SkNx& o) const { return _mm_mullo_epi16(fVec, o.fVec); }
+    AI SkNx operator & (const SkNx& o) const { return _mm_and_si128(fVec, o.fVec); }
+    AI SkNx operator | (const SkNx& o) const { return _mm_or_si128(fVec, o.fVec); }
 
     AI SkNx operator << (int bits) const { return _mm_slli_epi16(fVec, bits); }
     AI SkNx operator >> (int bits) const { return _mm_srli_epi16(fVec, bits); }
@@ -634,6 +638,14 @@
         return _mm256_cvtepi32_ps(SkNx_cast<int>(src).fVec);
     }
 
+    template<> AI /*static*/ Sk8i SkNx_cast<int>(const Sk8h& src) {
+        return _mm256_cvtepu16_epi32(src.fVec);
+    }
+
+    template<> AI /*static*/ Sk8f SkNx_cast<float>(const Sk8h& src) {
+        return _mm256_cvtepi32_ps(SkNx_cast<int>(src).fVec);
+    }
+
     template<> AI /*static*/ Sk8f SkNx_cast<float>(const Sk8i& src) {
         return _mm256_cvtepi32_ps(src.fVec);
     }
@@ -642,9 +654,6 @@
         return _mm256_cvttps_epi32(src.fVec);
     }
 
-    template<> AI /*static*/ Sk8i SkNx_cast<int>(const Sk8h& src) {
-        return _mm256_cvtepu16_epi32(src.fVec);
-    }
     template<> AI /*static*/ Sk8h SkNx_cast<uint16_t>(const Sk8i& src) {
         __m128i lo = _mm256_extractf128_si256(src.fVec, 0),
                 hi = _mm256_extractf128_si256(src.fVec, 1);
diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h
index 143a9ec..0d42b1f 100644
--- a/src/opts/SkRasterPipeline_opts.h
+++ b/src/opts/SkRasterPipeline_opts.h
@@ -564,8 +564,25 @@
     store(tail, byte(r,0)|byte(g,1)|byte(b,2)|byte(a,3), (int*)ptr);
 }
 
+STAGE_CTX(load_u16_be, const uint64_t**) {
+    auto ptr = *ctx + x;
+    const void* src = ptr;
+    SkNx<N, uint64_t> px;
+    if (tail) {
+        px = load(tail, ptr);
+        src = &px;
+    }
+
+    SkNh rh, gh, bh, ah;
+    SkNh::Load4(src, &rh, &gh, &bh, &ah);
+    r = (1.0f / 65535.0f) * SkNx_cast<float>((rh << 8) | (rh >> 8));
+    g = (1.0f / 65535.0f) * SkNx_cast<float>((gh << 8) | (gh >> 8));
+    b = (1.0f / 65535.0f) * SkNx_cast<float>((bh << 8) | (bh >> 8));
+    a = (1.0f / 65535.0f) * SkNx_cast<float>((ah << 8) | (ah >> 8));
+}
+
 STAGE_CTX(load_tables, const LoadTablesContext*) {
-    auto ptr = ctx->fSrc + x;
+    auto ptr = (const uint32_t*)ctx->fSrc + x;
 
     SkNu rgba = load(tail, ptr);
     auto to_int = [](const SkNu& v) { return SkNi::Load(&v); };
@@ -575,6 +592,19 @@
     a = SkNf_from_byte(rgba >> 24);
 }
 
+STAGE_CTX(load_tables_u16_be, const LoadTablesContext*) {
+    auto ptr = (const uint64_t*)ctx->fSrc + x;
+
+    SkNh rh, gh, bh, ah;
+    SkNh::Load4(ptr, &rh, &gh, &bh, &ah);
+
+    // ctx->fSrc is big-endian, so "& 0xff" grabs the 8 most significant bits of each component.
+    r = gather(tail, ctx->fR, SkNx_cast<int>(rh & 0xff));
+    g = gather(tail, ctx->fG, SkNx_cast<int>(gh & 0xff));
+    b = gather(tail, ctx->fB, SkNx_cast<int>(bh & 0xff));
+    a = (1.0f / 65535.0f) * SkNx_cast<float>((ah << 8) | (ah >> 8));
+}
+
 STAGE_CTX(store_tables, const StoreTablesContext*) {
     auto ptr = ctx->fDst + x;