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

Side by Side Diff: third_party/qcms/src/transform_util.h

Issue 1206353002: [qcms] Make half float code self-contained: add halffloat.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « third_party/qcms/src/transform.c ('k') | third_party/qcms/src/transform_util.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* vim: set ts=8 sw=8 noexpandtab: */ 1 /* vim: set ts=8 sw=8 noexpandtab: */
2 // qcms 2 // qcms
3 // Copyright (C) 2009 Mozilla Foundation 3 // Copyright (C) 2009 Mozilla Foundation
4 // Copyright (C) 1998-2007 Marti Maria 4 // Copyright (C) 1998-2007 Marti Maria
5 // 5 //
6 // Permission is hereby granted, free of charge, to any person obtaining 6 // Permission is hereby granted, free of charge, to any person obtaining
7 // a copy of this software and associated documentation files (the "Software"), 7 // a copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation 8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar e
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 49
50 float *build_input_gamma_table(struct curveType *TRC); 50 float *build_input_gamma_table(struct curveType *TRC);
51 struct matrix build_colorant_matrix(qcms_profile *p); 51 struct matrix build_colorant_matrix(qcms_profile *p);
52 void build_output_lut(struct curveType *trc, 52 void build_output_lut(struct curveType *trc,
53 uint16_t **output_gamma_lut, size_t *output_gamma_lut_leng th); 53 uint16_t **output_gamma_lut, size_t *output_gamma_lut_leng th);
54 54
55 struct matrix matrix_invert(struct matrix mat); 55 struct matrix matrix_invert(struct matrix mat);
56 qcms_bool compute_precache(struct curveType *trc, uint8_t *output); 56 qcms_bool compute_precache(struct curveType *trc, uint8_t *output);
57 57
58 static inline unsigned short float_to_half_float(float f)
59 {
60 extern const unsigned short qcms_half_float_base_table[512];
61 extern const unsigned char qcms_half_float_shift_table[512];
62
63 // See Blink::Source/platform/graphics/gpu/WebGLImageConversion.cpp::con vertFloatToHalfFloat()
64 // and http://crbug.com/491784
65
66 unsigned temp = *((unsigned *)(&f));
67 unsigned signexp = (temp >> 23) & 0x1ff;
68 return qcms_half_float_base_table[signexp] + ((temp & 0x007fffff) >> qcm s_half_float_shift_table[signexp]);
69 }
70
71 #endif 58 #endif
OLDNEW
« no previous file with comments | « third_party/qcms/src/transform.c ('k') | third_party/qcms/src/transform_util.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698