diff options
author | Erich Eckner <git@eckner.net> | 2017-07-21 12:10:10 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-07-21 12:10:10 +0200 |
commit | d6ff133fd1ff7c325c7dea5866cd8ee752fb47af (patch) | |
tree | e194560f6792d65ec8e2d3f989d258e8a5def638 | |
parent | 0f1d4a00485da9604a79d8f73da7bce079a412bb (diff) | |
download | epost-d6ff133fd1ff7c325c7dea5866cd8ee752fb47af.tar.xz |
verschiebung neu
-rw-r--r-- | epost.lps | 166 | ||||
-rw-r--r-- | epostunit.pas | 35 | ||||
-rw-r--r-- | werteunit.pas | 45 |
3 files changed, 137 insertions, 109 deletions
@@ -7,8 +7,7 @@ <Unit0> <Filename Value="epost.lpr"/> <IsPartOfProject Value="True"/> - <TopLine Value="502"/> - <CursorPos X="31" Y="531"/> + <CursorPos X="54" Y="13"/> <UsageCount Value="202"/> <Loaded Value="True"/> </Unit0> @@ -24,8 +23,8 @@ <IsPartOfProject Value="True"/> <IsVisibleTab Value="True"/> <EditorIndex Value="1"/> - <TopLine Value="5772"/> - <CursorPos X="42" Y="5801"/> + <TopLine Value="3890"/> + <CursorPos X="27" Y="3905"/> <UsageCount Value="201"/> <Loaded Value="True"/> </Unit2> @@ -40,8 +39,8 @@ <Filename Value="werteunit.pas"/> <IsPartOfProject Value="True"/> <EditorIndex Value="6"/> - <TopLine Value="1086"/> - <CursorPos X="32" Y="1114"/> + <TopLine Value="2055"/> + <CursorPos Y="2074"/> <UsageCount Value="200"/> <Loaded Value="True"/> </Unit4> @@ -59,7 +58,7 @@ <IsPartOfProject Value="True"/> <EditorIndex Value="2"/> <TopLine Value="220"/> - <UsageCount Value="189"/> + <UsageCount Value="191"/> <Loaded Value="True"/> </Unit6> <Unit7> @@ -68,7 +67,7 @@ <EditorIndex Value="3"/> <TopLine Value="162"/> <CursorPos X="12" Y="191"/> - <UsageCount Value="186"/> + <UsageCount Value="188"/> <Loaded Value="True"/> </Unit7> <Unit8> @@ -76,7 +75,7 @@ <IsPartOfProject Value="True"/> <EditorIndex Value="7"/> <CursorPos X="35" Y="10"/> - <UsageCount Value="92"/> + <UsageCount Value="94"/> <Loaded Value="True"/> </Unit8> <Unit9> @@ -84,34 +83,33 @@ <EditorIndex Value="-1"/> <TopLine Value="1612"/> <CursorPos X="2" Y="1675"/> - <UsageCount Value="7"/> + <UsageCount Value="6"/> </Unit9> <Unit10> <Filename Value="../units/mystringlistunit.pas"/> <EditorIndex Value="-1"/> <TopLine Value="638"/> <CursorPos X="58" Y="660"/> - <UsageCount Value="9"/> + <UsageCount Value="8"/> </Unit10> <Unit11> <Filename Value="../units/lowlevelunit.pas"/> <EditorIndex Value="5"/> - <TopLine Value="449"/> - <CursorPos X="22" Y="469"/> - <UsageCount Value="75"/> + <TopLine Value="10"/> + <UsageCount Value="77"/> <Loaded Value="True"/> </Unit11> <Unit12> <Filename Value="../units/randomunit.pas"/> <EditorIndex Value="-1"/> - <UsageCount Value="7"/> + <UsageCount Value="6"/> </Unit12> <Unit13> <Filename Value="../units/matheunit.pas"/> <EditorIndex Value="4"/> - <TopLine Value="517"/> - <CursorPos X="21" Y="393"/> - <UsageCount Value="49"/> + <TopLine Value="789"/> + <CursorPos Y="800"/> + <UsageCount Value="51"/> <Loaded Value="True"/> </Unit13> <Unit14> @@ -119,48 +117,48 @@ <EditorIndex Value="-1"/> <TopLine Value="186"/> <CursorPos Y="161"/> - <UsageCount Value="9"/> + <UsageCount Value="8"/> </Unit14> <Unit15> <Filename Value="/usr/lib/fpc/src/rtl/inc/objpash.inc"/> <EditorIndex Value="-1"/> <TopLine Value="182"/> <CursorPos X="21" Y="202"/> - <UsageCount Value="10"/> + <UsageCount Value="9"/> </Unit15> <Unit16> <Filename Value="/usr/lib/fpc/src/rtl/unix/bunxovlh.inc"/> <EditorIndex Value="-1"/> <TopLine Value="61"/> <CursorPos X="10" Y="99"/> - <UsageCount Value="8"/> + <UsageCount Value="7"/> </Unit16> <Unit17> <Filename Value="/usr/lib/fpc/src/rtl/unix/baseunix.pp"/> <UnitName Value="BaseUnix"/> <EditorIndex Value="-1"/> <TopLine Value="61"/> - <UsageCount Value="8"/> + <UsageCount Value="7"/> </Unit17> <Unit18> <Filename Value="/usr/lib/fpc/src/rtl/unix/bunxovl.inc"/> <EditorIndex Value="-1"/> <TopLine Value="414"/> <CursorPos X="20" Y="434"/> - <UsageCount Value="8"/> + <UsageCount Value="7"/> </Unit18> <Unit19> <Filename Value="/usr/lib/fpc/src/rtl/linux/bunxsysc.inc"/> <EditorIndex Value="-1"/> <TopLine Value="16"/> - <UsageCount Value="8"/> + <UsageCount Value="7"/> </Unit19> <Unit20> <Filename Value="/usr/lib/fpc/src/rtl/unix/bunxh.inc"/> <EditorIndex Value="-1"/> <TopLine Value="74"/> <CursorPos X="15" Y="102"/> - <UsageCount Value="8"/> + <UsageCount Value="7"/> </Unit20> <Unit21> <Filename Value="/usr/lib/fpc/src/packages/fcl-image/src/fpimage.pp"/> @@ -168,155 +166,157 @@ <EditorIndex Value="-1"/> <TopLine Value="10"/> <CursorPos X="3" Y="30"/> - <UsageCount Value="8"/> + <UsageCount Value="7"/> </Unit21> <Unit22> <Filename Value="../fpGUI/src/corelib/render/software/agg_basics.pas"/> <EditorIndex Value="-1"/> <TopLine Value="327"/> <CursorPos X="12" Y="347"/> - <UsageCount Value="1"/> + <UsageCount Value="0"/> </Unit22> <Unit23> <Filename Value="/usr/lib/fpc/src/rtl/objpas/classes/classesh.inc"/> <EditorIndex Value="-1"/> <TopLine Value="673"/> <CursorPos X="42" Y="705"/> - <UsageCount Value="1"/> + <UsageCount Value="0"/> </Unit23> <Unit24> <Filename Value="/usr/lib/fpc/src/rtl/objpas/math.pp"/> <EditorIndex Value="-1"/> <TopLine Value="166"/> <CursorPos X="10" Y="183"/> - <UsageCount Value="9"/> + <UsageCount Value="8"/> </Unit24> <Unit25> <Filename Value="GTIWebServerTestAggActionHandlerUnit.pas"/> <EditorIndex Value="-1"/> <TopLine Value="53"/> <CursorPos X="49" Y="82"/> - <UsageCount Value="9"/> + <UsageCount Value="8"/> </Unit25> </Units> <JumpHistory Count="30" HistoryIndex="29"> <Position1> <Filename Value="werteunit.pas"/> - <Caret Line="1074" Column="103" TopLine="1058"/> + <Caret Line="75" Column="65" TopLine="58"/> </Position1> <Position2> - <Filename Value="../units/fftunit.inc"/> - <Caret Line="214" TopLine="195"/> + <Filename Value="werteunit.pas"/> + <Caret Line="76" TopLine="57"/> </Position2> <Position3> - <Filename Value="../units/fftunit.inc"/> - <Caret Line="229" Column="9" TopLine="195"/> + <Filename Value="werteunit.pas"/> + <Caret Line="2061" Column="3" TopLine="2044"/> </Position3> <Position4> - <Filename Value="../units/fftunit.pas"/> - <Caret Line="469" Column="69" TopLine="450"/> + <Filename Value="werteunit.pas"/> + <Caret Line="75" Column="47" TopLine="64"/> </Position4> <Position5> - <Filename Value="../units/fftunit.inc"/> - <Caret Line="126" Column="23" TopLine="103"/> + <Filename Value="epostunit.pas"/> + <Caret Line="3913" Column="36" TopLine="3894"/> </Position5> <Position6> - <Filename Value="epostunit.pas"/> - <Caret Line="5794" Column="51" TopLine="5779"/> + <Filename Value="werteunit.pas"/> + <Caret Line="2063" Column="21" TopLine="2048"/> </Position6> <Position7> <Filename Value="epostunit.pas"/> + <Caret Line="3913" Column="61" TopLine="3895"/> </Position7> <Position8> <Filename Value="epostunit.pas"/> - <Caret Line="153" Column="17" TopLine="125"/> + <Caret Line="3908" TopLine="3893"/> </Position8> <Position9> <Filename Value="epostunit.pas"/> - <Caret Line="2856" Column="20" TopLine="2827"/> + <Caret Line="162" TopLine="155"/> </Position9> <Position10> <Filename Value="epostunit.pas"/> - <Caret Line="2869" Column="23" TopLine="2840"/> + <Caret Line="3914" Column="84" TopLine="3890"/> </Position10> <Position11> - <Filename Value="epostunit.pas"/> - <Caret Line="3329" Column="15" TopLine="3301"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="412" Column="81" TopLine="393"/> </Position11> <Position12> - <Filename Value="epostunit.pas"/> - <Caret Line="3753" Column="13" TopLine="3725"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="54" TopLine="24"/> </Position12> <Position13> - <Filename Value="epostunit.pas"/> - <Caret Line="3759" Column="13" TopLine="3731"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="53" Column="10" TopLine="35"/> </Position13> <Position14> - <Filename Value="epostunit.pas"/> - <Caret Line="3783" Column="13" TopLine="3755"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="735" TopLine="700"/> </Position14> <Position15> - <Filename Value="epostunit.pas"/> - <Caret Line="3789" Column="13" TopLine="3761"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="31" TopLine="28"/> </Position15> <Position16> - <Filename Value="../units/fftunit.inc"/> - <Caret Line="120" TopLine="106"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="793" Column="47" TopLine="759"/> </Position16> <Position17> - <Filename Value="../units/fftunit.inc"/> - <Caret Line="180" Column="83" TopLine="166"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="792" Column="18" TopLine="762"/> </Position17> <Position18> - <Filename Value="../units/fftunit.inc"/> + <Filename Value="../units/lowlevelunit.pas"/> + <Caret Line="469" Column="22" TopLine="449"/> </Position18> <Position19> - <Filename Value="../units/fftunit.inc"/> - <Caret Line="170" Column="36" TopLine="142"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="55" TopLine="31"/> </Position19> <Position20> - <Filename Value="../units/fftunit.inc"/> - <Caret Line="116" Column="11" TopLine="87"/> + <Filename Value="epostunit.pas"/> + <Caret Line="3907" Column="18" TopLine="3890"/> </Position20> <Position21> - <Filename Value="../units/fftunit.inc"/> - <Caret Line="191" Column="11" TopLine="168"/> + <Filename Value="epost.lpr"/> + <Caret Line="45" TopLine="27"/> </Position21> <Position22> - <Filename Value="../units/fftunit.inc"/> - <Caret Column="23"/> + <Filename Value="epost.lpr"/> + <Caret Line="47" Column="30" TopLine="31"/> </Position22> <Position23> - <Filename Value="werteunit.pas"/> - <Caret Line="1039" Column="69" TopLine="1031"/> + <Filename Value="epost.lpr"/> + <Caret Line="46" TopLine="31"/> </Position23> <Position24> - <Filename Value="werteunit.pas"/> - <Caret Line="1112" Column="52" TopLine="1083"/> + <Filename Value="epost.lpr"/> + <Caret Line="47" Column="51" TopLine="28"/> </Position24> <Position25> - <Filename Value="werteunit.pas"/> - <Caret Line="87" TopLine="86"/> + <Filename Value="epost.lpr"/> + <Caret Line="13" Column="65"/> </Position25> <Position26> - <Filename Value="werteunit.pas"/> - <Caret Line="1115" Column="24" TopLine="1086"/> + <Filename Value="epost.lpr"/> + <Caret Line="47" Column="13" TopLine="29"/> </Position26> <Position27> - <Filename Value="epostunit.pas"/> - <Caret Line="3923" Column="113" TopLine="3903"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="795" Column="24" TopLine="776"/> </Position27> <Position28> - <Filename Value="epostunit.pas"/> - <Caret Line="5784" Column="12" TopLine="5755"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="794" Column="28" TopLine="776"/> </Position28> <Position29> - <Filename Value="epostunit.pas"/> - <Caret Line="5783" Column="12" TopLine="5754"/> + <Filename Value="../units/matheunit.pas"/> + <Caret Line="800" Column="44" TopLine="790"/> </Position29> <Position30> - <Filename Value="epostunit.pas"/> - <Caret Line="5801" Column="46" TopLine="5772"/> + <Filename Value="epost.lpr"/> + <Caret Line="46" TopLine="35"/> </Position30> </JumpHistory> </ProjectSession> diff --git a/epostunit.pas b/epostunit.pas index 07e921a..64afc65 100644 --- a/epostunit.pas +++ b/epostunit.pas @@ -3802,7 +3802,7 @@ var s: string; b,hintergrundAbziehen: boolean; bekannteBefehle: tMyStringList; - maxPos: tIntPoint; + maxPos,einheitsZelle: tIntPoint; betraege: tWerte; i,j: int64; begin @@ -3885,14 +3885,14 @@ begin gibAus(' (Parseval-Fehler = '+floatToStr(pvFehler)+')',3); for b:=false to true do fensters[b].free; -(* + gibAus('spektrale Beträge ermitteln',3); betraege:=tWerte.create(self,0,_xSteps-1); betraege.fft2dNachbearbeitung(threads,doBetrQdr); - *) + fft2dNachbearbeitung(threads,doAlleResIms); -(* gibAus('tiefe Frequenzen filtern',3); + gibAus('tiefe Frequenzen filtern',3); case genauigkeit of gSingle: sWerte.kantenFilter(betraege.sWerte,xFak,yFak,kfHochpass,true,maxPos); @@ -3900,8 +3900,19 @@ begin dWerte.kantenFilter(betraege.dWerte,xFak,yFak,kfHochpass,true,maxPos); gExtended: eWerte.kantenFilter(betraege.eWerte,xFak,yFak,kfHochpass,true,maxPos); - end{of case}; *) -// betraege.free; + end{of case}; + betraege.free; + + gibAus('zentrieren',3); + einheitsZelle:=berechneEinheitsZelle(maxPos,intPoint(_xSteps,_tSiz div 2)); + case genauigkeit of + gSingle: + sWerte.verschiebe(maxPos,0,einheitsZelle['x']-1,0,einheitsZelle['y']-1,true); + gDouble: + dWerte.verschiebe(maxPos,0,einheitsZelle['x']-1,0,einheitsZelle['y']-1,true); + gExtended: + eWerte.verschiebe(maxPos,0,einheitsZelle['x']-1,0,einheitsZelle['y']-1,true); + end{of case}; gibAus('berechne inverse x-FFT ...',3); if not fft(threads,false,true,doAlleResIms,doAlleResIms,nil,0,pvFehler,wsLasch) then begin @@ -3916,18 +3927,6 @@ begin end; gibAus(' (Parseval-Fehler = '+floatToStr(pvFehler)+')',3); - hintergrund:=0; - for i:=_tSiz div 2 +1 to _tSiz-1 do - for j:=0 to _xSteps-1 do - hintergrund:=hintergrund + sqr(eWerte.werte[j+i*_xSteps]); - - writeln(hintergrund,' ',_xSteps*_tSiz div 2,' ',hintergrund*2/_xSteps/_tSiz); - - pvFehler:=0; - for i:=0 to _tSiz div 2 do - for j:=0 to _xSteps-1 do - pvFehler:=pvFehler + sqr(eWerte.werte[j+i*_xSteps]); - // _tSiz:=_tSiz div 2; // holeRAM(3); diff --git a/werteunit.pas b/werteunit.pas index aabb8fe..f81e864 100644 --- a/werteunit.pas +++ b/werteunit.pas @@ -12,7 +12,7 @@ type pTLLWerteSingle = ^tLLWerteSingle; pTLLWerteDouble = ^tLLWerteDouble; pTLLWerteExtended = ^tLLWerteExtended; - generic tLLWerte<wgen> = class(tObject) + generic tLLWerte<wGen> = class(tObject) { Diese Klasse stellt nur die Berechnungsroutinen und ähnliches bereit, nicht jedoch ein (wie auch immer geartetes) Userinterface. @@ -21,7 +21,7 @@ type private procedure sortiereMaxima(var maxima: tIntPointArray); public - werte: array of wgen; + werte: array of wGen; params: tExtraInfos; constructor create(ps: tExtraInfos); overload; constructor create(original: pTLLWerteSingle; ps: tExtraInfos; xMin,xMax: longint); overload; @@ -72,6 +72,7 @@ type procedure kantenFilter(betraege: tLLWerte; xFak,yFak: extended; filterTyp: tKantenFilterTyp); overload; procedure kantenFilter(betraege: tLLWerte; xFak,yFak: extended; filterTyp: tKantenFilterTyp; einseitig: boolean; out maxPos: tIntPoint); overload; procedure fenstereWerte(xMi,xMa,tMi,tMa: int64; xFen,tFen: tFenster; hg: extended); + procedure verschiebe(richtung: tIntPoint; xV,xB,tV,tB: longint; komplex: boolean); end; tLLWerteSingle = specialize tLLWerte<single>; tLLWerteDouble = specialize tLLWerte<double>; @@ -769,8 +770,8 @@ begin close(f); exit; end; - if sizeOf(wgen) = wertGroesze(dateien[i].genauigkeit) then - blockread(f,werte[(j+dateien[i].t0Abs)*params.xSteps],params.xSteps*sizeOf(wgen)) + if sizeOf(wGen) = wertGroesze(dateien[i].genauigkeit) then + blockread(f,werte[(j+dateien[i].t0Abs)*params.xSteps],params.xSteps*sizeOf(wGen)) else begin setLength(sA,params.xSteps); blockread(f,sA[0],params.xSteps*sizeOf(single)); @@ -939,7 +940,7 @@ begin reset(f,1); seek(f,(dateien[i] as tAndorInputDateiInfo).datenStart); tmpI:=wertGroesze(dateien[i].genauigkeit); - if tmpI = sizeOf(wgen) then + if tmpI = sizeOf(wGen) then blockread(f,werte[0],dateien[i].xSteps*dateien[i].tSiz*tmpI) else case dateien[i].genauigkeit of gSingle: @@ -1047,7 +1048,7 @@ begin in0:=true; out0:=true; - case sizeOf(wgen) of + case sizeOf(wGen) of sizeOf(single): for i:=sMin to sMax do begin if not senkrecht and (algo.inOrdnung = doAlleResIms) then @@ -1196,7 +1197,7 @@ end; procedure tLLWerte.spiegle(tMin,tMax: longint); var i,j: longint; - tmp: wgen; + tmp: wGen; begin for i:=tMin to tMax do for j:=0 to params.xSteps div 2 -1 do begin @@ -1405,7 +1406,7 @@ begin ho:=params.tSiz; end; if (ausgaben and __ausgabenMaske) <> 0 then - gibAus('Fordere '+intToStr(floor(ho*br*sizeOf(wgen)/1024/1024))+' MB RAM an ('+intToStr(br)+' x-Schritte mal '+intToStr(ho)+' t-Schritte; bisher '+intToStr(belegterSpeicher div 1024)+' MB belegt). ...',ausgaben); + gibAus('Fordere '+intToStr(floor(ho*br*sizeOf(wGen)/1024/1024))+' MB RAM an ('+intToStr(br)+' x-Schritte mal '+intToStr(ho)+' t-Schritte; bisher '+intToStr(belegterSpeicher div 1024)+' MB belegt). ...',ausgaben); setLength(werte,br*ho); if (ausgaben and __ausgabenMaske) <> 0 then @@ -2055,6 +2056,34 @@ begin (werte[i+j*params.xSteps]-hg)*xFen.werte[i]*tFen.werte[j]; end; +procedure tLLWerte.verschiebe(richtung: tIntPoint; xV,xB,tV,tB: longint; komplex: boolean); +var + xS,tS,x,t,xN,tN,xM,tM: longint; + imPart: boolean; + wert: wGen; +begin + xM:=params.xSteps; + tM:=params.tSiz div (1+byte(komplex)); + if (xV<0) or (xB<0) or (tV<0) or (tB<0) or + (xV>=xM) or (xB>=xM) or (tV>=tM) or (tB>=tM) then + raise exception.create('Fehler: Das Startrechteck ('+intToStr(xV)+'-'+intToStr(xB)+'x'+intToStr(tV)+'-'+intToStr(tB)+') liegt nicht vollsändig in den Daten ('+intToStr(xM)+'x'+intToStr(tM)+').'); + for imPart:=false to komplex do + for xS:=xV to xB do + for tS:=tV to tB do begin + wert:=werte[xS+tS*xM]; + xN:=xS; + tN:=tS; + repeat + x:=xN; + t:=tN; + xN:=(x + richtung['x']) mod xM; + tN:=(t + richtung['y']) mod tM; + werte[x+t*xM]:=werte[xN+tN*xM]; + until (xN=xS) and (tN=tS); + werte[x+t*xM]:=wert; + end; +end; + // tWavelet ******************************************************************** function tWavelet.setzeTyp(s: string): boolean; |