home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 January / macpower199701.bin / AMUG / Programming_10 / Videotoolbox 96-08-22-c.sit / VideoToolbox / (Utilities) / TestLuminance / TestLuminance.c < prev    next >
MacBinary  |  1995-08-14  |  6.9 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: TestLuminance.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Mon Aug 14 12:45:36 1995, modified Mon Aug 14 12:45:36 1995, creator 'CWIE', type ASCII, 6345 bytes "TestLuminance.c" , at 0x1949 464 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0f 54 65 73 74 4c 75 | 6d 69 6e 61 6e 63 65 2e |..TestLu|minance.|
|00000010| 63 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |c.......|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 18 c9 00 | 00 01 d0 ac 55 2e 30 ac |........|....U.0.|
|00000060| 55 2e 30 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |U.0.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 9c da 00 00 |........|........|
|00000080| 2f 2a 0d 54 65 73 74 4c | 75 6d 69 6e 61 6e 63 65 |/*.TestL|uminance|
|00000090| 2e 63 0d 61 20 73 69 6d | 70 6c 65 20 64 72 69 76 |.c.a sim|ple driv|
|000000a0| 65 72 20 74 6f 20 74 65 | 73 74 20 73 6f 6d 65 20 |er to te|st some |
|000000b0| 6f 66 20 74 68 65 20 66 | 75 6e 63 74 69 6f 6e 61 |of the f|unctiona|
|000000c0| 6c 69 74 79 20 6f 66 20 | 4c 75 6d 69 6e 61 6e 63 |lity of |Luminanc|
|000000d0| 65 2e 63 0d 48 49 53 54 | 4f 52 59 3a 0d 38 2f 31 |e.c.HIST|ORY:.8/1|
|000000e0| 35 2f 38 39 20 64 67 70 | 20 77 72 6f 74 65 20 69 |5/89 dgp| wrote i|
|000000f0| 74 2e 0d 31 30 2f 31 32 | 2f 39 30 20 64 67 70 09 |t..10/12|/90 dgp.|
|00000100| 75 70 64 61 74 65 64 20 | 69 74 2e 0d 31 30 2f 31 |updated |it..10/1|
|00000110| 37 2f 39 30 20 64 67 70 | 09 74 69 64 69 65 64 20 |7/90 dgp|.tidied |
|00000120| 75 70 20 74 68 65 20 74 | 69 6d 69 6e 67 20 70 72 |up the t|iming pr|
|00000130| 69 6e 74 20 6f 75 74 2e | 0d 38 2f 32 34 2f 39 31 |int out.|.8/24/91|
|00000140| 09 64 67 70 09 4d 61 64 | 65 20 63 6f 6d 70 61 74 |.dgp.Mad|e compat|
|00000150| 69 62 6c 65 20 77 69 74 | 68 20 54 48 49 4e 4b 20 |ible wit|h THINK |
|00000160| 43 20 35 2e 30 2e 0d 38 | 2f 32 37 2f 39 32 09 64 |C 5.0..8|/27/92.d|
|00000170| 67 70 09 72 65 70 6c 61 | 63 65 20 53 79 73 45 6e |gp.repla|ce SysEn|
|00000180| 76 69 72 6f 6e 73 28 29 | 20 62 79 20 47 65 73 74 |virons()| by Gest|
|00000190| 61 6c 74 28 29 0d 31 32 | 2f 32 31 2f 39 32 20 64 |alt().12|/21/92 d|
|000001a0| 67 70 20 64 6f 6e 27 74 | 20 61 73 73 75 6d 65 20 |gp don't| assume |
|000001b0| 38 2d 62 69 74 20 64 61 | 63 73 2e 0d 2a 2f 0d 23 |8-bit da|cs..*/.#|
|000001c0| 69 6e 63 6c 75 64 65 20 | 22 56 69 64 65 6f 54 6f |include |"VideoTo|
|000001d0| 6f 6c 62 6f 78 2e 68 22 | 0d 23 69 6e 63 6c 75 64 |olbox.h"|.#includ|
|000001e0| 65 20 22 4c 75 6d 69 6e | 61 6e 63 65 2e 68 22 0d |e "Lumin|ance.h".|
|000001f0| 2f 2f 23 69 6e 63 6c 75 | 64 65 20 3c 46 6f 6e 74 |//#inclu|de <Font|
|00000200| 73 2e 68 3e 0d 23 69 66 | 20 28 54 48 49 4e 4b 5f |s.h>.#if| (THINK_|
|00000210| 43 20 7c 7c 20 54 48 49 | 4e 4b 5f 43 50 4c 55 53 |C || THI|NK_CPLUS|
|00000220| 20 7c 7c 20 53 59 4d 41 | 4e 54 45 43 5f 43 29 0d | || SYMA|NTEC_C).|
|00000230| 09 23 69 6e 63 6c 75 64 | 65 20 3c 70 72 6f 66 69 |.#includ|e <profi|
|00000240| 6c 65 2e 68 3e 0d 23 65 | 6e 64 69 66 0d 0d 76 6f |le.h>.#e|ndif..vo|
|00000250| 69 64 20 54 65 73 74 4c | 75 6d 69 6e 61 6e 63 65 |id TestL|uminance|
|00000260| 28 76 6f 69 64 29 3b 0d | 0d 76 6f 69 64 20 6d 61 |(void);.|.void ma|
|00000270| 69 6e 28 76 6f 69 64 29 | 0d 7b 0d 09 52 65 71 75 |in(void)|.{..Requ|
|00000280| 69 72 65 28 67 65 73 74 | 61 6c 74 38 42 69 74 51 |ire(gest|alt8BitQ|
|00000290| 44 29 3b 0d 09 54 65 73 | 74 4c 75 6d 69 6e 61 6e |D);..Tes|tLuminan|
|000002a0| 63 65 28 29 3b 0d 7d 0d | 0d 76 6f 69 64 20 54 65 |ce();.}.|.void Te|
|000002b0| 73 74 4c 75 6d 69 6e 61 | 6e 63 65 28 76 6f 69 64 |stLumina|nce(void|
|000002c0| 29 0d 7b 0d 09 72 65 67 | 69 73 74 65 72 20 69 6e |).{..reg|ister in|
|000002d0| 74 20 69 3b 0d 09 73 74 | 61 74 69 63 20 4c 75 6d |t i;..st|atic Lum|
|000002e0| 69 6e 61 6e 63 65 52 65 | 63 6f 72 64 20 4c 52 3b |inanceRe|cord LR;|
|000002f0| 0d 09 72 65 67 69 73 74 | 65 72 20 64 6f 75 62 6c |..regist|er doubl|
|00000300| 65 20 4c 2c 56 3b 0d 09 | 72 65 67 69 73 74 65 72 |e L,V;..|register|
|00000310| 20 64 6f 75 62 6c 65 20 | 64 4c 2c 64 56 3b 0d 09 | double |dL,dV;..|
|00000320| 75 6e 73 69 67 6e 65 64 | 20 6c 6f 6e 67 20 74 2c |unsigned| long t,|
|00000330| 72 65 70 73 3d 31 30 30 | 3b 0d 09 64 6f 75 62 6c |reps=100|;..doubl|
|00000340| 65 20 74 6f 6c 65 72 61 | 6e 63 65 3b 0d 09 64 6f |e tolera|nce;..do|
|00000350| 75 62 6c 65 20 4c 30 2c | 4c 31 3b 0d 09 69 6e 74 |uble L0,|L1;..int|
|00000360| 20 6e 3b 0d 09 64 6f 75 | 62 6c 65 20 63 2c 62 69 | n;..dou|ble c,bi|
|00000370| 74 73 3b 0d 09 64 6f 75 | 62 6c 65 20 65 5b 35 31 |ts;..dou|ble e[51|
|00000380| 32 5d 2c 6d 65 61 6e 2c | 73 64 2c 6d 61 78 2c 4c |2],mean,|sd,max,L|
|00000390| 47 6f 74 3b 0d 0d 09 2f | 2a 20 4c 75 6d 69 6e 61 |Got;.../|* Lumina|
|000003a0| 6e 63 65 2e 63 20 69 6e | 63 6c 75 64 65 73 20 61 |nce.c in|cludes a|
|000003b0| 20 72 65 63 75 72 73 69 | 76 65 20 72 6f 75 74 69 | recursi|ve routi|
|000003c0| 6e 65 20 74 68 61 74 20 | 72 65 71 75 69 72 65 73 |ne that |requires|
|000003d0| 20 6c 6f 74 73 20 6f 66 | 20 73 74 61 63 6b 20 73 | lots of| stack s|
|000003e0| 70 61 63 65 20 2a 2f 0d | 09 53 74 61 63 6b 47 72 |pace */.|.StackGr|
|000003f0| 6f 77 28 31 30 30 30 30 | 29 3b 09 09 2f 2a 20 49 |ow(10000|);../* I|
|00000400| 6e 63 72 65 61 73 65 20 | 73 74 61 63 6b 20 2a 2f |ncrease |stack */|
|00000410| 0d 09 61 73 73 65 72 74 | 28 53 74 61 63 6b 53 70 |..assert|(StackSp|
|00000420| 61 63 65 28 29 3e 31 30 | 30 30 30 29 3b 0d 09 4d |ace()>10|000);..M|
|00000430| 61 78 41 70 70 6c 5a 6f | 6e 65 28 29 3b 09 09 09 |axApplZo|ne();...|
|00000440| 2f 2a 20 45 78 70 61 6e | 64 20 68 65 61 70 20 74 |/* Expan|d heap t|
|00000450| 6f 20 74 68 65 20 6c 69 | 6d 69 74 2e 20 2a 2f 0d |o the li|mit. */.|
|00000460| 0d 09 4d 61 78 69 6d 69 | 7a 65 43 6f 6e 73 6f 6c |..Maximi|zeConsol|
|00000470| 65 48 65 69 67 68 74 28 | 29 3b 0d 09 23 69 66 20 |eHeight(|);..#if |
|00000480| 28 54 48 49 4e 4b 5f 43 | 20 7c 7c 20 54 48 49 4e |(THINK_C| || THIN|
|00000490| 4b 5f 43 50 4c 55 53 20 | 7c 7c 20 53 59 4d 41 4e |K_CPLUS ||| SYMAN|
|000004a0| 54 45 43 5f 43 29 0d 09 | 09 49 6e 69 74 50 72 6f |TEC_C)..|.InitPro|
|000004b0| 66 69 6c 65 28 32 30 30 | 2c 32 29 3b 0d 09 23 65 |file(200|,2);..#e|
|000004c0| 6e 64 69 66 0d 09 23 69 | 66 20 28 54 48 49 4e 4b |ndif..#i|f (THINK|
|000004d0| 5f 43 20 7c 7c 20 54 48 | 49 4e 4b 5f 43 50 4c 55 |_C || TH|INK_CPLU|
|000004e0| 53 20 7c 7c 20 53 59 4d | 41 4e 54 45 43 5f 43 29 |S || SYM|ANTEC_C)|
|000004f0| 0d 09 09 63 6f 6e 73 6f | 6c 65 5f 6f 70 74 69 6f |...conso|le_optio|
|00000500| 6e 73 2e 6e 63 6f 6c 73 | 3d 31 30 30 3b 0d 09 09 |ns.ncols|=100;...|
|00000510| 70 72 69 6e 74 66 28 22 | 5c 6e 22 29 3b 0d 09 23 |printf("|\n");..#|
|00000520| 65 6c 69 66 20 5f 5f 4d | 57 45 52 4b 53 5f 5f 0d |elif __M|WERKS__.|
|00000530| 09 09 53 49 4f 55 58 53 | 65 74 74 69 6e 67 73 2e |..SIOUXS|ettings.|
|00000540| 63 6f 6c 75 6d 6e 73 3d | 31 30 30 3b 0d 09 23 65 |columns=|100;..#e|
|00000550| 6c 73 65 0d 09 20 20 20 | 09 2f 2a 20 49 4e 49 54 |lse.. |./* INIT|
|00000560| 49 41 4c 49 5a 45 20 51 | 75 69 63 6b 44 72 61 77 |IALIZE Q|uickDraw|
|00000570| 20 2a 2f 0d 09 09 49 6e | 69 74 47 72 61 66 28 26 | */...In|itGraf(&|
|00000580| 71 64 2e 74 68 65 50 6f | 72 74 29 3b 0d 09 09 49 |qd.thePo|rt);...I|
|00000590| 6e 69 74 46 6f 6e 74 73 | 28 29 3b 0d 09 09 49 6e |nitFonts|();...In|
|000005a0| 69 74 57 69 6e 64 6f 77 | 73 28 29 3b 0d 09 09 49 |itWindow|s();...I|
|000005b0| 6e 69 74 43 75 72 73 6f | 72 28 29 3b 0d 09 23 65 |nitCurso|r();..#e|
|000005c0| 6e 64 69 66 0d 09 0d 09 | 23 69 6e 63 6c 75 64 65 |ndif....|#include|
|000005d0| 20 22 4c 75 6d 69 6e 61 | 6e 63 65 52 65 63 6f 72 | "Lumina|nceRecor|
|000005e0| 64 31 2e 68 22 09 0d 09 | 70 72 69 6e 74 66 28 22 |d1.h"...|printf("|
|000005f0| 54 65 73 74 20 53 65 74 | 52 61 6e 67 65 20 61 6e |Test Set|Range an|
|00000600| 64 20 53 65 74 4c 75 6d | 69 6e 61 6e 63 65 5c 6e |d SetLum|inance\n|
|00000610| 22 29 3b 0d 09 63 3d 31 | 2e 30 3b 0d 09 4c 3d 28 |");..c=1|.0;..L=(|
|00000620| 4c 52 2e 4c 4d 69 6e 2b | 4c 52 2e 4c 4d 61 78 29 |LR.LMin+|LR.LMax)|
|00000630| 2f 32 2e 30 3b 0d 09 66 | 6f 72 28 69 3d 30 3b 69 |/2.0;..f|or(i=0;i|
|00000640| 3c 31 35 3b 69 2b 2b 29 | 7b 0d 09 09 4c 30 3d 4c |<15;i++)|{...L0=L|
|00000650| 2a 28 31 2e 30 2d 63 29 | 3b 0d 09 09 4c 31 3d 4c |*(1.0-c)|;...L1=L|
|00000660| 2a 28 31 2e 30 2b 63 29 | 3b 0d 09 09 74 6f 6c 65 |*(1.0+c)|;...tole|
|00000670| 72 61 6e 63 65 3d 53 65 | 74 4c 75 6d 69 6e 61 6e |rance=Se|tLuminan|
|00000680| 63 65 28 4e 55 4c 4c 2c | 26 4c 52 2c 30 2c 4c 2c |ce(NULL,|&LR,0,L,|
|00000690| 4c 30 2c 4c 31 29 3b 0d | 09 09 70 72 69 6e 74 66 |L0,L1);.|..printf|
|000006a0| 28 22 63 25 39 2e 36 66 | 2c 20 22 2c 63 29 3b 0d |("c%9.6f|, ",c);.|
|000006b0| 09 09 70 72 69 6e 74 66 | 28 22 52 61 6e 67 65 25 |..printf|("Range%|
|000006c0| 35 2e 31 66 25 35 2e 31 | 66 2c 20 22 2c 4c 30 2c |5.1f%5.1|f, ",L0,|
|000006d0| 4c 31 29 3b 0d 09 09 70 | 72 69 6e 74 66 28 22 66 |L1);...p|rintf("f|
|000006e0| 69 78 65 64 20 25 31 64 | 2f 25 31 64 2c 20 22 2c |ixed %1d|/%1d, ",|
|000006f0| 4c 52 2e 66 69 78 65 64 | 2c 4c 52 2e 64 61 63 73 |LR.fixed|,LR.dacs|
|00000700| 29 3b 0d 09 09 70 72 69 | 6e 74 66 28 22 4c 28 56 |);...pri|ntf("L(V|
|00000710| 46 69 78 65 64 29 3d 25 | 35 2e 31 66 20 63 64 2f |Fixed)=%|5.1f cd/|
|00000720| 6d 5e 32 2c 20 22 2c 56 | 54 6f 4c 28 26 4c 52 2c |m^2, ",V|ToL(&LR,|
|00000730| 4c 52 2e 56 46 69 78 65 | 64 29 29 3b 0d 09 09 62 |LR.VFixe|d));...b|
|00000740| 69 74 73 3d 6c 6f 67 28 | 28 4c 52 2e 4c 4d 61 78 |its=log(|(LR.LMax|
|00000750| 2d 4c 52 2e 4c 4d 69 6e | 29 2f 74 6f 6c 65 72 61 |-LR.LMin|)/tolera|
|00000760| 6e 63 65 29 2f 6c 6f 67 | 28 32 2e 30 29 3b 0d 09 |nce)/log|(2.0);..|
|00000770| 09 70 72 69 6e 74 66 28 | 22 74 6f 6c 65 72 61 6e |.printf(|"toleran|
|00000780| 63 65 25 36 2e 33 66 3d | 25 34 2e 31 66 20 62 69 |ce%6.3f=|%4.1f bi|
|00000790| 74 73 5c 6e 22 2c 74 6f | 6c 65 72 61 6e 63 65 2c |ts\n",to|lerance,|
|000007a0| 62 69 74 73 29 3b 0d 09 | 09 63 20 2a 3d 20 30 2e |bits);..|.c *= 0.|
|000007b0| 35 3b 0d 09 7d 0d 0d 09 | 70 72 69 6e 74 66 28 22 |5;..}...|printf("|
|000007c0| 54 65 73 74 20 53 65 74 | 4c 75 6d 69 6e 61 6e 63 |Test Set|Luminanc|
|000007d0| 65 73 41 6e 64 52 61 6e | 67 65 20 26 20 47 65 74 |esAndRan|ge & Get|
|000007e0| 4c 75 6d 69 6e 61 6e 63 | 65 5c 6e 22 29 3b 0d 09 |Luminanc|e\n");..|
|000007f0| 4c 30 3d 4c 52 2e 4c 4d | 69 6e 3b 0d 09 4c 31 3d |L0=LR.LM|in;..L1=|
|00000800| 4c 52 2e 4c 4d 61 78 3b | 0d 09 74 6f 6c 65 72 61 |LR.LMax;|..tolera|
|00000810| 6e 63 65 3d 53 65 74 4c | 75 6d 69 6e 61 6e 63 65 |nce=SetL|uminance|
|00000820| 73 41 6e 64 52 61 6e 67 | 65 28 4e 55 4c 4c 2c 26 |sAndRang|e(NULL,&|
|00000830| 4c 52 2c 30 2c 4c 52 2e | 56 4d 61 78 2c 4c 30 2c |LR,0,LR.|VMax,L0,|
|00000840| 4c 31 2c 4c 30 2c 4c 31 | 29 3b 0d 09 70 72 69 6e |L1,L0,L1|);..prin|
|00000850| 74 66 28 22 52 61 6e 67 | 65 20 25 35 2e 31 66 20 |tf("Rang|e %5.1f |
|00000860| 25 35 2e 31 66 2c 20 22 | 2c 4c 30 2c 4c 31 29 3b |%5.1f, "|,L0,L1);|
|00000870| 0d 09 70 72 69 6e 74 66 | 28 22 66 69 78 65 64 20 |..printf|("fixed |
|00000880| 25 31 64 2f 25 31 64 2c | 20 22 2c 4c 52 2e 66 69 |%1d/%1d,| ",LR.fi|
|00000890| 78 65 64 2c 4c 52 2e 64 | 61 63 73 29 3b 0d 09 70 |xed,LR.d|acs);..p|
|000008a0| 72 69 6e 74 66 28 22 4c | 28 56 46 69 78 65 64 29 |rintf("L|(VFixed)|
|000008b0| 3d 25 35 2e 31 66 20 63 | 64 2f 6d 5e 32 2c 20 22 |=%5.1f c|d/m^2, "|
|000008c0| 2c 56 54 6f 4c 28 26 4c | 52 2c 4c 52 2e 56 46 69 |,VToL(&L|R,LR.VFi|
|000008d0| 78 65 64 29 29 3b 0d 09 | 62 69 74 73 3d 6c 6f 67 |xed));..|bits=log|
|000008e0| 28 28 4c 52 2e 4c 4d 61 | 78 2d 4c 52 2e 4c 4d 69 |((LR.LMa|x-LR.LMi|
|000008f0| 6e 29 2f 74 6f 6c 65 72 | 61 6e 63 65 29 2f 6c 6f |n)/toler|ance)/lo|
|00000900| 67 28 32 2e 30 29 3b 0d | 09 70 72 69 6e 74 66 28 |g(2.0);.|.printf(|
|00000910| 22 74 6f 6c 65 72 61 6e | 63 65 20 25 31 30 2e 33 |"toleran|ce %10.3|
|00000920| 66 20 3d 20 25 31 30 2e | 33 66 20 62 69 74 73 5c |f = %10.|3f bits\|
|00000930| 6e 22 2c 74 6f 6c 65 72 | 61 6e 63 65 2c 62 69 74 |n",toler|ance,bit|
|00000940| 73 29 3b 0d 09 64 4c 3d | 28 4c 31 2d 4c 30 29 2f |s);..dL=|(L1-L0)/|
|00000950| 4c 52 2e 56 4d 61 78 3b | 0d 09 70 72 69 6e 74 66 |LR.VMax;|..printf|
|00000960| 28 22 25 31 30 73 20 25 | 31 30 73 20 25 31 30 73 |("%10s %|10s %10s|
|00000970| 5c 6e 22 2c 22 4c 20 72 | 65 71 75 65 73 74 65 64 |\n","L r|equested|
|00000980| 22 2c 22 4c 20 72 65 63 | 65 69 76 65 64 22 2c 22 |","L rec|eived","|
|00000990| 45 72 72 6f 72 22 29 3b | 0d 09 6e 3d 4c 52 2e 56 |Error");|..n=LR.V|
|000009a0| 4d 61 78 2b 31 3b 0d 09 | 69 66 28 6e 3e 73 69 7a |Max+1;..|if(n>siz|
|000009b0| 65 6f 66 28 65 29 2f 73 | 69 7a 65 6f 66 28 65 5b |eof(e)/s|izeof(e[|
|000009c0| 30 5d 29 29 6e 3d 73 69 | 7a 65 6f 66 28 65 29 2f |0]))n=si|zeof(e)/|
|000009d0| 73 69 7a 65 6f 66 28 65 | 5b 30 5d 29 3b 0d 09 66 |sizeof(e|[0]);..f|
|000009e0| 6f 72 28 69 3d 30 2c 4c | 3d 4c 30 3b 69 3c 6e 3b |or(i=0,L|=L0;i<n;|
|000009f0| 69 2b 2b 2c 4c 2b 3d 64 | 4c 29 7b 0d 09 09 4c 47 |i++,L+=d|L){...LG|
|00000a00| 6f 74 3d 47 65 74 4c 75 | 6d 69 6e 61 6e 63 65 28 |ot=GetLu|minance(|
|00000a10| 4e 55 4c 4c 2c 26 4c 52 | 2c 69 29 3b 0d 09 09 65 |NULL,&LR|,i);...e|
|00000a20| 5b 69 5d 3d 4c 47 6f 74 | 2d 4c 3b 0d 09 09 69 66 |[i]=LGot|-L;...if|
|00000a30| 28 69 25 31 36 3d 3d 30 | 29 70 72 69 6e 74 66 28 |(i%16==0|)printf(|
|00000a40| 22 25 31 30 2e 33 66 20 | 25 31 30 2e 33 66 20 25 |"%10.3f |%10.3f %|
|00000a50| 31 30 2e 33 66 5c 6e 22 | 2c 4c 2c 4c 47 6f 74 2c |10.3f\n"|,L,LGot,|
|00000a60| 4c 47 6f 74 2d 4c 29 3b | 0d 09 7d 0d 09 6d 65 61 |LGot-L);|..}..mea|
|00000a70| 6e 3d 4d 65 61 6e 28 65 | 2c 6e 2c 26 73 64 29 3b |n=Mean(e|,n,&sd);|
|00000a80| 0d 09 6d 61 78 3d 30 2e | 30 3b 0d 09 66 6f 72 28 |..max=0.|0;..for(|
|00000a90| 69 3d 30 3b 69 3c 6e 3b | 69 2b 2b 29 69 66 28 66 |i=0;i<n;|i++)if(f|
|00000aa0| 61 62 73 28 6d 61 78 29 | 3c 66 61 62 73 28 65 5b |abs(max)|<fabs(e[|
|00000ab0| 69 5d 29 29 6d 61 78 3d | 65 5b 69 5d 3b 0d 09 70 |i]))max=|e[i];..p|
|00000ac0| 72 69 6e 74 66 28 22 45 | 72 72 6f 72 20 6d 65 61 |rintf("E|rror mea|
|00000ad0| 6e 20 25 66 20 73 64 20 | 25 66 20 6d 61 78 20 25 |n %f sd |%f max %|
|00000ae0| 66 5c 6e 5c 6e 22 2c 6d | 65 61 6e 2c 73 64 2c 6d |f\n\n",m|ean,sd,m|
|00000af0| 61 78 29 3b 0d 09 0d 09 | 70 72 69 6e 74 66 28 22 |ax);....|printf("|
|00000b00| 54 65 73 74 20 56 54 6f | 4c 20 61 6e 64 20 4c 54 |Test VTo|L and LT|
|00000b10| 6f 56 5c 6e 22 29 3b 0d | 09 70 72 69 6e 74 66 28 |oV\n");.|.printf(|
|00000b20| 22 25 31 30 73 20 25 31 | 30 73 20 25 31 30 73 5c |"%10s %1|0s %10s\|
|00000b30| 6e 22 2c 22 4c 20 72 65 | 71 75 65 73 74 65 64 22 |n","L re|quested"|
|00000b40| 2c 22 56 20 72 65 63 65 | 69 76 65 64 22 2c 22 4c |,"V rece|ived","L|
|00000b50| 20 72 65 63 65 69 76 65 | 64 22 29 3b 0d 09 66 6f | receive|d");..fo|
|00000b60| 72 28 4c 3d 2d 31 30 2e | 30 3b 4c 3c 31 30 30 2e |r(L=-10.|0;L<100.|
|00000b70| 30 3b 4c 2b 3d 32 30 2e | 30 29 7b 0d 09 09 56 3d |0;L+=20.|0){...V=|
|00000b80| 4c 54 6f 56 28 26 4c 52 | 2c 4c 29 3b 0d 09 09 70 |LToV(&LR|,L);...p|
|00000b90| 72 69 6e 74 66 28 22 25 | 39 2e 30 66 20 25 39 2e |rintf("%|9.0f %9.|
|00000ba0| 31 66 20 25 31 32 2e 36 | 66 5c 6e 22 2c 4c 2c 56 |1f %12.6|f\n",L,V|
|00000bb0| 2c 56 54 6f 4c 28 26 4c | 52 2c 56 29 29 3b 0d 09 |,VToL(&L|R,V));..|
|00000bc0| 7d 0d 0d 09 72 65 70 73 | 3d 31 30 30 30 3b 0d 09 |}...reps|=1000;..|
|00000bd0| 74 3d 54 69 63 6b 43 6f | 75 6e 74 28 29 3b 0d 09 |t=TickCo|unt();..|
|00000be0| 56 3d 4c 52 2e 56 4d 69 | 6e 3b 0d 09 64 56 3d 28 |V=LR.VMi|n;..dV=(|
|00000bf0| 4c 52 2e 56 4d 61 78 2d | 56 29 2f 72 65 70 73 2f |LR.VMax-|V)/reps/|
|00000c00| 34 3b 0d 09 66 6f 72 28 | 69 3d 72 65 70 73 2f 34 |4;..for(|i=reps/4|
|00000c10| 3b 69 3e 30 3b 69 2d 2d | 29 20 7b 0d 09 09 56 3d |;i>0;i--|) {...V=|
|00000c20| 56 54 6f 4c 28 26 4c 52 | 2c 56 29 3b 0d 09 09 56 |VToL(&LR|,V);...V|
|00000c30| 3d 56 54 6f 4c 28 26 4c | 52 2c 56 29 3b 0d 09 09 |=VToL(&L|R,V);...|
|00000c40| 56 3d 56 54 6f 4c 28 26 | 4c 52 2c 56 29 3b 0d 09 |V=VToL(&|LR,V);..|
|00000c50| 09 56 3d 56 54 6f 4c 28 | 26 4c 52 2c 56 29 3b 0d |.V=VToL(|&LR,V);.|
|00000c60| 09 09 56 2b 3d 64 56 3b | 0d 09 7d 0d 09 74 3d 54 |..V+=dV;|..}..t=T|
|00000c70| 69 63 6b 43 6f 75 6e 74 | 28 29 2d 74 3b 0d 09 70 |ickCount|()-t;..p|
|00000c80| 72 69 6e 74 66 28 22 56 | 54 6f 4c 20 74 61 6b 65 |rintf("V|ToL take|
|00000c90| 73 20 25 2e 31 66 20 b5 | 73 5c 6e 22 2c 31 65 36 |s %.1f .|s\n",1e6|
|00000ca0| 2a 74 2f 28 36 30 2e 31 | 35 2a 72 65 70 73 29 29 |*t/(60.1|5*reps))|
|00000cb0| 3b 0d 0d 09 72 65 70 73 | 3d 31 30 30 30 3b 0d 09 |;...reps|=1000;..|
|00000cc0| 74 3d 54 69 63 6b 43 6f | 75 6e 74 28 29 3b 0d 09 |t=TickCo|unt();..|
|00000cd0| 4c 3d 4c 52 2e 4c 4d 69 | 6e 3b 0d 09 64 4c 3d 28 |L=LR.LMi|n;..dL=(|
|00000ce0| 4c 52 2e 4c 4d 61 78 2d | 4c 29 2f 72 65 70 73 2f |LR.LMax-|L)/reps/|
|00000cf0| 34 3b 0d 09 66 6f 72 28 | 69 3d 72 65 70 73 2f 34 |4;..for(|i=reps/4|
|00000d00| 3b 69 3e 30 3b 69 2d 2d | 29 20 7b 0d 09 09 56 3d |;i>0;i--|) {...V=|
|00000d10| 4c 54 6f 56 28 26 4c 52 | 2c 4c 29 3b 0d 09 09 56 |LToV(&LR|,L);...V|
|00000d20| 3d 4c 54 6f 56 28 26 4c | 52 2c 4c 29 3b 0d 09 09 |=LToV(&L|R,L);...|
|00000d30| 56 3d 4c 54 6f 56 28 26 | 4c 52 2c 4c 29 3b 0d 09 |V=LToV(&|LR,L);..|
|00000d40| 09 56 3d 4c 54 6f 56 28 | 26 4c 52 2c 4c 29 3b 0d |.V=LToV(|&LR,L);.|
|00000d50| 09 09 4c 2b 3d 64 4c 3b | 0d 09 7d 0d 09 74 3d 54 |..L+=dL;|..}..t=T|
|00000d60| 69 63 6b 43 6f 75 6e 74 | 28 29 2d 74 3b 0d 09 70 |ickCount|()-t;..p|
|00000d70| 72 69 6e 74 66 28 22 4c | 54 6f 56 20 74 61 6b 65 |rintf("L|ToV take|
|00000d80| 73 20 25 2e 31 66 20 b5 | 73 5c 6e 22 2c 31 65 36 |s %.1f .|s\n",1e6|
|00000d90| 2a 74 2f 28 36 30 2e 31 | 35 2a 72 65 70 73 29 29 |*t/(60.1|5*reps))|
|00000da0| 3b 0d 0d 09 72 65 70 73 | 3d 31 30 30 30 3b 0d 09 |;...reps|=1000;..|
|00000db0| 4c 30 3d 28 4c 52 2e 4c | 4d 69 6e 2b 4c 52 2e 4c |L0=(LR.L|Min+LR.L|
|00000dc0| 4d 61 78 29 2f 32 2e 30 | 3b 0d 09 4c 31 3d 31 2e |Max)/2.0|;..L1=1.|
|00000dd0| 30 31 2a 4c 30 3b 0d 09 | 53 65 74 4c 75 6d 69 6e |01*L0;..|SetLumin|
|00000de0| 61 6e 63 65 28 4e 55 4c | 4c 2c 26 4c 52 2c 30 2c |ance(NUL|L,&LR,0,|
|00000df0| 35 30 2e 2c 4c 30 2c 4c | 31 29 3b 0d 09 4c 3d 4c |50.,L0,L|1);..L=L|
|00000e00| 30 3b 0d 09 64 4c 3d 28 | 4c 31 2d 4c 29 2f 72 65 |0;..dL=(|L1-L)/re|
|00000e10| 70 73 2f 34 3b 0d 09 74 | 3d 54 69 63 6b 43 6f 75 |ps/4;..t|=TickCou|
|00000e20| 6e 74 28 29 3b 0d 09 66 | 6f 72 28 69 3d 72 65 70 |nt();..f|or(i=rep|
|00000e30| 73 2f 34 3b 69 3e 30 3b | 69 2d 2d 29 20 7b 0d 09 |s/4;i>0;|i--) {..|
|00000e40| 09 53 65 74 4c 75 6d 69 | 6e 61 6e 63 65 28 4e 55 |.SetLumi|nance(NU|
|00000e50| 4c 4c 2c 26 4c 52 2c 30 | 2c 4c 2c 4c 30 2c 4c 31 |LL,&LR,0|,L,L0,L1|
|00000e60| 29 3b 0d 09 09 53 65 74 | 4c 75 6d 69 6e 61 6e 63 |);...Set|Luminanc|
|00000e70| 65 28 4e 55 4c 4c 2c 26 | 4c 52 2c 30 2c 4c 2c 4c |e(NULL,&|LR,0,L,L|
|00000e80| 30 2c 4c 31 29 3b 0d 09 | 09 53 65 74 4c 75 6d 69 |0,L1);..|.SetLumi|
|00000e90| 6e 61 6e 63 65 28 4e 55 | 4c 4c 2c 26 4c 52 2c 30 |nance(NU|LL,&LR,0|
|00000ea0| 2c 4c 2c 4c 30 2c 4c 31 | 29 3b 0d 09 09 53 65 74 |,L,L0,L1|);...Set|
|00000eb0| 4c 75 6d 69 6e 61 6e 63 | 65 28 4e 55 4c 4c 2c 26 |Luminanc|e(NULL,&|
|00000ec0| 4c 52 2c 30 2c 4c 2c 4c | 30 2c 4c 31 29 3b 0d 09 |LR,0,L,L|0,L1);..|
|00000ed0| 09 4c 2b 3d 64 4c 3b 0d | 09 7d 0d 09 74 3d 54 69 |.L+=dL;.|.}..t=Ti|
|00000ee0| 63 6b 43 6f 75 6e 74 28 | 29 2d 74 3b 0d 09 70 72 |ckCount(|)-t;..pr|
|00000ef0| 69 6e 74 66 28 22 53 65 | 74 4c 75 6d 69 6e 61 6e |intf("Se|tLuminan|
|00000f00| 63 65 20 74 61 6b 65 73 | 20 25 2e 31 66 20 b5 73 |ce takes| %.1f .s|
|00000f10| 20 77 69 74 68 20 73 6d | 61 6c 6c 20 6f 6c 64 20 | with sm|all old |
|00000f20| 72 61 6e 67 65 5c 6e 22 | 2c 31 65 36 2a 74 2f 28 |range\n"|,1e6*t/(|
|00000f30| 36 30 2e 31 35 2a 72 65 | 70 73 29 29 3b 0d 0d 09 |60.15*re|ps));...|
|00000f40| 72 65 70 73 3d 31 30 30 | 30 3b 0d 09 53 65 74 4c |reps=100|0;..SetL|
|00000f50| 75 6d 69 6e 61 6e 63 65 | 28 4e 55 4c 4c 2c 26 4c |uminance|(NULL,&L|
|00000f60| 52 2c 30 2c 35 30 2e 2c | 4c 52 2e 4c 4d 69 6e 2c |R,0,50.,|LR.LMin,|
|00000f70| 4c 52 2e 4c 4d 61 78 29 | 3b 0d 09 4c 3d 4c 52 2e |LR.LMax)|;..L=LR.|
|00000f80| 4c 4d 69 6e 3b 0d 09 64 | 4c 3d 28 4c 52 2e 4c 4d |LMin;..d|L=(LR.LM|
|00000f90| 61 78 2d 4c 29 2f 72 65 | 70 73 2f 34 3b 0d 09 74 |ax-L)/re|ps/4;..t|
|00000fa0| 3d 54 69 63 6b 43 6f 75 | 6e 74 28 29 3b 0d 09 66 |=TickCou|nt();..f|
|00000fb0| 6f 72 28 69 3d 72 65 70 | 73 2f 34 3b 69 3e 30 3b |or(i=rep|s/4;i>0;|
|00000fc0| 69 2d 2d 29 20 7b 0d 09 | 09 53 65 74 4c 75 6d 69 |i--) {..|.SetLumi|
|00000fd0| 6e 61 6e 63 65 28 4e 55 | 4c 4c 2c 26 4c 52 2c 30 |nance(NU|LL,&LR,0|
|00000fe0| 2c 4c 2c 4c 52 2e 4c 4d | 69 6e 2c 4c 52 2e 4c 4d |,L,LR.LM|in,LR.LM|
|00000ff0| 61 78 29 3b 0d 09 09 53 | 65 74 4c 75 6d 69 6e 61 |ax);...S|etLumina|
|00001000| 6e 63 65 28 4e 55 4c 4c | 2c 26 4c 52 2c 30 2c 4c |nce(NULL|,&LR,0,L|
|00001010| 2c 4c 52 2e 4c 4d 69 6e | 2c 4c 52 2e 4c 4d 61 78 |,LR.LMin|,LR.LMax|
|00001020| 29 3b 0d 09 09 53 65 74 | 4c 75 6d 69 6e 61 6e 63 |);...Set|Luminanc|
|00001030| 65 28 4e 55 4c 4c 2c 26 | 4c 52 2c 30 2c 4c 2c 4c |e(NULL,&|LR,0,L,L|
|00001040| 52 2e 4c 4d 69 6e 2c 4c | 52 2e 4c 4d 61 78 29 3b |R.LMin,L|R.LMax);|
|00001050| 0d 09 09 53 65 74 4c 75 | 6d 69 6e 61 6e 63 65 28 |...SetLu|minance(|
|00001060| 4e 55 4c 4c 2c 26 4c 52 | 2c 30 2c 4c 2c 4c 52 2e |NULL,&LR|,0,L,LR.|
|00001070| 4c 4d 69 6e 2c 4c 52 2e | 4c 4d 61 78 29 3b 0d 09 |LMin,LR.|LMax);..|
|00001080| 09 4c 2b 3d 64 4c 3b 0d | 09 7d 0d 09 74 3d 54 69 |.L+=dL;.|.}..t=Ti|
|00001090| 63 6b 43 6f 75 6e 74 28 | 29 2d 74 3b 0d 09 70 72 |ckCount(|)-t;..pr|
|000010a0| 69 6e 74 66 28 22 53 65 | 74 4c 75 6d 69 6e 61 6e |intf("Se|tLuminan|
|000010b0| 63 65 20 74 61 6b 65 73 | 20 25 2e 31 66 20 b5 73 |ce takes| %.1f .s|
|000010c0| 20 77 69 74 68 20 6c 61 | 72 67 65 20 6f 6c 64 20 | with la|rge old |
|000010d0| 72 61 6e 67 65 5c 6e 22 | 2c 31 65 36 2a 74 2f 28 |range\n"|,1e6*t/(|
|000010e0| 36 30 2e 31 35 2a 72 65 | 70 73 29 29 3b 0d 0d 09 |60.15*re|ps));...|
|000010f0| 72 65 70 73 3d 32 30 30 | 3b 0d 09 53 65 74 4c 75 |reps=200|;..SetLu|
|00001100| 6d 69 6e 61 6e 63 65 28 | 4e 55 4c 4c 2c 26 4c 52 |minance(|NULL,&LR|
|00001110| 2c 30 2c 4c 2c 4c 52 2e | 4c 4d 69 6e 2c 4c 52 2e |,0,L,LR.|LMin,LR.|
|00001120| 4c 4d 61 78 29 3b 0d 09 | 4c 3d 4c 52 2e 4c 4d 69 |LMax);..|L=LR.LMi|
|00001130| 6e 3b 0d 09 64 4c 3d 28 | 4c 52 2e 4c 4d 61 78 2d |n;..dL=(|LR.LMax-|
|00001140| 4c 29 2f 72 65 70 73 2f | 34 3b 0d 09 74 3d 54 69 |L)/reps/|4;..t=Ti|
|00001150| 63 6b 43 6f 75 6e 74 28 | 29 3b 0d 09 66 6f 72 28 |ckCount(|);..for(|
|00001160| 69 3d 72 65 70 73 2f 34 | 3b 69 3e 30 3b 69 2d 2d |i=reps/4|;i>0;i--|
|00001170| 29 20 7b 0d 09 09 53 65 | 74 4c 75 6d 69 6e 61 6e |) {...Se|tLuminan|
|00001180| 63 65 28 4e 55 4c 4c 2c | 26 4c 52 2c 30 2c 4c 2c |ce(NULL,|&LR,0,L,|
|00001190| 4c 52 2e 4c 4d 69 6e 2c | 4c 52 2e 4c 4d 61 78 2d |LR.LMin,|LR.LMax-|
|000011a0| 31 2e 30 29 3b 0d 09 09 | 53 65 74 4c 75 6d 69 6e |1.0);...|SetLumin|
|000011b0| 61 6e 63 65 28 4e 55 4c | 4c 2c 26 4c 52 2c 30 2c |ance(NUL|L,&LR,0,|
|000011c0| 4c 2c 4c 52 2e 4c 4d 69 | 6e 2c 4c 52 2e 4c 4d 61 |L,LR.LMi|n,LR.LMa|
|000011d0| 78 29 3b 0d 09 09 53 65 | 74 4c 75 6d 69 6e 61 6e |x);...Se|tLuminan|
|000011e0| 63 65 28 4e 55 4c 4c 2c | 26 4c 52 2c 30 2c 4c 2c |ce(NULL,|&LR,0,L,|
|000011f0| 4c 52 2e 4c 4d 69 6e 2c | 4c 52 2e 4c 4d 61 78 2d |LR.LMin,|LR.LMax-|
|00001200| 31 2e 30 29 3b 0d 09 09 | 53 65 74 4c 75 6d 69 6e |1.0);...|SetLumin|
|00001210| 61 6e 63 65 28 4e 55 4c | 4c 2c 26 4c 52 2c 30 2c |ance(NUL|L,&LR,0,|
|00001220| 4c 2c 4c 52 2e 4c 4d 69 | 6e 2c 4c 52 2e 4c 4d 61 |L,LR.LMi|n,LR.LMa|
|00001230| 78 29 3b 0d 09 09 4c 2b | 3d 64 4c 3b 0d 09 7d 0d |x);...L+|=dL;..}.|
|00001240| 09 74 3d 54 69 63 6b 43 | 6f 75 6e 74 28 29 2d 74 |.t=TickC|ount()-t|
|00001250| 3b 0d 09 70 72 69 6e 74 | 66 28 22 53 65 74 4c 75 |;..print|f("SetLu|
|00001260| 6d 69 6e 61 6e 63 65 20 | 74 61 6b 65 73 20 25 2e |minance |takes %.|
|00001270| 31 66 20 b5 73 20 77 69 | 74 68 20 6c 61 72 67 65 |1f .s wi|th large|
|00001280| 20 6e 65 77 20 72 61 6e | 67 65 5c 6e 22 2c 31 65 | new ran|ge\n",1e|
|00001290| 36 2a 74 2f 28 36 30 2e | 31 35 2a 72 65 70 73 29 |6*t/(60.|15*reps)|
|000012a0| 29 3b 0d 0d 09 72 65 70 | 73 3d 32 30 30 3b 0d 09 |);...rep|s=200;..|
|000012b0| 53 65 74 4c 75 6d 69 6e | 61 6e 63 65 28 4e 55 4c |SetLumin|ance(NUL|
|000012c0| 4c 2c 26 4c 52 2c 30 2c | 4c 30 2c 4c 30 2c 4c 31 |L,&LR,0,|L0,L0,L1|
|000012d0| 29 3b 0d 09 74 3d 54 69 | 63 6b 43 6f 75 6e 74 28 |);..t=Ti|ckCount(|
|000012e0| 29 3b 0d 09 66 6f 72 28 | 69 3d 30 3b 69 3c 72 65 |);..for(|i=0;i<re|
|000012f0| 70 73 2f 34 3b 69 2b 2b | 29 20 7b 0d 09 09 53 65 |ps/4;i++|) {...Se|
|00001300| 74 4c 75 6d 69 6e 61 6e | 63 65 73 41 6e 64 52 61 |tLuminan|cesAndRa|
|00001310| 6e 67 65 28 4e 55 4c 4c | 2c 26 4c 52 2c 30 2c 32 |nge(NULL|,&LR,0,2|
|00001320| 35 35 2c 4c 30 2c 4c 31 | 2c 4c 30 2c 4c 31 29 3b |55,L0,L1|,L0,L1);|
|00001330| 0d 09 09 53 65 74 4c 75 | 6d 69 6e 61 6e 63 65 73 |...SetLu|minances|
|00001340| 41 6e 64 52 61 6e 67 65 | 28 4e 55 4c 4c 2c 26 4c |AndRange|(NULL,&L|
|00001350| 52 2c 30 2c 32 35 35 2c | 4c 30 2c 4c 31 2c 4c 30 |R,0,255,|L0,L1,L0|
|00001360| 2c 4c 31 29 3b 0d 09 09 | 53 65 74 4c 75 6d 69 6e |,L1);...|SetLumin|
|00001370| 61 6e 63 65 73 41 6e 64 | 52 61 6e 67 65 28 4e 55 |ancesAnd|Range(NU|
|00001380| 4c 4c 2c 26 4c 52 2c 30 | 2c 32 35 35 2c 4c 30 2c |LL,&LR,0|,255,L0,|
|00001390| 4c 31 2c 4c 30 2c 4c 31 | 29 3b 0d 09 09 53 65 74 |L1,L0,L1|);...Set|
|000013a0| 4c 75 6d 69 6e 61 6e 63 | 65 73 41 6e 64 52 61 6e |Luminanc|esAndRan|
|000013b0| 67 65 28 4e 55 4c 4c 2c | 26 4c 52 2c 30 2c 32 35 |ge(NULL,|&LR,0,25|
|000013c0| 35 2c 4c 30 2c 4c 31 2c | 4c 30 2c 4c 31 29 3b 0d |5,L0,L1,|L0,L1);.|
|000013d0| 09 7d 0d 09 74 3d 54 69 | 63 6b 43 6f 75 6e 74 28 |.}..t=Ti|ckCount(|
|000013e0| 29 2d 74 3b 0d 09 70 72 | 69 6e 74 66 28 22 53 65 |)-t;..pr|intf("Se|
|000013f0| 74 4c 75 6d 69 6e 61 6e | 63 65 73 41 6e 64 52 61 |tLuminan|cesAndRa|
|00001400| 6e 67 65 28 30 2e 2e 32 | 35 35 29 20 74 61 6b 65 |nge(0..2|55) take|
|00001410| 73 20 25 2e 31 66 20 6d | 73 20 77 69 74 68 20 73 |s %.1f m|s with s|
|00001420| 6d 61 6c 6c 20 6f 6c 64 | 20 72 61 6e 67 65 5c 6e |mall old| range\n|
|00001430| 22 2c 31 30 30 30 2e 30 | 2a 74 2f 28 36 30 2e 31 |",1000.0|*t/(60.1|
|00001440| 35 2a 72 65 70 73 29 29 | 3b 0d 0d 23 69 66 20 31 |5*reps))|;..#if 1|
|00001450| 0d 09 72 65 70 73 3d 34 | 38 3b 0d 09 53 65 74 4c |..reps=4|8;..SetL|
|00001460| 75 6d 69 6e 61 6e 63 65 | 28 4e 55 4c 4c 2c 26 4c |uminance|(NULL,&L|
|00001470| 52 2c 30 2c 4c 30 2c 4c | 30 2c 4c 31 29 3b 0d 09 |R,0,L0,L|0,L1);..|
|00001480| 74 3d 54 69 63 6b 43 6f | 75 6e 74 28 29 3b 0d 09 |t=TickCo|unt();..|
|00001490| 66 6f 72 28 69 3d 30 3b | 69 3c 72 65 70 73 2f 34 |for(i=0;|i<reps/4|
|000014a0| 3b 69 2b 2b 29 20 7b 0d | 09 09 53 65 74 4c 75 6d |;i++) {.|..SetLum|
|000014b0| 69 6e 61 6e 63 65 73 41 | 6e 64 52 61 6e 67 65 28 |inancesA|ndRange(|
|000014c0| 4e 55 4c 4c 2c 26 4c 52 | 2c 30 2c 32 35 35 2c 4c |NULL,&LR|,0,255,L|
|000014d0| 30 2c 4c 31 2c 4c 30 2c | 4c 31 2a 31 2e 30 30 31 |0,L1,L0,|L1*1.001|
|000014e0| 29 3b 0d 09 09 53 65 74 | 4c 75 6d 69 6e 61 6e 63 |);...Set|Luminanc|
|000014f0| 65 73 41 6e 64 52 61 6e | 67 65 28 4e 55 4c 4c 2c |esAndRan|ge(NULL,|
|00001500| 26 4c 52 2c 30 2c 32 35 | 35 2c 4c 30 2c 4c 31 2c |&LR,0,25|5,L0,L1,|
|00001510| 4c 30 2c 4c 31 29 3b 0d | 09 09 53 65 74 4c 75 6d |L0,L1);.|..SetLum|
|00001520| 69 6e 61 6e 63 65 73 41 | 6e 64 52 61 6e 67 65 28 |inancesA|ndRange(|
|00001530| 4e 55 4c 4c 2c 26 4c 52 | 2c 30 2c 32 35 35 2c 4c |NULL,&LR|,0,255,L|
|00001540| 30 2c 4c 31 2c 4c 30 2c | 4c 31 2a 31 2e 30 30 31 |0,L1,L0,|L1*1.001|
|00001550| 29 3b 0d 09 09 53 65 74 | 4c 75 6d 69 6e 61 6e 63 |);...Set|Luminanc|
|00001560| 65 73 41 6e 64 52 61 6e | 67 65 28 4e 55 4c 4c 2c |esAndRan|ge(NULL,|
|00001570| 26 4c 52 2c 30 2c 32 35 | 35 2c 4c 30 2c 4c 31 2c |&LR,0,25|5,L0,L1,|
|00001580| 4c 30 2c 4c 31 29 3b 0d | 09 7d 0d 09 74 3d 54 69 |L0,L1);.|.}..t=Ti|
|00001590| 63 6b 43 6f 75 6e 74 28 | 29 2d 74 3b 0d 09 70 72 |ckCount(|)-t;..pr|
|000015a0| 69 6e 74 66 28 22 53 65 | 74 4c 75 6d 69 6e 61 6e |intf("Se|tLuminan|
|000015b0| 63 65 73 41 6e 64 52 61 | 6e 67 65 28 30 2e 2e 32 |cesAndRa|nge(0..2|
|000015c0| 35 35 29 20 74 61 6b 65 | 73 20 25 2e 31 66 20 6d |55) take|s %.1f m|
|000015d0| 73 20 77 69 74 68 20 73 | 6d 61 6c 6c 20 6e 65 77 |s with s|mall new|
|000015e0| 20 72 61 6e 67 65 5c 6e | 22 2c 31 30 30 30 2e 30 | range\n|",1000.0|
|000015f0| 2a 74 2f 28 36 30 2e 31 | 35 2a 72 65 70 73 29 29 |*t/(60.1|5*reps))|
|00001600| 3b 0d 23 65 6e 64 69 66 | 0d 0d 09 72 65 70 73 3d |;.#endif|...reps=|
|00001610| 34 38 3b 0d 09 53 65 74 | 4c 75 6d 69 6e 61 6e 63 |48;..Set|Luminanc|
|00001620| 65 28 4e 55 4c 4c 2c 26 | 4c 52 2c 30 2c 35 30 2e |e(NULL,&|LR,0,50.|
|00001630| 2c 4c 52 2e 4c 4d 69 6e | 2c 4c 52 2e 4c 4d 61 78 |,LR.LMin|,LR.LMax|
|00001640| 29 3b 0d 09 74 3d 54 69 | 63 6b 43 6f 75 6e 74 28 |);..t=Ti|ckCount(|
|00001650| 29 3b 0d 09 66 6f 72 28 | 69 3d 30 3b 69 3c 72 65 |);..for(|i=0;i<re|
|00001660| 70 73 2f 32 3b 69 2b 2b | 29 20 7b 0d 09 09 53 65 |ps/2;i++|) {...Se|
|00001670| 74 4c 75 6d 69 6e 61 6e | 63 65 73 41 6e 64 52 61 |tLuminan|cesAndRa|
|00001680| 6e 67 65 28 4e 55 4c 4c | 2c 26 4c 52 2c 30 2c 32 |nge(NULL|,&LR,0,2|
|00001690| 35 35 2c 4c 52 2e 4c 4d | 69 6e 2c 4c 52 2e 4c 4d |55,LR.LM|in,LR.LM|
|000016a0| 61 78 2c 4c 52 2e 4c 4d | 69 6e 2c 4c 52 2e 4c 4d |ax,LR.LM|in,LR.LM|
|000016b0| 61 78 29 3b 0d 09 09 53 | 65 74 4c 75 6d 69 6e 61 |ax);...S|etLumina|
|000016c0| 6e 63 65 73 41 6e 64 52 | 61 6e 67 65 28 4e 55 4c |ncesAndR|ange(NUL|
|000016d0| 4c 2c 26 4c 52 2c 30 2c | 32 35 35 2c 4c 52 2e 4c |L,&LR,0,|255,LR.L|
|000016e0| 4d 69 6e 2c 4c 52 2e 4c | 4d 61 78 2c 4c 52 2e 4c |Min,LR.L|Max,LR.L|
|000016f0| 4d 69 6e 2c 4c 52 2e 4c | 4d 61 78 29 3b 0d 09 7d |Min,LR.L|Max);..}|
|00001700| 0d 09 74 3d 54 69 63 6b | 43 6f 75 6e 74 28 29 2d |..t=Tick|Count()-|
|00001710| 74 3b 0d 09 70 72 69 6e | 74 66 28 22 53 65 74 4c |t;..prin|tf("SetL|
|00001720| 75 6d 69 6e 61 6e 63 65 | 73 41 6e 64 52 61 6e 67 |uminance|sAndRang|
|00001730| 65 28 30 2e 2e 32 35 35 | 29 20 74 61 6b 65 73 20 |e(0..255|) takes |
|00001740| 25 2e 31 66 20 6d 73 20 | 77 69 74 68 20 6c 61 72 |%.1f ms |with lar|
|00001750| 67 65 20 6f 6c 64 20 72 | 61 6e 67 65 5c 6e 22 2c |ge old r|ange\n",|
|00001760| 31 30 30 30 2e 30 2a 74 | 2f 28 36 30 2e 31 35 2a |1000.0*t|/(60.15*|
|00001770| 72 65 70 73 29 29 3b 0d | 0d 23 69 66 20 31 0d 09 |reps));.|.#if 1..|
|00001780| 72 65 70 73 3d 34 38 3b | 0d 09 53 65 74 4c 75 6d |reps=48;|..SetLum|
|00001790| 69 6e 61 6e 63 65 28 4e | 55 4c 4c 2c 26 4c 52 2c |inance(N|ULL,&LR,|
|000017a0| 30 2c 35 30 2e 2c 4c 52 | 2e 4c 4d 69 6e 2c 4c 52 |0,50.,LR|.LMin,LR|
|000017b0| 2e 4c 4d 61 78 29 3b 0d | 09 74 3d 54 69 63 6b 43 |.LMax);.|.t=TickC|
|000017c0| 6f 75 6e 74 28 29 3b 0d | 09 66 6f 72 28 69 3d 30 |ount();.|.for(i=0|
|000017d0| 3b 69 3c 72 65 70 73 2f | 32 3b 69 2b 2b 29 20 7b |;i<reps/|2;i++) {|
|000017e0| 0d 09 09 53 65 74 4c 75 | 6d 69 6e 61 6e 63 65 73 |...SetLu|minances|
|000017f0| 41 6e 64 52 61 6e 67 65 | 28 4e 55 4c 4c 2c 26 4c |AndRange|(NULL,&L|
|00001800| 52 2c 30 2c 32 35 35 2c | 4c 52 2e 4c 4d 69 6e 2c |R,0,255,|LR.LMin,|
|00001810| 4c 52 2e 4c 4d 61 78 2d | 31 2e 30 2c 4c 52 2e 4c |LR.LMax-|1.0,LR.L|
|00001820| 4d 69 6e 2c 4c 52 2e 4c | 4d 61 78 2d 31 2e 30 29 |Min,LR.L|Max-1.0)|
|00001830| 3b 0d 09 09 53 65 74 4c | 75 6d 69 6e 61 6e 63 65 |;...SetL|uminance|
|00001840| 73 41 6e 64 52 61 6e 67 | 65 28 4e 55 4c 4c 2c 26 |sAndRang|e(NULL,&|
|00001850| 4c 52 2c 30 2c 32 35 35 | 2c 4c 52 2e 4c 4d 69 6e |LR,0,255|,LR.LMin|
|00001860| 2c 4c 52 2e 4c 4d 61 78 | 2d 31 2e 30 2c 4c 52 2e |,LR.LMax|-1.0,LR.|
|00001870| 4c 4d 69 6e 2c 4c 52 2e | 4c 4d 61 78 29 3b 0d 09 |LMin,LR.|LMax);..|
|00001880| 7d 0d 09 74 3d 54 69 63 | 6b 43 6f 75 6e 74 28 29 |}..t=Tic|kCount()|
|00001890| 2d 74 3b 0d 09 70 72 69 | 6e 74 66 28 22 53 65 74 |-t;..pri|ntf("Set|
|000018a0| 4c 75 6d 69 6e 61 6e 63 | 65 73 41 6e 64 52 61 6e |Luminanc|esAndRan|
|000018b0| 67 65 28 30 2e 2e 32 35 | 35 29 20 74 61 6b 65 73 |ge(0..25|5) takes|
|000018c0| 20 25 2e 31 66 20 6d 73 | 20 77 69 74 68 20 6c 61 | %.1f ms| with la|
|000018d0| 72 67 65 20 6e 65 77 20 | 72 61 6e 67 65 5c 6e 22 |rge new |range\n"|
|000018e0| 2c 31 30 30 30 2e 30 2a | 74 2f 28 36 30 2e 31 35 |,1000.0*|t/(60.15|
|000018f0| 2a 72 65 70 73 29 29 3b | 0d 23 65 6e 64 69 66 0d |*reps));|.#endif.|
|00001900| 09 23 69 66 20 5f 5f 4d | 57 45 52 4b 53 5f 5f 0d |.#if __M|WERKS__.|
|00001910| 09 09 70 72 69 6e 74 66 | 28 22 44 6f 6e 65 2e 20 |..printf|("Done. |
|00001920| 48 69 74 20 43 6f 6d 6d | 61 6e 64 2d 51 20 74 6f |Hit Comm|and-Q to|
|00001930| 20 71 75 69 74 2e 5c 6e | 22 29 3b 0d 09 23 65 6e | quit.\n|");..#en|
|00001940| 64 69 66 0d 7d 09 0d 0d | 0d 00 00 00 00 00 00 00 |dif.}...|........|
|00001950| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001970| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001980| 00 00 01 00 00 00 01 7e | 00 00 00 7e 00 00 00 52 |.......~|...~...R|
|00001990| 3d 39 3b 09 2f 2a 20 23 | 6f 66 20 63 6f 65 66 66 |=9;./* #|of coeff|
|000019a0| 69 63 69 65 6e 74 73 20 | 69 6e 20 70 6f 6c 79 6e |icients |in polyn|
|000019b0| 0f 54 65 73 74 4c 75 6d | 69 6e 61 6e 63 65 2e 63 |.TestLum|inance.c|
|000019c0| 02 00 00 00 54 45 58 54 | 43 57 49 45 01 00 00 00 |....TEXT|CWIE....|
|000019d0| 00 00 54 45 58 54 43 57 | 49 45 01 00 00 00 00 00 |..TEXTCW|IE......|
|000019e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000019f0| 00 00 a1 0d 62 0d 00 00 | 18 c9 00 00 01 d0 5b 33 |....b...|......[3|
|00001a00| 5d 3d 2d 30 2e 30 30 30 | 31 38 36 38 34 32 3b 0d |]=-0.000|186842;.|
|00001a10| 09 4c 52 2e 70 5b 34 5d | 3d 33 2e 34 38 36 31 37 |.LR.p[4]|=3.48617|
|00001a20| 65 2d 30 36 3b 0d 09 4c | 52 2e 70 5b 35 5d 3d 2d |e-06;..L|R.p[5]=-|
|00001a30| 33 2e 31 37 38 32 31 65 | 2d 30 38 3b 0d 09 4c 52 |3.17821e|-08;..LR|
|00001a40| 2e 70 5b 36 5d 3d 31 2e | 35 35 38 37 34 65 2d 31 |.p[6]=1.|55874e-1|
|00001a50| 30 3b 0d 09 4c 52 2e 70 | 5b 37 5d 3d 2d 33 2e 38 |0;..LR.p|[7]=-3.8|
|00001a60| 39 37 34 35 65 2d 31 33 | 3b 0d 09 4c 52 2e 70 5b |9745e-13|;..LR.p[|
|00001a70| 38 5d 3d 33 2e 38 36 33 | 34 65 2d 31 36 3b 0d 09 |8]=3.863|4e-16;..|
|00001a80| 00 00 00 26 00 02 00 00 | 02 09 00 00 02 0d 05 6d |...&....|.......m|
|00001a90| 61 69 6e 00 00 00 02 49 | 00 00 02 56 0d 54 65 73 |ain....I|...V.Tes|
|00001aa0| 74 4c 75 6d 69 6e 61 6e | 63 65 00 00 00 48 00 09 |tLuminan|ce...H..|
|00001ab0| 4d 6f 6e 61 63 6f 00 00 | 00 00 00 00 00 00 00 00 |Monaco..|........|
|00001ac0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001ad0| 00 03 00 04 00 3c 00 03 | 01 8c 02 7d 00 3c 00 03 |.....<..|...}.<..|
|00001ae0| 01 8c 02 7d ac 54 fb f9 | 00 00 04 4b 00 00 04 52 |...}.T..|...K...R|
|00001af0| 00 00 02 9f 00 00 00 00 | 00 04 00 01 00 01 00 00 |........|........|
|00001b00| 01 00 00 00 01 7e 00 00 | 00 7e 00 00 00 52 01 77 |.....~..|.~...R.w|
|00001b10| 19 e8 27 4c 00 00 00 1c | 00 52 00 01 4d 50 53 52 |..'L....|.R..MPSR|
|00001b20| 00 01 00 12 4d 57 42 42 | 00 00 00 2a 03 ef ff ff |....MWBB|...*....|
|00001b30| 00 00 00 00 00 00 00 00 | 03 ed ff ff 00 00 00 2a |........|.......*|
|00001b40| 00 00 00 00 03 f0 ff ff | 00 00 00 76 00 00 00 00 |........|...v....|
|00001b50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001b70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+