diff options
-rw-r--r-- | epost.lps | 138 | ||||
-rw-r--r-- | epostunit.pas | 172 | ||||
-rw-r--r-- | werteunit.pas | 19 |
3 files changed, 244 insertions, 85 deletions
@@ -7,7 +7,8 @@ <Unit0> <Filename Value="epost.lpr"/> <IsPartOfProject Value="True"/> - <CursorPos X="54" Y="13"/> + <TopLine Value="139"/> + <CursorPos X="57" Y="148"/> <UsageCount Value="202"/> <Loaded Value="True"/> </Unit0> @@ -23,8 +24,8 @@ <IsPartOfProject Value="True"/> <IsVisibleTab Value="True"/> <EditorIndex Value="1"/> - <TopLine Value="3890"/> - <CursorPos X="27" Y="3905"/> + <TopLine Value="3906"/> + <CursorPos X="23" Y="3940"/> <UsageCount Value="201"/> <Loaded Value="True"/> </Unit2> @@ -39,8 +40,8 @@ <Filename Value="werteunit.pas"/> <IsPartOfProject Value="True"/> <EditorIndex Value="6"/> - <TopLine Value="2055"/> - <CursorPos Y="2074"/> + <TopLine Value="2072"/> + <CursorPos X="3" Y="2101"/> <UsageCount Value="200"/> <Loaded Value="True"/> </Unit4> @@ -48,8 +49,8 @@ <Filename Value="typenunit.pas"/> <IsPartOfProject Value="True"/> <EditorIndex Value="8"/> - <TopLine Value="729"/> - <CursorPos X="28" Y="759"/> + <TopLine Value="2255"/> + <CursorPos Y="2273"/> <UsageCount Value="200"/> <Loaded Value="True"/> </Unit5> @@ -57,8 +58,9 @@ <Filename Value="../units/fftunit.pas"/> <IsPartOfProject Value="True"/> <EditorIndex Value="2"/> - <TopLine Value="220"/> - <UsageCount Value="191"/> + <TopLine Value="214"/> + <CursorPos Y="187"/> + <UsageCount Value="195"/> <Loaded Value="True"/> </Unit6> <Unit7> @@ -67,7 +69,7 @@ <EditorIndex Value="3"/> <TopLine Value="162"/> <CursorPos X="12" Y="191"/> - <UsageCount Value="188"/> + <UsageCount Value="192"/> <Loaded Value="True"/> </Unit7> <Unit8> @@ -75,7 +77,7 @@ <IsPartOfProject Value="True"/> <EditorIndex Value="7"/> <CursorPos X="35" Y="10"/> - <UsageCount Value="94"/> + <UsageCount Value="98"/> <Loaded Value="True"/> </Unit8> <Unit9> @@ -96,7 +98,7 @@ <Filename Value="../units/lowlevelunit.pas"/> <EditorIndex Value="5"/> <TopLine Value="10"/> - <UsageCount Value="77"/> + <UsageCount Value="79"/> <Loaded Value="True"/> </Unit11> <Unit12> @@ -109,7 +111,7 @@ <EditorIndex Value="4"/> <TopLine Value="789"/> <CursorPos Y="800"/> - <UsageCount Value="51"/> + <UsageCount Value="53"/> <Loaded Value="True"/> </Unit13> <Unit14> @@ -173,14 +175,14 @@ <EditorIndex Value="-1"/> <TopLine Value="327"/> <CursorPos X="12" Y="347"/> - <UsageCount Value="0"/> + <UsageCount Value="10"/> </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="0"/> + <UsageCount Value="10"/> </Unit23> <Unit24> <Filename Value="/usr/lib/fpc/src/rtl/objpas/math.pp"/> @@ -199,124 +201,122 @@ </Units> <JumpHistory Count="30" HistoryIndex="29"> <Position1> - <Filename Value="werteunit.pas"/> - <Caret Line="75" Column="65" TopLine="58"/> + <Filename Value="epostunit.pas"/> + <Caret Line="3918" Column="13" TopLine="3886"/> </Position1> <Position2> - <Filename Value="werteunit.pas"/> - <Caret Line="76" TopLine="57"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5060" Column="31" TopLine="5055"/> </Position2> <Position3> - <Filename Value="werteunit.pas"/> - <Caret Line="2061" Column="3" TopLine="2044"/> + <Filename Value="epostunit.pas"/> + <Caret Line="173" Column="30" TopLine="155"/> </Position3> <Position4> - <Filename Value="werteunit.pas"/> - <Caret Line="75" Column="47" TopLine="64"/> + <Filename Value="epostunit.pas"/> + <Caret Line="3934" Column="18" TopLine="3902"/> </Position4> <Position5> <Filename Value="epostunit.pas"/> - <Caret Line="3913" Column="36" TopLine="3894"/> + <Caret Line="5067" Column="43" TopLine="5054"/> </Position5> <Position6> - <Filename Value="werteunit.pas"/> - <Caret Line="2063" Column="21" TopLine="2048"/> + <Filename Value="epostunit.pas"/> + <Caret Line="388" Column="20" TopLine="380"/> </Position6> <Position7> <Filename Value="epostunit.pas"/> - <Caret Line="3913" Column="61" TopLine="3895"/> + <Caret Line="5021" Column="48" TopLine="4988"/> </Position7> <Position8> <Filename Value="epostunit.pas"/> - <Caret Line="3908" TopLine="3893"/> + <Caret Line="5035" Column="26" TopLine="5002"/> </Position8> <Position9> <Filename Value="epostunit.pas"/> - <Caret Line="162" TopLine="155"/> + <Caret Line="5046" Column="26" TopLine="5013"/> </Position9> <Position10> <Filename Value="epostunit.pas"/> - <Caret Line="3914" Column="84" TopLine="3890"/> + <Caret Line="5078" Column="24" TopLine="5045"/> </Position10> <Position11> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="412" Column="81" TopLine="393"/> + <Filename Value="epostunit.pas"/> + <Caret Line="7146" Column="21" TopLine="7113"/> </Position11> <Position12> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="54" TopLine="24"/> + <Filename Value="epostunit.pas"/> </Position12> <Position13> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="53" Column="10" TopLine="35"/> + <Filename Value="epostunit.pas"/> + <Caret Line="388" Column="20" TopLine="355"/> </Position13> <Position14> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="735" TopLine="700"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5021" Column="48" TopLine="4988"/> </Position14> <Position15> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="31" TopLine="28"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5035" Column="26" TopLine="5002"/> </Position15> <Position16> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="793" Column="47" TopLine="759"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5046" Column="26" TopLine="5013"/> </Position16> <Position17> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="792" Column="18" TopLine="762"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5078" Column="26" TopLine="5045"/> </Position17> <Position18> - <Filename Value="../units/lowlevelunit.pas"/> - <Caret Line="469" Column="22" TopLine="449"/> + <Filename Value="epostunit.pas"/> + <Caret Line="7190" Column="45" TopLine="7166"/> </Position18> <Position19> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="55" TopLine="31"/> + <Filename Value="epostunit.pas"/> </Position19> <Position20> <Filename Value="epostunit.pas"/> - <Caret Line="3907" Column="18" TopLine="3890"/> + <Caret Line="396" Column="22" TopLine="363"/> </Position20> <Position21> - <Filename Value="epost.lpr"/> - <Caret Line="45" TopLine="27"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5093" Column="12" TopLine="5056"/> </Position21> <Position22> - <Filename Value="epost.lpr"/> - <Caret Line="47" Column="30" TopLine="31"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5077" Column="24" TopLine="5057"/> </Position22> <Position23> - <Filename Value="epost.lpr"/> - <Caret Line="46" TopLine="31"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5081" Column="39" TopLine="5062"/> </Position23> <Position24> - <Filename Value="epost.lpr"/> - <Caret Line="47" Column="51" TopLine="28"/> + <Filename Value="werteunit.pas"/> + <Caret Line="1964" TopLine="2009"/> </Position24> <Position25> - <Filename Value="epost.lpr"/> - <Caret Line="13" Column="65"/> + <Filename Value="werteunit.pas"/> + <Caret Line="75" Column="25" TopLine="53"/> </Position25> <Position26> - <Filename Value="epost.lpr"/> - <Caret Line="47" Column="13" TopLine="29"/> + <Filename Value="epostunit.pas"/> + <Caret Line="7190" Column="18" TopLine="7175"/> </Position26> <Position27> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="795" Column="24" TopLine="776"/> + <Filename Value="epostunit.pas"/> + <Caret Line="396" Column="22" TopLine="378"/> </Position27> <Position28> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="794" Column="28" TopLine="776"/> + <Filename Value="epostunit.pas"/> + <Caret Line="5066" Column="22" TopLine="5063"/> </Position28> <Position29> - <Filename Value="../units/matheunit.pas"/> - <Caret Line="800" Column="44" TopLine="790"/> + <Filename Value="epostunit.pas"/> + <Caret Line="147" Column="155" TopLine="141"/> </Position29> <Position30> - <Filename Value="epost.lpr"/> - <Caret Line="46" TopLine="35"/> + <Filename Value="epostunit.pas"/> + <Caret Line="173" Column="35" TopLine="145"/> </Position30> </JumpHistory> </ProjectSession> diff --git a/epostunit.pas b/epostunit.pas index d19c466..ed65ab1 100644 --- a/epostunit.pas +++ b/epostunit.pas @@ -169,6 +169,8 @@ type procedure spiegle(threads: longint); overload; procedure spiegle(threads,tMin,tMax: longint); overload; procedure fuelleMitDummys(sT: boolean); + procedure verschiebe(threads: longint; richtung: tIntPoint; komplex: boolean); + procedure ermittlePhasenWinkel(threads: longint); procedure fft2dNachbearbeitung(threads: longint; nB: tFFTDatenordnung); procedure schreibeWert(var f: textfile; x,y: longint); function exprToFloat(sT: boolean; s: string): extended; @@ -383,6 +385,20 @@ type constructor create(werte: tWerte; xMin,xMax,tMin,tMax: longint; fensterX,fensterT: tFenster; hintergrund: extended); procedure stExecute; override; end; + tVerschiebeThread = class(tLogThread) + we: tWerte; + xMi,xMa,tMi,tMa: longint; + rtg: tIntPoint; + kmpl: boolean; + constructor create(werte: tWerte; xMin,xMax,tMin,tMax: longint; richtung: tIntPoint; komplex: boolean); + procedure stExecute; override; + end; + tPhasenWinkelThread = class(tLogThread) + we: tWerte; + xMi,xMa: longint; + constructor create(werte: tWerte; xMin,xMax: longint); + procedure stExecute; override; + end; function neuePalette(f: tMyStringList): boolean; function initBmpHeader(w,h: longint): tBmpHeader; @@ -3804,9 +3820,8 @@ var s: string; b,hintergrundAbziehen: boolean; bekannteBefehle: tMyStringList; - maxPos,einheitsZelle: tIntPoint; + maxPos: tIntPoint; betraege: tWerte; - i,j: int64; begin result:=false; Zeit:=now; @@ -3905,16 +3920,8 @@ begin 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('zentrieren '+tIntPointToStr(maxPos),3); + verschiebe(threads,maxPos,true); gibAus('berechne inverse x-FFT ...',3); if not fft(threads,false,true,doAlleResIms,doAlleResIms,nil,0,pvFehler,wsLasch) then begin @@ -3929,8 +3936,8 @@ begin end; gibAus(' (Parseval-Fehler = '+floatToStr(pvFehler)+')',3); -// _tSiz:=_tSiz div 2; -// holeRAM(3); + gibAus('Phasenwinkel ermitteln ...',3); + ermittlePhasenWinkel(threads); gibAus('... fertig '+timetostr(now-Zeit),3); result:=true; @@ -5007,6 +5014,85 @@ begin end; end; +procedure tWerte.verschiebe(threads: longint; richtung: tIntPoint; komplex: boolean); +var + einheitsZelle: tIntPoint; + teilRichtung: char; + verschiebeThreads: array of tVerschiebeThread; + i: longint; + fertig: boolean; +begin + einheitsZelle:=berechneEinheitsZelle(richtung,intPoint(_xSteps,_tSiz div (1+byte(komplex)))); + + teilRichtung:=char(ord('x')+byte(einheitsZelle['y']>einheitsZelle['x'])); + if einheitsZelle[teilRichtung]<threads then + threads:=einheitsZelle[teilRichtung]; + + setLength(verschiebeThreads,threads); + for i:=0 to threads-1 do + if teilRichtung='x' then + verschiebeThreads[i]:= + tVerschiebeThread.create( + self, + round(i/threads*einheitsZelle['x']), + round((i+1)/threads*einheitsZelle['x']-1), + 0, + einheitsZelle['y']-1, + richtung, + komplex + ) + else + verschiebeThreads[i]:= + tVerschiebeThread.create( + self, + 0, + einheitsZelle['x']-1, + round(i/threads*einheitsZelle['y']), + round((i+1)/threads*einheitsZelle['y']-1), + richtung, + komplex + ); + repeat + sleep(10); + fertig:=true; + for i:=0 to length(verschiebeThreads)-1 do + fertig:=fertig and verschiebeThreads[i].fertig; + until fertig; + for i:=0 to length(verschiebeThreads)-1 do + verschiebeThreads[i].free; + gibAus('Alle Verschiebethreads fertig!',1); +end; + +procedure tWerte.ermittlePhasenWinkel(threads: longint); +var + phasenWinkelThreads: array of tPhasenWinkelThread; + i: longint; + fertig: boolean; +begin + if _xSteps<threads then + threads:=_xSteps; + + setLength(phasenWinkelThreads,threads); + for i:=0 to threads-1 do + phasenWinkelThreads[i]:= + tPhasenWinkelThread.create( + self, + round(i/threads*_xSteps), + round((i+1)/threads*_xSteps-1) + ); + repeat + sleep(10); + fertig:=true; + for i:=0 to length(phasenWinkelThreads)-1 do + fertig:=fertig and phasenWinkelThreads[i].fertig; + until fertig; + for i:=0 to length(phasenWinkelThreads)-1 do + phasenWinkelThreads[i].free; + gibAus('Alle Phasenwinkelthreads fertig!',1); + _tSiz:=_tSiz div 2; + holeRAM(3); +end; + procedure tWerte.fft2dNachbearbeitung(threads: longint; nB: tFFTDatenordnung); var i: longint; @@ -7056,7 +7142,63 @@ begin gExtended: we.eWerte.fenstereWerte(xMi,xMa,tMi,tMa,xFen,tFen,hg); end{of case}; - gibAus('VerzerrLOthread beendet',1); + gibAus('FensterThread beendet',1); +end; + +// tVerschiebeThread *********************************************************** + +constructor tVerschiebeThread.create(werte: tWerte; xMin,xMax,tMin,tMax: longint; richtung: tIntPoint; komplex: boolean); +begin + inherited create; + we:=werte; + xMi:=xMin; + xMa:=xMax; + tMi:=tMin; + tMa:=tMax; + rtg:=richtung; + kmpl:=komplex; + gibAus('VerschiebeThread erzeugt: '+intToStr(xMin)+'-'+intToStr(xMax)+' '+intToStr(tMin)+'-'+intToStr(tMax)+' '+tIntPointToStr(richtung)+' '+intToStr(byte(komplex)),1); + suspended:=false; +end; + +procedure tVerschiebeThread.stExecute; +begin + gibAus('VerschiebeThread gestartet',1); + case we.genauigkeit of + gSingle: + we.sWerte.verschiebe(rtg,xMi,xMa,tMi,tMa,kmpl); + gDouble: + we.dWerte.verschiebe(rtg,xMi,xMa,tMi,tMa,kmpl); + gExtended: + we.eWerte.verschiebe(rtg,xMi,xMa,tMi,tMa,kmpl); + end{of case}; + gibAus('VerschiebeThread beendet',1); +end; + +// tPhasenWinkelThread ********************************************************* + +constructor tPhasenWinkelThread.create(werte: tWerte; xMin,xMax: longint); +begin + inherited create; + we:=werte; + xMi:=xMin; + xMa:=xMax; + gibAus('PhasenWinkelThread erzeugt: '+intToStr(xMin)+'-'+intToStr(xMax),1); + suspended:=false; +end; + +procedure tPhasenWinkelThread.stExecute; +begin + gibAus('PhasenWinkelThread gestartet',1); + case we.genauigkeit of + gSingle: + we.sWerte.ermittlePhasenWinkel(xMi,xMa); + gDouble: + we.dWerte.ermittlePhasenWinkel(xMi,xMa); + gExtended: + we.eWerte.ermittlePhasenWinkel(xMi,xMa); + end{of case}; + gibAus('PhasenWinkelThread beendet',1); end; // sonstiges ******************************************************************* diff --git a/werteunit.pas b/werteunit.pas index 745ed68..d26b65a 100644 --- a/werteunit.pas +++ b/werteunit.pas @@ -73,6 +73,7 @@ type 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); + procedure ermittlePhasenWinkel(xMi,xMa: longint); end; tLLWerteSingle = specialize tLLWerte<single>; tLLWerteDouble = specialize tLLWerte<double>; @@ -1961,7 +1962,6 @@ begin end; end; setLength(maxima,mCnt); - writeln(length(maxima),' (von ',betraege.params.xSteps*betraege.params.tSiz,')'); betraege.sortiereMaxima(maxima); maxPos:=maxima[1]; @@ -2084,6 +2084,23 @@ begin end; end; +procedure tLLWerte.ermittlePhasenWinkel(xMi,xMa: longint); +var + i,j,ts2: longint; +begin + ts2:=params.tSiz div 2; + for j:=0 to ts2-1 do + for i:=xMi to xMa do + if (werte[i+(j+ts2)*params.xSteps]=0) and (werte[i+j*params.xSteps]=0) then + werte[i+j*params.xSteps]:=0 + else + werte[i+j*params.xSteps]:= + arctan2( + werte[i+(j+ts2)*params.xSteps], + werte[i+j*params.xSteps] + ); +end; + // tWavelet ******************************************************************** function tWavelet.setzeTyp(s: string): boolean; |