Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- the creation of the file used for 3 blob fx on st
- (c) gloky
- */
- program calcST;
- uses crt;
- /*
- lngtab: table de longueur => TX*TY= 50*50
- */
- const TX = 50;
- TY = 50;
- maxLOG = 8192 ;
- maxEXP = 8192 ; // = maxLOGval
- maxLNGval = 1024;
- var f:word;
- lngtab:array[0..100*100-1] of word;
- logtab:array[0..8191] of smallint;
- exptab:array[0..1024+768-1] of word;
- cst1:double;
- g:word;
- valeur,cpt:word;
- packExp:array[0..1024+768] of word;
- logtabST:array[0..16383] of byte;
- exptabST:array[0..2048+768*2-1] of byte;
- lngtabST:array[0..100*100*2-1] of byte;
- fi:file;
- sinq:array[0..511] of word;
- sinqST:array[0..1023] of byte;
- begin
- cst1:=256*32/sqrt(48*48+48*48);
- for g:=0 to 47 do begin;
- for f:=0 to 47 do begin;
- lngtab[f+g*48]:=round(sqrt(f*f+g*g)*cst1); // val lng de zero a 255
- end;
- end;
- // log(lng) faisable donc log[f]=v: f de 0 a 255*32 surechantillonage = 8192
- for g:=0 to 8192-1 do begin;
- logtab[g]:=round((ln(g*256/8192+128/8192)/ln((8191*256+128)/8192)*1023.5))*16;
- exptab[768+logtab[g] div 16]:=g;
- end;
- //; de 0 a 1024 * 16 = 16384
- /*
- cpt:=0;
- for f:=0 to 1023+768 do begin;
- if (exptab[f]=0) then inc(cpt) else begin;
- if (cpt = 0) then begin;
- limite=cpt;
- end;
- pacexp[off]:=cpt;
- cpt:=0;
- pacexp[off]:=
- end;
- end;
- */
- cpt:=0;
- for f:=0 to 1023+768 do begin;
- if (exptab[f]=0) then inc(cpt) else begin;
- valeur:=exptab[f];
- while (cpt>0) do begin;
- exptab[f-cpt]:=valeur;
- dec(cpt);
- end;
- end;
- end;
- for f:=0 to 1023+768 do begin;
- exptabST[f*2]:= exptab[f] div 256;
- exptabST[f*2+1]:=exptab[f] and 255;
- end;
- for f:=0 to 8192-1 do begin;
- logtabST[f*2]:= logtab[f] div 256;
- logtabST[f*2+1]:= logtab[f] and 255;
- end;
- for f:=0 to 100*100-1 do begin;
- lngtabST[f*2]:=lngtab[f] div 256;
- lngtabST[f*2+1]:=lngtab[f] and 255;
- end;
- assign(fi,'c:\ln1.dat');
- rewrite(fi);
- blockWrite(fi,logtabST,16384);
- close(fi);
- assign(fi,'c:\exp1.dat');
- rewrite(fi);
- blockWrite(fi,exptabST,2048+768*2);
- close(fi);
- assign(fi,'c:\lng1.dat');
- rewrite(fi);
- blockWrite(fi,lngtabST,48*48*2);
- close(fi);
- for g:=0 to 95 do begin;
- for f:=0 to 95 do begin;
- lngtab[f+g*96]:=round(sqrt((f-47.5)*(f-47.5)+(g-47.5)*(g-47.5))*cst1);
- end;
- end;
- for f:=0 to 100*100-1 do begin;
- lngtabST[f*2]:=lngtab[f] div 256;
- lngtabST[f*2+1]:=lngtab[f] and 255;
- end;
- assign(fi,'c:\lng3.dat');
- rewrite(fi);
- blockWrite(fi,lngtabST,96*96*2);
- close(fi);
- for f:=0 to 511 do begin;
- sinq[f]:=round((23+23*sin(f*2*PI/512))/2);
- sinqST[f*2]:=sinq[f] div 256;
- sinqST[f*2+1]:=sinq[f] and 255;
- end;
- assign(fi,'c:\sin1.dat');
- rewrite(fi);
- blockWrite(fi,sinqST,1024);
- close(fi);
- for f:=0 to 1024+768-1 do begin;
- writeln(exptab[f]); //1 a 8192
- if (f mod 24)=23 then readln;
- end;
- for f:=0 to 8191 do begin;
- writeln(logtab[f] div 16); // -768 a 1024
- if (f mod 23)=22 then readln;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement