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

Side by Side Diff: tests/SkNxTest.cpp

Issue 2347473007: Revert of Support Float32 output from SkColorSpaceXform (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « tests/ColorSpaceXformTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 #include "Sk4px.h" 8 #include "Sk4px.h"
9 #include "SkNx.h" 9 #include "SkNx.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 301
302 // A naive implementation with _mm_packs_epi32 would succeed up to 0x7fff bu t fail here: 302 // A naive implementation with _mm_packs_epi32 would succeed up to 0x7fff bu t fail here:
303 for (int i = 0x8000; (1) && i <= 0xffff; i++) { 303 for (int i = 0x8000; (1) && i <= 0xffff; i++) {
304 uint16_t expected = (uint16_t)i; 304 uint16_t expected = (uint16_t)i;
305 uint16_t actual = SkNx_cast<uint16_t>(Sk4i(i))[0]; 305 uint16_t actual = SkNx_cast<uint16_t>(Sk4i(i))[0];
306 306
307 REPORTER_ASSERT(r, expected == actual); 307 REPORTER_ASSERT(r, expected == actual);
308 } 308 }
309 } 309 }
310
311 DEF_TEST(SkNx_4fLoad4Store4, r) {
312 float src[] = {
313 0.0f, 1.0f, 2.0f, 3.0f,
314 4.0f, 5.0f, 6.0f, 7.0f,
315 8.0f, 9.0f, 10.0f, 11.0f,
316 12.0f, 13.0f, 14.0f, 15.0f
317 };
318
319 Sk4f a, b, c, d;
320 Sk4f_load4(src, &a, &b, &c, &d);
321 REPORTER_ASSERT(r, 0.0f == a[0]);
322 REPORTER_ASSERT(r, 4.0f == a[1]);
323 REPORTER_ASSERT(r, 8.0f == a[2]);
324 REPORTER_ASSERT(r, 12.0f == a[3]);
325 REPORTER_ASSERT(r, 1.0f == b[0]);
326 REPORTER_ASSERT(r, 5.0f == b[1]);
327 REPORTER_ASSERT(r, 9.0f == b[2]);
328 REPORTER_ASSERT(r, 13.0f == b[3]);
329 REPORTER_ASSERT(r, 2.0f == c[0]);
330 REPORTER_ASSERT(r, 6.0f == c[1]);
331 REPORTER_ASSERT(r, 10.0f == c[2]);
332 REPORTER_ASSERT(r, 14.0f == c[3]);
333 REPORTER_ASSERT(r, 3.0f == d[0]);
334 REPORTER_ASSERT(r, 7.0f == d[1]);
335 REPORTER_ASSERT(r, 11.0f == d[2]);
336 REPORTER_ASSERT(r, 15.0f == d[3]);
337
338 float dst[16];
339 Sk4f_store4(dst, a, b, c, d);
340 REPORTER_ASSERT(r, 0 == memcmp(dst, src, 16 * sizeof(float)));
341 }
OLDNEW
« no previous file with comments | « tests/ColorSpaceXformTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698