Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: src/opts/SkColorXform_opts.h

Issue 2184543003: Perform color correction on png decodes (Closed) Base URL: https://skia.googlesource.com/skia.git@colorjpegs
Patch Set: Rebase on Sk4u Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkColorXform_opts_DEFINED 8 #ifndef SkColorXform_opts_DEFINED
9 #define SkColorXform_opts_DEFINED 9 #define SkColorXform_opts_DEFINED
10 10
(...skipping 23 matching lines...) Expand all
34 enum DstGamma { 34 enum DstGamma {
35 // 8888 35 // 8888
36 kSRGB_DstGamma, 36 kSRGB_DstGamma,
37 k2Dot2_DstGamma, 37 k2Dot2_DstGamma,
38 kTable_DstGamma, 38 kTable_DstGamma,
39 39
40 // F16 40 // F16
41 kLinear_DstGamma, 41 kLinear_DstGamma,
42 }; 42 };
43 43
44 template <DstGamma kDstGamma, bool kSwapRB> 44 template <DstGamma kDstGamma, bool kPremul, bool kSwapRB>
mtklein 2016/07/29 18:48:57 to think about, bool kPremul -> {Premul, Unpremul,
msarett 2016/07/29 20:07:51 Agreed, that would be better, particularly for F16
45 static void color_xform_RGB1(void* dst, const uint32_t* src, int len, 45 static void color_xform_RGBA(void* dst, const uint32_t* src, int len,
46 const float* const srcTables[3], const float matrix [16], 46 const float* const srcTables[3], const float matrix [16],
47 const uint8_t* const dstTables[3]) { 47 const uint8_t* const dstTables[3]) {
48 int kRShift = 0; 48 int kRShift = 0;
49 int kGShift = 8; 49 int kGShift = 8;
50 int kBShift = 16; 50 int kBShift = 16;
51 int kAShift = 24; 51 int kAShift = 24;
52 if (kSwapRB) { 52 if (kSwapRB) {
53 kBShift = 0; 53 kBShift = 0;
54 kRShift = 16; 54 kRShift = 16;
55 } 55 }
56 56
57 Sk4f rXgXbX = Sk4f::Load(matrix + 0), 57 Sk4f rXgXbX = Sk4f::Load(matrix + 0),
58 rYgYbY = Sk4f::Load(matrix + 4), 58 rYgYbY = Sk4f::Load(matrix + 4),
59 rZgZbZ = Sk4f::Load(matrix + 8), 59 rZgZbZ = Sk4f::Load(matrix + 8),
60 rTgTbT = Sk4f::Load(matrix + 12); 60 rTgTbT = Sk4f::Load(matrix + 12);
61 61
62 if (len >= 4) { 62 if (len >= 4) {
63 Sk4f reds, greens, blues; 63 Sk4i iAlphas;
64 auto load_next_4 = [&reds, &greens, &blues, &src, &len, &srcTables] { 64 Sk4f reds, greens, blues, alphas;
65 auto load_next_4 = [&reds, &greens, &blues, &iAlphas, &alphas, &src, &le n, &srcTables] {
65 reds = Sk4f{srcTables[0][(src[0] >> 0) & 0xFF], 66 reds = Sk4f{srcTables[0][(src[0] >> 0) & 0xFF],
66 srcTables[0][(src[1] >> 0) & 0xFF], 67 srcTables[0][(src[1] >> 0) & 0xFF],
67 srcTables[0][(src[2] >> 0) & 0xFF], 68 srcTables[0][(src[2] >> 0) & 0xFF],
68 srcTables[0][(src[3] >> 0) & 0xFF]}; 69 srcTables[0][(src[3] >> 0) & 0xFF]};
69 greens = Sk4f{srcTables[1][(src[0] >> 8) & 0xFF], 70 greens = Sk4f{srcTables[1][(src[0] >> 8) & 0xFF],
70 srcTables[1][(src[1] >> 8) & 0xFF], 71 srcTables[1][(src[1] >> 8) & 0xFF],
71 srcTables[1][(src[2] >> 8) & 0xFF], 72 srcTables[1][(src[2] >> 8) & 0xFF],
72 srcTables[1][(src[3] >> 8) & 0xFF]}; 73 srcTables[1][(src[3] >> 8) & 0xFF]};
73 blues = Sk4f{srcTables[2][(src[0] >> 16) & 0xFF], 74 blues = Sk4f{srcTables[2][(src[0] >> 16) & 0xFF],
74 srcTables[2][(src[1] >> 16) & 0xFF], 75 srcTables[2][(src[1] >> 16) & 0xFF],
75 srcTables[2][(src[2] >> 16) & 0xFF], 76 srcTables[2][(src[2] >> 16) & 0xFF],
76 srcTables[2][(src[3] >> 16) & 0xFF]}; 77 srcTables[2][(src[3] >> 16) & 0xFF]};
78
79 Sk4u uAlphas = Sk4u::Load(src) >> 24;
80 iAlphas = Sk4i::Load(&uAlphas);
mtklein 2016/07/29 18:48:57 // We'll need iAlphas again later.
msarett 2016/07/29 20:07:51 Done.
81 alphas = (1.0f / 255.0f) * SkNx_cast<float>(iAlphas);
82
77 src += 4; 83 src += 4;
78 len -= 4; 84 len -= 4;
79 }; 85 };
80 86
81 Sk4f dstReds, dstGreens, dstBlues; 87 Sk4i dstIAlphas;
mtklein 2016/07/29 18:48:57 Do we really need dstIAlphas and iAlphas? Can we
msarett 2016/07/29 20:07:51 Yeah we need it because we interleave loads and st
82 auto transform_4 = [&reds, &greens, &blues, &dstReds, &dstGreens, &dstBl ues, &rXgXbX, 88 Sk4f dstReds, dstGreens, dstBlues, dstAlphas;
83 &rYgYbY, &rZgZbZ, &rTgTbT] { 89 auto transform_4 = [&reds, &greens, &blues, &alphas, &iAlphas, &dstReds, &dstGreens,
90 &dstBlues, &dstAlphas, &dstIAlphas, &rXgXbX, &rYgYbY , &rZgZbZ, &rTgTbT]
91 {
84 dstReds = rXgXbX[0]*reds + rYgYbY[0]*greens + rZgZbZ[0]*blues + rT gTbT[0]; 92 dstReds = rXgXbX[0]*reds + rYgYbY[0]*greens + rZgZbZ[0]*blues + rT gTbT[0];
85 dstGreens = rXgXbX[1]*reds + rYgYbY[1]*greens + rZgZbZ[1]*blues + rT gTbT[1]; 93 dstGreens = rXgXbX[1]*reds + rYgYbY[1]*greens + rZgZbZ[1]*blues + rT gTbT[1];
86 dstBlues = rXgXbX[2]*reds + rYgYbY[2]*greens + rZgZbZ[2]*blues + rT gTbT[2]; 94 dstBlues = rXgXbX[2]*reds + rYgYbY[2]*greens + rZgZbZ[2]*blues + rT gTbT[2];
95 dstAlphas = alphas;
96 dstIAlphas = iAlphas;
97
98 if (kPremul) {
99 dstReds = alphas * dstReds;
100 dstGreens = alphas * dstGreens;
101 dstBlues = alphas * dstBlues;
102 }
87 }; 103 };
88 104
89 auto store_4 = [&dstReds, &dstGreens, &dstBlues, &dst, &dstTables, kRShi ft, kGShift, 105 auto store_4 = [&dstReds, &dstGreens, &dstBlues, &dstIAlphas, &dstAlphas , &dst, &dstTables,
90 kBShift, kAShift] { 106 kRShift, kGShift, kBShift, kAShift] {
91 if (kSRGB_DstGamma == kDstGamma || k2Dot2_DstGamma == kDstGamma) { 107 if (kSRGB_DstGamma == kDstGamma || k2Dot2_DstGamma == kDstGamma) {
92 Sk4f (*linear_to_curve)(const Sk4f&) = (kSRGB_DstGamma == kDstGa mma) ? 108 Sk4f (*linear_to_curve)(const Sk4f&) = (kSRGB_DstGamma == kDstGa mma) ?
93 sk_linear_to_srgb_needs_trunc : linear_to_2dot2; 109 sk_linear_to_srgb_needs_trunc : linear_to_2dot2;
94 Sk4i (*float_to_int)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma ) ? 110 Sk4i (*float_to_int)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma ) ?
95 Sk4f_trunc : Sk4f_round; 111 Sk4f_trunc : Sk4f_round;
96 112
97 dstReds = linear_to_curve(dstReds); 113 dstReds = linear_to_curve(dstReds);
98 dstGreens = linear_to_curve(dstGreens); 114 dstGreens = linear_to_curve(dstGreens);
99 dstBlues = linear_to_curve(dstBlues); 115 dstBlues = linear_to_curve(dstBlues);
100 116
101 dstReds = sk_clamp_0_255(dstReds); 117 dstReds = sk_clamp_0_255(dstReds);
102 dstGreens = sk_clamp_0_255(dstGreens); 118 dstGreens = sk_clamp_0_255(dstGreens);
103 dstBlues = sk_clamp_0_255(dstBlues); 119 dstBlues = sk_clamp_0_255(dstBlues);
104 120
105 auto rgba = (float_to_int(dstReds) << kRShift) 121 auto rgba = (float_to_int(dstReds) << kRShift)
106 | (float_to_int(dstGreens) << kGShift) 122 | (float_to_int(dstGreens) << kGShift)
107 | (float_to_int(dstBlues) << kBShift) 123 | (float_to_int(dstBlues) << kBShift)
108 | (Sk4i{0xFF} << kAShift); 124 | (dstIAlphas << kAShift);
109 rgba.store((uint32_t*) dst); 125 rgba.store((uint32_t*) dst);
110 126
111 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint32_t)); 127 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint32_t));
112 } else if (kTable_DstGamma == kDstGamma) { 128 } else if (kTable_DstGamma == kDstGamma) {
113 Sk4f scaledReds = Sk4f::Min(Sk4f::Max(1023.0f * dstReds, 0.0 f), 1023.0f); 129 Sk4f scaledReds = Sk4f::Min(Sk4f::Max(1023.0f * dstReds, 0.0 f), 1023.0f);
114 Sk4f scaledGreens = Sk4f::Min(Sk4f::Max(1023.0f * dstGreens, 0.0 f), 1023.0f); 130 Sk4f scaledGreens = Sk4f::Min(Sk4f::Max(1023.0f * dstGreens, 0.0 f), 1023.0f);
115 Sk4f scaledBlues = Sk4f::Min(Sk4f::Max(1023.0f * dstBlues, 0.0 f), 1023.0f); 131 Sk4f scaledBlues = Sk4f::Min(Sk4f::Max(1023.0f * dstBlues, 0.0 f), 1023.0f);
116 132
117 Sk4i indicesReds = Sk4f_round(scaledReds); 133 Sk4i indicesReds = Sk4f_round(scaledReds);
118 Sk4i indicesGreens = Sk4f_round(scaledGreens); 134 Sk4i indicesGreens = Sk4f_round(scaledGreens);
119 Sk4i indicesBlues = Sk4f_round(scaledBlues); 135 Sk4i indicesBlues = Sk4f_round(scaledBlues);
120 136
121 uint32_t* dst32 = (uint32_t*) dst; 137 uint32_t* dst32 = (uint32_t*) dst;
122 dst32[0] = dstTables[0][indicesReds [0]] << kRShift 138 dst32[0] = dstTables[0][indicesReds [0]] << kRShift
123 | dstTables[1][indicesGreens[0]] << kGShift 139 | dstTables[1][indicesGreens[0]] << kGShift
124 | dstTables[2][indicesBlues [0]] << kBShift 140 | dstTables[2][indicesBlues [0]] << kBShift
125 | 0xFF << kAShift; 141 | dstIAlphas[0] << kAShift;
126 dst32[1] = dstTables[0][indicesReds [1]] << kRShift 142 dst32[1] = dstTables[0][indicesReds [1]] << kRShift
127 | dstTables[1][indicesGreens[1]] << kGShift 143 | dstTables[1][indicesGreens[1]] << kGShift
128 | dstTables[2][indicesBlues [1]] << kBShift 144 | dstTables[2][indicesBlues [1]] << kBShift
129 | 0xFF << kAShift; 145 | dstIAlphas[1] << kAShift;
130 dst32[2] = dstTables[0][indicesReds [2]] << kRShift 146 dst32[2] = dstTables[0][indicesReds [2]] << kRShift
131 | dstTables[1][indicesGreens[2]] << kGShift 147 | dstTables[1][indicesGreens[2]] << kGShift
132 | dstTables[2][indicesBlues [2]] << kBShift 148 | dstTables[2][indicesBlues [2]] << kBShift
133 | 0xFF << kAShift; 149 | dstIAlphas[2] << kAShift;
134 dst32[3] = dstTables[0][indicesReds [3]] << kRShift 150 dst32[3] = dstTables[0][indicesReds [3]] << kRShift
135 | dstTables[1][indicesGreens[3]] << kGShift 151 | dstTables[1][indicesGreens[3]] << kGShift
136 | dstTables[2][indicesBlues [3]] << kBShift 152 | dstTables[2][indicesBlues [3]] << kBShift
137 | 0xFF << kAShift; 153 | dstIAlphas[3] << kAShift;
138 154
139 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint32_t)); 155 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint32_t));
140 } else { 156 } else {
141 Sk4h_store4(dst, SkFloatToHalf_finite(dstReds), 157 Sk4h_store4(dst, SkFloatToHalf_finite(dstReds),
142 SkFloatToHalf_finite(dstGreens), 158 SkFloatToHalf_finite(dstGreens),
143 SkFloatToHalf_finite(dstBlues), 159 SkFloatToHalf_finite(dstBlues),
144 SK_Half1); 160 SkFloatToHalf_finite(dstAlphas));
145 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint64_t)); 161 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint64_t));
146 } 162 }
147 }; 163 };
148 164
149 load_next_4(); 165 load_next_4();
150 166
151 while (len >= 4) { 167 while (len >= 4) {
152 transform_4(); 168 transform_4();
153 load_next_4(); 169 load_next_4();
154 store_4(); 170 store_4();
155 } 171 }
156 172
157 transform_4(); 173 transform_4();
158 store_4(); 174 store_4();
159 } 175 }
160 176
161 while (len > 0) { 177 while (len > 0) {
162 // Splat r,g,b across a register each. 178 // Splat r,g,b across a register each.
163 auto r = Sk4f{srcTables[0][(*src >> 0) & 0xFF]}, 179 auto r = Sk4f{srcTables[0][(*src >> 0) & 0xFF]},
164 g = Sk4f{srcTables[1][(*src >> 8) & 0xFF]}, 180 g = Sk4f{srcTables[1][(*src >> 8) & 0xFF]},
165 b = Sk4f{srcTables[2][(*src >> 16) & 0xFF]}; 181 b = Sk4f{srcTables[2][(*src >> 16) & 0xFF]},
182 a = (1.0f / 255.0f) * Sk4f(*src >> 24);
166 183
167 auto dstPixel = rXgXbX*r + rYgYbY*g + rZgZbZ*b + rTgTbT; 184 auto dstPixel = rXgXbX*r + rYgYbY*g + rZgZbZ*b + rTgTbT;
168 185
169 if (kSRGB_DstGamma == kDstGamma || k2Dot2_DstGamma == kDstGamma) { 186 if (kSRGB_DstGamma == kDstGamma || k2Dot2_DstGamma == kDstGamma) {
170 Sk4f (*linear_to_curve)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma) ? 187 Sk4f (*linear_to_curve)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma) ?
171 sk_linear_to_srgb_needs_trunc : linear_to_2dot2; 188 sk_linear_to_srgb_needs_trunc : linear_to_2dot2;
172 Sk4i (*float_to_int)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma) ? 189 Sk4i (*float_to_int)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma) ?
173 Sk4f_trunc : Sk4f_round; 190 Sk4f_trunc : Sk4f_round;
174 191
192 if (kPremul) {
193 dstPixel = a * dstPixel;
194 }
195
175 dstPixel = sk_clamp_0_255(linear_to_curve(dstPixel)); 196 dstPixel = sk_clamp_0_255(linear_to_curve(dstPixel));
176 197
177 uint32_t rgba; 198 uint32_t rgba;
178 SkNx_cast<uint8_t>(float_to_int(dstPixel)).store(&rgba); 199 SkNx_cast<uint8_t>(float_to_int(dstPixel)).store(&rgba);
179 rgba |= 0xFF000000; 200 uint32_t* dst32 = (uint32_t*) dst;
201 *dst32 = (*src & 0xFF000000) | (rgba & 0x00FFFFFF);
202
180 if (kSwapRB) { 203 if (kSwapRB) {
181 *((uint32_t*) dst) = SkSwizzle_RB(rgba); 204 *dst32 = SkSwizzle_RB(*dst32);
182 } else {
183 *((uint32_t*) dst) = rgba;
184 } 205 }
206
185 dst = SkTAddOffset<void>(dst, sizeof(uint32_t)); 207 dst = SkTAddOffset<void>(dst, sizeof(uint32_t));
186 } else if (kTable_DstGamma == kDstGamma) { 208 } else if (kTable_DstGamma == kDstGamma) {
187 Sk4f scaledPixel = Sk4f::Min(Sk4f::Max(1023.0f * dstPixel, 0.0f), 10 23.0f); 209 Sk4f scaledPixel = Sk4f::Min(Sk4f::Max(1023.0f * dstPixel, 0.0f), 10 23.0f);
188 210
189 Sk4i indices = Sk4f_round(scaledPixel); 211 Sk4i indices = Sk4f_round(scaledPixel);
190 212
191 *((uint32_t*) dst) = dstTables[0][indices[0]] << kRShift 213 *((uint32_t*) dst) = dstTables[0][indices[0]] << kRShift
192 | dstTables[1][indices[1]] << kGShift 214 | dstTables[1][indices[1]] << kGShift
193 | dstTables[2][indices[2]] << kBShift 215 | dstTables[2][indices[2]] << kBShift
194 | 0xFF << kAShift; 216 | (*src & 0xFF000000);
195 217
196 dst = SkTAddOffset<void>(dst, sizeof(uint32_t)); 218 dst = SkTAddOffset<void>(dst, sizeof(uint32_t));
197 } else { 219 } else {
198 uint64_t rgba; 220 dstPixel = Sk4f(dstPixel[0], dstPixel[1], dstPixel[2], a[3]);
199 SkFloatToHalf_finite(dstPixel).store(&rgba); 221 SkFloatToHalf_finite(dstPixel).store((uint64_t*) dst);
200 rgba |= static_cast<uint64_t>(SK_Half1) << 48;
201 *((uint64_t*) dst) = rgba;
202 dst = SkTAddOffset<void>(dst, sizeof(uint64_t)); 222 dst = SkTAddOffset<void>(dst, sizeof(uint64_t));
203 } 223 }
204 224
205 src += 1; 225 src += 1;
206 len -= 1; 226 len -= 1;
207 } 227 }
208 } 228 }
209 229
210 static void color_xform_RGB1_to_2dot2(uint32_t* dst, const uint32_t* src, int le n, 230 static void color_xform_RGBA_to_2dot2(uint32_t* dst, const uint32_t* src, int le n,
211 const float* const srcTables[3], const flo at matrix[16]) { 231 const float* const srcTables[3], const flo at matrix[16]) {
212 color_xform_RGB1<k2Dot2_DstGamma, false>(dst, src, len, srcTables, matrix, n ullptr); 232 color_xform_RGBA<k2Dot2_DstGamma, false, false>(dst, src, len, srcTables, ma trix, nullptr);
213 } 233 }
214 234
215 static void color_xform_RGB1_to_srgb(uint32_t* dst, const uint32_t* src, int len , 235 static void color_xform_RGBA_to_srgb(uint32_t* dst, const uint32_t* src, int len ,
216 const float* const srcTables[3], const floa t matrix[16]) { 236 const float* const srcTables[3], const floa t matrix[16]) {
217 color_xform_RGB1<kSRGB_DstGamma, false>(dst, src, len, srcTables, matrix, nu llptr); 237 color_xform_RGBA<kSRGB_DstGamma, false, false>(dst, src, len, srcTables, mat rix, nullptr);
218 } 238 }
219 239
220 static void color_xform_RGB1_to_table(uint32_t* dst, const uint32_t* src, int le n, 240 static void color_xform_RGBA_to_table(uint32_t* dst, const uint32_t* src, int le n,
221 const float* const srcTables[3], const flo at matrix[16], 241 const float* const srcTables[3], const flo at matrix[16],
222 const uint8_t* const dstTables[3]) { 242 const uint8_t* const dstTables[3]) {
223 color_xform_RGB1<kTable_DstGamma, false>(dst, src, len, srcTables, matrix, d stTables); 243 color_xform_RGBA<kTable_DstGamma, false, false>(dst, src, len, srcTables, ma trix, dstTables);
224 } 244 }
225 245
226 static void color_xform_RGB1_to_linear(uint64_t* dst, const uint32_t* src, int l en, 246 static void color_xform_RGBA_to_linear(uint64_t* dst, const uint32_t* src, int l en,
227 const float* const srcTables[3], const fl oat matrix[16]) { 247 const float* const srcTables[3], const fl oat matrix[16]) {
228 color_xform_RGB1<kLinear_DstGamma, false>(dst, src, len, srcTables, matrix, nullptr); 248 color_xform_RGBA<kLinear_DstGamma, false, false>(dst, src, len, srcTables, m atrix, nullptr);
229 } 249 }
230 250
231 static void color_xform_RGB1_to_2dot2_swaprb(uint32_t* dst, const uint32_t* src, int len, 251 static void color_xform_RGBA_to_2dot2_swaprb(uint32_t* dst, const uint32_t* src, int len,
232 const float* const srcTables[3], 252 const float* const srcTables[3],
233 const float matrix[16]) { 253 const float matrix[16]) {
234 color_xform_RGB1<k2Dot2_DstGamma, true>(dst, src, len, srcTables, matrix, nu llptr); 254 color_xform_RGBA<k2Dot2_DstGamma, false, true>(dst, src, len, srcTables, mat rix, nullptr);
235 } 255 }
236 256
237 static void color_xform_RGB1_to_srgb_swaprb(uint32_t* dst, const uint32_t* src, int len, 257 static void color_xform_RGBA_to_srgb_swaprb(uint32_t* dst, const uint32_t* src, int len,
238 const float* const srcTables[3], 258 const float* const srcTables[3],
239 const float matrix[16]) { 259 const float matrix[16]) {
240 color_xform_RGB1<kSRGB_DstGamma, true>(dst, src, len, srcTables, matrix, nul lptr); 260 color_xform_RGBA<kSRGB_DstGamma, false, true>(dst, src, len, srcTables, matr ix, nullptr);
241 } 261 }
242 262
243 static void color_xform_RGB1_to_table_swaprb(uint32_t* dst, const uint32_t* src, int len, 263 static void color_xform_RGBA_to_table_swaprb(uint32_t* dst, const uint32_t* src, int len,
244 const float* const srcTables[3], 264 const float* const srcTables[3],
245 const float matrix[16], 265 const float matrix[16],
246 const uint8_t* const dstTables[3]) { 266 const uint8_t* const dstTables[3]) {
247 color_xform_RGB1<kTable_DstGamma, true>(dst, src, len, srcTables, matrix, ds tTables); 267 color_xform_RGBA<kTable_DstGamma, false, true>(dst, src, len, srcTables, mat rix, dstTables);
268 }
269
270 static void color_xform_RGBA_to_2dot2_premul(uint32_t* dst, const uint32_t* src, int len,
271 const float* const srcTables[3],
272 const float matrix[16]) {
273 color_xform_RGBA<k2Dot2_DstGamma, true, false>(dst, src, len, srcTables, mat rix, nullptr);
274 }
275
276 static void color_xform_RGBA_to_srgb_premul(uint32_t* dst, const uint32_t* src, int len,
277 const float* const srcTables[3],
278 const float matrix[16]) {
279 color_xform_RGBA<kSRGB_DstGamma, true, false>(dst, src, len, srcTables, matr ix, nullptr);
280 }
281
282 static void color_xform_RGBA_to_table_premul(uint32_t* dst, const uint32_t* src, int len,
283 const float* const srcTables[3],
284 const float matrix[16],
285 const uint8_t* const dstTables[3]) {
286 color_xform_RGBA<kTable_DstGamma, true, false>(dst, src, len, srcTables, mat rix, dstTables);
287 }
288
289 static void color_xform_RGBA_to_linear_premul(uint64_t* dst, const uint32_t* src , int len,
290 const float* const srcTables[3],
291 const float matrix[16]) {
292 color_xform_RGBA<kLinear_DstGamma, true, false>(dst, src, len, srcTables, ma trix, nullptr);
293 }
294
295 static void color_xform_RGBA_to_2dot2_premul_swaprb(uint32_t* dst, const uint32_ t* src, int len,
296 const float* const srcTables [3],
297 const float matrix[16]) {
298 color_xform_RGBA<k2Dot2_DstGamma, true, true>(dst, src, len, srcTables, matr ix, nullptr);
299 }
300
301 static void color_xform_RGBA_to_srgb_premul_swaprb(uint32_t* dst, const uint32_t * src, int len,
302 const float* const srcTables[ 3],
303 const float matrix[16]) {
304 color_xform_RGBA<kSRGB_DstGamma, true, true>(dst, src, len, srcTables, matri x, nullptr);
305 }
306
307 static void color_xform_RGBA_to_table_premul_swaprb(uint32_t* dst, const uint32_ t* src, int len,
308 const float* const srcTables [3],
309 const float matrix[16],
310 const uint8_t* const dstTabl es[3]) {
311 color_xform_RGBA<kTable_DstGamma, true, true>(dst, src, len, srcTables, matr ix, dstTables);
248 } 312 }
249 313
250 } // namespace SK_OPTS_NS 314 } // namespace SK_OPTS_NS
251 315
252 #endif // SkColorXform_opts_DEFINED 316 #endif // SkColorXform_opts_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698