HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PXL_PixelImpl.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: PXL_Pixel.C
7  *
8  * COMMENTS:
9  * Utility class for manipulating different types of pixel data (uint8,
10  * uint16, int32, float32)
11  */
12 #ifndef PXL_PIXEL_C
13 #define PXL_PIXEL_C
14 
15 #include <limits.h>
16 #include <stdlib.h>
17 
18 #include <SYS/SYS_Types.h>
19 #include <SYS/SYS_Math.h>
20 #include <SYS/SYS_Floor.h>
21 
22 #include <UT/UT_Endian.h>
23 
24 #include "PXL_Pixel.h"
25 #include <UT/UT_StackTrace.h>
26 
27 //#ifndef LONGLONG_MAX
28 //#define LONGLONG_MAX 9223372036854775807L
29 //#endif
30 
31 //#define USE_LUT_FOR_8_16_TO_FP_CONV
32 
33 #ifdef USE_LUT_FOR_8_TO_FP_CONV
34 // Hard coded LUTs for 8bit conversion to FP.
35 static float lut8bitFP[256] =
36 {
37 0.000000, 0.003922, 0.007843, 0.011765, 0.015686, 0.019608, 0.023529, 0.027451,
38 0.031373, 0.035294, 0.039216, 0.043137, 0.047059, 0.050980, 0.054902, 0.058824,
39 0.062745, 0.066667, 0.070588, 0.074510, 0.078431, 0.082353, 0.086275, 0.090196,
40 0.094118, 0.098039, 0.101961, 0.105882, 0.109804, 0.113725, 0.117647, 0.121569,
41 0.125490, 0.129412, 0.133333, 0.137255, 0.141176, 0.145098, 0.149020, 0.152941,
42 0.156863, 0.160784, 0.164706, 0.168627, 0.172549, 0.176471, 0.180392, 0.184314,
43 0.188235, 0.192157, 0.196078, 0.200000, 0.203922, 0.207843, 0.211765, 0.215686,
44 0.219608, 0.223529, 0.227451, 0.231373, 0.235294, 0.239216, 0.243137, 0.247059,
45 0.250980, 0.254902, 0.258824, 0.262745, 0.266667, 0.270588, 0.274510, 0.278431,
46 0.282353, 0.286275, 0.290196, 0.294118, 0.298039, 0.301961, 0.305882, 0.309804,
47 0.313725, 0.317647, 0.321569, 0.325490, 0.329412, 0.333333, 0.337255, 0.341176,
48 0.345098, 0.349020, 0.352941, 0.356863, 0.360784, 0.364706, 0.368627, 0.372549,
49 0.376471, 0.380392, 0.384314, 0.388235, 0.392157, 0.396078, 0.400000, 0.403922,
50 0.407843, 0.411765, 0.415686, 0.419608, 0.423529, 0.427451, 0.431373, 0.435294,
51 0.439216, 0.443137, 0.447059, 0.450980, 0.454902, 0.458824, 0.462745, 0.466667,
52 0.470588, 0.474510, 0.478431, 0.482353, 0.486275, 0.490196, 0.494118, 0.498039,
53 0.501961, 0.505882, 0.509804, 0.513725, 0.517647, 0.521569, 0.525490, 0.529412,
54 0.533333, 0.537255, 0.541176, 0.545098, 0.549020, 0.552941, 0.556863, 0.560784,
55 0.564706, 0.568627, 0.572549, 0.576471, 0.580392, 0.584314, 0.588235, 0.592157,
56 0.596078, 0.600000, 0.603922, 0.607843, 0.611765, 0.615686, 0.619608, 0.623529,
57 0.627451, 0.631373, 0.635294, 0.639216, 0.643137, 0.647059, 0.650980, 0.654902,
58 0.658824, 0.662745, 0.666667, 0.670588, 0.674510, 0.678431, 0.682353, 0.686275,
59 0.690196, 0.694118, 0.698039, 0.701961, 0.705882, 0.709804, 0.713725, 0.717647,
60 0.721569, 0.725490, 0.729412, 0.733333, 0.737255, 0.741176, 0.745098, 0.749020,
61 0.752941, 0.756863, 0.760784, 0.764706, 0.768627, 0.772549, 0.776471, 0.780392,
62 0.784314, 0.788235, 0.792157, 0.796078, 0.800000, 0.803922, 0.807843, 0.811765,
63 0.815686, 0.819608, 0.823529, 0.827451, 0.831373, 0.835294, 0.839216, 0.843137,
64 0.847059, 0.850980, 0.854902, 0.858824, 0.862745, 0.866667, 0.870588, 0.874510,
65 0.878431, 0.882353, 0.886275, 0.890196, 0.894118, 0.898039, 0.901961, 0.905882,
66 0.909804, 0.913725, 0.917647, 0.921569, 0.925490, 0.929412, 0.933333, 0.937255,
67 0.941176, 0.945098, 0.949020, 0.952941, 0.956863, 0.960784, 0.964706, 0.968627,
68 0.972549, 0.976471, 0.980392, 0.984314, 0.988235, 0.992157, 0.996078, 1.000000
69 };
70 #endif
71 
72 
73 // Contructors.
74 template<>
75 inline
77  unsigned int white,
78  unsigned char value)
79 {
81  myType = PXL_INT8;
82  myBlack = black;
83  myWhite = white;
84  myValue = value;
85  if(myBlack != myWhite)
86  myPntScale = 1.0f / (myWhite - myBlack);
87  else myPntScale = 1.0f;
88 }
89 
90 template<>
91 inline
93  unsigned int white,
94  unsigned char value)
95 {
97  myType = PXL_INT8;
98  myBlack = black;
99  myWhite = white;
100  myValue = value;
101  myPntScale = 1.0f;
102 }
103 
104 template<>
105 inline
107 {
109  myType = PXL_INT8;
110 
111  myBlack = pix.myBlack;
112  myWhite = pix.myWhite;
113  myValue = pix.myValue;
114  if(myBlack != myWhite)
115  myPntScale = 1.0f / (myWhite - myBlack);
116  else myPntScale = 1.0f;
117 }
118 
119 
120 template<>
121 inline
123 {
125  myType = PXL_INT8;
126 
127  myBlack = pix.myBlack;
128  myWhite = pix.myWhite;
129  myValue = pix.myValue;
130  myPntScale = 1.0f;
131 }
132 
133 template<>
134 inline
136  unsigned int white,
137  unsigned short value)
138 {
140  myType = PXL_INT16;
141  myBlack = black;
142  myWhite = white;
143  myValue = value;
144  if(myBlack != myWhite)
145  myPntScale = 1.0f / (myWhite - myBlack);
146  else myPntScale = 1.0f;
147 }
148 
149 template<>
150 inline
152  unsigned int white,
153  unsigned short value)
154 {
156  myType = PXL_INT16;
157  myBlack = black;
158  myWhite = white;
159  myValue = value;
160  myPntScale = 1.0f;
161 }
162 
163 template<>
164 inline
166 {
168  myType = PXL_INT16;
169 
170  myBlack = pix.myBlack;
171  myWhite = pix.myWhite;
172  myValue = pix.myValue;
173  if(myBlack != myWhite)
174  myPntScale = 1.0f / (myWhite - myBlack);
175  else myPntScale = 1.0f;
176 }
177 
178 template<>
179 inline
181 {
183  myType = PXL_INT16;
184 
185  myBlack = pix.myBlack;
186  myWhite = pix.myWhite;
187  myValue = pix.myValue;
188  myPntScale = 1.0f;
189 }
190 
191 template<>
192 inline
194  unsigned int white,
195  unsigned int value)
196 {
198  myType = PXL_INT32;
199  myBlack = black;
200  myWhite = white;
201  myValue = value;
202  if(myBlack != myWhite)
203  myPntScale = 1.0f / (myWhite - myBlack);
204  else myPntScale = 1.0f;
205 }
206 
207 template<>
208 inline
210  unsigned int white,
211  unsigned int value)
212 {
214  myType = PXL_INT32;
215  myBlack = black;
216  myWhite = white;
217  myValue = value;
218  myPntScale = 1.0f;
219 }
220 
221 template<>
222 inline
224 {
226  myType = PXL_INT32;
227 
228  myBlack = pix.myBlack;
229  myWhite = pix.myWhite;
230  myValue = pix.myValue;
231  if(myBlack != myWhite)
232  myPntScale = 1.0f / (myWhite - myBlack);
233  else myPntScale = 1.0f;
234 }
235 
236 
237 template<>
238 inline
240 {
242  myType = PXL_INT32;
243 
244  myBlack = pix.myBlack;
245  myWhite = pix.myWhite;
246  myValue = pix.myValue;
247  myPntScale = 1.0f;
248 }
249 
250 template<>
251 inline
253  unsigned int white,
254  float value)
255 {
257  myType = PXL_FLOAT32;
258  myBlack = black;
259  myWhite = white;
260  myValue = value;
261  myPntScale = 1.0f;
262 }
263 
264 template<>
265 inline
267  unsigned int white,
268  float value)
269 {
271  myType = PXL_FLOAT32;
272  myBlack = black;
273  myWhite = white;
274  myValue = value;
275  myPntScale = 1.0f;
276 }
277 
278 template<>
279 inline
281  unsigned int,
282  fpreal16 value)
283 {
285  myType = PXL_FLOAT16;
286  myBlack = 0;
287  myWhite = 1;
288  myValue = value;
289  myPntScale = 1.0f;
290 }
291 
292 template<>
293 inline
295  unsigned int,
296  fpreal16 value)
297 {
299  myType = PXL_FLOAT16;
300  myBlack = 0;
301  myWhite = 1;
302  myValue = value;
303  myPntScale = 1.0f;
304 }
305 
306 template<>
307 inline
309 {
311  myType = PXL_FLOAT32;
312 
313  myBlack = pix.myBlack;
314  myWhite = pix.myWhite;
315  myValue = pix.myValue;
316  myPntScale = 1.0f;
317 }
318 
319 
320 template<>
321 inline
323 {
325  myType = PXL_FLOAT32;
326 
327  myBlack = pix.myBlack;
328  myWhite = pix.myWhite;
329  myValue = pix.myValue;
330  myPntScale = 1.0f;
331 }
332 
333 template<>
334 inline
336 {
338  myType = PXL_FLOAT16;
339 
340  myBlack = pix.myBlack;
341  myWhite = pix.myWhite;
342  myValue = pix.myValue;
343  myPntScale = 1.0f;
344 }
345 
346 
347 template<>
348 inline
350 {
352  myType = PXL_FLOAT16;
353 
354  myBlack = pix.myBlack;
355  myWhite = pix.myWhite;
356  myValue = pix.myValue;
357  myPntScale = 1.0f;
358 }
359 
360 template<class Type, int fast>
361 inline
362 PXL_Pixel<Type, fast>::PXL_Pixel(unsigned b, unsigned int w, Type v)
363 {
365  myBlack = b;
366  myWhite = w;
367  myValue = v;
368  if(myBlack != myWhite)
369  myPntScale = 1.0f / (myWhite - myBlack);
370  else myPntScale = 1.0f;
371 }
372 
373 template<class Type, int fast>
374 inline
376 {
378  myType = pix.myType;
379  myBlack = pix.myBlack;
380  myWhite = pix.myWhite;
381  myValue = pix.myValue;
382 
383  if(myBlack != myWhite)
384  myPntScale = 1.0f / (myWhite - myBlack);
385  else myPntScale = 1.0f;
386 }
387 
388 // format names.
389 template<>
390 inline const char * PXL_Pixel<unsigned char, 0>::formatName() const
391 { return "char:slow"; }
392 template<>
393 inline const char * PXL_Pixel<unsigned char, 1>::formatName() const
394 { return "char:fast"; }
395 template<>
396 inline const char * PXL_Pixel<unsigned short, 0>::formatName() const
397 { return "short:slow"; }
398 template<>
399 inline const char * PXL_Pixel<unsigned short, 1>::formatName() const
400 { return "short:fast"; }
401 template<>
402 inline const char * PXL_Pixel<unsigned int, 0>::formatName() const
403 { return "int:slow"; }
404 template<>
405 inline const char * PXL_Pixel<unsigned int, 1>::formatName() const
406 { return "int:fast"; }
407 template<>
408 inline const char * PXL_Pixel<float, 0>::formatName() const
409 { return "float:slow"; }
410 template<>
411 inline const char * PXL_Pixel<float, 1>::formatName() const
412 { return "float:fast"; }
413 template<>
414 inline const char * PXL_Pixel<fpreal16, 0>::formatName() const
415 { return "float16:slow"; }
416 template<>
417 inline const char * PXL_Pixel<fpreal16, 1>::formatName() const
418 { return "float16:fast"; }
419 
420 template<class Type, int fast> inline const char *
422 { return "unknown"; }
423 
424 
425 // Min/Max definitions
426 
427 template<>
428 inline unsigned char
430 {
431  return UCHAR_MAX;
432 }
433 
434 template<>
435 inline unsigned char
437 {
438  return UCHAR_MAX;
439 }
440 
441 template<>
442 inline unsigned char
444 {
445  return (unsigned char) 0;
446 }
447 
448 template<>
449 inline unsigned char
451 {
452  return (unsigned char) 0;
453 }
454 
455 template<>
456 inline unsigned short
458 {
459  return USHRT_MAX;
460 }
461 
462 template<>
463 inline unsigned short
465 {
466  return USHRT_MAX;
467 }
468 
469 template<>
470 inline unsigned short
472 {
473  return (unsigned short) 0;
474 }
475 
476 template<>
477 inline unsigned short
479 {
480  return (unsigned short) 0;
481 }
482 
483 template<>
484 inline unsigned int
486 {
487  return UINT_MAX;
488 }
489 
490 template<>
491 inline unsigned int
493 {
494  return UINT_MAX;
495 }
496 
497 template<>
498 inline unsigned int
500 {
501  return 0;
502 }
503 
504 template<>
505 inline unsigned int
507 {
508  return 0;
509 }
510 
511 template<>
512 inline float
514 {
515  return (float) 0.0F;
516 }
517 
518 template<>
519 inline float
521 {
522  return (float) 0.0F;
523 }
524 
525 template<>
526 inline float
528 {
529  return 1.0F;
530 }
531 
532 template<>
533 inline float
535 {
536  return 1.0F;
537 }
538 
539 
540 template<>
541 inline fpreal16
543 {
544  return -H_REAL16_MAX;
545 }
546 
547 template<>
548 inline fpreal16
550 {
551  return -H_REAL16_MAX;
552 }
553 
554 template<>
555 inline fpreal16
557 {
558  return H_REAL16_MAX;
559 }
560 
561 template<>
562 inline fpreal16
564 {
565  return H_REAL16_MAX;
566 }
567 
568 
569 // specific 8 bit pixel definitions.... 0-255 *****************************
570 
571 template<>
572 inline unsigned char
574 {
575  int result = (int(myValue) - myBlack) *maxValue() /(myWhite - myBlack);
576  result /= val;
577  result = result * (myWhite - myBlack) / maxValue() + myBlack;
578 
579  if(result > maxValue())
580  result = maxValue();
581  else if(result < 0)
582  result = 0;
583 
584  return result;
585 }
586 
587 template<>
588 inline unsigned char
590 {
591  return (val > 0) ? (myValue / val) : 0;
592 }
593 
594 template<>
595 inline unsigned char
597 {
598  int64 result = myValue;
599  int64 max = maxValue();
600 
601  result = (int64(myValue) - myBlack) * max / (myWhite - myBlack);
602  result *= val;
603  result = result * (myWhite - myBlack) / max + myBlack;
604 
605  if(result > max)
606  result = max;
607  else if(result < 0)
608  result = 0;
609 
610  return result;
611 }
612 
613 template<>
614 inline unsigned char
616 {
617  int64 max = maxValue();
618  int64 result = myValue * val;
619 
620  if(result > max)
621  result = max;
622  else if(result < 0)
623  result = 0;
624 
625  return result;
626 }
627 
628 template<>
629 inline unsigned char
631 {
632  int64 result;
633  int64 max = maxValue();
634  double f;
635 
636  result = (int(myValue) - myBlack) *max / (myWhite - myBlack);
637 
638  f = result * fval;
639  result = (f > 0.0) ? int64(f + 0.5) : int64(f-0.5);
640  result = result *(myWhite+myBlack) / max + myBlack;
641 
642  if(result > max)
643  result = max;
644  else if(result < 0)
645  result = 0;
646 
647  return (unsigned char) result;
648 }
649 
650 template<>
651 inline unsigned char
653 {
654  int64 result;
655  int64 max = maxValue();
656 
657  if(fval > 0.0F)
658  {
659  double f;
660 
661  result = myValue;
662  f = result * fval;
663  result = (f>0.0) ? int64(f + 0.5) : int64(f - 0.5);
664  }
665  else
666  result = 0;
667 
668  if(result > max)
669  result = max;
670  else if(result < 0)
671  result = 0;
672 
673  return (unsigned char) result;
674 }
675 
676 template<>
677 inline PXL_Pixel<unsigned char,0>::operator unsigned char () const
678 {
679  int result = (int(myValue) - myBlack) *UCHAR_MAX / (myWhite - myBlack);
680 
681  if(result > UCHAR_MAX)
682  result = UCHAR_MAX;
683  else if(result < 0)
684  result = 0;
685 
686  return (unsigned char) result;
687 }
688 
689 template<>
690 inline PXL_Pixel<unsigned char,1>::operator unsigned char () const
691 {
692  return myValue;
693 }
694 
695 template<>
696 inline PXL_Pixel<unsigned char,0>::operator unsigned short () const
697 {
698  int64 result = (((int64)myValue) - ((int64)myBlack)) *((int64)USHRT_MAX)
699  / (int64)(myWhite - myBlack);
700 
701  if(result > (int64)USHRT_MAX)
702  result = (int64)USHRT_MAX;
703  else if(result < 0)
704  result = 0;
705 
706  return (unsigned short) (result&0x0000FFFFU);
707 }
708 
709 template<>
710 inline PXL_Pixel<unsigned char,1>::operator unsigned short () const
711 {
712  unsigned short val = (((unsigned short)myValue) << 8) +
713  ((unsigned short)myValue);
714 
715  return val;
716 }
717 
718 
719 template<>
721 {
722  int64 val = (int64)((myValue) - myBlack) *
723  ((int64)UINT_MAX) / ((int64)(myWhite - myBlack));
724 
725  if(val < 0) val =0;
726  if(val > (int64) UINT_MAX) val = (int64) UINT_MAX;
727 
728  return (unsigned int) val;
729 }
730 
731 template<>
733 {
734  unsigned int result = (((unsigned int)myValue) << 24U) +
735  (((unsigned int)myValue) << 16U) +
736  (((unsigned int)myValue) << 8U) +
737  (((unsigned int)myValue));
738  return result;
739 }
740 
741 template<>
743 {
744  return float((int)(myValue - myBlack)) * myPntScale;
745 }
746 
747 template<>
749 {
750 #ifdef USE_LUT_FOR_8_TO_FP_CONV
751  return lut8bitFP[myValue];
752 #else
753  return (((int)myValue) * 3.921569e-03f);
754 #endif
755 }
756 
757 template<>
758 inline void
760 {
761  int max = maxValue();
762  int half = (max>>1);
763  int result = (v * (myWhite - myBlack) + half) / max + myBlack;
764 
765  if(result > max)
766  result = max;
767  else if(result < 0)
768  result = 0;
769 
770  myValue = (unsigned char) result;
771 }
772 
773 template<>
774 inline void
776 {
777  int max = maxValue();
778 
779  if(v > max)
780  v = max;
781 
782  myValue = (unsigned char) v;
783 }
784 
785 template<>
786 inline int
788 {
789  int range = myWhite - myBlack;
790  float max = float(int(maxValue()) - myBlack) / float(range);
791  float min = float(int(minValue()) - myBlack) / float(range);
792 
793  if(f > max)
794  f = max;
795  else if(f < min)
796  f = min;
797 
798  return (int) SYSfloorIL(range *f +myBlack +0.5F);
799 }
800 
801 template<>
802 inline int
804 {
805  if(f > 1.0F)
806  f = 1.0F;
807  else if(f < 0.0F)
808  f = 0.0F;
809 
810  return int(SYSfloorIL(maxValue() *f +0.5F));
811 }
812 
813 template<>
814 inline void
816 {
817  if(b < 0.0F) b = 0.0F;
818  if(w < 0.0F) w = 0.0F;
819  if(b > 1.0F) b = 1.0F;
820  if(w > 1.0F) w = 1.0F;
821 
822  myBlack = (unsigned int)SYSfloorIL(b * UCHAR_MAX + 0.5F);
823  myWhite = (unsigned int)SYSfloorIL(w * UCHAR_MAX + 0.5F);
824  if(myBlack != myWhite)
825  myPntScale = 1.0f / (myWhite - myBlack);
826  else
827  myPntScale = 1.0f;
828 }
829 
830 template<>
831 inline void
833 {
834  myPntScale = 1.0f; // the fast version does not use b/w points.
835 }
836 
837 
838 // 16 bit unsigned definitions (0-65535) ************************************
839 
840 template<>
841 inline unsigned short
843 {
844  int64 result = (int64(myValue) -myBlack) * USHRT_MAX / (myWhite - myBlack);
845  result /= val;
846  result = result * (myWhite - myBlack) / USHRT_MAX + myBlack;
847 
848  if(result > maxValue())
849  result = maxValue();
850  else if(result < 0)
851  result = 0;
852 
853  return (unsigned short) result;
854 }
855 
856 template<>
857 inline unsigned short
859 {
860  return (val > 0) ? (myValue / val) : 0;
861 }
862 
863 template<>
864 inline unsigned short
866 {
867  int64 result = myValue;
868  int64 max = maxValue();
869 
870  result = (int64(myValue) - myBlack) * USHRT_MAX / (myWhite - myBlack);
871  result *= val;
872  result = result * (myWhite - myBlack) / USHRT_MAX + myBlack;
873 
874  if(result > max)
875  result = max;
876  else if(result < 0)
877  result = 0;
878 
879  return result;
880 }
881 
882 template<>
883 inline unsigned short
885 {
886  int64 result = myValue * val;
887  int64 max = maxValue();
888 
889  if(result > max)
890  result = max;
891  else if(result < 0)
892  result = 0;
893 
894  return result;
895 }
896 
897 template<>
898 inline unsigned short
900 {
901  int64 result;
902  int64 max = maxValue();
903 
904  result = (int(myValue) - myBlack) *max / (myWhite - myBlack);
905  double f;
906 
907  f = result * fval;
908  result = (f > 0.0) ? int64(f + 0.5) : int64(f-0.5);
909  result = result *(myWhite+myBlack) / max + myBlack;
910 
911  if(result > max)
912  result = max;
913  else if(result < 0)
914  result = 0;
915 
916  return (unsigned short) result;
917 }
918 
919 template<>
920 inline unsigned short
922 {
923  int64 result;
924  int64 max = maxValue();
925 
926  if(fval > 0.0F)
927  {
928  double f;
929 
930  result = myValue;
931  f = result * fval;
932  result = (f>0.0) ? int64(f + 0.5) : int64(f - 0.5);
933  }
934  else
935  result = 0;
936 
937  if(result > max)
938  result = max;
939  else if(result < 0)
940  result = 0;
941 
942  return (unsigned short) result;
943 }
944 
945 template<>
946 inline PXL_Pixel<unsigned short,0>::operator unsigned char () const
947 {
948  float result = ((float)myValue-(float)myBlack) / float(myWhite-myBlack);
949 
950  if(result > 1.0f)
951  result = 1.0f;
952  else if(result < 0.0f)
953  result = 0.0f;
954 
955  return (int) SYSfloorIL(result * UCHAR_MAX);
956 }
957 
958 template<>
959 inline PXL_Pixel<unsigned short,1>::operator unsigned char () const
960 {
961  unsigned char val = (unsigned char) ((myValue >> 8)&0x00FF);
962  if(val < UCHAR_MAX && (myValue &0x0080))
963  val++;
964 
965  return val;
966 }
967 
968 template<>
969 inline PXL_Pixel<unsigned short,0>::operator unsigned short () const
970 {
971  int result = (int(myValue) - myBlack) *USHRT_MAX / (myWhite - myBlack);
972 
973  if(result > USHRT_MAX)
974  result = USHRT_MAX;
975  else if(result < 0)
976  result = 0;
977 
978  return (unsigned short) result;
979 }
980 
981 template<>
982 inline PXL_Pixel<unsigned short,1>::operator unsigned short () const
983 {
984  return myValue;
985 }
986 
987 template<>
989 {
990  float val = float(myValue - myBlack) *myPntScale;
991 
992  if(val < 0.0f) val = 0.0f;
993  else if(val > 1.0f) val = 1.0f;
994 
995  return (unsigned int) SYSfloorIL(val * UINT_MAX);
996 }
997 
998 template<>
1000 {
1001  unsigned int result = (((unsigned int)myValue) << 15) +
1002  (((unsigned int)myValue) >> 1);
1003  return result;
1004 }
1005 
1006 template<>
1008 {
1009  return float((int)(myValue - myBlack)) * myPntScale;
1010 }
1011 
1012 template<>
1014 {
1015  return ((int)myValue) * 1.5259021e-5f;
1016 }
1017 
1018 template<>
1019 inline void
1021 {
1022  int max = maxValue();
1023  int half = (max>>1);
1024  int result = (v * (myWhite - myBlack) + half) / max + myBlack;
1025 
1026  if(result > max)
1027  result = max;
1028  else if(result < 0)
1029  result = 0;
1030 
1031  myValue = (unsigned short) result;
1032 }
1033 
1034 template<>
1035 inline void
1037 {
1038  int max = maxValue();
1039 
1040  if(v > max)
1041  v = max;
1042 
1043  myValue = (unsigned short) v;
1044 }
1045 
1046 
1047 template<>
1048 inline int
1050 {
1051  int range = myWhite - myBlack;
1052  float max = float(int(maxValue()) - myBlack) / float(range);
1053  float min = float(int(minValue()) - myBlack) / float(range);
1054 
1055  if(f > max)
1056  f = max;
1057  else if(f < min)
1058  f = min;
1059 
1060  return int(SYSfloorIL(range *f +myBlack +0.5F));
1061 }
1062 
1063 template<>
1064 inline int
1066 {
1067  if(f > 1.0F)
1068  f = 1.0F;
1069  else if(f < 0.0F)
1070  f = 0.0F;
1071 
1072  return int(SYSfloorIL(maxValue() *f +0.5F));
1073 }
1074 
1075 template<>
1076 inline void
1078 {
1079  if(b < 0.0F) b = 0.0F;
1080  if(w < 0.0F) w = 0.0F;
1081  if(b > 1.0F) b = 1.0F;
1082  if(w > 1.0F) w = 1.0F;
1083 
1084  myBlack = (unsigned int)SYSfloorIL(b * USHRT_MAX + 0.5F);
1085  myWhite = (unsigned int)SYSfloorIL(w * USHRT_MAX + 0.5F);
1086  if(myBlack != myWhite)
1087  myPntScale = 1.0f / (myWhite - myBlack);
1088  else
1089  myPntScale = 1.0f;
1090 }
1091 
1092 template<>
1093 inline void
1095 {
1096  myPntScale = 1.0f; // the fast version does not use b/w points.
1097 }
1098 
1099 
1100 
1101 
1102 
1103 
1104 // 32 Bit Integer (-2e9 to 2e9) **************************************
1105 
1106 
1107 template<>
1109 {
1110  return myValue;
1111 }
1112 
1113 template<>
1115 {
1116  return (float)((double(myValue) - myBlack) * myPntScale);
1117 }
1118 
1119 template<>
1121 {
1122  return myValue / double(UINT_MAX);
1123 }
1124 
1125 template<>
1126 inline unsigned int
1128 {
1129  int64 result = (int64(myValue) -myBlack)*INT_MAX / (myWhite - myBlack);
1130  result /= val;
1131  result = result * (myWhite - myBlack) / INT_MAX + myBlack;
1132 
1133  if(result > maxValue())
1134  result = maxValue();
1135  else if(result < minValue())
1136  result = minValue();
1137 
1138  return (unsigned int) result;
1139 }
1140 
1141 template<>
1142 inline unsigned int
1144 {
1145  return (val != 0) ? (myValue / val) : 0;
1146 }
1147 
1148 #define ABS(x) ((x) < 0 ? -x : x)
1149 
1150 template<>
1151 inline unsigned int
1153 {
1154  int64 result = myValue;
1155  int64 max = maxValue();
1156  int64 maxmult;
1157 
1158  result = (int64(myValue) - myBlack) * INT_MAX / (myWhite - myBlack);
1159 
1160  // prevent overflow by determining the maximum factor allowable (the nutty
1161  // expression is the max value of an int64, since I know of no way to
1162  // declare long long constants on LINUX)
1163 #if defined(WIN32) || (defined(LINUX) && !defined(INTEL_COMPILER))
1164  maxmult = ABS( ( ((~int64(0))^(int64(1)<<63)) / result ) );
1165 #else
1166  maxmult = ABS(9223372036854775807LL / result);
1167 #endif
1168 
1169  UT_StackTrace trace;
1170  trace.doTraceback();
1171 
1172  // If the result will overflow, clamp to -/+ max,
1173  // depending on the signs of the multiplicands.
1174  if(abs(val) > maxmult)
1175  {
1176  if((val > 0 && result > 0) ||
1177  (val < 0 && result < 0))
1178  {
1179  result = max;
1180  }
1181  else
1182  {
1183  result = -max -1;
1184  }
1185  }
1186  else
1187  {
1188  result *= val;
1189  result = result * (myWhite - myBlack) / INT_MAX + myBlack;
1190  }
1191 
1192  if(result > max)
1193  result = max;
1194  else if(result < minValue())
1195  result = minValue();
1196 
1197  return result;
1198 }
1199 
1200 template<>
1201 inline unsigned int
1203 {
1204  int64 result = myValue * val;
1205  int64 max = maxValue();
1206 
1207  if(result > max)
1208  result = max;
1209  else if(result < minValue())
1210  result = minValue();
1211 
1212  return result;
1213 }
1214 
1215 template<>
1216 inline unsigned int
1218 {
1219  int64 result;
1220  int64 max = maxValue();
1221  double f;
1222 
1223  result = (int(myValue) - myBlack) * max / (myWhite - myBlack);
1224 
1225  f = result * fval;
1226 
1227  result = (f > 0.0) ? int64(f + 0.5) : int64(f-0.5);
1228  result = result *(myWhite+myBlack) / max + myBlack;
1229 
1230  if(result > max)
1231  result = max;
1232  else if(result < minValue())
1233  result = minValue();
1234 
1235  return (int) result;
1236 }
1237 
1238 template<>
1239 inline unsigned int
1241 {
1242  int64 result;
1243  int64 max = maxValue();
1244  double f;
1245 
1246  result = myValue;
1247  f = result * fval;
1248  result = (f>0.0) ? int64(f + 0.5) : int64(f - 0.5);
1249 
1250  if(result > max)
1251  result = max;
1252  else if(result < minValue())
1253  result = minValue();
1254 
1255  return (int) result;
1256 }
1257 
1258 template<>
1259 inline PXL_Pixel<unsigned int,0>::operator unsigned char () const
1260 {
1261  int64 result = (((int64)(myValue)) -myBlack) *UCHAR_MAX /(myWhite-myBlack);
1262 
1263  if(result > UCHAR_MAX)
1264  result = UCHAR_MAX;
1265  else if(result < 0)
1266  result = 0;
1267 
1268  return (unsigned char) result;
1269 }
1270 
1271 template<>
1272 inline PXL_Pixel<unsigned int,1>::operator unsigned char () const
1273 {
1274  unsigned int val;
1275 
1276  val = (unsigned char) ((myValue >> 24U)&0x000000FFU);
1277  if(val < UCHAR_MAX && (myValue & 0x00800000U))
1278  val++;
1279 
1280  return val;
1281 }
1282 
1283 template<>
1284 inline PXL_Pixel<unsigned int,0>::operator unsigned short () const
1285 {
1286  int64 result = (int64)((int64)myValue-(int64)myBlack) *((int64)USHRT_MAX) /
1287  ((int64)(myWhite - myBlack));
1288 
1289  if(result > (int64) USHRT_MAX)
1290  result = (int64) USHRT_MAX;
1291  else if(result < 0)
1292  result = 0;
1293 
1294  return (unsigned short) (result&0x0000FFFF);
1295 }
1296 
1297 template<>
1298 inline PXL_Pixel<unsigned int,1>::operator unsigned short () const
1299 {
1300  int val;
1301 
1302  val = (unsigned short) ((myValue >> 16U)&0x0000FFFFU);
1303  if(val < USHRT_MAX && (myValue & 0x00008000U))
1304  val++;
1305 
1306  return (unsigned short) val;
1307 }
1308 
1309 template<>
1311 {
1312  int64 result = myValue;
1313  result = (result - myBlack) *INT_MAX / (myWhite - myBlack);
1314  if(result > INT_MAX)
1315  result = INT_MAX;
1316  else if(result < INT_MIN)
1317  result = INT_MIN;
1318 
1319  return (unsigned int) result;
1320 }
1321 
1322 template<>
1323 inline void
1325 {
1326  int64 max = maxValue();
1327  int64 half = (max>>1);
1328  int64 result = (int64(v) * (myWhite - myBlack) + half) / max + myBlack;
1329 
1330  if(result > max)
1331  result = max;
1332  else if(result < minValue())
1333  result = minValue();
1334 
1335  myValue = (unsigned int) result;
1336 }
1337 
1338 template<>
1339 inline void
1341 {
1342  int64 max = maxValue();
1343 
1344  if(v > max)
1345  v = max;
1346  else if(v < minValue())
1347  v = minValue();
1348 
1349  myValue = (int) v;
1350 }
1351 
1352 template<>
1353 inline int
1355 {
1356  int range = myWhite - myBlack;
1357  float max = float(maxValue() - myBlack) / float(range);
1358  float min = float(minValue() - myBlack) / float(range);
1359 
1360  if(f > max)
1361  f = max;
1362  else if(f < min)
1363  f = min;
1364 
1365  return int(SYSfloorIL(range *f +myBlack +0.5F));
1366 }
1367 
1368 template<>
1369 inline int
1371 {
1372  if(f > 1.0F)
1373  f = 1.0F;
1374  else if(f < 0.0F)
1375  f = 0.0F;
1376 
1377  return (unsigned int)(SYSfloorIL(maxValue() *f +0.5F));
1378 }
1379 
1380 template<>
1381 inline void
1383 {
1384  if(b < 0.0F) b = 0.0F;
1385  if(w < 0.0F) w = 0.0F;
1386  if(b > 1.0F) b = 1.0F;
1387  if(w > 1.0F) w = 1.0F;
1388 
1389  myBlack = (unsigned int)SYSfloorIL(b * UINT_MAX + 0.5F);
1390  myWhite = (unsigned int)SYSfloorIL(w * UINT_MAX + 0.5F);
1391  if(myBlack != myWhite)
1392  myPntScale = 1.0f / (myWhite - myBlack);
1393  else
1394  myPntScale = 1.0f;
1395 }
1396 
1397 template<>
1398 inline void
1400 {
1401  myPntScale = 1.0f; // the fast version does not use b/w points.
1402 }
1403 
1404 
1405 
1406 // 32 bit floating point pixels *****************************************
1407 
1408 template<>
1409 inline float
1411 {
1412  return myValue + val;
1413 }
1414 
1415 template<>
1416 inline float
1418 {
1419  return myValue + val;
1420 }
1421 
1422 template<>
1423 inline float
1425 {
1426  return myValue / val;
1427 }
1428 
1429 template<>
1430 inline float
1432 {
1433  return myValue / val;
1434 }
1435 
1436 template<>
1437 inline float
1439 {
1440  return myValue * val;
1441 }
1442 
1443 template<>
1444 inline float
1446 {
1447  return myValue * val;
1448 }
1449 
1450 template<>
1451 inline float
1453 {
1454  return myValue + fval;
1455 }
1456 
1457 template<>
1458 inline float
1460 {
1461  return myValue + fval;
1462 }
1463 
1464 template<>
1465 inline float
1467 {
1468  return myValue / fval;
1469 }
1470 
1471 template<>
1472 inline float
1474 {
1475  return myValue / fval;
1476 }
1477 
1478 template<>
1479 inline float
1481 {
1482  return myValue * fval;
1483 }
1484 
1485 template<>
1486 inline float
1488 {
1489  return myValue * fval;
1490 }
1491 
1492 template<>
1493 inline float
1495 {
1496  return myValue += fval;
1497 }
1498 
1499 template<>
1500 inline float
1502 {
1503  return myValue += fval;
1504 }
1505 
1506 template<>
1507 inline PXL_Pixel<float,0>::operator unsigned char () const
1508 {
1509  unsigned char val;
1510  float f;
1511 
1512  f = myValue;
1513  if(f < 0.0F)
1514  f = 0.0F;
1515  else if(f > 1.0F)
1516  f = 1.0F;
1517 
1518  val = (unsigned char) SYSfloorIL(f * UCHAR_MAX + 0.5F);
1519 
1520  return val;
1521 }
1522 
1523 template<>
1524 inline PXL_Pixel<float,1>::operator unsigned char () const
1525 {
1526  unsigned char val;
1527  float f;
1528 
1529  f = myValue;
1530  if(f < 0.0F)
1531  f = 0.0F;
1532  else if(f > 1.0F)
1533  f = 1.0F;
1534 
1535  val = (unsigned char) SYSfloorIL(f * UCHAR_MAX + 0.5F);
1536 
1537  return val;
1538 }
1539 
1540 template<>
1541 inline PXL_Pixel<float,0>::operator unsigned short () const
1542 {
1543  unsigned short val;
1544  float f;
1545 
1546  f = myValue;
1547  if(f < 0.0F)
1548  f = 0.0F;
1549  else if(f > 1.0F)
1550  f = 1.0F;
1551 
1552  val = (unsigned short) SYSfloorIL(f * USHRT_MAX + 0.5F);
1553 
1554  return val;
1555 }
1556 
1557 template<>
1558 inline PXL_Pixel<float,1>::operator unsigned short () const
1559 {
1560  unsigned short val;
1561  float f;
1562 
1563  f = myValue;
1564  if(f < 0.0F)
1565  f = 0.0F;
1566  else if(f > 1.0F)
1567  f = 1.0F;
1568 
1569  val = (unsigned short) SYSfloorIL(f * USHRT_MAX + 0.5F);
1570 
1571  return val;
1572 }
1573 
1574 template<>
1575 inline PXL_Pixel<float,0>::operator unsigned int () const
1576 {
1577  unsigned int result;
1578  float f;
1579 
1580  f = myValue;
1581  if(f < 0.0F)
1582  f = 0.0F;
1583  else if(f > 1.0F)
1584  f = 1.0F;
1585 
1586  result = (unsigned int)SYSfloorIL(f * UINT_MAX);
1587 
1588  return result;
1589 }
1590 
1591 template<>
1592 inline PXL_Pixel<float,1>::operator unsigned int () const
1593 {
1594  unsigned int result;
1595  float f;
1596 
1597  f = myValue;
1598  if(f < 0.0F)
1599  f = 0.0F;
1600  else if(f > 1.0F)
1601  f = 1.0F;
1602 
1603  result = (unsigned int)SYSfloorIL(f * UINT_MAX);
1604 
1605  return result;
1606 }
1607 
1608 template<>
1609 inline PXL_Pixel<float,0>::operator float () const
1610 {
1611  return myValue;
1612 }
1613 
1614 template<>
1615 inline PXL_Pixel<float,1>::operator float () const
1616 {
1617  return myValue;
1618 }
1619 
1620 template<>
1621 inline PXL_Pixel<fpreal16,0>::operator float () const
1622 {
1623  return (float)myValue;
1624 }
1625 
1626 template<>
1627 inline PXL_Pixel<fpreal16,1>::operator float () const
1628 {
1629  return (float)myValue;
1630 }
1631 
1632 template<>
1633 inline float
1635 {
1636  return (myValue = (float)val);
1637 }
1638 
1639 template<>
1640 inline float
1642 {
1643  return (myValue = (float)val);
1644 }
1645 
1646 template<>
1647 inline bool
1649 {
1650  return SYSisEqual(myValue, float(val));
1651 }
1652 
1653 template<>
1654 inline bool
1656 {
1657  return SYSisEqual(myValue, float(val));
1658 }
1659 
1660 template<>
1661 inline float
1663 {
1664  return (myValue = fval);
1665 }
1666 
1667 template<>
1668 inline float
1670 {
1671  return (myValue = fval);
1672 }
1673 
1674 template<>
1675 inline bool
1677 {
1678  return SYSisEqual(myValue, fval);
1679 }
1680 
1681 template<>
1682 inline bool
1684 {
1685  return SYSisEqual(myValue, fval);
1686 }
1687 
1688 template<>
1689 inline int
1691 {
1692  return (int)f;
1693 }
1694 
1695 template<>
1696 inline int
1698 {
1699  return (int)f;
1700 }
1701 
1702 
1703 template<>
1704 inline fpreal16
1706 {
1707  return (myValue = (float)val);
1708 }
1709 
1710 template<>
1711 inline fpreal16
1713 {
1714  return (myValue = (float)val);
1715 }
1716 
1717 template<>
1718 inline bool
1720 {
1721  return SYSisEqual((float)myValue, float(val));
1722 }
1723 
1724 template<>
1725 inline bool
1727 {
1728  return SYSisEqual((float)myValue, float(val));
1729 }
1730 
1731 template<>
1732 inline fpreal16
1734 {
1735  myValue = fval;
1736  return (float) myValue;
1737 }
1738 
1739 template<>
1740 inline fpreal16
1742 {
1743  myValue = fval;
1744  return (float) myValue;
1745 }
1746 
1747 template<>
1748 inline bool
1750 {
1751  return SYSisEqual((float)myValue, fval);
1752 }
1753 
1754 template<>
1755 inline bool
1757 {
1758  return SYSisEqual((float)myValue, fval);
1759 }
1760 
1761 template<>
1762 inline int
1764 {
1765  return (int) ((float)f);
1766 }
1767 
1768 template<>
1769 inline int
1771 {
1772  return (int) ((float)f);
1773 }
1774 
1775 // Generic Definitions **************************************
1776 
1777 template<class Type, int fast> inline bool
1779  unsigned b, unsigned w) const
1780 {
1781  return myType == format && (myType == PXL_FLOAT16 ||
1782  myType == PXL_FLOAT32 ||
1783  (b == myBlack && w == myWhite));
1784 }
1785 
1786 
1787 template<class Type, int fast> inline Type
1789 {
1790  Type result = myValue;
1791  Type max = maxValue();
1792 
1793  if(val > 0)
1794  {
1795  if(val > max - myValue)
1796  result = max;
1797  else
1798  result += val;
1799  }
1800  else if(val < 0)
1801  {
1802  if(-val > myValue)
1803  result = 0;
1804  else
1805  result += val;
1806  }
1807 
1808  return result;
1809 }
1810 
1811 template<class Type, int fast> inline Type
1813 {
1814  return *this + (-val);
1815 }
1816 
1817 template<class Type, int fast> inline Type
1819 {
1820  myValue = *this + val;
1821  return myValue;
1822 }
1823 
1824 template<class Type, int fast> inline Type
1826 {
1827  myValue = *this + (-val);
1828  return myValue;
1829 }
1830 
1831 template<class Type, int fast> inline Type
1833 {
1834  myValue = *this / val;
1835  return myValue;
1836 }
1837 
1838 template<class Type, int fast> inline Type
1840 {
1841  myValue = *this * val;
1842  return myValue;
1843 }
1844 
1845 
1846 template<class Type, int fast> inline Type
1848 {
1849  return *this + getIntFromFloat(fval);
1850 }
1851 
1852 template<class Type, int fast> inline Type
1854 {
1855  return *this + (-fval);
1856 }
1857 
1858 template<class Type, int fast> inline Type
1860 {
1861  if(fval == 0.0F)
1862  return maxValue();
1863  else
1864  return *this * (1.0F/fval);
1865 }
1866 
1867 
1868 template<class Type, int fast> inline Type
1870 {
1871  int val = (int) SYSfloorIL((myWhite-myBlack) *fval +myBlack + 0.5F);
1872  return *this += val;
1873 }
1874 
1875 template<class Type, int fast> inline Type
1877 {
1878  return *this += (-fval);
1879 }
1880 
1881 template<class Type, int fast> inline Type
1883 {
1884  return myValue = (*this * fval);
1885 }
1886 
1887 template<class Type, int fast> inline Type
1889 {
1890  if(fval == 0.0F)
1891  {
1892  myValue = maxValue();
1893  return myValue;
1894  }
1895  else
1896  return *this *= (1.0F/fval);
1897 }
1898 
1899 template<>
1900 inline unsigned char
1902 {
1903  int t = (int) SYSfloorIL(fval * 255.0f +0.5F);
1904 
1905  myValue = (unsigned char) PXLclampChar(t);
1906 
1907  return myValue;
1908 }
1909 
1910 template<>
1911 inline unsigned char
1913 {
1914  float f = fval * float(myWhite - myBlack) + (float)myBlack;
1915  int t = (int) SYSfloorIL(f +0.5F);
1916 
1917  myValue = (unsigned char) PXLclampChar(t);
1918 
1919  return myValue;
1920 }
1921 
1922 template<>
1923 inline unsigned short
1925 {
1926  int t = (int) SYSfloorIL(fval * 65535.0f +0.5F);
1927 
1928  myValue = (unsigned short) PXLclampShort(t);
1929 
1930  return myValue;
1931 }
1932 
1933 template<>
1934 inline unsigned short
1936 {
1937  float f = fval * float(myWhite - myBlack) + (float)myBlack;
1938  int t = (int) SYSfloorIL(f +0.5F);
1939 
1940  myValue = PXLclampShort(t);
1941 
1942  return myValue;
1943 }
1944 
1945 template<class Type, int fast> inline Type
1947 {
1948  double f = fval * double(myWhite - myBlack) + myBlack;
1949 
1950  f = SYSfloorIL(f +0.5F);
1951 
1952  if(f < minValue())
1953  set(minValue());
1954  else if(f > maxValue())
1955  set(maxValue());
1956  else
1957  set((unsigned int) f);
1958 
1959  return myValue;
1960 }
1961 
1962 template<class Type, int fast> inline Type
1964 {
1965  if(val > maxValue())
1966  myValue = maxValue();
1967  else if(val < minValue())
1968  myValue = minValue();
1969  else
1970  myValue = val;
1971 
1972  return myValue;
1973 }
1974 
1975 template<class Type, int fast> inline Type
1977 {
1978  myValue = val;
1979  return myValue;
1980 }
1981 
1982 
1983 
1984 template<class Type, int fast> inline bool
1986 {
1987  unsigned int val = (int) SYSfloorIL(fval *(myWhite-myBlack) +myBlack +0.5F);
1988 
1989  return (*this == val);
1990 }
1991 
1992 template<class Type, int fast> inline bool
1994 {
1995  if(val > maxValue())
1996  val = maxValue();
1997 
1998  return (val == myValue) ? 1 : 0;
1999 }
2000 
2001 template<class Type, int fast> inline void
2002 PXL_Pixel<Type,fast>::setRange(unsigned int b, unsigned int w)
2003 {
2004  myWhite = w;
2005  myBlack = b;
2006 }
2007 
2008 template<class Type, int fast> inline void
2010 {
2011  // no mapping done.
2012  myValue = v;
2013 }
2014 
2015 template<class Type, int fast> void
2017 {
2018  myPntScale = 1.0f;
2019 }
2020 
2021 #endif
bool isSameType(PXL_DataFormat format, unsigned b, unsigned w) const
GLenum GLint * range
Definition: glcorearb.h:1924
Type operator/=(int)
const GLdouble * v
Definition: glcorearb.h:836
#define ABS(x)
Type operator+(int) const
bool operator==(unsigned int) const
#define H_REAL16_MAX
Definition: fpreal16.h:270
long long int64
Definition: SYS_Types.h:107
Type operator*(int) const
GLfloat f
Definition: glcorearb.h:1925
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER T abs(T a)
Definition: ImathFun.h:55
const std::enable_if<!VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:133
PXL_Pixel(unsigned int black=0, unsigned int white=0, Type value=0)
Type operator-(int) const
PXL_DataFormat
Definition: PXL_Common.h:19
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
Helper class to output stack traces from the current execution point.
Definition: UT_StackTrace.h:47
void doTraceback(UTsignalHandlerArg sig_arg, const char *label=0, bool add_markers=false)
int getIntFromFloat(float f) const
void mapValue(unsigned int val)
Type operator/(int) const
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:107
GLsizei const GLfloat * value
Definition: glcorearb.h:823
Type assign(unsigned int)
typedef int
Definition: png.h:1175
Type operator-=(int)
Type maxValue() const
const char * formatName() const
Type operator*=(int)
void setBWPoints(float b, float w)
GLuint GLfloat * val
Definition: glcorearb.h:1607
Type set(Type)
int PXLclampChar(int t)
Definition: PXL_Common.h:109
Type minValue() const
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
int PXLclampShort(int t)
Definition: PXL_Common.h:119
const std::enable_if<!VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:129
Type operator=(float)
void setRange(unsigned int b, unsigned int w)
Definition: half.h:91
fpreal32 SYSfloorIL(fpreal32 val)
Definition: SYS_Floor.h:59
PXL_API void PXLdetermineProcCaps()
Type operator+=(int)