%!PS % Distortion Reduction Techniques for 8-bit magic sinewaves GG19 % ============================================ % by Don Lancaster % Copyright c 2002 by Don Lancaster & Synergetics, Box 809, Thatcher, AZ, 85552 % (928) 428-4073 Email: don@tinaja.com Website: http://www.tinaja.com % Consulting services available http://www.tinaja.com/info01.html % Linking welcome. Reposting expressly forbidden. % All commercial rights and all electronic media rights ~fully~ reserved. % Linking usually welcome. Reposting expressly forbidden. Version 1.1 % Shows how to reduce the distortion on 8-bit data magic sinewaves by % using accumulation, offsetting, and scaling techniques. % IMPORTANT NOTE: Don Lancaster's file gonzo.ps is required for this program. % After obvious location mods, uncomment ONE of the following two lines: (C:\\windows\\desktop\\gonzo\\gonzo.ps) run % use internal gonzo % (A:\\gonzo.ps) run % use external gonzo % NOTE THAT ALL PS FILENAME STRINGS !!!DEMAND!!! DOUBLE REVERSE SLASHES. % GONZO20A Guru Gonzo PostScript power tools (Interim release) % Includes gonzo justification and layout utilities. % Copyright c 1990, 1996, 2001 by Don Lancaster and Synergetics, Box 809, % Thatcher Arizona, 5552 (928) 428-4073 don@tinaja.com support % via http://www.tinaja.com All commercial rights and all electronic % media rights **FULLY** reserved. Reposting is expressly forbidden. %%%%%%%%%%% links menu directory %%%%%%%%%%%% % This code locks pdfmark commands out of a PostScript printer. /pdfmark where {pop}{userdict /pdfmark /cleartomark load put} ifelse % /surl "start url" marks the beginning of a text sequence to be urled. % It also paints the text blue... /surl {mark /blue cvx 0.33 /setgray cvx % change text to blue /currentpoint cvx % remember box start /urly /exch cvx /store cvx /urlx /exch cvx /store cvx ] cvx % complete deferred command printlist exch 3 index exch put % stuff into gonzo printlist exch 1 add exch % increment gonzo list count } def % /eurl "end url" unmarks the end of a text sequence and sets up % the pdfmark needed to define the Acrobat web link. /eurl {mark % start deferred proc exch % position url string % /black cvx 0 /setgray cvx % turn blue marker off % maintextcolor /setrgbcolor cvx % reset to main text color??? /aqua cvx /black cvx /makeurl cvx % defer call of url builder ] cvx % complete deferred proc printlist exch 3 index exch % stuff into gonzo printlist put exch 1 add exch % increment gonzo list count } def % /makeurl generates the pdfmark, receiving a {(urlstring) makeurl}. % Note that it is not called until formatted printlist time... /urlover 0.2 def % fraction of hot area over bounds /makeurl { /cururlname exch store % save the url string mark % start pdfmark currentfont /ScaleMatrix get 3 get /fsize exch store % guess height /Rect [ urlx fsize urlover mul sub % set box left x urly fsize urlover mul sub % set box left y currentpoint exch fsize urlover mul add exch fsize add ] /Border [ 0 0 0] % [0 0 0 ] = none; [0 0 2] = debug /Color [ .7 0 0 ] /Action <> /Subtype /Link /ANN % annotation type pdfmark % call pdf operators } def % /makeurlx generates the box specific pdfmark, receiving % a {(urlstring) makeurl}. % Note that it is not called until formatted printlist time... /makeurlx { /cururlnamex exch store % save the url string mark % start pdfmark /Rect [ xpos % set box left x ypos 0.9 sub % set box left y xpos 2.8 add % box right x ypos 0.9 sub 2.8 add % box right y ] /Border [ 0 0 0] % [0 0 0 ] = none; [0 0 2] = debug /Color [ .7 0 0 ] /Action <> /Subtype /Link /ANN % annotation type pdfmark % call pdf operators } def /maintextcolor {0 0 0 } def % text link specific data -- use dictionary instead below { /cubic01 {(http://www.tinaja.com/cubic01.asp) eurl} def /hack62 {(http://www.tinaja.com/glib/hack62.pdf) eurl} def /increment {(http://www.tinaja.com/text/bezgen3.html) eurl} def /interpolate {(http://members.bellatlantic.net/~vze2vrva/design.html) eurl } def /bezmath {(http://www.tinaja.com/text/bezmath.html) eurl } def /table {(http://www.tinaja.com/psutils/imtable.psl) eurl } def } pop % dictionary method << %zzzzz %%%% unused links have been commented for gg9a simplicity /plotb28s (http://www.tinaja.com/glib/plo1b.psl) /plotb28 (http://www.tinaja.com/glib/plo1b.pdf) /plotd28s (http://www.tinaja.com/glib/plo3d.psl) /plotd28 (http://www.tinaja.com/glib/plo3d.pdf) /muse153 (http://www.tinaja.com/glib/muse153.pdf) /stepsynt (http://www.tinaja.com/glib/stepsynt.pdf) /msintro1 (http://www.tinaja.com/glib/msintro1.pdf) /msinprop (http://www.tinaja.com/glib/msinprop.pdf) /muse106 (http://www.tinaja.com/glib/muse106.pdf) /muse142 (http://www.tinaja.com/glib/muse142.pdf) /math01 (http://www.tinaja.com/math01.asp) /cubic01 (http://www.tinaja.com/cubic01.asp) /bez4pts (http://www.tinaja.com/glib/bez4pts.pdf) /muse145 (http://www.tinaja.com/glib/muse145.pdf) /muse148 (http://www.tinaja.com/glib/muse148.pdf) /curveft3 (http://www.tinaja.com/psutils/curveft3.psl) /fuzzybez (http://www.tinaja.com/glib/fuzzybez.pdf) /bmprpt01 (http://www.tinaja.com/psutils/bmprpt01.psl) /nowhit01 (http://www.tinaja.com/psutils/nowhit01.psl) /blender (http://www.tinaja.com/psutils/blender.psl) /speedup2 (http://www.tinaja.com/glib/speedup2.pdf) /histog01 (http://www.tinaja.com/psutils/histog01.psl) /imgviewer32 (http://www.arcatapet.net/imgv32.cfm) /basis (http://www.tinaja.com/glib/basis.pdf) /expbmp (http://www.tinaja.com/glib/expbmp.pdf) /dodbur01 (http://www.tinaja.com/psutils/dodbur01.psl) /dodgebur (http://www.tinaja.com/glib/dodgebur.pdf) /magfill1 (http://www.tinaja.com/psutils/magfill1.psl) /swingt01 (http://www.tinaja.com/psutils/swingt01.psl) /before01 (http://www.tinaja.com/images/bargs/marcon01.jpg) /during01 (http://www.tinaja.com/images/bargs/marcon01.bmp) /after01 (http://www.tinaja.com/images/bargs/marconz1.jpg) /repobmp (http://www.tinaja.com/glib/repobmp.pdf) /basis01 (http://www.tinaja.com/glib/basis.pdf) /arcata (http://www.arcatapet.net/imgv32.cfm) /comparebmp (http://www.designer-info.com/Writing/bmp_tiff_jpeg_gif.htm) /imagimag (http://www.tinaja.com/glib/imagimag.pdf) /myebays (http://www.tinaja.com/glib/myebays.pdf) /stepprep (http://www.tinaja.com/glib/stepprep.pdf) /aafont01 (http://www.tinaja.com/aafont01.asp) /here1 (http://village.infoweb.ne.jp/~fwhw1257/study/bmpform.htm) /here2 (http://www.daubnet.com/formats/BMP.html) /bittype (http://www.tinaja.com/psutils/pdf2bmp.psl) /photocombine (http://www.tinaja.com/psutils/blender.psl) /psl (http://www.tinaja.com/psutils/) % dummy temp /psl1 (http://www.tinaja.com/psutils/pdf2bmp.psl) /psl2 (http://www.tinaja.com/psutils/acatdata.psl) /psl3 (http://www.tinaja.com/psutils/catwords.psl) /psl4 (http://www.tinaja.com/psutils/graburls.psl) /psl5 (http://www.tinaja.com/psutils/blender.psl) /psl6 (http://www.tinaja.com/psutils/catools1.psl) /psl7 (http://www.tinaja.com/psutils/strconv.html) /psl8 (http://www.tinaja.com/psutils/bodcat.psl) /psl9 (http://www.tinaja.com/psutils/flatvue1.psl) /psl10 (http://www.tinaja.com/psutils/fern2img.psl) /psl11 (http://www.tinaja.com/psutils/flutools.psl) /psl12 (http://www.tinaja.com/psutils/mscal156q.psl) /psl13 (http://www.tinaja.com/psutils/weblogu2.psl) /psl14 (http://www.tinaja.com/psutils/pfa2pfb.psl) /psl15 (http://www.tinaja.com/psutils/pfb2pfa.psl) /psl16 (http://www.tinaja.com/glib/psdisk03.psl) /psl17 (http://www.tinaja.com/psutils/disktool.psl) /psl18 (http://www.tinaja.com/glib/psinscrt.psl) /psl19 (http://www.tinaja.com/glib/pssearch.psl) /psl20 (http://www.tinaja.com/text/refsum1.html) /psl21 (http://www.tinaja.com/text/reflog1.html) /psl22 (http://www.tinaja.com/psutils/reflog1.psl) /psl23 (http://www.tinaja.com/psutils/refsum1.psl) /psl24 (http://www.tinaja.com/psutils/searepl.psl) /psl25 (http://www.tinaja.com/psutils/weberru2.psl) /psl26 (http://www.tinaja.com/psutils/grabsrch.psl) /psl27 (http://www.tinaja.com/psutils/grabrefs.psl) /magsn01 (http://www.tinaja.com/magsn01.asp) /gonzoutils (http://www.tinaja.com/post01.asp#gonzo) /disktool (http://www.tinaja.com/psutils/disktool.ps) /elesimp (http://www.tinaja.com/glib/elesimp.pdf) /tn5603 (http://partners.adobe.com/asn/developer/pdfs/tn/TN5603.Filters.pdf) /fern2img (http://www.tinaja.com/psutils/fern2img.psl) /fern (http://www.tinaja.com/psutils/fern2img.pdf) /oldfern (http://www.tinaja.com/psutils/fernx1.pdf) /acrosdk (http://partners.adobe.com/asn/developer/acrosdk/main.html) /refman2 (http://partners.adobe.com/asn/developer/pdfs/tn/psrefman.pdf) /refman3 (http://partners.adobe.com/asn/developer/pdfs/tn/PLRM.pdf) /s3011 (http://partners.adobe.com/asn/developer/pdfs/tn/PS3010and3011.Supplement.pdf) /s2011 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2011.supplement.pdf) /s2012 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2012.supplement.pdf) /s2013 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2013.supplement.pdf) /s2014 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2014.supplement.pdf) /s2015 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2015.supplement.pdf) /s2016 (http://ftp.ktug.or.kr/obsolete/info/adobe/devtechnotes/pdffiles/ps2016.supplement.pdf) /ghost (http://www.cs.wisc.edu/~ghost/) /distlang (http://www.tinaja.com/psutils/distlang.html) /adobepst (http://partners.adobe.com/asn/developer/technotes/) /maildon (mailto:don@tinaja.com) /tinaja (http://www.tinaja.com) /adobe (http://www.adobe.com) /adobesdk (http://partners.adobe.com/asn/developer/acrosdk/main.html) /pstrans (http://www.tinaja.com/glib/pstrans.pdf) /borland (http://www.borland.com/products/downloads/download_cbuilder.html) /ebay (http://cgi6.ebay.com/ws/eBayISAPI.dll?ViewSellersOtherItems&userid=abeja&completed=0&sort=2&since=-1&include=0&page=1&rows=100) /searepl (http://www.tinaja.com/psutils/searepl.psl) /aasdk (http://www.tinaja.com/plugins/AboutAcrobatSDK.api) /uncomp (http://www.tinaja.com/plugins/UncompressPDF.api) /addimage (http://www.tinaja.com/plugins/AddImage.api) /samplejpg (http://www.tinaja.com/plugins/sample.jpg) /transparency (http://www.tinaja.com/plugins/Transparency.api) /threerects (http://www.tinaja.com/plugins/threerects.pdf) /watermark (http://www.tinaja.com/plugins/Watermark.api) /verifyurls (http://www.tinaja.com/plugins/VerifyURLS.api) /flate (http://www.tinaja.com/glib/flatvue.pdf) /pstrans (http://www.tinaja.com/glib/pstrans.pdf) /advt01 (http://www.tinaja.com/advt01.asp) /amlink01 (http://www.tinaja.com/amlink01.asp) /ng1 (news:///comp.text.pdf) /ng2 (news:///comp.lang.postscript) /msc++ (http://msdn.microsoft.com/visualc/productinfo/default.asp) /degub (http://www.tinaja.com/glib/degub.pdf) /ghostscript (http://www.artifex.com/pressreleases/GS70.htm) /demox.psl (http://www.tinaja.com/glib/g9demox.psl) /demox.pdf (http://www.tinaja.com/glib/g9demox.pdf) /demo.pdf (http://www.tinaja.com/glib/g9demo.pdf) /flatvue (http://www.tinaja.com/glib/flatvue.psl) /pdfrefman (http://partners.adobe.com/asn/developer/acrosdk/docs.html) /psrefman (http://partners.adobe.com/asn/developer/technotes/postscript.html) /pdfmrm (http://partners.adobe.com/asn/developer/acrosdk/docs.html) /tipdf (http://partners.adobe.com/asn/developer/acrosdk/docs.html) /asdk (http://partners.adobe.com/asn/developer/acrosdk) /mtcr (http://support.adobe.com/devsup/devsup.nsf/docs/51864.htm) /flatvue1 (http://www.tinaja.com/psutils/flatvue1.psl) /acrob01 (http://www.tinaja.com/acrob01.asp) /post01 (http://www.tinaja.com/post01.asp) /info01 (http://www.tinaja.com/info01.asp) /gurgrm01 (http://www.tinaja.com/gurgrm01.asp) { /tilley (http://www.tilleyfoundation.com) /mnglobal (http://www.mnglobal.com/energy/pg2.htm) /keely (http://www.keelynet.com) /evolve (http://www.evolvedtechnology.com) /hack64 (http://www.tinaja.com/glib/hack64.pdf) /hackar3 (http://www.tinaja.com/glib/hackar3.pdf) /resbn58 (http://www.tinaja.com/glib/resbn58.pdf) /bppt (http://www.batterypoweronline.com) /muse112 (http://www.tinaja.com/glib/muse112.pdf) /muse113 (http://www.tinaja.com/glib/muse113.pdf) /energfun (http://www.tinaja.com/glib/energfun.pdf) /bashpseu (http://www.tinaja.com/glib/bashpseu.pdf) /adobe (http://www.adobe.com) /netscape (http://www.netscape.com) /gallypsl (http://www.tinaja.com/galley1.psl) /gallypdf (http://www.tinaja.com/galley1.pdf) /atn5150 (http://partners.adobe.com/asn/developer/acrosdk/docs/createpdfapi/pdfmarkReference.pdf) /nutour (http://www.tinaja.com/bargains/nutour02.pdf) /nutoursource (http://www.tinaja.com/bargains/nutour02.psl) /bwhistle (http://www.tinaja.com/glib/bwhistle.pdf) /gonzo1 (http://www.tinaja.com/post01.asp#gonzo) /barg01 (http://www.tinaja.com/barg01.asp) /weblib01 (http://www.tinaja.com/weblib01.asp) /gurgrm01 (http://www.tinaja.com/gurgrm01.asp) /z1 (http://www.tinaja.com/bargains/thumb/albradz2.jpg) /z2 (http://www.tinaja.com/bargains/sbtesteq.asp) /z3 (http://www.tinaja.com/images/bargs/albrad02.jpg) /z4 (http://www.tinaja.com/bargains/thumb/tutenaz2.jpg) /z5 (http://www.tinaja.com/bargains/sbphone.asp) /z6 (http://www.tinaja.com/images/bargs/tutena02.jpg) /sourceme (http://www.tinaja.com/glib/gallery.psl) /sourceme2 (http://www.tinaja.com/glib/autourl.psl) } pop >> {mark exch /eurl cvx ] cvx def} forall %%%%%%%%%%%%%%%% New colorizer patches %%%%%%%%%%%%%%%%%% /boxgrays 0.899 def /grayshade boxgrays def /mastergray boxgrays def /staytint {0.33 setgray} def /staytint1 {0.25 setgray} def /showadgrays true def /red {0 settint} def /Zmacro {staytint /ypos ypos 2 add def 72 300 div setlinewidth xpos ypos moveto txtwide 0 rlineto stroke /ypos ypos -2 add def tintoff} def % hair rule /amacro {(zy0) stringmacro /ypos ypos ypara add def 0.33 setgray } def % start drop cap /bmacro {(iFy1) stringmacro /ypos ypos ypara add def black} def % finish drop cap % Gonzo character colorizer /blueon {mark /blue cvx 0.33 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /blueoff {mark /beige cvx 0 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton {mark 0.33 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1 {mark 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1b {mark beige cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1a {mark /aqua cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1p {mark /burple cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1r {mark /red cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1a {mark /aqua cvx % try for aqua after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tinton1b {mark /beige cvx % try for beige after url??? 0.25 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def /tintoff {mark 0 /setgray cvx] cvx printlist exch 3 index exch put exch 1 add exch} def %%%%%%%%%%%%%% COMPACT VERSION OF COLORIZER II %%%%%%%%%%%%%%%%%%%%%% /settint {dup /currenttint exch store 5.999 mul dup floor cvi /&cbar exch store dup floor sub /&cwt exch store [ {/setgray [ /dup cvx 0.3 &cwt 0.59 mul add /ge cvx [1 /exch cvx &cwt 0.59 mul 0.30 add /sub cvx 1 &cwt sub 0.59 mul 0.11 add /div cvx /dup cvx 1 &cwt sub /mul cvx &cwt /add cvx /exch cvx ] cvx [ &cwt 0.59 mul 0.3 add /div cvx /dup cvx &cwt /mul cvx 0] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.59 1 &cwt sub 0.3 mul add /ge cvx [1 &cwt sub 0.3 mul 0.59 add /sub cvx &cwt 0.3 mul 0.11 add /div cvx /dup cvx &cwt /mul cvx 1 &cwt sub /add cvx /exch cvx 1 /exch cvx] cvx [1 &cwt sub 0.3 mul 0.59 add /div cvx /dup cvx 1 &cwt sub /mul cvx /exch cvx 0] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.59 &cwt 0.11 mul add /ge cvx [&cwt 0.11 mul 0.59 add /sub cvx 1 &cwt sub 0.11 mul 0.30 add /div cvx /dup cvx 1 &cwt sub /mul cvx &cwt /add cvx 1 /exch cvx] cvx [0 /exch cvx &cwt 0.11 mul 0.59 add /div cvx /dup cvx &cwt /mul cvx] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.59 1 &cwt sub mul 0.11 add /ge cvx [1 &cwt sub 0.59 mul 0.11 add /sub cvx &cwt 0.59 mul 0.30 add /div cvx /dup cvx &cwt /mul cvx 1 &cwt sub /add cvx 1] cvx [0 /exch cvx 1 &cwt sub 0.59 mul 0.11 add /div cvx /dup cvx 1 &cwt sub /mul cvx /exch cvx] cvx /ifelse cvx /setrgbcolor cvx] cvx /def cvx} {/setgray [/dup cvx 0.11 &cwt 0.30 mul add /ge cvx[&cwt 0.30 mul 0.11 add /sub cvx 1 &cwt sub 0.30 mul 0.59 add /div cvx /dup cvx 1 &cwt sub /mul cvx &cwt /add cvx /exch cvx 1] cvx [ &cwt 0.30 mul 0.11 add /div cvx /dup cvx &cwt /mul cvx /exch cvx 0 /exch cvx ] cvx /ifelse cvx /setrgbcolor cvx ] cvx /def cvx} {/setgray [ /dup cvx 0.30 1 &cwt sub 0.11 mul add /ge cvx[ 1 /exch cvx 1 &cwt sub 0.11 mul 0.30 add /sub cvx &cwt 0.11 mul 0.59 add /div cvx /dup cvx &cwt /mul cvx 1 &cwt sub /add cvx ] cvx [ 1 &cwt sub 0.11 mul 0.30 add /div cvx /dup cvx 1 &cwt sub /mul cvx 0 /exch cvx] cvx /ifelse cvx /setrgbcolor cvx ] cvx /def cvx} ] &cbar get exec exec} bind def /beige {0.10 settint} def % examples of convenience operators /aqua {0.52 settint} def /blue {0.67 settint} def /lime {0.44 settint} def /burple {0.75 settint} def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /guru { gonzo begin ps.util.1 begin printerror nuisance begin} def % guru % activate gonzo utilities 50 50 10 setgrid % create grid % 56 61 showgrid /setpagefonts { /cstretch 0.015 def /sstretch 0.015 def /font0 /StoneSans-Bold 1.6 gonzofont /font1 /StoneSans 0.95 gonzofont /font2 /StoneSans [0.95 0 0.25 0.95 0 0 ] gonzofont /font4 /StoneSans 0.85 gonzofont /font3 /StoneSans-Bold 0.85 gonzofont /font6 /StoneSans-Bold 0.85 gonzofont /font7 /StoneSans-Bold 1.05 gonzofont % subheaders /font8 /StoneSans-Bold [0.65 0 0 0.65 0 0.4] gonzofont /txtwide 36 store /yinc 1.2 store /kern 0.1 store /pm 1.5 store aqua 0.33 setgray font1 black /amacro { mark /aqua cvx 0.33 /setgray cvx ] cvx printlist exch 3 index exch % stuff into gonzo printlist put exch 1 add exch } def /bmacro { mark /black cvx ] cvx printlist exch 3 index exch % stuff into gonzo printlist put exch 1 add exch } def /shiftin {xpos /xposhold exch store /xpos xpos 3 add store} def /shiftout {/xpos xposhold store} def /texttop 51 store /textleft 3 store /cmacro {aqua 0.25 setgray (znhL7) stringmacro /xpos xpos 1.7 sub store /ypos ypos .1 sub def } def % left title /dmacro {black (pL1hz) stringmacro /xpos xpos 1.7 add store /ypos ypos .1 add def} def % normal text after centered title /fmacro % try and fake | {mark /gsave cvx /currentpoint cvx /moveto cvx 0.1 /setlinewidth cvx 0 0.65 /rlineto cvx /stroke cvx /grestore cvx ] cvx printlist exch 3 index exch put % stuff into gonzo printlist exch 1 add exch % increment gonzo list count } def } def setpagefonts % -2 50.5 (optional header here \274) cl %% Set document opening conventions. Note DOCVIEW limited. [/CropBox [0 0 520 620] % set the wierd size /PAGES pdfmark [ {Catalog} << /ViewerPreferences << /FitWindow true /CenterWindow true >> /PageLayout /OneColumn % continous /Pagemode /UseNone % no thumbs /View [/XYZ null null 1 ] % force 100% >> /PUT pdfmark %%%%%%%%%%%%%%%%% START DEMO ART (not in use) %%%%%%%%%%%%%%%% %%% Hand patching Info: % next available variable is /GS3 % transparency gstate is object 2 % contents stream is object 18 gets q /GS3 gs (xstuff) Q % be sure to q Q bracket to localize % resources stream is object 19 gets /GS3 2 0 R /transoverlay { % make a new graphics state [ /_objdef {newgsstate} /type /dict /OBJ pdfmark % fill the new overlay graphics state - See PDF manual for details [ {newgsstate} << /Type /ExtGState /ca 0.5 % fill transparency is 0.5 /CA 0.5 % stroke transparency is 0.5 /BM /Normal /AIS false /OP false /OPM 1 /op true >> /PUT pdfmark % start a Begin Picture graphics overlay subroutine... [ /BBox [0 0 1000 1000 ] /_objdef {overlaypix} /BP pdfmark % fill the Begin Picture graphics overlay Xobject subroutine... 0 0.5 1 setrgbcolor % on the aqua side of blue 4 4 6 6 rectfill % complete the Begin Picture graphics overlay Xobject... [ /EP pdfmark } def % Write a two squares program... /twosquares { gsave translate 1 0.5 0 setrgbcolor % red side of orange 2 2 6 6 rectfill % do background opaque box [ {overlaypix} /SP pdfmark % show foreground transparent box grestore} def % Distill the two squares program. Initially use a BARE Distiller Job % Options that has no compression, no embedded fonts, and little else save /snap1 exch store %%% transoverlay % create new objects %%% 14 17.5 twosquares snap1 restore %%%%%%%%%%%% END DEMO %%%%%%% %%%%%%%%%%%% PHOTO INSERTS %%%%%%%%%% % When photos are needed, they are inserted here. Comment out otherwise. %%%%%%%%% photo links %%%%%%%%% /pixfilename1 (C:\\windows\\desktop\\aaraw_pix\\flashfix.jpg) def /figure1 {12.5 37 200 200 pixfilename1 jpegimageproc} def % image link /pixfilename3 (C:\\windows\\desktop\\aaraw_pix\\dintcjx1.jpg) def /figure3 {12.5 0 225 202 pixfilename3 jpegimageproc} def % image link /hotspot1 { 0 0 20.5 14.3 (http://www.tinaja.com/images/bargs/marcon01.jpg) setareaurl} def /hotspot3 { 12.5 0 30 15.5 (http://www.tinaja.com/images/bargs/dintcj01.jpg) setareaurl} def /photoscale 0.075 store /jpegimageproc { % hoffset voffset hres vres save /snap2 exch def /infilename exch store % grab passed pix file /vpixels exch store /hpixels exch store translate % adjust position for final figure ??? electronics begin /DeviceRGB setcolorspace % pick color model 0 0 translate % set page position hpixels vpixels scale % magnify unit square photoscale dup scale /infile infilename (r) file def % establish input read file /Data {infile /DCTDecode filter} def % define a data source << % start image dicationary /ImageType 1 % always one /Width hpixels % JPEG width in pixels /Height vpixels % JPEG height in pixels /ImageMatrix [hpixels 0 0 vpixels neg 0 vpixels ] /DataSource Data % proc to get filtered JPEG /BitsPerComponent 8 % color resolution /Decode [0 1 0 1 0 1] % per red book 4.10 >> image % call the image operator end ypos snap2 restore /ypos exch def } def %%%%%%%%%%%%%%%%%%%%%% HOTSPOTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % manually positioned area url click.. /setareaurl { /cururlname exch store % save the url string /ury exch store /urx exch store /lly exch store /llx exch store mark % start pdfmark /Rect [ llx lly urx ury] /Border [ 0 0 0] % [0 0 0 ] = none; [0 0 2] = debug /Color [ .7 0 0 ] /Action <> /Subtype /Link /ANN % annotation type pdfmark % call pdf operators } def %%%%%%%%%%%%% /burpwide 29.5 store /burplebox3 {save /burp1 exch store xpos ypos translate -1 .2 mt 3.5 yinc mul .4 add pd burpwide pr 3.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox2 {save /burp1 exch store xpos ypos translate -1 .2 mt 2.5 yinc mul .4 add pd burpwide pr 2.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox2.5 {save /burp1 exch store xpos ypos translate -1 .2 mt 3 yinc mul .4 add pd burpwide pr 3 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox4 {save /burp1 exch store xpos ypos translate -1 .2 mt 4.5 yinc mul .4 add pd burpwide pr 4.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox4.5 {save /burp1 exch store xpos ypos translate -1 .2 mt 5 yinc mul .4 add pd burpwide pr 5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox5 {save /burp1 exch store xpos ypos translate -1 .2 mt 5.5 yinc mul .4 add pd burpwide pr 5.5 yinc mul .4 add pu closepath 0.9 setgray fill true {special5 } if burp1 restore } def /burplebox6 { save /burp1 exch store xpos ypos translate -1 .2 mt 6.5 yinc mul .4 add pd burpwide pr 6.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox7.5 {save /burp1 exch store xpos ypos translate -1 .2 mt 8 yinc mul .4 add pd burpwide pr 8 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox8 {save /burp1 exch store xpos ypos translate -1 .2 mt 8.5 yinc mul .4 add pd burpwide pr 8.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox9 {save /burp1 exch store xpos ypos translate -1 .2 mt 9.5 yinc mul .4 add pd burpwide pr 9.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox15.5 {save /burp1 exch store xpos ypos translate -1 .2 mt 16 yinc mul .4 add pd burpwide pr 16 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox17 {save /burp1 exch store xpos ypos translate -1 .2 mt 17.5 yinc mul .4 add pd burpwide pr 17.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox20 {save /burp1 exch store xpos ypos translate -1 .2 mt 20.5 yinc mul .4 add pd burpwide pr 20.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox26.5 {save /burp1 exch store xpos ypos translate -1 .2 mt 27 yinc mul .4 add pd burpwide pr 27 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def /burplebox36 {save /burp1 exch store xpos ypos translate -1 .2 mt 36.5 yinc mul .4 add pd burpwide pr 36.5 yinc mul .4 add pu closepath 0.9 setgray fill burp1 restore } def %%%%%%%%%%% figure 1 routine % autopositions on box6 %%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%% QUARTIC FIVE-POINT FIT %%%%%%%%%%%%%% /figure3 { save /snap3 exch store % we use an earlier and cruder method here translate 0.9 dup scale % fit a quartic to five data points % points are 0,0 x1,y1, x2,y2, x3,y3 and 1,1 % seek general solution. % y = ax4 + bx3 + cx2 + dx + e no e since y=0 at x=0 % 1 = a + b + c + d at x = 1 EQUATION AA % a = 1 - b - c - d % egn I % a(x1)4 + b(x1)3 + c(x1)2 + d(x1) = (y1) % evaluating first point % a(x2)4 + b(x2)3 + c(x2)2 + d(x2) = (y2) % evaluating second point % a(x3)4 + b(x3)3 + c(x3)2 + d(x3) = (y3) % evaluating third point % scale to clean a % a + b/(x1) + c/(x1)2 + d(x1)3 = (y1)/(x1)4 % divide by (x1)4 % a + b/(x2) + c/(x2)2 + d(x2)3 = (y2)/(x2)4 % divide by (x2)4 % a + b/(x3) + c/(x3)2 + d(x3)3 = (y1)/(x3)4 % divide by (x3)4 % reduce a with eqn I % 1 - b - c - d + b/(x1) + c/(x1)2 + d(x1)3 = (y1)/(x1)4 % substituting for a % 1 - b - c - d + b/(x2) + c/(x2)2 + d(x2)3 = (y2)/(x1)4 % substituting for a % 1 - b - c - d + b/(x3) + c/(x3)2 + d(x3)3 = (y3)/(x1)4 % substituting for a % rearranging % b (1-(x1))/(x1) + c (1-(x1)2)/(x1)2 + d (1-(x1)3)/(x1)3 = (y1)/(x1)4 - 1 % b (1-(x2))/(x2) + c (1-(x2)2)/(x2)2 + d (1-(x2)3)/(x2)3 = (y2)/(x2)4 - 1 % b (1-(x3))/(x3) + c (1-(x3)2)/(x3)2 + d (1-(x3)3)/(x3)3 = (y3)/(x3)4 - 1 % simplifying variables % f1 = (1-(x1))/(x1) % f2 = (1-(x1)2)/(x1)2 % f3 = (1-(x1)3)/(x1)3 % f4 = (y1)/(x1)4 - 1 /f1 { 1 x1 sub x1 div } store /f2 { 1 x1 dup mul sub x1 dup mul div } store /f3 { 1 x1 dup dup mul mul sub x1 dup dup mul mul div } store /f4 { y1 x1 dup mul dup mul div 1 sub } store % g1 = (1-(x2))/(x2) % g2 = (1-(x2)2)/(x2)2 % g3 = (1-(x2)3)/(x2)3 % g4 = (y2)/(x2)4 - 1 /g1 { 1 x2 sub x2 div } store /g2 { 1 x2 dup mul sub x2 dup mul div } store /g3 { 1 x2 dup dup mul mul sub x2 dup dup mul mul div } store /g4 { y2 x2 dup mul dup mul div 1 sub } store % h1 = (1-(x3))/(x3) % h2 = (1-(x3)2)/(x3)2 % h3 = (1-(x3)3)/(x3)3 % h4 = (y3)/(x3)4 - 1 /h1 { 1 x3 sub x3 div } store /h2 { 1 x3 dup mul sub x3 dup mul div } store /h3 { 1 x3 dup dup mul mul sub x3 dup dup mul mul div } store /h4 { y3 x3 dup mul dup mul div 1 sub } store % b(f1) + c(f2) + d(f3) = (f4) % b(g1) + c(g2) + d(g3) = (g4) % b(h1) + c(h2) + d(h3) = (h4) % unify b % b + c(f2/f1) + d(f3/f1) = (f4)/(f1) % b + c(g2/g1) + d(g3/g1) = (g4)/(g1) % b + c(h2/h1) + d(h3/h1) = (h4)/(h1) % simplify variables % p1 = f2/f1 % p2 = f3/f1 % p3 = f4/f1 /p1 { f2 f1 div} store /p2 { f3 f1 div} store /p3 { f4 f1 div} store % q1 = g2/g1 % q2 = g3/g1 % q3 = g4/g1 /q1 { g2 g1 div} store /q2 { g3 g1 div} store /q3 { g4 g1 div} store % r1 = h2/h1 % r2 = h3/h1 % r3 = h4/h1 /r1 { h2 h1 div} store /r2 { h3 h1 div} store /r3 { h4 h1 div} store % b + c(p1) + d(p2) = (p3) % eqn II % b + c(q1) + d(q2) = (q3) % eqn III % b + c(r1) + d(r2) = (r3) % eqn IV % subtract eqn III from II and eqn IV from III % c((p1)-(q1)) + d((p2)-(q2) = (p3)-(q3) % c((q1)-(r1)) + d((q2)-(r2) = (q3)-(r3) % simplify variables % s1 = (p1) - (q1) % s2 = (p2) - (q2) % s3 = (p3) - (q3) /s1 { p1 q1 sub} store /s2 { p2 q2 sub} store /s3 { p3 q3 sub} store % t1 = (q1) - (r1) % t2 = (q2) - (r2) % t3 = (q3) - (r3) /t1 { q1 r1 sub} store /t2 { q2 r2 sub} store /t3 { q3 r3 sub} store % c(s1) + d(s2) = (s3) % c(t1) + d(t2) = (t3) % unify c % c + d (s2)/(s1) = (s3)/(s1) % c + d (t2)/(t1) = (t3)/(t1) % simplify variables % u1 = (s2)/(s1) % u2 = (s3)/(s1) /u1 { s2 s1 div} store /u2 { s3 s1 div} store % v1 = (t2)/(t1) % v2 = (t3)/(t1) /v1 { t2 t1 div} store /v2 { t3 t1 div} store % c + d(u1) = (u2) % eqn V % c + d(v1) = (v2) % eqn VI % subtract VI from V % d ((u1) - (v1)) = (u2) - (v2) % AND SOLVE FOR DDD % d = (u2) - (v2)/((u1) - (v1)) % DDDDDDDDD /dd { u2 v2 sub u1 v1 sub div } store % find c from eqn V % c + d(u1) = (u2) % c = (u2) - d(u1) <------- CCCCC /cc {u2 dd u1 mul sub} store % find b from eqn II % b + c(p1) + d(p2) = (p3) % b = (p3) - c(p1) - d(p2) <------- BBBBB /bb { p3 cc p1 mul sub dd p2 mul sub } store % and a from eqn I % a = 1 - b - c - d /aa {1 bb sub cc sub dd sub} store % ========== /x1 0.2 store /y1 0.1 store /x2 0.4 store /y2 0.3 store /x3 0.7 store /y3 0.8 store gsave line2 staytint 0 0 mt 20 pu 20 pr 20 pd closepath 0.9 setgray fill grestore 20 20 showgrid 0.55 setgray line3 0 0 mt 20 u 20 r 20 d 20 l staytint 0 0 mt dot 1 20 mul 1 20 mul mt dot x1 20 mul y1 20 mul mt dot x2 20 mul y2 20 mul mt dot x3 20 mul y3 20 mul mt dot % line1 0 0 mt 20 20 lineto stroke line2 0 0 moveto 0 0.01 1 { /xx exch store xx 20 mul xx dup mul dup mul aa mul xx dup dup mul mul bb mul add xx dup mul cc mul add xx dd mul add 20 mul lineto } for stroke % aa == bb == cc == dd == snap3 restore } store %%%%%%%%%%%%%%% end figure3 /special5 {gsave 4 -5.85 translate line1 black 0.3 0 mt 0.3 l 5.2 u 0.3 r 13.2 0 mt 0.3 r 5.2 u 0.3 l 15.3 0 mt 0.3 l 5.2 u 0.3 r 18.3 0 mt 0.3 r 5.2 u 0.3 l grestore } store /xkernon {/kernsave kern store /kern 0.18 store } def /xkernoff {/kern kernsave store} def /pagenum 1 store /startnewpage { black beige 0.35 setgray 21 -2.5 (|3\320|j) pagenum 10 string cvs mergestr (|j\320) mergestr cc aqua showpage %% start next page /pagenum pagenum 1 add store 50 50 10 setgrid % create grid setpagefonts font1 textleft texttop } def /su {surl font6} store /to {tinton1 font6} store /tx {tintoff font1} store /tabs [11 15] store % /font7 /helvetica [0.7 0 0 0.7 0 0.5] gonzofont font1 aqua 0.33 setgray font0 20 47.3 0.7 add 1 sub 1 add (Distortion Reduction Techniques) cc 20 45.3 0.7 add (for 8-bit Magic Sinewaves) cc black font2 textleft 43 0.3 add % this one only need |h below (|/aqua |/staytint1 |3Don Lancaster Synergetics, Box 809, Thatcher, AZ 85552 copyright c2003 as |/surl |6GuruGram|1|/gurgrm01 |/tinton1 |6#19 |/surl http://www.tinaja.com|/tinaja |/surl don@tinaja.com|/maildon (928) 428-4073 |/aqua |/black |a|0A|b|1|j|jnew class of |/su math functions|1|/math01 called |/su Magic Sinewaves|1|/magsn01 lets you efficiently produce power sinewaves that can have |/to any|/tx chosen number of low harmonics forced very near |/to zero|/tx . And do so using the fewest possible switching events for the highest possible energy efficiency. A new Intro appears |/su here|1|/msintro1 , along with a development proposal |/su here|1|/msinprop , a tutorial |/su here|1|/stepsynt , and calculators |/su here|1|/magsn01 , and seminars and workshops |/su here|1|/info01 . |h Magic Sinewaves only work properly when their pulse positions and delays are |/to exactly|/tx specified. The various |/su Magic Sinewave Calculators|1|/magsn01 typically do show what may be excessive distortion if you try to use 8-bit quantized data for your table lookup values. Obviously, 8-bit data is desirable for lookup table simplicity and compactness. |h It turns out that\274 |6|/shiftin |/burplebox2 |/staytint1 Some sneaky "smoke and mirror" trickery can very dramatically reduce 8-bit magic sinewave distortion. |1|/shiftout |/aqua |/black These tricks include |/to bigger chips|/tx , |/to delta for all|/tx , |/to offsetting|/tx , |/to delay scaling|/tx , |/to linear |/to differencing|/tx , |/to quadratic interpolation|/tx , |/to plot viewing|/tx , and |/to progressive builds|/tx . All of which seem to be fairly easily implemented. And, taken together, should be able to dramatically reduce 8-bit |/su Magic Sinewave|1|/magsn01 distortion. |h |c Ploy #1: Bigger chips |d It is fastest and simplest to just go ahead and use 16-bit delay values instead of 8-bit ones. While this doubles the needed storage, overall microchip sizes would often remain fairly small and economical. |h |c Ploy #2: Delta for all |d Delta magic sinewaves only need |/to one-half|/tx the storage of best efficeicy ones, so you could do deltas with 16-bit resolution in the same storage as a best efficiency ) cl startnewpage (with 8-bit resolution. The often optimum delta-28 would thus require 1400 8-bit bytes of storage and confortably fit in a 2K address space. Note that deltas reject only |/to (|j3n|j/|j4|j-|j1|j)|/tx harmonics. |h |c Ploy #3: Offsetting |d By storing a few extra |/to offset|/tx values and summing certain calculations, some significant distortion reduction is possible. Consider |/to p1s|/tx as it ranges from 10.097 degrees at full unity amplitude up to 11.987 degrees at one percent amplitude. We'll note in passing that |/to p1s|/tx "backs up" as the pulses get fatter. |h We can accurately generate a 10.097 degree |/to offset|/tx and then only generate the |/to difference|/tx of 0 to 1.890 degrees using 8-bit values. For a roughly 6:1 resolution improvement. But on top of this, we can add\274 |h |c Ploy #4: Delay Scaling |d The original quantization calculations assumed that "full scale" for 8-bits was 20 degrees, or somewhat more than the fattest needed pulse. By |/to scaling|/tx to different delay routines for different pulse positions, we can gain quite a bit. Ferinstance, in the case of |/to p1S,|/tx we need only use an 8-bit full scale value of two degrees. Giving us a further 10:1 improvement, for a combined whopping 60:1. Or nearly a 14 bit accuracy from a stored 8-bit amplitude value! |h The benefits of offset and scaling do drop as you go further into the quadrant. A separate small table could hold the needed offset and scaling values. Note that these would apply to |/to all|/tx amplitudes in the sequence. And thus would add only a few additional bytes to total storage needs. |h |c Ploy #5: Linear Differencing |d In general, the pulse widths increase more or less linearly with amplitude. If a guess was made that an 0.53 pulse width was 53|j/|j100|jths the corresponding 1.00 pulse width, then only the actual |/to difference|/tx need be stored. The difference would then be summed with the guess. Since this difference is typically only a fraction of a degree, table lookup storage accuracy would dramatically increase. Typically giving four or five bits of improvement. |h This may require a micro with a multiply instruction. An approximation might involve splitting the amplitudes into four or eight groups and using shifts or whatever to properly deal with them. |h |c Ploy #6: Quadratic Interpolation |d With |/to quadratic interpolation|/tx , only |/to one-tenth|/tx or fewer amplitudes need be stored along with an |/to increment|/tx and an |/to increment delta|/tx value. Details of this method appear in |/su MUSE153.PDF|1|/muse153 . ) cl startnewpage (If 0.50 is stored as |/to x|/tx , 0.51 will be |/to y|j=|jx|j+|jincrement|/tx . 0.52 would be |/to y|j+|jincrement|j+|j |/to delta|/tx , and so on. Each new interval would get |/to fatter|/tx by delta. Per the detailed examples in the tutorial. |h |c Ploy #7: Plot Viewing |d Actually viewing the |/to delay-vs-amplitude|/tx magic sinewave plots can reveal other avenues for substantial error reduction. As in this crude |/su Delta Friendly 28|1|/plotd28 plot and its |/su sourcecode|1|/plotd28s . Or this |/su Best Distortion 28|1|/plotb28 and its |/su sourcecode|1|/plotb28s . |h In which we see several rather surprising features. Of the eight delay values useful for this particular delta magic sinewave, three appear to be perfectly linear with amplitude. And thus can be |/to eliminated entirely|/tx from table lookup storage! Provided a multiply function is available. Three more deviate from linearity by only a small fraction of a degree. And easily handled by linear differencing. |h The final two delay curves only require two degrees of full scale accuracy, and thus give 10X over the 20 degree quantizations used in the |/su calculators|1|/magsn01 . Interestingly, most of the "bent" part of these curves takes place above 0.9 amplitude. Which leaves options of not using the highest possible amplitudes or using a few 16-bit double words to deal with these small and specific areas. |h |c Ploy #8: Progressive Builds |d When you plot view a best distortion magic sinewave, the widest pulse is also seen to be the most nonlinear. Giving a "double whammy" to the needed resolution. But note that |/to best distortion pulse width is always progressive|/tx . Suggesting that we |/to sum|/tx previous pulse subroutines to increase build accuracy. |h Ferinstance, on a best distortion 28, the critical pulse seven can be generated by doing a pulse |/to six|/tx delay and then adding a differential new delay to it. Pulse six can be built by doing a pulse |/to five|/tx delay and then adding its differential. |c Setting Frequency |d These more precise delay schemes could make setting the overall frequency trickier. The best way to deal with this would appear to be a two-step process where one microcontroller generates a variable reference |/to clock|/tx frequency and a second one uses that frequency to generate the desired |/su magic sinewave|1|/magsn01 . This also nicely avoids the need for excessively high clock frequencies. |h |c For More Help |d Additional |/su Magic Sinewave|1|/magsn01 help is available per the previously shown web links. Detailed analysis of distortion improvements are available at our standard consulting rates. Per our |/su Magic Sinewave Development Proposal|1|/msinprop and our |/su Consulting Services|1|/info01 . |h Additional |/surl |6GuruGrams|1|/gurgrm01 await your ongoing support as a |/surl |6Synergetics Partner|1|/advt01 . ) cl startnewpage %%%%%%%%%%%%%%%%%%%% % EOF