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

Side by Side Diff: src/core/SkColorSpaceXform.cpp

Issue 2256023002: Flush denorm half floats to zero. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix threshold, clean up tests 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 | « src/core/SkBitmap.cpp ('k') | src/core/SkHalf.h » ('j') | 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 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 #include "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkColorSpace_Base.h" 9 #include "SkColorSpace_Base.h"
10 #include "SkColorSpacePriv.h" 10 #include "SkColorSpacePriv.h"
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 if (kYes_SwapRB == kSwapRB) { 869 if (kYes_SwapRB == kSwapRB) {
870 tmp = SkSwizzle_RB(tmp); 870 tmp = SkSwizzle_RB(tmp);
871 } 871 }
872 872
873 *(uint32_t*)dst = tmp; 873 *(uint32_t*)dst = tmp;
874 } 874 }
875 875
876 static inline void store_f16(void* dst, const uint32_t* src, 876 static inline void store_f16(void* dst, const uint32_t* src,
877 Sk4f& dr, Sk4f& dg, Sk4f& db, Sk4f& da, 877 Sk4f& dr, Sk4f& dg, Sk4f& db, Sk4f& da,
878 const uint8_t* const[3], SwapRB) { 878 const uint8_t* const[3], SwapRB) {
879 Sk4h_store4(dst, SkFloatToHalf_finite(dr), 879 Sk4h_store4(dst, SkFloatToHalf_finite_ftz(dr),
880 SkFloatToHalf_finite(dg), 880 SkFloatToHalf_finite_ftz(dg),
881 SkFloatToHalf_finite(db), 881 SkFloatToHalf_finite_ftz(db),
882 SkFloatToHalf_finite(da)); 882 SkFloatToHalf_finite_ftz(da));
883 } 883 }
884 884
885 static inline void store_f16_1(void* dst, const uint32_t* src, 885 static inline void store_f16_1(void* dst, const uint32_t* src,
886 Sk4f& rgba, const Sk4f& a, 886 Sk4f& rgba, const Sk4f& a,
887 const uint8_t* const[3], SwapRB kSwapRB) { 887 const uint8_t* const[3], SwapRB kSwapRB) {
888 rgba = Sk4f(rgba[0], rgba[1], rgba[2], a[3]); 888 rgba = Sk4f(rgba[0], rgba[1], rgba[2], a[3]);
889 SkFloatToHalf_finite(rgba).store((uint64_t*) dst); 889 SkFloatToHalf_finite_ftz(rgba).store((uint64_t*) dst);
890 } 890 }
891 891
892 static inline void store_f16_opaque(void* dst, const uint32_t* src, 892 static inline void store_f16_opaque(void* dst, const uint32_t* src,
893 Sk4f& dr, Sk4f& dg, Sk4f& db, Sk4f& da, 893 Sk4f& dr, Sk4f& dg, Sk4f& db, Sk4f& da,
894 const uint8_t* const[3], SwapRB) { 894 const uint8_t* const[3], SwapRB) {
895 Sk4h_store4(dst, SkFloatToHalf_finite(dr), 895 Sk4h_store4(dst, SkFloatToHalf_finite_ftz(dr),
896 SkFloatToHalf_finite(dg), 896 SkFloatToHalf_finite_ftz(dg),
897 SkFloatToHalf_finite(db), 897 SkFloatToHalf_finite_ftz(db),
898 SK_Half1); 898 SK_Half1);
899 } 899 }
900 900
901 static inline void store_f16_1_opaque(void* dst, const uint32_t* src, 901 static inline void store_f16_1_opaque(void* dst, const uint32_t* src,
902 Sk4f& rgba, const Sk4f& a, 902 Sk4f& rgba, const Sk4f& a,
903 const uint8_t* const[3], SwapRB kSwapRB) { 903 const uint8_t* const[3], SwapRB kSwapRB) {
904 uint64_t tmp; 904 uint64_t tmp;
905 SkFloatToHalf_finite(rgba).store(&tmp); 905 SkFloatToHalf_finite_ftz(rgba).store(&tmp);
906 tmp |= static_cast<uint64_t>(SK_Half1) << 48; 906 tmp |= static_cast<uint64_t>(SK_Half1) << 48;
907 *((uint64_t*) dst) = tmp; 907 *((uint64_t*) dst) = tmp;
908 } 908 }
909 909
910 static inline void store_generic(void* dst, const uint32_t* src, 910 static inline void store_generic(void* dst, const uint32_t* src,
911 Sk4f& dr, Sk4f& dg, Sk4f& db, Sk4f&, 911 Sk4f& dr, Sk4f& dg, Sk4f& db, Sk4f&,
912 const uint8_t* const dstTables[3], SwapRB kSwap RB) { 912 const uint8_t* const dstTables[3], SwapRB kSwap RB) {
913 int kRShift = 0; 913 int kRShift = 0;
914 int kGShift = 8; 914 int kGShift = 8;
915 int kBShift = 16; 915 int kBShift = 16;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 (dst, src, len, fSrcGammaTables, fSrcToDst, fDstGamm aTables); 1190 (dst, src, len, fSrcGammaTables, fSrcToDst, fDstGamm aTables);
1191 default: 1191 default:
1192 SkASSERT(false); 1192 SkASSERT(false);
1193 return; 1193 return;
1194 } 1194 }
1195 default: 1195 default:
1196 SkASSERT(false); 1196 SkASSERT(false);
1197 return; 1197 return;
1198 } 1198 }
1199 } 1199 }
OLDNEW
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | src/core/SkHalf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698