- scltfd ©
[..] La fonction [scl] qtfdmatscl
Code
int qtfdmat_xpl(){
scltracefa(§, ƒ, ∅);
scltracefc("scl-%s (%s) : %s\n\n", sclver(), sclsec(), temps_char(0));
qtfdmat_xpl(1, qtfdmat_f1l, "./don/img/legorythme.jpg", 0.02, 180, 90, "-a");
qtfdmat_xpl(7, qtfdmat_fil, "./don/img/legorythme.jpg", 0.02, 180, 90, "-a");
qtfdmat_xpl(1, qtfdmat_f1l, "./don/tfd/tapir.png", 0.1, 170.0, 80.0, "-a");
qtfdmat_xpl(7, qtfdmat_fil, "./don/tfd/tapir.png", 0.1, 170.0, 80.0, "-a");
scltracefe(§, ƒ, ∅);
return 0;
}
/* ƒ décorée par
le 20-03-2025 23:32:49 */
int qtfdmat_xpl(int filn, int (*qtfdmat_p)(int, int, int, double**,
double **, double **, double **,
double, double, double, int, double **, double **, double **, double **),
const char *filepath,
double axye, double ze, double aza, const char *linespeca){
scltracefa(§, ƒ, ∅);
int ichk, ierr=-1;
char **repnom=frepnom(filepath), *imgid=repnom[2];
char *fctid = ∅;
if(qtfdmat_p==&qtfdmat_f1l){ fctid = newchar(0, "qtfdmat_xpl"); }
else if(qtfdmat_p==&qtfdmat_fil){ fctid = newchar(0, "qtfdmat_fil_xpl"); }
int imgi=-1, coln=0, coli, rown=0, rowi;
ichk = chargimage_lpt(filepath, &imgi, &coln, &rown);
if(ichk<0){
scltracerr(§, ƒ, ∅,
"erreur chargimage_lpt()\n");
scltracefe(§, ƒ, ∅);
return ierr;
} ierr--;
scltracefc("'%s' :\n", filepath);
scltracefc(" - width=%d [px], height=%d [px]\n", coln, rown);
int r, v, b;
// Constitution du signal couleur
double **sr=newmat<double>(rown, coln);
double **sji=newmat<double>(rown, coln),
**sjj=newmat<double>(rown, coln),
**sjk=newmat<double>(rown, coln);
for(rowi=0;rowi<rown;rowi++){
for(coli=0;coli<coln;coli++){
ichk = recoirvb_lpt(imgi, coli, rowi, &r, &v, &b);
if(ichk<0){
scltracerr(§, ƒ, ∅,
"erreur recoirvb_lpt()\n");
scltracefe(§, ƒ, ∅);
return ierr;
}
// Partie réelle nulle
sr[rowi][coli]=0;
// Parties imaginaires
sji[rowi][coli]=(double)r;
sjj[rowi][coli]=(double)v;
sjk[rowi][coli]=(double)b;
}
} ierr=ierr-1; // 1 erreur dans la boucle
double **tr=newmat<double>(rown, coln);
double **tji=newmat<double>(rown, coln),
**tjj=newmat<double>(rown, coln),
**tjk=newmat<double>(rown, coln);
double **ta=newmat<double>(rown, coln);
//---------------------------------------------------------------------
// μ imaginaire pure de norme unite gris
double muji=1/√(3), mujj=1/√(3), mujk=1/√(3);
scl::string_c binname=scl::string_c(fctid)+"-"+imgid+"-tag.bin";
scl::string_c binpath= "./srt/"+ binname;
double ctr, ctji, ctjj, ctjk;
FILE *fid = ∅;
size_t sot=sizeof(double);
int dimn=2;
int *crdn=new int[2]; crdn[0]=rown; crdn[1]=coln;
if(estfichier(binpath.c_str())<=0){
tic();
ichk = (*qtfdmat_p)(filn, rown, coln, sr, sji, sjj, sjk, muji, mujj, mujk, 0,
tr, tji, tjj, tjk);
if(ichk<0){
if(qtfdmat_p==&qtfdmat_f1l){
scltracerr(§, ƒ, ∅,
"erreur qtfdmat()!\n"); }
else if(qtfdmat_p==&qtfdmat_fil){
scltracerr(§, ƒ, ∅,
"erreur qtfdmat_fil()!\n"); }
scltracefe(§, ƒ, ∅);
return ierr;
}
else{
scltracefc("Grey 2d-QDFT computation time: %lf [s]\n",
(tac()/103));
}
for (rowi=0;rowi<rown;rowi++){
for (coli=0;coli<coln;coli++){
ctr=tr[rowi][coli]; ctji=tji[rowi][coli];
ctjj=tjj[rowi][coli]; ctjk=tjk[rowi][coli];
ta[rowi][coli] =
10*log10(ctr*ctr+ctji*ctji+ctjj*ctjj+ctjk*ctjk);
}
}
// Sauvegarde
fid = fopen(binpath.c_str(), "w+b");
sauvetabx(fid, 0, 0, sot, dimn, &crdn[0], (void*)ta);
fclose(fid);
}
else{
// Chargement
fid = fopen(binpath.c_str(), "r+b");
chargetabx(fid, 0, 0, &sot, &dimn, &crdn, (void**)&ta);
fclose(fid);
} ierr=ierr-1; // 1 erreur dans la condition
double *f=newtablin(coln+1, 0, 1);
double *g=newtablin(rown+1, 0, 1);
// Decallage frequentiel pour affichage
crabemat(rown, coln, ta, (rown-1)/2, (coln-1)/2, ta);
crabe(coln, f, (coln-1)/2, f);
for(coli=0;coli<coln;coli++){
if(f[coli]>0.5){ f[coli]-=1; }
}
crabe(rown, g, (rown-1)/2, g);
for(rowi=0;rowi<rown;rowi++){
if(g[rowi]>0.5){ g[rowi]-=1; }
}
scl::string_c imgname=scl::string_c(fctid)+"-"+imgid+".pdf";
scl::string_c imgpath="./srt/"+imgname;
int chan=4, chai=0;
int nyl = (int)round(1400.0/((double)chan));
grafmat_dis(imgpath.c_str(), rown, coln, ta,
"x", g, "y", f,
"yaxislength", nyl*92/100,
"yaxisposition", 1799-(chan-1-chai)*nyl,
"colormap", "grey", "ylabel", "Fréq.",
"titlex", "Spectres colorés",
"subtitlex", imgname.c_str(),
"axmin", -axye, "axmax", axye,
"aymin", -axye, "aymax", axye,
"zmax", ze, "azmin", aza, /*"zlabel", "[<zrange>]",*/
"linespeca", linespeca,
"append", "on", ∅);
//---------------------------------------------------------------------
// μ imaginaire pure de norme unite rouge
muji=1; mujj=0; mujk=0;
binname.clear(); binname=scl::string_c(fctid)+"-"+imgid+"-tar.bin";
binpath.clear(); binpath= "./srt/"+ binname;
if(estfichier(binpath.c_str())<=0){
tic();
ichk = (*qtfdmat_p)(filn, rown, coln, sr, sji, sjj, sjk,
muji, mujj, mujk, 0, tr, tji, tjj, tjk);
if(ichk<0){
if(qtfdmat_p==&qtfdmat_f1l){
scltracerr(§, ƒ, ∅,
"erreur qtfdmat()!\n"); }
else if(qtfdmat_p==&qtfdmat_fil){
scltracerr(§, ƒ, ∅,
"erreur qtfdmat_fil()!\n"); }
scltracefe(§, ƒ, ∅);
return ierr;
}
else{
scltracefc("Red 2d-QDFT computation time: %lf [s]\n",
(tac()/103));
}
for (rowi=0;rowi<rown;rowi++){
for (coli=0;coli<coln;coli++){
ctr=tr[rowi][coli]; ctji=tji[rowi][coli];
ctjj=tjj[rowi][coli]; ctjk=tjk[rowi][coli];
ta[rowi][coli] =
10*log10(ctr*ctr+ctji*ctji+ctjj*ctjj+ctjk*ctjk);
}
}
// Sauvegarde
fid = fopen(binpath.c_str(), "w+b");
sauvetabx(fid, 0, 0, sot, dimn, &crdn[0], (void*)ta);
fclose(fid);
}
else{
// Chargement
fid = fopen(binpath.c_str(), "r+b");
chargetabx(fid, 0, 0, &sot, &dimn, &crdn, (void**)&ta);
fclose(fid);
} ierr=ierr-1; // 1 erreur dans la condition
chai++;
// Decallage frequentiel pour affichage
crabemat(rown, coln, ta, (rown-1)/2, (coln-1)/2, ta);
grafmat_dis(imgpath.c_str(), rown, coln, ta,
"x", g, "y", f,
"yaxislength", nyl*92/100,
"yaxisposition", 1799-(chan-1-chai)*nyl,
"colormap", "rouge", "ylabel", "Fréq.",
"titlex", "", "subtitlex", "",
"axmin", -axye, "axmax", axye,
"aymin", -axye, "aymax", axye,
"zmax", ze, "azmin", aza, /* "zlabel", "[<zrange>]",*/
"linespeca", linespeca,
"append", "on", ∅);
//---------------------------------------------------------------------
// μ imaginaire pure de norme unite vert
muji=0; mujj=1; mujk=0;
binname.clear(); binname=scl::string_c(fctid)+"-"+imgid+"-tav.bin";
binpath.clear(); binpath= "./srt/"+ binname;
if(estfichier(binpath.c_str())<=0){
tic();
ichk = (*qtfdmat_p)(filn, rown, coln, sr, sji, sjj, sjk,
muji, mujj, mujk, 0, tr, tji, tjj, tjk);
if(ichk<0){
if(qtfdmat_p==&qtfdmat_f1l){
scltracerr(§, ƒ, ∅,
"erreur qtfdmat()!\n"); }
else if(qtfdmat_p==&qtfdmat_fil){
scltracerr(§, ƒ, ∅,
"erreur qtfdmat_fil()!\n"); }
scltracefe(§, ƒ, ∅);
return ierr;
}
else{
scltracefc("Green 2d-QDFT computation time: %lf [s]\n",
(tac()/103));
}
for (rowi=0;rowi<rown;rowi++){
for (coli=0;coli<coln;coli++){
ctr=tr[rowi][coli]; ctji=tji[rowi][coli];
ctjj=tjj[rowi][coli]; ctjk=tjk[rowi][coli];
ta[rowi][coli] =
10*log10(ctr*ctr+ctji*ctji+ctjj*ctjj+ctjk*ctjk);
}
}
// Sauvegarde
fid = fopen(binpath.c_str(), "w+b");
sauvetabx(fid, 0, 0, sot, dimn, &crdn[0], (void*)ta);
fclose(fid);
}
else{
// Chargement
fid = fopen(binpath.c_str(), "r+b");
chargetabx(fid, 0, 0, &sot, &dimn, &crdn, (void**)&ta);
fclose(fid);
} ierr=ierr-1; // 1 erreur dans la condition
chai++;
// Decallage frequentiel pour affichage
crabemat(rown, coln, ta, (rown-1)/2, (coln-1)/2, ta);
grafmat_dis(imgpath.c_str(), rown, coln, ta,
"x", g, "y", f,
"yaxislength", nyl*92/100,
"yaxisposition", 1799-(chan-1-chai)*nyl,
"colormap", "vert", "ylabel", "Fréq.",
"titlex", "", "subtitlex", "",
"axmin", -axye, "axmax", axye,
"aymin", -axye, "aymax", axye,
"zmax", ze, "azmin", aza, /* "zlabel", "[<zrange>]",*/
"linespeca", linespeca,
"append", "on", ∅);
//---------------------------------------------------------------------
// μ imaginaire pure de norme unite bleu
muji=0; mujj=0; mujk=1;
binname.clear(); binname=scl::string_c(fctid)+"-"+imgid+"-tab.bin";
binpath.clear(); binpath= "./srt/"+ binname;
if(estfichier(binpath.c_str())<=0){
tic();
ichk = (*qtfdmat_p)(filn, rown, coln, sr, sji, sjj, sjk,
muji, mujj, mujk, 0, tr, tji, tjj, tjk);
if(ichk<0){
if(qtfdmat_p==&qtfdmat_f1l){
scltracerr(§, ƒ, ∅,
"erreur qtfdmat()!\n"); }
else if(qtfdmat_p==&qtfdmat_fil){
scltracerr(§, ƒ, ∅,
"erreur qtfdmat_fil()!\n"); }
scltracefe(§, ƒ, ∅);
return ierr;
}
else{
scltracefc("Blue 2d-QDFT computation time: %lf [s]\n",
(tac()/103));
}
for (rowi=0;rowi<rown;rowi++){
for (coli=0;coli<coln;coli++){
ctr=tr[rowi][coli]; ctji=tji[rowi][coli];
ctjj=tjj[rowi][coli]; ctjk=tjk[rowi][coli];
ta[rowi][coli] =
10*log10(ctr*ctr+ctji*ctji+ctjj*ctjj+ctjk*ctjk);
}
}
fid = fopen(binpath.c_str(), "w+b");
sauvetabx(fid, 0, 0, sot, dimn, &crdn[0], (void*)ta);
fclose(fid);
}
else{
// Chargement
fid = fopen(binpath.c_str(), "r+b");
chargetabx(fid, 0, 0, &sot, &dimn, &crdn, (void**)&ta);
fclose(fid);
} ierr=ierr-1; // 1 erreur dans la condition
chai++;
// Decallage frequentiel pour affichage
crabemat(rown, coln, ta, (rown-1)/2, (coln-1)/2, ta);
grafmat_dis(imgpath.c_str(), rown, coln, ta,
"x", g, "y", f,
"yaxislength", nyl*92/100,
"yaxisposition", 1799-(chan-1-chai)*nyl,
"colormap", "bleu", "ylabel", "Fréq.",
"titlex", "", "subtitlex", "", "xlabel", "Fréq.",
"axmin", -axye, "axmax", axye,
"aymin", -axye, "aymax", axye,
"zmax", ze, "azmin", aza, /* "zlabel", "[<zrange>]",*/
"linespeca", linespeca,
/*"append", "off",*/ ∅);
//---------------------------------------------------------------------
//[>LIBERE MEMOIRE]
//---------------------------------------------------------------------
imgpath.clear(); imgname.clear();
free(g); g=∅; free(f); f=∅;
free(crdn); crdn=∅;
fid = ∅;
binpath.clear(); binname.clear();
deletemat<double>(rown, &ta);
deletemat<double>(rown, &tjk); deletemat<double>(rown, &tjj);
deletemat<double>(rown, &tji); deletemat<double>(rown, &tr);
deletemat<double>(rown, &sjk); deletemat<double>(rown, &sjj);
deletemat<double>(rown, &sji); deletemat<double>(rown, &sr);
librimage_lpt(imgi);
imgid=∅; deletemat<char>(4, &repnom);
//---------------------------------------------------------------------
//[<LIBERE MEMOIRE]
//---------------------------------------------------------------------
scltracefe(§, ƒ, ∅);
return 0;
}
/* ƒ décorée par
le 20-03-2025 23:32:49 */
Sortie
[>..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]
scl-25.03 (gwin64) : 20-03-2025 23:32:49
[>..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]
'./don/img/legorythme.jpg' :
- width=5184 [px], height=3456 [px]
Grey 2d-QDFT computation time: 3008.651592 [s]
Red 2d-QDFT computation time: 2670.643068 [s]
Green 2d-QDFT computation time: 2589.745360 [s]
Blue 2d-QDFT computation time: 2561.626484 [s]
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<< END OF DISLIN / VERSION 11.3.2 <<
<< Date : 21.03.2025 Time : 02:33:24 Pageformat: DA4L <<
<< Vectors : 309 Warnings: 0 Fileformat: PDF <<
<< Metafile: ./srt/qtfdmat_xpl-legorythme.pdf <<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[<..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]
[>..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]
'./don/img/legorythme.jpg' :
- width=5184 [px], height=3456 [px]
Grey 2d-QDFT computation time: 819.715166 [s]
Red 2d-QDFT computation time: 835.687486 [s]
Green 2d-QDFT computation time: 843.817776 [s]
Blue 2d-QDFT computation time: 836.636260 [s]
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<< END OF DISLIN / VERSION 11.3.2 <<
<< Date : 21.03.2025 Time : 03:29:04 Pageformat: DA4L <<
<< Vectors : 309 Warnings: 0 Fileformat: PDF <<
<< Metafile: ./srt/qtfdmat_fil_xpl-legorythme.pdf <<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[<..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]
[>..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]
'./don/tfd/tapir.png' :
- width=1411 [px], height=1062 [px]
Grey 2d-QDFT computation time: 65.327555 [s]
Red 2d-QDFT computation time: 61.110920 [s]
Green 2d-QDFT computation time: 60.738637 [s]
Blue 2d-QDFT computation time: 61.319222 [s]
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<< END OF DISLIN / VERSION 11.3.2 <<
<< Date : 21.03.2025 Time : 03:33:14 Pageformat: DA4L <<
<< Vectors : 205 Warnings: 0 Fileformat: PDF <<
<< Metafile: ./srt/qtfdmat_xpl-tapir.pdf <<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[<..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]
[>..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]
'./don/tfd/tapir.png' :
- width=1411 [px], height=1062 [px]
Grey 2d-QDFT computation time: 17.592219 [s]
Red 2d-QDFT computation time: 18.450409 [s]
Green 2d-QDFT computation time: 18.770819 [s]
Blue 2d-QDFT computation time: 18.977627 [s]
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<< END OF DISLIN / VERSION 11.3.2 <<
<< Date : 21.03.2025 Time : 03:34:28 Pageformat: DA4L <<
<< Vectors : 205 Warnings: 0 Fileformat: PDF <<
<< Metafile: ./srt/qtfdmat_fil_xpl-tapir.pdf <<
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[<..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]
[<..\xpl\src\scltfd.xpl.cpp.qtfdmat_xpl]