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

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: 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>
45 static void color_xform_RGB1(void* dst, const uint32_t* src, int len, 45 static void color_xform_RGB1(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 iAlphas = Sk4i::Load(src).logicalShiftRight(24);
80 alphas = (1.0f / 255.0f) * SkNx_cast<float>(iAlphas);
81
77 src += 4; 82 src += 4;
78 len -= 4; 83 len -= 4;
79 }; 84 };
80 85
81 Sk4f dstReds, dstGreens, dstBlues; 86 Sk4i dstIAlphas;
82 auto transform_4 = [&reds, &greens, &blues, &dstReds, &dstGreens, &dstBl ues, &rXgXbX, 87 Sk4f dstReds, dstGreens, dstBlues, dstAlphas;
83 &rYgYbY, &rZgZbZ, &rTgTbT] { 88 auto transform_4 = [&reds, &greens, &blues, &alphas, &iAlphas, &dstReds, &dstGreens,
89 &dstBlues, &dstAlphas, &dstIAlphas, &rXgXbX, &rYgYbY , &rZgZbZ, &rTgTbT]
90 {
84 dstReds = rXgXbX[0]*reds + rYgYbY[0]*greens + rZgZbZ[0]*blues + rT gTbT[0]; 91 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]; 92 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]; 93 dstBlues = rXgXbX[2]*reds + rYgYbY[2]*greens + rZgZbZ[2]*blues + rT gTbT[2];
94 dstAlphas = alphas;
95 dstIAlphas = iAlphas;
96
97 if (kPremul) {
98 dstReds = alphas * dstReds;
99 dstGreens = alphas * dstGreens;
100 dstBlues = alphas * dstBlues;
101 }
87 }; 102 };
88 103
89 auto store_4 = [&dstReds, &dstGreens, &dstBlues, &dst, &dstTables, kRShi ft, kGShift, 104 auto store_4 = [&dstReds, &dstGreens, &dstBlues, &dstIAlphas, &dstAlphas , &dst, &dstTables,
90 kBShift, kAShift] { 105 kRShift, kGShift, kBShift, kAShift] {
91 if (kSRGB_DstGamma == kDstGamma || k2Dot2_DstGamma == kDstGamma) { 106 if (kSRGB_DstGamma == kDstGamma || k2Dot2_DstGamma == kDstGamma) {
92 Sk4f (*linear_to_curve)(const Sk4f&) = (kSRGB_DstGamma == kDstGa mma) ? 107 Sk4f (*linear_to_curve)(const Sk4f&) = (kSRGB_DstGamma == kDstGa mma) ?
93 sk_linear_to_srgb_needs_trunc : linear_to_2dot2; 108 sk_linear_to_srgb_needs_trunc : linear_to_2dot2;
94 Sk4i (*float_to_int)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma ) ? 109 Sk4i (*float_to_int)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma ) ?
95 Sk4f_trunc : Sk4f_round; 110 Sk4f_trunc : Sk4f_round;
96 111
97 dstReds = linear_to_curve(dstReds); 112 dstReds = linear_to_curve(dstReds);
98 dstGreens = linear_to_curve(dstGreens); 113 dstGreens = linear_to_curve(dstGreens);
99 dstBlues = linear_to_curve(dstBlues); 114 dstBlues = linear_to_curve(dstBlues);
100 115
101 dstReds = sk_clamp_0_255(dstReds); 116 dstReds = sk_clamp_0_255(dstReds);
102 dstGreens = sk_clamp_0_255(dstGreens); 117 dstGreens = sk_clamp_0_255(dstGreens);
103 dstBlues = sk_clamp_0_255(dstBlues); 118 dstBlues = sk_clamp_0_255(dstBlues);
104 119
105 auto rgba = (float_to_int(dstReds) << kRShift) 120 auto rgba = (float_to_int(dstReds) << kRShift)
106 | (float_to_int(dstGreens) << kGShift) 121 | (float_to_int(dstGreens) << kGShift)
107 | (float_to_int(dstBlues) << kBShift) 122 | (float_to_int(dstBlues) << kBShift)
108 | (Sk4i{0xFF} << kAShift); 123 | (dstIAlphas << kAShift);
109 rgba.store((uint32_t*) dst); 124 rgba.store((uint32_t*) dst);
110 125
111 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint32_t)); 126 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint32_t));
112 } else if (kTable_DstGamma == kDstGamma) { 127 } else if (kTable_DstGamma == kDstGamma) {
113 Sk4f scaledReds = Sk4f::Min(Sk4f::Max(1023.0f * dstReds, 0.0 f), 1023.0f); 128 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); 129 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); 130 Sk4f scaledBlues = Sk4f::Min(Sk4f::Max(1023.0f * dstBlues, 0.0 f), 1023.0f);
116 131
117 Sk4i indicesReds = Sk4f_round(scaledReds); 132 Sk4i indicesReds = Sk4f_round(scaledReds);
118 Sk4i indicesGreens = Sk4f_round(scaledGreens); 133 Sk4i indicesGreens = Sk4f_round(scaledGreens);
119 Sk4i indicesBlues = Sk4f_round(scaledBlues); 134 Sk4i indicesBlues = Sk4f_round(scaledBlues);
120 135
121 uint32_t* dst32 = (uint32_t*) dst; 136 uint32_t* dst32 = (uint32_t*) dst;
122 dst32[0] = dstTables[0][indicesReds [0]] << kRShift 137 dst32[0] = dstTables[0][indicesReds [0]] << kRShift
123 | dstTables[1][indicesGreens[0]] << kGShift 138 | dstTables[1][indicesGreens[0]] << kGShift
124 | dstTables[2][indicesBlues [0]] << kBShift 139 | dstTables[2][indicesBlues [0]] << kBShift
125 | 0xFF << kAShift; 140 | dstIAlphas[0] << kAShift;
126 dst32[1] = dstTables[0][indicesReds [1]] << kRShift 141 dst32[1] = dstTables[0][indicesReds [1]] << kRShift
127 | dstTables[1][indicesGreens[1]] << kGShift 142 | dstTables[1][indicesGreens[1]] << kGShift
128 | dstTables[2][indicesBlues [1]] << kBShift 143 | dstTables[2][indicesBlues [1]] << kBShift
129 | 0xFF << kAShift; 144 | dstIAlphas[1] << kAShift;
130 dst32[2] = dstTables[0][indicesReds [2]] << kRShift 145 dst32[2] = dstTables[0][indicesReds [2]] << kRShift
131 | dstTables[1][indicesGreens[2]] << kGShift 146 | dstTables[1][indicesGreens[2]] << kGShift
132 | dstTables[2][indicesBlues [2]] << kBShift 147 | dstTables[2][indicesBlues [2]] << kBShift
133 | 0xFF << kAShift; 148 | dstIAlphas[2] << kAShift;
134 dst32[3] = dstTables[0][indicesReds [3]] << kRShift 149 dst32[3] = dstTables[0][indicesReds [3]] << kRShift
135 | dstTables[1][indicesGreens[3]] << kGShift 150 | dstTables[1][indicesGreens[3]] << kGShift
136 | dstTables[2][indicesBlues [3]] << kBShift 151 | dstTables[2][indicesBlues [3]] << kBShift
137 | 0xFF << kAShift; 152 | dstIAlphas[3] << kAShift;
138 153
139 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint32_t)); 154 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint32_t));
140 } else { 155 } else {
141 Sk4h_store4(dst, SkFloatToHalf_finite(dstReds), 156 Sk4h_store4(dst, SkFloatToHalf_finite(dstReds),
142 SkFloatToHalf_finite(dstGreens), 157 SkFloatToHalf_finite(dstGreens),
143 SkFloatToHalf_finite(dstBlues), 158 SkFloatToHalf_finite(dstBlues),
144 SK_Half1); 159 SkFloatToHalf_finite(dstAlphas));
145 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint64_t)); 160 dst = SkTAddOffset<void>(dst, 4 * sizeof(uint64_t));
146 } 161 }
147 }; 162 };
148 163
149 load_next_4(); 164 load_next_4();
150 165
151 while (len >= 4) { 166 while (len >= 4) {
152 transform_4(); 167 transform_4();
153 load_next_4(); 168 load_next_4();
154 store_4(); 169 store_4();
155 } 170 }
156 171
157 transform_4(); 172 transform_4();
158 store_4(); 173 store_4();
159 } 174 }
160 175
161 while (len > 0) { 176 while (len > 0) {
162 // Splat r,g,b across a register each. 177 // Splat r,g,b across a register each.
163 auto r = Sk4f{srcTables[0][(*src >> 0) & 0xFF]}, 178 auto r = Sk4f{srcTables[0][(*src >> 0) & 0xFF]},
164 g = Sk4f{srcTables[1][(*src >> 8) & 0xFF]}, 179 g = Sk4f{srcTables[1][(*src >> 8) & 0xFF]},
165 b = Sk4f{srcTables[2][(*src >> 16) & 0xFF]}; 180 b = Sk4f{srcTables[2][(*src >> 16) & 0xFF]},
181 a = (1.0f / 255.0f) * Sk4f(*src >> 24);
166 182
167 auto dstPixel = rXgXbX*r + rYgYbY*g + rZgZbZ*b + rTgTbT; 183 auto dstPixel = rXgXbX*r + rYgYbY*g + rZgZbZ*b + rTgTbT;
168 184
169 if (kSRGB_DstGamma == kDstGamma || k2Dot2_DstGamma == kDstGamma) { 185 if (kSRGB_DstGamma == kDstGamma || k2Dot2_DstGamma == kDstGamma) {
170 Sk4f (*linear_to_curve)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma) ? 186 Sk4f (*linear_to_curve)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma) ?
171 sk_linear_to_srgb_needs_trunc : linear_to_2dot2; 187 sk_linear_to_srgb_needs_trunc : linear_to_2dot2;
172 Sk4i (*float_to_int)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma) ? 188 Sk4i (*float_to_int)(const Sk4f&) = (kSRGB_DstGamma == kDstGamma) ?
173 Sk4f_trunc : Sk4f_round; 189 Sk4f_trunc : Sk4f_round;
174 190
191 if (kPremul) {
192 dstPixel = a * dstPixel;
193 }
194
175 dstPixel = sk_clamp_0_255(linear_to_curve(dstPixel)); 195 dstPixel = sk_clamp_0_255(linear_to_curve(dstPixel));
176 196
177 uint32_t rgba; 197 uint32_t rgba;
178 SkNx_cast<uint8_t>(float_to_int(dstPixel)).store(&rgba); 198 SkNx_cast<uint8_t>(float_to_int(dstPixel)).store(&rgba);
179 rgba |= 0xFF000000; 199 uint32_t* dst32 = (uint32_t*) dst;
200 *dst32 = (*src & 0xFF000000) | (rgba & 0x00FFFFFF);
201
180 if (kSwapRB) { 202 if (kSwapRB) {
181 *((uint32_t*) dst) = SkSwizzle_RB(rgba); 203 *dst32 = SkSwizzle_RB(*dst32);
182 } else {
183 *((uint32_t*) dst) = rgba;
184 } 204 }
205
185 dst = SkTAddOffset<void>(dst, sizeof(uint32_t)); 206 dst = SkTAddOffset<void>(dst, sizeof(uint32_t));
186 } else if (kTable_DstGamma == kDstGamma) { 207 } else if (kTable_DstGamma == kDstGamma) {
187 Sk4f scaledPixel = Sk4f::Min(Sk4f::Max(1023.0f * dstPixel, 0.0f), 10 23.0f); 208 Sk4f scaledPixel = Sk4f::Min(Sk4f::Max(1023.0f * dstPixel, 0.0f), 10 23.0f);
188 209
189 Sk4i indices = Sk4f_round(scaledPixel); 210 Sk4i indices = Sk4f_round(scaledPixel);
190 211
191 *((uint32_t*) dst) = dstTables[0][indices[0]] << kRShift 212 *((uint32_t*) dst) = dstTables[0][indices[0]] << kRShift
192 | dstTables[1][indices[1]] << kGShift 213 | dstTables[1][indices[1]] << kGShift
193 | dstTables[2][indices[2]] << kBShift 214 | dstTables[2][indices[2]] << kBShift
194 | 0xFF << kAShift; 215 | (*src & 0xFF000000);
195 216
196 dst = SkTAddOffset<void>(dst, sizeof(uint32_t)); 217 dst = SkTAddOffset<void>(dst, sizeof(uint32_t));
197 } else { 218 } else {
198 uint64_t rgba; 219 dstPixel = Sk4f(dstPixel[0], dstPixel[1], dstPixel[2], a[3]);
199 SkFloatToHalf_finite(dstPixel).store(&rgba); 220 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)); 221 dst = SkTAddOffset<void>(dst, sizeof(uint64_t));
203 } 222 }
204 223
205 src += 1; 224 src += 1;
206 len -= 1; 225 len -= 1;
207 } 226 }
208 } 227 }
209 228
210 static void color_xform_RGB1_to_2dot2(uint32_t* dst, const uint32_t* src, int le n, 229 static void color_xform_RGB1_to_2dot2(uint32_t* dst, const uint32_t* src, int le n,
211 const float* const srcTables[3], const flo at matrix[16]) { 230 const float* const srcTables[3], const flo at matrix[16]) {
212 color_xform_RGB1<k2Dot2_DstGamma, false>(dst, src, len, srcTables, matrix, n ullptr); 231 color_xform_RGB1<k2Dot2_DstGamma, false, false>(dst, src, len, srcTables, ma trix, nullptr);
213 } 232 }
214 233
215 static void color_xform_RGB1_to_srgb(uint32_t* dst, const uint32_t* src, int len , 234 static void color_xform_RGB1_to_srgb(uint32_t* dst, const uint32_t* src, int len ,
216 const float* const srcTables[3], const floa t matrix[16]) { 235 const float* const srcTables[3], const floa t matrix[16]) {
217 color_xform_RGB1<kSRGB_DstGamma, false>(dst, src, len, srcTables, matrix, nu llptr); 236 color_xform_RGB1<kSRGB_DstGamma, false, false>(dst, src, len, srcTables, mat rix, nullptr);
218 } 237 }
219 238
220 static void color_xform_RGB1_to_table(uint32_t* dst, const uint32_t* src, int le n, 239 static void color_xform_RGB1_to_table(uint32_t* dst, const uint32_t* src, int le n,
221 const float* const srcTables[3], const flo at matrix[16], 240 const float* const srcTables[3], const flo at matrix[16],
222 const uint8_t* const dstTables[3]) { 241 const uint8_t* const dstTables[3]) {
223 color_xform_RGB1<kTable_DstGamma, false>(dst, src, len, srcTables, matrix, d stTables); 242 color_xform_RGB1<kTable_DstGamma, false, false>(dst, src, len, srcTables, ma trix, dstTables);
224 } 243 }
225 244
226 static void color_xform_RGB1_to_linear(uint64_t* dst, const uint32_t* src, int l en, 245 static void color_xform_RGB1_to_linear(uint64_t* dst, const uint32_t* src, int l en,
227 const float* const srcTables[3], const fl oat matrix[16]) { 246 const float* const srcTables[3], const fl oat matrix[16]) {
228 color_xform_RGB1<kLinear_DstGamma, false>(dst, src, len, srcTables, matrix, nullptr); 247 color_xform_RGB1<kLinear_DstGamma, false, false>(dst, src, len, srcTables, m atrix, nullptr);
229 } 248 }
230 249
231 static void color_xform_RGB1_to_2dot2_swaprb(uint32_t* dst, const uint32_t* src, int len, 250 static void color_xform_RGB1_to_2dot2_swaprb(uint32_t* dst, const uint32_t* src, int len,
232 const float* const srcTables[3], 251 const float* const srcTables[3],
233 const float matrix[16]) { 252 const float matrix[16]) {
234 color_xform_RGB1<k2Dot2_DstGamma, true>(dst, src, len, srcTables, matrix, nu llptr); 253 color_xform_RGB1<k2Dot2_DstGamma, false, true>(dst, src, len, srcTables, mat rix, nullptr);
235 } 254 }
236 255
237 static void color_xform_RGB1_to_srgb_swaprb(uint32_t* dst, const uint32_t* src, int len, 256 static void color_xform_RGB1_to_srgb_swaprb(uint32_t* dst, const uint32_t* src, int len,
238 const float* const srcTables[3], 257 const float* const srcTables[3],
239 const float matrix[16]) { 258 const float matrix[16]) {
240 color_xform_RGB1<kSRGB_DstGamma, true>(dst, src, len, srcTables, matrix, nul lptr); 259 color_xform_RGB1<kSRGB_DstGamma, false, true>(dst, src, len, srcTables, matr ix, nullptr);
241 } 260 }
242 261
243 static void color_xform_RGB1_to_table_swaprb(uint32_t* dst, const uint32_t* src, int len, 262 static void color_xform_RGB1_to_table_swaprb(uint32_t* dst, const uint32_t* src, int len,
244 const float* const srcTables[3], 263 const float* const srcTables[3],
245 const float matrix[16], 264 const float matrix[16],
246 const uint8_t* const dstTables[3]) { 265 const uint8_t* const dstTables[3]) {
247 color_xform_RGB1<kTable_DstGamma, true>(dst, src, len, srcTables, matrix, ds tTables); 266 color_xform_RGB1<kTable_DstGamma, false, true>(dst, src, len, srcTables, mat rix, dstTables);
267 }
268
269 static void color_xform_RGB1_to_2dot2_premul(uint32_t* dst, const uint32_t* src, int len,
270 const float* const srcTables[3],
271 const float matrix[16]) {
272 color_xform_RGB1<k2Dot2_DstGamma, true, false>(dst, src, len, srcTables, mat rix, nullptr);
273 }
274
275 static void color_xform_RGB1_to_srgb_premul(uint32_t* dst, const uint32_t* src, int len,
276 const float* const srcTables[3],
277 const float matrix[16]) {
278 color_xform_RGB1<kSRGB_DstGamma, true, false>(dst, src, len, srcTables, matr ix, nullptr);
279 }
280
281 static void color_xform_RGB1_to_table_premul(uint32_t* dst, const uint32_t* src, int len,
282 const float* const srcTables[3],
283 const float matrix[16],
284 const uint8_t* const dstTables[3]) {
285 color_xform_RGB1<kTable_DstGamma, true, false>(dst, src, len, srcTables, mat rix, dstTables);
286 }
287
288 static void color_xform_RGB1_to_linear_premul(uint64_t* dst, const uint32_t* src , int len,
289 const float* const srcTables[3],
290 const float matrix[16]) {
291 color_xform_RGB1<kLinear_DstGamma, true, false>(dst, src, len, srcTables, ma trix, nullptr);
292 }
293
294 static void color_xform_RGB1_to_2dot2_premul_swaprb(uint32_t* dst, const uint32_ t* src, int len,
295 const float* const srcTables [3],
296 const float matrix[16]) {
297 color_xform_RGB1<k2Dot2_DstGamma, true, true>(dst, src, len, srcTables, matr ix, nullptr);
298 }
299
300 static void color_xform_RGB1_to_srgb_premul_swaprb(uint32_t* dst, const uint32_t * src, int len,
301 const float* const srcTables[ 3],
302 const float matrix[16]) {
303 color_xform_RGB1<kSRGB_DstGamma, true, true>(dst, src, len, srcTables, matri x, nullptr);
304 }
305
306 static void color_xform_RGB1_to_table_premul_swaprb(uint32_t* dst, const uint32_ t* src, int len,
307 const float* const srcTables [3],
308 const float matrix[16],
309 const uint8_t* const dstTabl es[3]) {
310 color_xform_RGB1<kTable_DstGamma, true, true>(dst, src, len, srcTables, matr ix, dstTables);
248 } 311 }
249 312
250 } // namespace SK_OPTS_NS 313 } // namespace SK_OPTS_NS
251 314
252 #endif // SkColorXform_opts_DEFINED 315 #endif // SkColorXform_opts_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698