_______________________________________________________________________________________________________________________________________ /*************************************************************************************************************************************/ /* */ /* F O N C T I O N S D E B A S E A T R O I S I M A G E S : */ /* */ /* */ /* Definition : */ /* */ /* Ce fichier contient toutes les fonctions */ /* de base de gestion et de manipulation de */ /* trois images raster, quelle que soit la definition. */ /* Ainsi, on pourra avec elles combiner deux */ /* images entre elles,... */ /* */ /* */ /* Author of '$xiii/tri_image$FON' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, 19870000000000). */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D E P L A C E M E N T D ' U N E I M A G E T R I D I M E N S I O N N E L L E */ /* A V E C M A S Q U A G E E T G E S T I O N D U ' Z - B U F F E R ' */ /* E T M A R Q U A G E D ' A P P A R T E N A N C E A U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(ImoveM_3D_volume_avec_marquage(imageR,imageMR,imageA,Z_BufferA,marqueurR,marqueurA)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR[X][Y]=imageA[X][Y] pour les points {X,Y} non masques */ /* qui ne sont pas caches par d'autres points plus pres de l'observateur (voir la gestion */ /* du 'Z-Buffer'). */ DEFV(Argument,DEFV(image,imageMR)); /* Image Marqueur Resultat, telle que : imageMR[X][Y]=marqueurR pour les points {X,Y} */ /* initialement dans 'imageR' et qui subsistent, ou imageMR[X][Y]=marqueurA pour les points */ /* {X,Y} de 'imageA' qui apparaissent dans 'imageR'. */ DEFV(Argument,DEFV(image,imageA)); /* Image Argument, */ DEFV(Argument,DEFV(imageF,Z_BufferA)); /* Et son 'Z-Buffer'. */ DEFV(Argument,DEFV(genere_p,marqueurR)); /* Niveau de marquage des points initialement dans 'imageR' et qui subsistent. */ DEFV(Argument,DEFV(genere_p,marqueurA)); /* Niveau de marquage des points de 'imageA' qui apparaissent dans 'imageR'. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ CALS(Iinitialisation(imageMR,marqueurR)); /* Initialisation du marquage... */ traite_image_BH_GD(BLOC(TEST_Z_Buffer_(X,Y,loadF_point(Z_BufferA,X,Y) ,BLOC(store_point(marqueurA ,imageMR ,X,Y ,FVARIABLE ); ) ); /* Generation du marquage... */ store_point_3D(load_point(imageA,X,Y),imageR,X,Y,loadF_point(Z_BufferA,X,Y)); ) ); RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* A D D I T I O N D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iaddition(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1+imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock PADD(X,Y,imageA1,imageA2,imageR); Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* A D D I T I O N D E D E U X I M A G E S A V E C R E N O R M A L I S A T I O N : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iaddition_avec_renormalisation(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1+imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,somme_flottante); /* Image intermediaire flottante avant renormalisation... */ /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_p,INIT(niveau_imageA1,load_point(imageA1,X,Y))); DEFV(genere_p,INIT(niveau_imageA2,load_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(NIVA(ADD2(FLOT(NIVR(niveau_imageA1)) ,FLOT(NIVR(niveau_imageA2)) ) ) ,somme_flottante ,X,Y ); Eblock end_image CALS(Ifloat_std_avec_renormalisation(imageR,somme_flottante)); /* Et renormalisation de la somme... */ EDEFV(imageF,somme_flottante); /* Image intermediaire flottante avant renormalisation... */ RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ @define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_SGPCM801_IRIX_CC /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* A D D I T I O N F L O T T A N T E D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFaddition(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1+imageA2. */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(ADD2(niveau_imageA1 ,niveau_imageA2 ) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* S O U S T R A C T I O N D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Isoustraction(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1-imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock PSUB(X,Y,imageA1,imageA2,imageR); Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D I F F E R E N C E D E D E U X I M A G E S A V E C R E N O R M A L I S A T I O N : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Isoustraction_avec_renormalisation(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1-imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,difference_flottante); /* Image intermediaire flottante avant renormalisation... */ /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_p,INIT(niveau_imageA1,load_point(imageA1,X,Y))); DEFV(genere_p,INIT(niveau_imageA2,load_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(NIVA(SOUS(FLOT(NIVR(niveau_imageA1)) ,FLOT(NIVR(niveau_imageA2)) ) ) ,difference_flottante ,X,Y ); Eblock end_image CALS(Ifloat_std_avec_renormalisation(imageR,difference_flottante)); /* Et renormalisation de la difference... */ EDEFV(imageF,difference_flottante); /* Image intermediaire flottante avant renormalisation... */ RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D I F F E R E N C E F L O T T A N T E D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFsoustraction(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1-imageA2. */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(SOUS(niveau_imageA1 ,niveau_imageA2 ) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N T E R P O L A T I O N E N T R E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(Logical,SINT(Iinterpolation_____renverser_axe_OX_de_imageA1,FAUX))); DEFV(Common,DEFV(Logical,SINT(Iinterpolation_____renverser_axe_OY_de_imageA1,FAUX))); DEFV(Common,DEFV(Logical,SINT(Iinterpolation_____renverser_axe_OX_de_imageA2,FAUX))); DEFV(Common,DEFV(Logical,SINT(Iinterpolation_____renverser_axe_OY_de_imageA2,FAUX))); /* Introduit le 20120708091420 par "symetrie" avec 'IFinterpolation(...)'. */ DEFV(Common,DEFV(FonctionP,POINTERp(Iinterpolation(imageR,alpha,imageA1,beta_,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=alpha*imageA1 + beta*imageA2. */ DEFV(Argument,DEFV(Float,alpha)); /* Premier coefficient d'interpolation, */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument. */ DEFV(Argument,DEFV(Float,beta_)); /* Second coefficient d'interpolation, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_p,INIT(niveau_imageA1 ,load_point(imageA1 ,cRENX(Iinterpolation_____renverser_axe_OX_de_imageA1,X) ,cRENY(Iinterpolation_____renverser_axe_OY_de_imageA1,Y) ) ) ); DEFV(genere_p,INIT(niveau_imageA2 ,load_point(imageA2 ,cRENX(Iinterpolation_____renverser_axe_OX_de_imageA2,X) ,cRENY(Iinterpolation_____renverser_axe_OY_de_imageA2,Y) ) ) ); /* Ces variables intermediaires sont introduites afin d'alleger le travail des compilateurs */ /* a cause de l'usage de 'TRNP(...)'... */ store_point(GENP(TRNP(VADD(NIVA(VMULF(alpha,NIVR(niveau_imageA1))) ,NIVA(VMULF(beta_,NIVR(niveau_imageA2))) ) ) ) ,imageR,X,Y,FVARIABLE ); /* Le 20120708091420, la procedure 'PINTER(...)' a ete remplacee explicitement par sa */ /* definition afin de pouvoir implementer le renversement des axes 'OX' et 'OY'... */ Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N T E R P O L A T I O N E N T R E D E U X I M A G E S A V E C R E N O R M A L I S A T I O N : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(Logical,SINT(Iinterpolation_avec_renormalisation_____renverser_axe_OX_de_imageA1,FAUX))); DEFV(Common,DEFV(Logical,SINT(Iinterpolation_avec_renormalisation_____renverser_axe_OY_de_imageA1,FAUX))); DEFV(Common,DEFV(Logical,SINT(Iinterpolation_avec_renormalisation_____renverser_axe_OX_de_imageA2,FAUX))); DEFV(Common,DEFV(Logical,SINT(Iinterpolation_avec_renormalisation_____renverser_axe_OY_de_imageA2,FAUX))); /* Introduit le 20120707091152 par "symetrie" avec 'IFinterpolation(...)'. */ DEFV(Common,DEFV(FonctionP,POINTERp(Iinterpolation_avec_renormalisation(imageR,alpha,imageA1,beta_,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=alpha*imageA1 + beta*imageA2. */ DEFV(Argument,DEFV(Float,alpha)); /* Premier coefficient d'interpolation, */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument. */ DEFV(Argument,DEFV(Float,beta_)); /* Second coefficient d'interpolation, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,interpolee_flottante); /* Image intermediaire flottante avant renormalisation... */ /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_p,INIT(niveau_imageA1 ,load_point(imageA1 ,cRENX(Iinterpolation_avec_renormalisation_____renverser_axe_OX_de_imageA1 ,X ) ,cRENY(Iinterpolation_avec_renormalisation_____renverser_axe_OY_de_imageA1 ,Y ) ) ) ); DEFV(genere_p,INIT(niveau_imageA2 ,load_point(imageA2 ,cRENX(Iinterpolation_avec_renormalisation_____renverser_axe_OX_de_imageA2 ,X ) ,cRENY(Iinterpolation_avec_renormalisation_____renverser_axe_OY_de_imageA2 ,Y ) ) ) ); /* Introduit le 20181204124617 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(NIVA(LIZ2(alpha,FLOT(NIVR(niveau_imageA1)) ,beta_,FLOT(NIVR(niveau_imageA2)) ) ) ,interpolee_flottante ,X,Y ); Eblock end_image CALS(Ifloat_std_avec_renormalisation(imageR,interpolee_flottante)); /* Et renormalisation de la difference... */ EDEFV(imageF,interpolee_flottante); /* Image intermediaire flottante avant renormalisation... */ RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N T E R P O L A T I O N F L O T T A N T E D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Logical,SINT(IFinterpolation_____utiliser_l_arithmetique_etendue_au_lieu_de_l_arithmetique_de_base,FAUX))); /* Introduit le 20081230114104... */ DEFV(Common,DEFV(Logical,SINT(IFinterpolation_____renverser_axe_OX_de_imageA1,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFinterpolation_____renverser_axe_OY_de_imageA1,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFinterpolation_____renverser_axe_OX_de_imageA2,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFinterpolation_____renverser_axe_OY_de_imageA2,FAUX))); /* Introduit le 20120706182555 afin de pouvoir faire des symetries par rapport aux axes */ /* 'OX' et/ou 'OY' sur les images Arguments. Cela fut introduit, par exemple, pour etre */ /* utilise dans 'v $xiirs/.PROJ.91.1.$U renverser_O._A.'... */ DEFV(Common,DEFV(FonctionF,POINTERF(IFinterpolation(imageR,alpha,imageA1,beta_,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=alpha*imageA1 + beta*imageA2. */ DEFV(Argument,DEFV(Float,alpha)); /* Premier coefficient d'interpolation, */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument. */ DEFV(Argument,DEFV(Float,beta_)); /* Second coefficient d'interpolation, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1 ,loadF_point(imageA1 ,cRENX(IFinterpolation_____renverser_axe_OX_de_imageA1,X) ,cRENY(IFinterpolation_____renverser_axe_OY_de_imageA1,Y) ) ) ); DEFV(genere_Float,INIT(niveau_imageA2 ,loadF_point(imageA2 ,cRENX(IFinterpolation_____renverser_axe_OX_de_imageA2,X) ,cRENY(IFinterpolation_____renverser_axe_OY_de_imageA2,Y) ) ) ); /* Niveaux courants des images Arguments evalues a l'exterieur de la procedure */ /* 'USs_GooF______CONDITIONNEL(...)' pour des raisons evidentes de "simplification" et */ /* d'evitement d'appication du 'GooF' a autre chose... */ DEFV(genere_Float,INIT(niveau_imageR,FLOT__NIVEAU_UNDEF)); /* Niveau Resultat... */ USs_GooF______CONDITIONNEL(IFinterpolation_____utiliser_l_arithmetique_etendue_au_lieu_de_l_arithmetique_de_base /* Possibilite introduite le 20081230114104... */ ,BLOC( Bblock EGAL(niveau_imageR ,LIZ2(alpha,niveau_imageA1 ,beta_,niveau_imageA2 ) ); Eblock ) ); storeF_point(niveau_imageR ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N T E R P O L A T I O N F L O T T A N T E " F L O U E " D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFinterpolation_floue(imageR,alpha,imageA1,beta_,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=MAX2(alpha*imageA1,beta*imageA2). */ DEFV(Argument,DEFV(Float,alpha)); /* Premier coefficient d'interpolation, */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument. */ DEFV(Argument,DEFV(Float,beta_)); /* Second coefficient d'interpolation, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(Float,INIT(niveau1,MUL2(alpha,load_point(imageA1,X,Y)))); DEFV(Float,INIT(niveau2,MUL2(beta_,load_point(imageA2,X,Y)))); /* Pour ne pas "fatiguer" les compilateurs... */ storeF_point(MAX2(niveau1,niveau2) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M U L T I P L I C A T I O N ( P R O D U I T ) D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Imultiplication(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1*imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock PMUL(X,Y,imageA1,imageA2,imageR); Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M U L T I P L I C A T I O N ( P R O D U I T ) D E D E U X I M A G E S A V E C R E N O R M A L I S A T I O N : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Imultiplication_avec_renormalisation(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1*imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,produit_flottant); /* Image intermediaire flottante avant renormalisation... */ /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_p,INIT(niveau_imageA1,load_point(imageA1,X,Y))); DEFV(genere_p,INIT(niveau_imageA2,load_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(MUL2(FLOT(NIVR(niveau_imageA1)) ,FLOT(NIVR(niveau_imageA2)) ) ,produit_flottant ,X,Y ); /* ATTENTION, le 1995082800, 'FLOT(NIVR(...))' a ete substitue a 'FLOT(...)'. */ Eblock end_image CALS(Ifloat_std_avec_renormalisation(imageR,produit_flottant)); /* Et renormalisation du produit... */ EDEFV(imageF,produit_flottant); /* Image intermediaire flottante avant renormalisation... */ RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M U L T I P L I C A T I O N ( P R O D U I T ) F L O T T A N T E D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFmultiplication(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1*imageA2. */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(MUL2(niveau_imageA1 ,niveau_imageA2 ) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O M B I N A I S O N U N I V E R S E L L E D E D E U X V A L E U R S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Local,DEFV(Logical,INIT(Fcombinaison_universelle_valeurs_____utiliser_evidemment_la_precision_Float,VRAI))); /* Jusqu'au 20190201161118, il y avait ci-dessus 'SINT(...)' au lieu de 'INIT(...)'... */ DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_ADD2,___FU))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_SOUS,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MUL2,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_DIVZ,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MIN2,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MAX2,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MINMAX,_FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MAXMIN,_FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MOYE,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MOYZ,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MOYZSI,_FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MOYQ,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MOYQSI,_FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MOYH,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_SPUIX,__FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_ATAN,___FZERO))); DEFV(Common,DEFV(Float,SINT(Fcombinaison_universelle_valeurs_____ponderation_de_MULH24,_FZERO))); /* Le 20180823100659 furent introduites les ponderations de 'MOYH(...)', 'SE12(...)' et */ /* 'SE22(...)'... */ /* */ /* Le 20181009171327 fut introduite la ponderation de 'ATAN(...)'. */ /* */ /* Le 20181203162649 fut introduite la ponderation de 'MULH24(...)'. */ /* */ /* Le 20201004111704 furent introduites les ponderations de type "Non Commutative"s... */ DEFV(Common,DEFV(Positive,SINT(Fcombinaison_universelle_valeurs_____compteur_de_reference,ZERO))); /* Le 20130514122928 'Icombinaison_universelle_____compteur_de_reference' a ete introduit. */ DEFV(Local,GENERE__FonctionF_UNI2_02_ALLEGEE(Fcombinaison_universelle_valeurs(argument1,argument2) ,Fcombinaison_universelle_valeurs_____ ) ) /* Jusqu'au 20181204115619, il y avait 'Icombinaison_universelle_____' au lieu de */ /* 'Fcombinaison_universelle_____' en tant que 'nom_de_la_fonction' dans la procedure */ /* 'v $xig/fonct$vv$DEF GENERE__FonctionF_UNI2_02'... */ /* */ /* Avant le 20181206121149 au lieu de 'Fcombinaison_universelle_valeurs(...)' il y avait */ /* trois fonctions de ce type : */ /* */ /* Fcombinaison_universelle(...) pour 'Icombinaison_universelle(...)' */ /* FFcombinaison_universelle(...) pour 'IFcombinaison_universelle(...)' */ /* Fcombinaison_universelle_variable(...) pour 'IFcombinaison_universelle_variable(...)' */ /* */ /* Malheureusement cela provoquait des lenteurs dans 'v $xbii/tri_image$K 20181118133107'. */ /* Or il n'y a aucune raison pour que ces trois fonctions soient referencees dans le meme */ /* '$K', d'ou le passage a une seule fonction "commune"... */ /* */ /* C'est l'expression 'v $xig/$xig/fonct$vv$DEF EXPRESSION_GENERE__FonctionF_UNI2_02' qui */ /* est responsable de ces lenteurs (note le 20201004135235)... */ EFonctionF /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O M B I N A I S O N U N I V E R S E L L E D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Icombinaison_universelle(imageR,imageA1,imageA2)))) /* Fonction introduite le 20101111091552... */ DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1*imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_p,INIT(niveau_imageA1,load_point(imageA1,X,Y))); DEFV(genere_p,INIT(niveau_imageA2,load_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ store_point(GENP(NIVA(Fcombinaison_universelle_valeurs(FLOT(NIVR(niveau_imageA1)) ,FLOT(NIVR(niveau_imageA2)) ) ) ) ,imageR ,X,Y ,FVARIABLE ); Eblock end_image RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O M B I N A I S O N U N I V E R S E L L E D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFcombinaison_universelle(imageR,imageA1,imageA2)))) /* Fonction introduite le 20101111091552... */ DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1*imageA2. */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(Fcombinaison_universelle_valeurs(niveau_imageA1 ,niveau_imageA2 ) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O M B I N A I S O N U N I V E R S E L L E V A R I A B L E D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERp(IFcombinaison_universelle_variable(imageR ,imageA1 ,imageA2 ,image____ADD2 ,image____SOUS ,image____MUL2 ,image____DIVZ ,image____MIN2 ,image____MAX2 ,image__MINMAX ,image__MAXMIN ,image____MOYE ,image____MOYZ ,image__MOYZSI ,image____MOYQ ,image__MOYQSI ,image____MOYH ,image___SPUIX ,image____ATAN ,image__MULH24 ) ) ) ) /* Fonction introduite le 20181118105401... */ DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1*imageA2. */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(imageF,image____ADD2)); DEFV(Argument,DEFV(imageF,image____SOUS)); DEFV(Argument,DEFV(imageF,image____MUL2)); DEFV(Argument,DEFV(imageF,image____DIVZ)); DEFV(Argument,DEFV(imageF,image____MIN2)); DEFV(Argument,DEFV(imageF,image____MAX2)); DEFV(Argument,DEFV(imageF,image__MINMAX)); DEFV(Argument,DEFV(imageF,image__MAXMIN)); DEFV(Argument,DEFV(imageF,image____MOYE)); DEFV(Argument,DEFV(imageF,image____MOYZ)); DEFV(Argument,DEFV(imageF,image__MOYZSI)); DEFV(Argument,DEFV(imageF,image____MOYQ)); DEFV(Argument,DEFV(imageF,image__MOYQSI)); DEFV(Argument,DEFV(imageF,image____MOYH)); DEFV(Argument,DEFV(imageF,image___SPUIX)); DEFV(Argument,DEFV(imageF,image____ATAN)); DEFV(Argument,DEFV(imageF,image__MULH24)); /* Images de ponderation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_ADD2,loadF_point(image____ADD2,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_SOUS,loadF_point(image____SOUS,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MUL2,loadF_point(image____MUL2,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_DIVZ,loadF_point(image____DIVZ,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MIN2,loadF_point(image____MIN2,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MAX2,loadF_point(image____MAX2,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MINMAX,loadF_point(image__MINMAX,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MAXMIN,loadF_point(image__MAXMIN,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MOYE,loadF_point(image____MOYE,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MOYZ,loadF_point(image____MOYZ,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MOYZSI,loadF_point(image__MOYZSI,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MOYQ,loadF_point(image____MOYQ,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MOYQSI,loadF_point(image__MOYQSI,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MOYH,loadF_point(image____MOYH,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_SPUIX,loadF_point(image___SPUIX,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_ATAN,loadF_point(image____ATAN,X,Y)); EGAL(Fcombinaison_universelle_valeurs_____ponderation_de_MULH24,loadF_point(image__MULH24,X,Y)); storeF_point(Fcombinaison_universelle_valeurs(niveau_imageA1 ,niveau_imageA2 ) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P R O D U I T V A R I A B L E D E H O R N E R D U Q U A T R I E M E D E G R E */ /* D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERp(IFproduit_de_Horner_2_04(imageR ,imageA1 ,imageA2 ,image_a44 ,image_a43 ,image_a42 ,image_a41 ,image_a40 ,image_a34 ,image_a33 ,image_a32 ,image_a31 ,image_a30 ,image_a24 ,image_a23 ,image_a22 ,image_a21 ,image_a20 ,image_a14 ,image_a13 ,image_a12 ,image_a11 ,image_a10 ,image_a04 ,image_a03 ,image_a02 ,image_a01 ,image_a00 ) ) ) ) /* Fonction introduite le 20181119101834... */ DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1*imageA2. */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(imageF,image_a44)); DEFV(Argument,DEFV(imageF,image_a43)); DEFV(Argument,DEFV(imageF,image_a42)); DEFV(Argument,DEFV(imageF,image_a41)); DEFV(Argument,DEFV(imageF,image_a40)); DEFV(Argument,DEFV(imageF,image_a34)); DEFV(Argument,DEFV(imageF,image_a33)); DEFV(Argument,DEFV(imageF,image_a32)); DEFV(Argument,DEFV(imageF,image_a31)); DEFV(Argument,DEFV(imageF,image_a30)); DEFV(Argument,DEFV(imageF,image_a24)); DEFV(Argument,DEFV(imageF,image_a23)); DEFV(Argument,DEFV(imageF,image_a22)); DEFV(Argument,DEFV(imageF,image_a21)); DEFV(Argument,DEFV(imageF,image_a20)); DEFV(Argument,DEFV(imageF,image_a14)); DEFV(Argument,DEFV(imageF,image_a13)); DEFV(Argument,DEFV(imageF,image_a12)); DEFV(Argument,DEFV(imageF,image_a11)); DEFV(Argument,DEFV(imageF,image_a10)); DEFV(Argument,DEFV(imageF,image_a04)); DEFV(Argument,DEFV(imageF,image_a03)); DEFV(Argument,DEFV(imageF,image_a02)); DEFV(Argument,DEFV(imageF,image_a01)); DEFV(Argument,DEFV(imageF,image_a00)); /* Images de ponderation... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); DEFV(genere_Float,INIT(a44,loadF_point(image_a44,X,Y))); DEFV(genere_Float,INIT(a43,loadF_point(image_a43,X,Y))); DEFV(genere_Float,INIT(a42,loadF_point(image_a42,X,Y))); DEFV(genere_Float,INIT(a41,loadF_point(image_a41,X,Y))); DEFV(genere_Float,INIT(a40,loadF_point(image_a40,X,Y))); DEFV(genere_Float,INIT(a34,loadF_point(image_a34,X,Y))); DEFV(genere_Float,INIT(a33,loadF_point(image_a33,X,Y))); DEFV(genere_Float,INIT(a32,loadF_point(image_a32,X,Y))); DEFV(genere_Float,INIT(a31,loadF_point(image_a31,X,Y))); DEFV(genere_Float,INIT(a30,loadF_point(image_a30,X,Y))); DEFV(genere_Float,INIT(a24,loadF_point(image_a24,X,Y))); DEFV(genere_Float,INIT(a23,loadF_point(image_a23,X,Y))); DEFV(genere_Float,INIT(a22,loadF_point(image_a22,X,Y))); DEFV(genere_Float,INIT(a21,loadF_point(image_a21,X,Y))); DEFV(genere_Float,INIT(a20,loadF_point(image_a20,X,Y))); DEFV(genere_Float,INIT(a14,loadF_point(image_a14,X,Y))); DEFV(genere_Float,INIT(a13,loadF_point(image_a13,X,Y))); DEFV(genere_Float,INIT(a12,loadF_point(image_a12,X,Y))); DEFV(genere_Float,INIT(a11,loadF_point(image_a11,X,Y))); DEFV(genere_Float,INIT(a10,loadF_point(image_a10,X,Y))); DEFV(genere_Float,INIT(a04,loadF_point(image_a04,X,Y))); DEFV(genere_Float,INIT(a03,loadF_point(image_a03,X,Y))); DEFV(genere_Float,INIT(a02,loadF_point(image_a02,X,Y))); DEFV(genere_Float,INIT(a01,loadF_point(image_a01,X,Y))); DEFV(genere_Float,INIT(a00,loadF_point(image_a00,X,Y))); DEFV(genere_Float,INIT(niveauR,FLOT__NIVEAU_UNDEF)); EGAL(niveauR ,HORNER_2_04(niveau_imageA1 ,niveau_imageA2 ,a44,a43,a42,a41,a40 ,a34,a33,a32,a31,a30 ,a24,a23,a22,a21,a20 ,a14,a13,a12,a11,a10 ,a04,a03,a02,a01,a00 ) ); /* Le 20181119120731, je note que l'on a bien (grace au '$c' issu de 'v $xbii/tri_image$K' */ /* lors d'une compilation de 'v $xbii/tri_image$K'...) : */ /* */ /* HORNER_2_04(x,y,...) = (((((((P4[x]*y)+P3[x])*y)+P2[x])*y)+P1[x])*y)+P0[x] */ /* */ /* avec : */ /* */ /* P4[x] = (((((((a44*x+a43)*x)+a42)*x)+a41)*x)+a40) */ /* P3[x] = (((((((a34*x+a33)*x)+a32)*x)+a31)*x)+a30) */ /* P2[x] = (((((((a24*x+a23)*x)+a22)*x)+a21)*x)+a20) */ /* P1[x] = (((((((a14*x+a13)*x)+a12)*x)+a11)*x)+a10) */ /* P0[x] = (((((((a04*x+a03)*x)+a02)*x)+a01)*x)+a00) */ /* */ storeF_point(niveauR ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P R O D U I T D E H O R N E R D U Q U A T R I E M E D E G R E */ /* D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_44,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_43,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_42,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_41,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_40,FZERO))); /* Definition du premier polynome en 'X' (puissance la plus elevee de 'Y'). */ DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_34,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_33,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_32,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_31,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_30,FZERO))); /* Definition du second polynome en 'X'. */ DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_24,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_23,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_22,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_21,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_20,FZERO))); /* Definition du troisieme polynome en 'X'. */ DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_14,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_13,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_12,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_11,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_10,FU))); /* Definition du quatrieme polynome en 'X'. */ DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_04,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_03,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_02,FZERO))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_01,FU))); DEFV(Common,DEFV(Float,SINT(IFpolynome_2_04_____coefficient_00,FZERO))); /* Definition du dernier polynome en 'X' (puissance la plus faible de 'Y'). */ DEFV(Common,DEFV(FonctionF,POINTERF(IFpolynome_2_04(imageR,imageA1,imageA2)))) /* Fonction introduite le 20071101094202... */ DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=HORNER_2_04(imageA1,imageA2). */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); /* Niveaux Arguments. */ storeF_point(HORNER_2_04(niveau_imageA1 ,niveau_imageA2 ,IFpolynome_2_04_____coefficient_44 ,IFpolynome_2_04_____coefficient_43 ,IFpolynome_2_04_____coefficient_42 ,IFpolynome_2_04_____coefficient_41 ,IFpolynome_2_04_____coefficient_40 ,IFpolynome_2_04_____coefficient_34 ,IFpolynome_2_04_____coefficient_33 ,IFpolynome_2_04_____coefficient_32 ,IFpolynome_2_04_____coefficient_31 ,IFpolynome_2_04_____coefficient_30 ,IFpolynome_2_04_____coefficient_24 ,IFpolynome_2_04_____coefficient_23 ,IFpolynome_2_04_____coefficient_22 ,IFpolynome_2_04_____coefficient_21 ,IFpolynome_2_04_____coefficient_20 ,IFpolynome_2_04_____coefficient_14 ,IFpolynome_2_04_____coefficient_13 ,IFpolynome_2_04_____coefficient_12 ,IFpolynome_2_04_____coefficient_11 ,IFpolynome_2_04_____coefficient_10 ,IFpolynome_2_04_____coefficient_04 ,IFpolynome_2_04_____coefficient_03 ,IFpolynome_2_04_____coefficient_02 ,IFpolynome_2_04_____coefficient_01 ,IFpolynome_2_04_____coefficient_00 ) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* T H E O R E M E D E P Y T H A G O R E S U R D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFlongueur2D(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=RACX((imageA1*imageA1) + (imageA2*imageA2)). */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ DEFV(deltaF_2D,delta_courant); INITIALISATION_ACCROISSEMENT_2D(delta_courant ,niveau_imageA1 ,niveau_imageA2 ); /* Mise des deux points courants de 'imageA1' et 'imageA2' sous la forme d'un 'delta'... */ storeF_point(longF2D(delta_courant) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P R O D U I T M A T R I C I E L D E D E U X I M A G E S : */ /* */ /* */ /* Definition : */ /* */ /* On definit ici un nouveau produit */ /* entre deux images ; celui-ci est en */ /* fait le produit matriciel des deux */ /* matrices correspondant aux deux images. */ /* Pour simplifier (au niveau de la com- */ /* patibilite des dimensions), on travaille */ /* sur la plus grande image carree inscrite */ /* dans une image du type (dimX,dimY). */ /* */ /* */ /* imageA1 imageA2 imageR */ /* */ /* X X */ /* ------------------ ------------------ ------------------ */ /* | | | * | | . | */ /* | | | * | | . | */ /* Y |* * * * * * * * * | | * | Y |. . . * . . . . . | */ /* | | \ / | * | | . | */ /* | | \ | * | --> | . | */ /* | | / \ | * | | . | */ /* | | | * | | . | */ /* | | | * | | . | */ /* | | | * | | . | */ /* ------------------ ------------------ ------------------ */ /* */ /* */ /* On a donc en notation "ligne" (Y) / "colonne" (X) : */ /* */ /* ----- */ /* \ */ /* imageR[Y,X] = / imageA1[Y,k].imageA2[k,X] */ /* ----- */ /* k */ /* */ /* et en notation type "image" : */ /* */ /* ----- */ /* \ */ /* imageR(X,Y) = / imageA1(k,Y).imageA2(X,k) */ /* ----- */ /* k */ /* */ /* Enfin, on n'oubliera pas au passage que */ /* l'axe 'OY' monte alors que l'indice "ligne" */ /* d'une matrice (donc ici 'Y') descend... */ /* */ /* */ /* Nota : */ /* */ /* La somme que l'on calcule pour obtenir */ /* le terme courant de 'imageR' est du type : */ /* */ /* N1*N2 + N1*N2 + ..., il est donc compris */ /* entre : */ /* */ /* 2 */ /* DIMENSION . NOIR */ /* */ /* et */ /* */ /* 2 */ /* DIMENSION . BLANC */ /* */ /* d'ou la renormalisation dans 'Ifloat_std'. */ /* */ /* */ /* Arithmetique etendue : */ /* */ /* Je rappelle le 20180818110847 que l'on */ /* peut utiliser l'arithmetique etendue avec */ /* profit ('v $xil/defi_K2$vv$DEF 20061102164207')... */ /* */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(Logical,SINT(Iproduit_matriciel_____valider_dimX_dimY_et_pasX_pasY,VRAI))); /* Indicateur introduit le 20111007173855 afin de pouvoir eviter les messages d'erreur */ /* correspondants... */ DEFV(Common,DEFV(Logical,SINT(Iproduit_matriciel_____compatibilite_20080108,FAUX))); /* Permet de parcourir l'axe 'OY' des matrices suivant la methode anterieure au */ /* 20080108142614... */ DEFV(Common,DEFV(Logical,SINT(Iproduit_matriciel_____utiliser_l_arithmetique_etendue_au_lieu_de_l_arithmetique_de_base,FAUX))); /* Introduit le 20080108134612... */ DEFV(Common,DEFV(Logical,SINT(Iproduit_matriciel_____ignorer_les_couples_de_niveaux_nuls,FAUX))); /* Introduit le 20080109083121... */ DEFV(Common,DEFV(Int,SINT(Iproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes,MOIT(INFINI)))); /* Introduit le 20110919180445 afin de permettre quelque chose d'un peu "exotique" qui */ /* consiste a ne pas faire le produit ligne-colonne sur toute leur longueur mais sur une */ /* partie seulement (centree sur le {X,Y} courant). */ DEFV(Common,DEFV(Float,SINT(Iproduit_matriciel_____ponderation_X_Xmin,UN))); DEFV(Common,DEFV(Float,SINT(Iproduit_matriciel_____ponderation_X_X___,ZERO))); DEFV(Common,DEFV(Float,SINT(Iproduit_matriciel_____ponderation_X_Y___,ZERO))); DEFV(Common,DEFV(Float,SINT(Iproduit_matriciel_____translation_X_____,ZERO))); DEFV(Common,DEFV(Float,SINT(Iproduit_matriciel_____ponderation_Y_Ymax,UN))); DEFV(Common,DEFV(Float,SINT(Iproduit_matriciel_____ponderation_Y_Y___,ZERO))); DEFV(Common,DEFV(Float,SINT(Iproduit_matriciel_____ponderation_Y_X___,ZERO))); DEFV(Common,DEFV(Float,SINT(Iproduit_matriciel_____translation_Y_____,ZERO))); /* Parametres introduits le 20110921172955 afin de rendre le produit matriciel plus */ /* "exotique" si besoin est... */ /* */ /* Le 20110922075707 ces parametres sont passes de 'Int' a 'Float'... */ /* */ /* Les deux translations ont ete introduites le 20110922080541... */ /* */ /* On notera que : */ /* */ /* Iproduit_matriciel_____ponderation_X_.... -0-> imageA1 */ /* Iproduit_matriciel_____translation_X_____ -0-> imageA1 */ /* */ /* et : */ /* Iproduit_matriciel_____ponderation_Y_.... -0-> imageA2 */ /* Iproduit_matriciel_____translation_Y_____ -0-> imageA2 */ /* */ DEFV(Common,DEFV(FonctionP,POINTERp(Iproduit_matriciel(imageR,imageA1,imageA2,renormaliser_l_image)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1*imageA2 (le produit '*' etant a */ /* entendre au sens matriciel, eventuellement avec l'arithmetique etendue). */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(Logical,renormaliser_l_image)); /* Indicateur precisant s'il faut a priori renormaliser 'imageR' ('VRAI') */ /* ou laisser choisir le programme en fonction du couple (minimum,maximum) */ /* calcule ('FAUX'). */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,produit_matriciel_non_renormalise); /* Destine a contenir le produit des deux images Arguments avec toute la */ /* precision utile. */ DEFV(Int,INIT(index_de_sommation,UNDEF)); /* Index utilise pour calculer les sommes de produits pour chaque element de */ /* la matrice Resultat. */ DEFV(Int,INIT(coordonnee_X_de_sommation,UNDEF)); /* Coordonnee 'X' pour explorer la ligne courante de 'imageA1', */ DEFV(Int,INIT(coordonnee_Y_de_sommation,UNDEF)); /* Coordonnee 'Y' pour explorer la colonne courante de 'imageA2'. */ /*..............................................................................................................................*/ Test(IL_FAUT(Iproduit_matriciel_____valider_dimX_dimY_et_pasX_pasY)) /* Test introduit le 20111007173855... */ Bblock Test(IFNE(dimX,dimY)) Bblock PRINT_ERREUR("pour que le produit matriciel soit correct, il faut dimX=dimY (leur minimum sera donc utilise)"); Eblock ATes Bblock Eblock ETes Test(IFNE(pasX,pasY)) Bblock PRINT_ERREUR("pour que le produit matriciel soit correct, il faut pasX=pasY"); Eblock ATes Bblock Eblock ETes Eblock ATes Bblock Eblock ETes CALi(IFinitialisation(produit_matriciel_non_renormalise,FZERO)); /* Initialisation du produit matriciel non renormalise (introduit le 20080109085633). */ begin_image Bblock DEFV(Logical,INIT(initialiser_le_cumul_courant,VRAI)); DEFV(Float,INIT(cumul_courant,FZERO)); /* Initialisation du cumul courant devant amener a la valeur du terme courant {X,Y} */ /* de l'image Resultat. */ /* */ /* On notera l'initialisation de 'cumul_courant', non pas avec 'FLOT__UNDEF' (comme cela se */ /* fait habituellement), mais avec 'FZERO' et ce au cas ou 'initialiser_le_cumul_courant' */ /* resterait 'VRAI' tout au long du 'DoIn(...)' qui va suivre, ce qui pourra se rencontrer */ /* lorsque 'IL_FAUT(Iproduit_matriciel_____ignorer_les_couples_de_niveaux_nuls)'... */ EGAL(coordonnee_X_de_sommation ,INTE(LIN3(Iproduit_matriciel_____ponderation_X_Xmin ,FLOT(Xmin) ,Iproduit_matriciel_____ponderation_X_X___ ,FLOT(X) ,Iproduit_matriciel_____ponderation_X_Y___ ,FLOT(Y) ,Iproduit_matriciel_____translation_X_____ ) ) ); /* Initialisation de la coordonnee 'X' pour explorer la ligne courante de 'imageA1', */ EGAL(coordonnee_Y_de_sommation ,INTE(LIN3(Iproduit_matriciel_____ponderation_Y_Ymax ,FLOT(COND(IL_NE_FAUT_PAS(Iproduit_matriciel_____compatibilite_20080108),Ymax,Ymin)) ,Iproduit_matriciel_____ponderation_Y_Y___ ,FLOT(Y) ,Iproduit_matriciel_____ponderation_Y_X___ ,FLOT(X) ,Iproduit_matriciel_____translation_Y_____ ) ) ); /* Initialisation de la coordonnee 'Y' pour explorer la colonne courante de 'imageA2'. */ /* Ainsi, dans le cas normal (pas de compatibilite), la sommation se fait selon : */ /* */ /* Xs+Ys = min(dimX,dimY)-1 */ /* */ /* alors que s'il y a compatibilite, elle se fait selon : */ /* */ /* Xs = Ys */ /* */ /* ATTENTION : l'axe 'OY' des images est dirige vers le haut, alors que pour une matrice, */ /* il descend (j'ai pris conscience de cela le 20080108142614...). */ DoIn(index_de_sommation,UN,PLUS_GRANDE_IMAGE_CARREE_INSCRITE,MIN2(pasX,pasY)) Bblock Test(IFOU(IFINff(coordonnee_X_de_sommation ,SOUS(X,Iproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes) ,ADD2(X,Iproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes) ) ,IFINff(coordonnee_Y_de_sommation ,SOUS(Y,Iproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes) ,ADD2(Y,Iproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes) ) ) ) /* Test introduit le 20110919180445 grace auquel on ne somme que les points {Xs,Ys} tels */ /* que : */ /* */ /* Xs E [X-da,X+da] */ /* */ /* ou */ /* */ /* Ys E [Y-da,Y+da] */ /* */ /* (ou "s" est pour "sommation" et "da" pour "demi_amplitude_de_balayage_..."). */ /* */ /* On notera que remplacer 'IFOU(...)' par 'IFET(...)' (comme je l'ai "betement" essaye) */ /* restreint le calcul a l'une des deux diagonales (respectivement suivant la valeur de */ /* l'indicateur 'Iproduit_matriciel_____compatibilite_20080108') d'equations : */ /* */ /* Xs+Ys = min(dimX,dimY)-1 ("seconde diagonale") */ /* */ /* s'il n'y a pas compatibilite (cas par defaut) et : */ /* */ /* Xs = Ys ("premiere diagonale") */ /* */ /* dans le cas contraire... */ Bblock DEFV(genere_p,INIT(niveau_imageA1,load_point(imageA1,coordonnee_X_de_sommation,Y))); DEFV(genere_p,INIT(niveau_imageA2,load_point(imageA2,X,coordonnee_Y_de_sommation))); /* Variables introduites le 20080108124622 afin de simplifier au maximum le calcul */ /* 'INCR(...,MUL2(...))' qui suit. En effet, 'load_point(...)' contient evidemment des */ /* operations arithmetiques elementaires qu'il ne faut pas etendre... */ #define Iproduit_matriciel_____utiliser_l_arithmetique_etendue \ Iproduit_matriciel_____utiliser_l_arithmetique_etendue_au_lieu_de_l_arithmetique_de_base \ /* Afin de raccourcir la ligne qui suit... */ USs_GooF______CONDITIONNEL(Iproduit_matriciel_____utiliser_l_arithmetique_etendue /* Possibilite introduite le 20080108134612... */ ,BLOC( Bblock Test(IFET(IL_FAUT(Iproduit_matriciel_____ignorer_les_couples_de_niveaux_nuls) ,IFET(IZEQ(niveau_imageA1) ,IZEQ(niveau_imageA2) ) ) ) /* Cette possibilite fut introduite le 20080109083426 afin de permettre dans le cas ou */ /* l'arithmetique traditionnelle {ADD2,MUL2} et remplacee par l'arithmetique etendue */ /* {MIN2,ADD2} de ne pas prendre en compte les couples nuls particulierement ennuyeux */ /* a cause du 'MIN2(...)' sur la diagonale... */ Bblock Eblock ATes Bblock DEFV(Float,INIT(produit_courant ,MUL2(FLOT(NIVR(niveau_imageA1)) ,FLOT(NIVR(niveau_imageA2)) ) ) ); Test(IL_FAUT(initialiser_le_cumul_courant)) /* A cause de 'USs_GooF______CONDITIONNEL(...)' lorsqu'il est actif, il est impossible de */ /* faire un 'INCR(...)' des la premiere iteration. Ceci rendrait impossible de traiter le */ /* cas 'v $xil/defi_K2$vv$DEF 20061102164207' dans lequel 'ADD2(...)' est remplace par */ /* 'MIN2(...)', puisque 'cumul_courant' etant nul initialement, le resterait alors */ /* systematiquement (via le 'MIN2(...)') dans le cas ou il n'y a que des valeurs positives. */ Bblock EGAL(cumul_courant,produit_courant); EGAL(initialiser_le_cumul_courant,FAUX); Eblock ATes Bblock INCR(cumul_courant,produit_courant); /* Calcul progressif du terme courant de 'imageR' par balayage horizontal de la ligne 'Y' */ /* de 'imageA1' et par balayage vertical de la colonne 'X' de 'imageA2'. */ /* ATTENTION, le 1995082800, 'FLOT(NIVR(...))' a ete substitue a 'FLOT(...)'. */ Eblock ETes Eblock ETes Eblock ) ); /* Le 'GooF' a ete introduit le 20080108124622 ('v $xil/defi_K2$vv$DEF 20061102164207'). */ /* */ /* En fait, a cause des problemes de renormalisation lors de la conversion en une image */ /* standard 'imageR' de la matrice 'produit_matriciel_non_renormalise' ci-apres (qui fait */ /* que les elements de 'imageR' ne seront pas numeriquement le resultat du produit matriciel */ /* de 'imageA1' et 'imageA2' (mais leurs seront proportionnels a une translation pres), le */ /* 'GooF' n'a que peu d'interet dans ce cas. Il est malgre tout conserve, mais est decide */ /* inaccessible dans 'v $xci/multi_02.03$K'... */ #undef Iproduit_matriciel_____utiliser_l_arithmetique_etendue Eblock ATes Bblock Eblock ETes INCR(coordonnee_X_de_sommation,pasX); /* Progression de la coordonnee 'X' pour explorer la ligne courante de 'imageA1' equivalant */ /* a la fonction : */ /* */ /* f(Xs) = Xmin + (index-1) */ /* */ /* avec : */ /* */ /* index E [1,min(dimX,dimY)-1] */ /* */ Test(IL_NE_FAUT_PAS(Iproduit_matriciel_____compatibilite_20080108)) Bblock DECR(coordonnee_Y_de_sommation,pasY); Eblock ATes Bblock INCR(coordonnee_Y_de_sommation,pasY); Eblock ETes /* Progression de la coordonnee 'Y' pour explorer la colonne courante de 'imageA2' */ /* equivalant a la fonction : */ /* */ /* f(Ys) = Ymax - (index-1) s'il n'y a pas compatibilite (par defaut) */ /* = Ymin + (index-1) s'il y a compatibilite */ /* */ /* avec : */ /* */ /* index E [1,min(dimX,dimY)-1] */ /* */ /* ATTENTION : l'axe 'OY' des images est dirige vers le haut, alors que pour une matrice, */ /* il descend (j'ai pris conscience de cela le 20080108142614...). */ EGAL(coordonnee_X_de_sommation,MODX(coordonnee_X_de_sommation)); EGAL(coordonnee_Y_de_sommation,MODY(coordonnee_Y_de_sommation)); /* Introduit le 20110921172955 afin de permettre des initialisations de {Xs,Ys} plus */ /* "exotiques"... */ Eblock EDoI storeF_point(cumul_courant,produit_matriciel_non_renormalise,X,Y); /* Et rangement de l'element courant {X,Y} non renormalise. */ Eblock end_image Test(IL_FAUT(renormaliser_l_image)) Bblock CALS(Ifloat_std_avec_renormalisation(imageR ,produit_matriciel_non_renormalise ) ); /* Lorsque les niveaux minimal et maximal sont hors de [NOIR,BLANC], */ /* ou bien si la renormalisation explicite est demandee, on renormalise... */ /* */ /* ATTENTION : on notera que cette renormalisation ramene donc les niveaux dans [NOIR,BLANC] */ /* et introduit donc ainsi des produits nuls alors qu'ils ne l'etaient pas en fait... */ Eblock ATes Bblock #define NIVEAU_MINIMAL_DE_CONVERSION_EN_UNE_MATRICE_DE_TYPE_IMAGE_STANDARD \ USe_GooF______CONDITIONNEL(Iproduit_matriciel_____utiliser_l_arithmetique_etendue_au_lieu_de_l_arithmetique_de_base \ ,MUL2(FLOT(PLUS_GRANDE_IMAGE_CARREE_INSCRITE),EXP2(FLOT__NOIR)) \ ) #define NIVEAU_MAXIMAL_DE_CONVERSION_EN_UNE_MATRICE_DE_TYPE_IMAGE_STANDARD \ USe_GooF______CONDITIONNEL(Iproduit_matriciel_____utiliser_l_arithmetique_etendue_au_lieu_de_l_arithmetique_de_base \ ,MUL2(FLOT(PLUS_GRANDE_IMAGE_CARREE_INSCRITE),EXP2(FLOT__BLANC)) \ ) /* Definitions introduites le 20080110095420 afin de reduire la longueur de lignes a venir. */ CALS(Ifloat_std(imageR ,produit_matriciel_non_renormalise ,NIVEAU_MINIMAL_DE_CONVERSION_EN_UNE_MATRICE_DE_TYPE_IMAGE_STANDARD ,NIVEAU_MAXIMAL_DE_CONVERSION_EN_UNE_MATRICE_DE_TYPE_IMAGE_STANDARD ) ); /* Les niveaux minimal et maximal sont dans [NOIR,BLANC] et on */ /* ne renormalise pas... */ /* */ /* Le 20080109085633 il a fallu introduire 'USe_GooF______CONDITIONNEL(...)' pour definir */ /* les niveaux minimal et maximal de 'Ifloat_std(...)' car sinon avec l'arithmetique etendue */ /* (et en particulier avec {MIN2,ADD2}), elles seraient bien trop enormes et conduirait */ /* assez systematiquement a une matrice 'imageR' nulle... */ #undef NIVEAU_MAXIMAL_DE_CONVERSION_EN_UNE_MATRICE_DE_TYPE_IMAGE_STANDARD #undef NIVEAU_MINIMAL_DE_CONVERSION_EN_UNE_MATRICE_DE_TYPE_IMAGE_STANDARD Eblock ETes EDEFV(imageF,produit_matriciel_non_renormalise); /* Destine a contenir le produit des deux images Arguments avec toute la */ /* precision utile. */ RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P R O D U I T M A T R I C I E L D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /* */ /* Definition : */ /* */ /* Voir la definition qui est donnee */ /* avec la fonction 'Iproduit_matriciel(...)'. */ /* */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Logical,SINT(IFproduit_matriciel_____valider_dimX_dimY_et_pasX_pasY,VRAI))); /* Indicateur introduit le 20111007173855 afin de pouvoir eviter les messages d'erreur */ /* correspondants... */ DEFV(Common,DEFV(Logical,SINT(IFproduit_matriciel_____compatibilite_20080109,FAUX))); /* Permet de parcourir l'axe 'OY' des matrices suivant la methode anterieure au */ /* 20080108142614... */ /* */ /* On notera le '20080109' et non pas le '20080108' tel qu'il est utilise dans */ /* 'Iproduit_matriciel_____compatibilite_20080108' et ce afin de facilement distinguer */ /* les deux parametres dans 'v $xci/multi_02.03$K GET_ARGUMENT_L..compatibilite_2008010..'. */ DEFV(Common,DEFV(Logical,SINT(IFproduit_matriciel_____utiliser_l_arithmetique_etendue_au_lieu_de_l_arithmetique_de_base,FAUX))); /* Introduit le 20080108134612... */ DEFV(Common,DEFV(Logical,SINT(IFproduit_matriciel_____ignorer_les_couples_de_niveaux_nuls,FAUX))); /* Introduit le 20080109083121... */ DEFV(Common,DEFV(Int,SINT(IFproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes,MOIT(INFINI)))); /* Introduit le 20110919180445 afin de permettre quelque chose d'un peu "exotique" qui */ /* consiste a ne pas faire le produit ligne-colonne sur toute leur longueur mais sur une */ /* partie seulement (centree sur le {X,Y} courant). */ DEFV(Common,DEFV(Float,SINT(IFproduit_matriciel_____ponderation_X_Xmin,UN))); DEFV(Common,DEFV(Float,SINT(IFproduit_matriciel_____ponderation_X_X___,ZERO))); DEFV(Common,DEFV(Float,SINT(IFproduit_matriciel_____ponderation_X_Y___,ZERO))); DEFV(Common,DEFV(Float,SINT(IFproduit_matriciel_____translation_X_____,ZERO))); DEFV(Common,DEFV(Float,SINT(IFproduit_matriciel_____ponderation_Y_Ymax,UN))); DEFV(Common,DEFV(Float,SINT(IFproduit_matriciel_____ponderation_Y_Y___,ZERO))); DEFV(Common,DEFV(Float,SINT(IFproduit_matriciel_____ponderation_Y_X___,ZERO))); DEFV(Common,DEFV(Float,SINT(IFproduit_matriciel_____translation_Y_____,ZERO))); /* Parametres introduits le 20110921172955 afin de rendre le produit matriciel plus */ /* "exotique" si besoin est... */ /* */ /* Le 20110922075707 ces parametres sont passes de 'Int' a 'Float'... */ /* */ /* Les deux translations ont ete introduites le 20110922080541... */ /* */ /* On notera que : */ /* */ /* IFproduit_matriciel_____ponderation_X_.... -0-> imageA1 */ /* IFproduit_matriciel_____translation_X_____ -0-> imageA1 */ /* */ /* et : */ /* IFproduit_matriciel_____ponderation_Y_.... -0-> imageA2 */ /* IFproduit_matriciel_____translation_Y_____ -0-> imageA2 */ /* */ DEFV(Common,DEFV(FonctionF,POINTERF(IFproduit_matriciel(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1*imageA2 (le produit '*' etant a */ /* entendre au sens matriciel, eventuellement avec l'arithmetique etendue). */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Int,INIT(index_de_sommation,UNDEF)); /* Index utilise pour calculer les sommes de produits pour chaque element de */ /* la matrice Resultat. */ DEFV(Int,INIT(coordonnee_X_de_sommation,UNDEF)); /* Coordonnee 'X' pour explorer la ligne courante de 'imageA1', */ DEFV(Int,INIT(coordonnee_Y_de_sommation,UNDEF)); /* Coordonnee 'Y' pour explorer la colonne courante de 'imageA2'. */ /*..............................................................................................................................*/ Test(IL_FAUT(IFproduit_matriciel_____valider_dimX_dimY_et_pasX_pasY)) /* Test introduit le 20111007173855... */ Bblock Test(IFNE(dimX,dimY)) Bblock PRINT_ERREUR("pour que le produit matriciel soit correct, il faut dimX=dimY (leur minimum sera donc utilise)"); Eblock ATes Bblock Eblock ETes Test(IFNE(pasX,pasY)) Bblock PRINT_ERREUR("pour que le produit matriciel soit correct, il faut pasX=pasY"); Eblock ATes Bblock Eblock ETes Eblock ATes Bblock Eblock ETes begin_image Bblock DEFV(Logical,INIT(initialiser_le_cumul_courant,VRAI)); DEFV(Float,INIT(cumul_courant,FZERO)); /* Initialisation du cumul courant devant amener a la valeur du terme courant {X,Y} */ /* de l'image Resultat. */ /* */ /* On notera l'initialisation de 'cumul_courant', non pas avec 'FLOT__UNDEF' (comme cela se */ /* fait habituellement), mais avec 'FZERO' et ce au cas ou 'initialiser_le_cumul_courant' */ /* resterait 'VRAI' tout au long du 'DoIn(...)' qui va suivre, ce qui pourra se rencontrer */ /* lorsque 'IL_FAUT(IFproduit_matriciel_____ignorer_les_couples_de_niveaux_nuls)'... */ EGAL(coordonnee_X_de_sommation ,INTE(LIN3(IFproduit_matriciel_____ponderation_X_Xmin ,FLOT(Xmin) ,IFproduit_matriciel_____ponderation_X_X___ ,FLOT(X) ,IFproduit_matriciel_____ponderation_X_Y___ ,FLOT(Y) ,IFproduit_matriciel_____translation_X_____ ) ) ); /* Initialisation de la coordonnee 'X' pour explorer la ligne courante de 'imageA1', */ EGAL(coordonnee_Y_de_sommation ,INTE(LIN3(IFproduit_matriciel_____ponderation_Y_Ymax ,FLOT(COND(IL_NE_FAUT_PAS(IFproduit_matriciel_____compatibilite_20080109),Ymax,Ymin)) ,IFproduit_matriciel_____ponderation_Y_Y___ ,FLOT(Y) ,IFproduit_matriciel_____ponderation_Y_X___ ,FLOT(X) ,IFproduit_matriciel_____translation_Y_____ ) ) ); /* Initialisation de la coordonnee 'Y' pour explorer la colonne courante de 'imageA2'. */ /* Ainsi, dans le cas normal (pas de compatibilite), la sommation se fait selon : */ /* */ /* Xs+Ys = min(dimX,dimY)-1 */ /* */ /* alors que s'il y a compatibilite, elle se fait selon : */ /* */ /* Xs = Ys */ /* */ /* ATTENTION : l'axe 'OY' des images est dirige vers le haut, alors que pour une matrice, */ /* il descend (j'ai pris conscience de cela le 20080108142614...). */ DoIn(index_de_sommation,UN,PLUS_GRANDE_IMAGE_CARREE_INSCRITE,MIN2(pasX,pasY)) Bblock Test(IFOU(IFINff(coordonnee_X_de_sommation ,SOUS(X,IFproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes) ,ADD2(X,IFproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes) ) ,IFINff(coordonnee_Y_de_sommation ,SOUS(Y,IFproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes) ,ADD2(Y,IFproduit_matriciel_____demi_amplitude_de_balayage_des_lignes_et_des_colonnes) ) ) ) /* Test introduit le 20110919180445 grace auquel on ne somme que les points {Xs,Ys} tels */ /* que : */ /* */ /* Xs E [X-da,X+da] */ /* */ /* ou */ /* */ /* Ys E [Y-da,Y+da] */ /* */ /* (ou "s" est pour "sommation" et "da" pour "demi_amplitude_de_balayage_..."). */ /* */ /* On notera que remplacer 'IFOU(...)' par 'IFET(...)' (comme je l'ai "betement" essaye) */ /* restreint le calcul a l'une des deux diagonales (respectivement suivant la valeur de */ /* l'indicateur 'Iproduit_matriciel_____compatibilite_20080108') d'equations : */ /* */ /* Xs+Ys = min(dimX,dimY)-1 ("seconde diagonale") */ /* */ /* s'il n'y a pas compatibilite (cas par defaut) et : */ /* */ /* Xs = Ys ("premiere diagonale") */ /* */ /* dans le cas contraire... */ /* */ /* Ce test 'IFOU(...)' peut donner des resultats a priori surprenant. Par exemple, */ /* si l'on calcule le carre d'une image uniforme ne contenant que des 1 (en la supposant */ /* 4x4), le resultat est (s'il n'y a pas compatibilite...) : */ /* */ /* 2 */ /* | 1 1 1 1 | | 1 2 2 2 | */ /* | | | | */ /* | 1 1 1 1 | | 2 1 2 1 | */ /* | | = | | */ /* | 1 1 1 1 | | 2 2 1 2 | */ /* | | | | */ /* | 1 1 1 1 | | 2 2 2 1 | */ /* */ /* Cela n'est pas etonnant quand on regarde les calculs intermediaires : */ /* */ /* cumul(X=0,Y=0) =2 ={[A1(Xs=0,Y=0)=1]x[A2(X=0,Ys=3)=1] */ /* +[A1(Xs=3,Y=0)=1]x[A2(X=0,Ys=0)=1] */ /* } */ /* cumul(X=1,Y=0) =2 ={[A1(Xs=1,Y=0)=1]x[A2(X=1,Ys=2)=1] */ /* +[A1(Xs=3,Y=0)=1]x[A2(X=1,Ys=0)=1] */ /* } */ /* cumul(X=2,Y=0) =2 ={[A1(Xs=2,Y=0)=1]x[A2(X=2,Ys=1)=1] */ /* +[A1(Xs=3,Y=0)=1]x[A2(X=2,Ys=0)=1] */ /* } */ /* --> cumul(X=3,Y=0) =1 ={[A1(Xs=3,Y=0)=1]x[A2(X=3,Ys=0)=1] */ /* } */ /* */ /* cumul(X=0,Y=1) =2 ={[A1(Xs=0,Y=1)=1]x[A2(X=0,Ys=3)=1] */ /* +[A1(Xs=2,Y=1)=1]x[A2(X=0,Ys=1)=1] */ /* } */ /* cumul(X=1,Y=1) =2 ={[A1(Xs=1,Y=1)=1]x[A2(X=1,Ys=2)=1] */ /* +[A1(Xs=2,Y=1)=1]x[A2(X=1,Ys=1)=1] */ /* } */ /* --> cumul(X=2,Y=1) =1 ={[A1(Xs=2,Y=1)=1]x[A2(X=2,Ys=1)=1] */ /* } */ /* cumul(X=3,Y=1) =2 ={[A1(Xs=2,Y=1)=1]x[A2(X=3,Ys=1)=1] */ /* +[A1(Xs=3,Y=1)=1]x[A2(X=3,Ys=0)=1] */ /* } */ /* */ /* cumul(X=0,Y=2) =2 ={[A1(Xs=0,Y=2)=1]x[A2(X=0,Ys=3)=1] */ /* +[A1(Xs=1,Y=2)=1]x[A2(X=0,Ys=2)=1] */ /* } */ /* --> cumul(X=1,Y=2) =1 ={[A1(Xs=1,Y=2)=1]x[A2(X=1,Ys=2)=1] */ /* } */ /* cumul(X=2,Y=2) =2 ={[A1(Xs=1,Y=2)=1]x[A2(X=2,Ys=2)=1] */ /* +[A1(Xs=2,Y=2)=1]x[A2(X=2,Ys=1)=1] */ /* } */ /* cumul(X=3,Y=2) =2 ={[A1(Xs=1,Y=2)=1]x[A2(X=3,Ys=2)=1] */ /* +[A1(Xs=3,Y=2)=1]x[A2(X=3,Ys=0)=1] */ /* } */ /* */ /* --> cumul(X=0,Y=3) =1 ={[A1(Xs=0,Y=3)=1]x[A2(X=0,Ys=3)=1] */ /* } */ /* cumul(X=1,Y=3) =2 ={[A1(Xs=0,Y=3)=1]x[A2(X=1,Ys=3)=1] */ /* +[A1(Xs=1,Y=3)=1]x[A2(X=1,Ys=2)=1] */ /* } */ /* cumul(X=2,Y=3) =2 ={[A1(Xs=0,Y=3)=1]x[A2(X=2,Ys=3)=1] */ /* +[A1(Xs=2,Y=3)=1]x[A2(X=2,Ys=1)=1] */ /* } */ /* cumul(X=3,Y=3) =2 ={[A1(Xs=0,Y=3)=1]x[A2(X=3,Ys=3)=1] */ /* +[A1(Xs=3,Y=3)=1]x[A2(X=3,Ys=0)=1] */ /* } */ /* */ /* qui montrent que sur la deuxieme diagonale (reperee par "-->") un seul couple */ /* d'elements des images 'A1' et 'A2' est pris en compte pour le cumul ; cette */ /* deuxieme diagonale correspondant au cas ou {Xs,Y} est egal a {X,Ys}. */ Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,coordonnee_X_de_sommation,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,coordonnee_Y_de_sommation))); /* Variables introduites le 20080108124622 afin de simplifier au maximum le calcul */ /* 'INCR(...,MUL2(...))' qui suit. En effet, 'loadF_point(...)' contient evidemment des */ /* operations arithmetiques elementaires qu'il ne faut pas etendre... */ #define IFproduit_matriciel_____utiliser_l_arithmetique_etendue \ IFproduit_matriciel_____utiliser_l_arithmetique_etendue_au_lieu_de_l_arithmetique_de_base \ /* Afin de raccourcir la ligne qui suit... */ USs_GooF______CONDITIONNEL(IFproduit_matriciel_____utiliser_l_arithmetique_etendue /* Possibilite introduite le 20080108134612... */ ,BLOC( Bblock Test(IFET(IL_FAUT(IFproduit_matriciel_____ignorer_les_couples_de_niveaux_nuls) ,IFET(IZEQ(niveau_imageA1) ,IZEQ(niveau_imageA2) ) ) ) /* Cette possibilite fut introduite le 20080109083426 afin de permettre dans le cas ou */ /* l'arithmetique traditionnelle {ADD2,MUL2} et remplacee par l'arithmetique etendue */ /* {MIN2,ADD2} de ne pas prendre en compte les couples nuls particulierement ennuyeux */ /* a cause du 'MIN2(...)' sur la diagonale... */ Bblock Eblock ATes Bblock DEFV(Float,INIT(produit_courant ,MUL2(niveau_imageA1 ,niveau_imageA2 ) ) ); Test(IL_FAUT(initialiser_le_cumul_courant)) /* A cause de 'USs_GooF______CONDITIONNEL(...)' lorsqu'il est actif, il est impossible de */ /* faire un 'INCR(...)' des la premiere iteration. Ceci rendrait impossible de traiter le */ /* cas 'v $xil/defi_K2$vv$DEF 20061102164207' dans lequel 'ADD2(...)' est remplace par */ /* 'MIN2(...)', puisque 'cumul_courant' etant nul initialement, le resterait alors */ /* systematiquement (via le 'MIN2(...)') dans le cas ou il n'y a que des valeurs positives. */ Bblock EGAL(cumul_courant,produit_courant); EGAL(initialiser_le_cumul_courant,FAUX); Eblock ATes Bblock INCR(cumul_courant,produit_courant); /* Calcul progressif du terme courant de 'imageR' par balayage horizontal de la ligne 'Y' */ /* de 'imageA1' et par balayage vertical de la colonne 'X' de 'imageA2'. */ Eblock ETes Eblock ETes Eblock ) ); /* Le 'GooF' a ete introduit le 20080108124622 ('v $xil/defi_K2$vv$DEF 20061102164207'). */ #undef IFproduit_matriciel_____utiliser_l_arithmetique_etendue Eblock ATes Bblock Eblock ETes INCR(coordonnee_X_de_sommation,pasX); /* Progression de la coordonnee 'X' pour explorer la ligne courante de 'imageA1' equivalant */ /* a la fonction : */ /* */ /* f(Xs) = Xmin + (index-1) */ /* */ /* avec : */ /* */ /* index E [1,min(dimX,dimY)-1] */ /* */ Test(IL_NE_FAUT_PAS(IFproduit_matriciel_____compatibilite_20080109)) Bblock DECR(coordonnee_Y_de_sommation,pasY); Eblock ATes Bblock INCR(coordonnee_Y_de_sommation,pasY); Eblock ETes /* Progression de la coordonnee 'Y' pour explorer la colonne courante de 'imageA2' */ /* equivalant a la fonction : */ /* */ /* f(Ys) = Ymax - (index-1) s'il n'y a pas compatibilite (par defaut) */ /* = Ymin + (index-1) s'il y a compatibilite */ /* */ /* avec : */ /* */ /* index E [1,min(dimX,dimY)-1] */ /* */ /* ATTENTION : l'axe 'OY' des images est dirige vers le haut, alors que pour une matrice, */ /* il descend (j'ai pris conscience de cela le 20080108142614...). */ EGAL(coordonnee_X_de_sommation,MODX(coordonnee_X_de_sommation)); EGAL(coordonnee_Y_de_sommation,MODY(coordonnee_Y_de_sommation)); /* Introduit le 20110921172955 afin de permettre des initialisations de {Xs,Ys} plus */ /* "exotiques"... */ Eblock EDoI storeF_point(cumul_courant,imageR,X,Y); /* Et rangement de l'element courant {X,Y}. */ Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* S O M M E C O M P L E X E D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionJ DEFV(Common,DEFV(FonctionJ,POINTERJ(IJaddition_complexe(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(imageJ,imageR)); /* Image resultat a calculer comme la somme complexe somme des deux images Arguments. */ DEFV(Argument,DEFV(imageJ,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageJ,imageA2)); /* Deuxieme image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(complexe,nombre_complexe_courant); /* Nombre complexe contenant la somme complexe au point courant {X,Y}. */ /*..............................................................................................................................*/ begin_image Bblock Csomme(nombre_complexe_courant ,loadJ_point(imageA1,X,Y) ,loadJ_point(imageA2,X,Y) ); /* Calcul de la somme courante entre 'imageA1' et 'imageA2'. */ storeJ_point(nombre_complexe_courant ,imageR ,X,Y ); /* Rangement de la somme point par point... */ Eblock end_image RETIJ(imageR); Eblock EFonctionJ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P R O D U I T C O M P L E X E D E D E U X I M A G E S C O M P L E X E S : */ /* */ /*************************************************************************************************************************************/ BFonctionJ DEFV(Common,DEFV(FonctionJ,POINTERJ(IJproduit_complexe(imageR,imageA1,imageA2,ARGUMENT_POINTERs(translation_de_l_imageA2))))) DEFV(Argument,DEFV(imageJ,imageR)); /* Image resultat a calculer comme le produit complexe des deux images Arguments. */ DEFV(Argument,DEFV(imageJ,imageA1)); /* Premiere image Argument. */ DEFV(Argument,DEFV(imageJ,imageA2)); /* Deuxieme image Argument (aussi appelee "noyau de filtrage"...) qui peut etre, */ /* comme nous le verrons ci-apres, translatee : */ DEFV(Argument,DEFV(deltaF_2D,POINTERs(translation_de_l_imageA2))); /* Translation horizontale ('dx') et verticale ('dy') du noyau de filtrage ; on */ /* n'oubliera pas que cette translation est exprimee dans des unites telles */ /* l'unite soit respectivement [Xmin,Xmax] et [Ymin,Ymax]. En effet, en general, */ /* les images "complexes" proviennent d'une transformee de Fourier d'une image "fonction" */ /* qui en fait a ete calculee avec son origine (0,0) au point (Xcentre,Ycentre) ; c'est */ /* par exemple le cas des champs de Morlet... Il faut donc pouvoir "recaler" les fonctions. */ /* On se rappelera alors la propriete de translation de la transformee de Fourier : */ /* */ /* transX transY */ /* -2.i.PI.(-(X.-------- + Y.--------)) */ /* T(f(X+transX,Y+transY),u,v) = e dimX dimY .T(f(X,Y),u,v) */ /* */ /* (ou 'transX' et 'transY' designent les translations 'dx' et 'dy' respectivement). */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Float,INIT(facteur_flottant_de_translation,FLOT__UNDEF)); /* Facteur de translation qui permet de connaitre les points de 'imageA2' qui sont */ /* en dehors de [Xmin,Xmax][Ymin][Ymax] ; il vaut : */ /* */ /* translationX translationY */ /* -2.PI.(-(X.-------------- + Y.--------------)) */ /* dimX dimY */ /* */ /* en flottant... */ DEFV(complexe,facteur_complexe_de_translation); /* Facteur de translation qui permet de connaitre les points de 'imageA2' qui sont */ /* en dehors de [Xmin,Xmax][Ymin][Ymax] ; il vaut : */ /* */ /* translationX translationY */ /* -2.i.PI.(-(X.-------------- + Y.--------------)) */ /* e dimX dimY */ /* */ /* en complexe... */ DEFV(complexe,translatee_de_l_imageA2); /* Nombre complexe contenant le point courant {X,Y} de 'imageA2' translate suivant le */ /* vecteur translation argument. */ DEFV(complexe,nombre_complexe_courant); /* Nombre complexe contenant le produit complexe au point courant {X,Y}. */ /*..............................................................................................................................*/ begin_image Bblock EGAL(facteur_flottant_de_translation ,NEGA(MUL2(CERCLE_TRIGONOMETRIQUE ,NEGA(ADD2(MUL2(FLOT(X) ,DIVI(_lDENORMALISE_OX(ASI1(translation_de_l_imageA2,dx)) ,FLOT(dimX) ) ) ,MUL2(FLOT(Y) ,DIVI(_lDENORMALISE_OY(ASI1(translation_de_l_imageA2,dy)) ,FLOT(dimY) ) ) ) ) ) ) ); /* Calcul du facteur flottant de translation de 'imageA2' suivant la formule : */ /* */ /* translationX translationY */ /* -2.PI.(-(X.-------------- + Y.--------------)) */ /* dimX dimY */ /* */ Cinitialisation(facteur_complexe_de_translation ,COSX(facteur_flottant_de_translation) ,SINX(facteur_flottant_de_translation) ); /* Calcul du facteur complexe de translation de 'imageA2' suivant la formule : */ /* */ /* translationX translationY */ /* -2.i.PI.(-(X.-------------- + Y.--------------)) */ /* e dimX dimY */ /* */ Cproduit(translatee_de_l_imageA2 ,facteur_complexe_de_translation ,loadJ_point(imageA2,X,Y) ); /* Translation de 'imageA2' pour chaque point {X,Y}. */ Cproduit(nombre_complexe_courant ,loadJ_point(imageA1,X,Y) ,translatee_de_l_imageA2 ); /* Calcul du produit courant entre 'imageA1' et 'imageA2' (translatee). */ storeJ_point(nombre_complexe_courant ,imageR ,X,Y ); /* Rangement du produit point par point... */ Eblock end_image RETIJ(imageR); Eblock EFonctionJ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N T E R P O L A T I O N C O M P L E X E E N T R E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionJ DEFV(Common,DEFV(FonctionJ,POINTERJ(IJinterpolation_complexe(imageR,alpha,imageA1,beta_,imageA2)))) DEFV(Argument,DEFV(imageJ,imageR)); /* Image Resultat, telle que : imageR=alpha*imageA1 + beta*imageA2. */ DEFV(Argument,DEFV(Float,alpha)); /* Premier coefficient d'interpolation, */ DEFV(Argument,DEFV(imageJ,imageA1)); /* Premiere image Argument. */ DEFV(Argument,DEFV(Float,beta_)); /* Second coefficient d'interpolation, */ DEFV(Argument,DEFV(imageJ,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(complexe,nombre_complexe_courant); /* Nombre complexe contenant la somme complexe ponderee au point courant {X,Y}. */ /*..............................................................................................................................*/ begin_image Bblock Cinterpolation(nombre_complexe_courant ,alpha ,loadJ_point(imageA1,X,Y) ,beta_ ,loadJ_point(imageA2,X,Y) ); /* Calcul de la somme ponderee courante entre 'imageA1' et 'imageA2'. */ storeJ_point(nombre_complexe_courant ,imageR ,X,Y ); /* Rangement de la somme point par point... */ Eblock end_image RETIJ(imageR); Eblock EFonctionJ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* " C U T O F F " O U E L I M I N A T I O N D E M O R C E A U X D ' U N E I M A G E */ /* C O R R E S P O N D A N T A D E S V A L E U R S F A I B L E S D ' U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFcutoff(imageR,marqueur_des_points_faibles,imageA,seuil_de_cutoff,image_de_cutoff)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image flottante Resultat, telle que : imageR[X][Y]=imageA[X][Y] si imageA[X][Y] >= seuil, */ /* =marqueur si imageA[X][Y] < seuil. */ DEFV(Argument,DEFV(genere_Float,marqueur_des_points_faibles)); /* Marqueur dans 'imageR' des points correspondant a une valeur inferieure au seuil. */ DEFV(Argument,DEFV(imageF,imageA)); /* Image flottante Argument. */ DEFV(Argument,DEFV(genere_Float,seuil_de_cutoff)); /* Seuil de cutoff... */ DEFV(Argument,DEFV(imageF,image_de_cutoff)); /* Image flottante permettant avec le seuil de determiner les points de 'imageA' */ /* qui sont transportes dans 'imageR'. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_image_de_cutoff,loadF_point(image_de_cutoff,X,Y))); DEFV(genere_Float,INIT(niveau_imageA,loadF_point(imageA,X,Y))); /* Introduit le 20181204124617 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(COND(IFGE(niveau_image_de_cutoff,seuil_de_cutoff) ,niveau_imageA ,marqueur_des_points_faibles ) ,imageR ,X,Y ); /* On notera que le test 'IFGE' est identique a celui de 'TEST_MASQUE_ACTIF'... */ Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* F I L T R A G E " A D D I T I F " D ' U N E I M A G E " C O M P L E X E " */ /* P A R U N " N O Y A U " D E F I N I P A R U N E */ /* I M A G E " F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionJ DEFV(Common,DEFV(Float,SINT(IJFfiltrage_additif_____minimum_Reelle____,FLOT__UNDEF))); DEFV(Common,DEFV(Float,SINT(IJFfiltrage_additif_____maximum_Reelle____,FLOT__UNDEF))); DEFV(Common,DEFV(Float,SINT(IJFfiltrage_additif_____minimum_Imaginaire,FLOT__UNDEF))); DEFV(Common,DEFV(Float,SINT(IJFfiltrage_additif_____maximum_Imaginaire,FLOT__UNDEF))); /* Introduit le 20240707184716, cela peut servir pour la mise au points des parametres... */ DEFV(Common,DEFV(FonctionJ,POINTERJ(IJFfiltrage_additif(imageR ,imageA ,noyau_de_filtrage_Reelle,noyau_de_filtrage_Imaginaire ,ARGUMENT_POINTERs(translation_Reelle) ,ARGUMENT_POINTERs(translation_Imaginaire) ) ) ) ) /* Fonction introduite le 20240707134452... */ DEFV(Argument,DEFV(imageJ,imageR)); /* Image Resultat, telle que : imageR=imageA filtree par 'noyau'. */ DEFV(Argument,DEFV(imageJ,imageA)); /* Image Argument (a filtrer). */ DEFV(Argument,DEFV(imageF,noyau_de_filtrage_Reelle)); DEFV(Argument,DEFV(imageF,noyau_de_filtrage_Imaginaire)); /* Images definissant les noyaux de filtrage. */ DEFV(Argument,DEFV(deltaF_2D,POINTERs(translation_Reelle))); DEFV(Argument,DEFV(deltaF_2D,POINTERs(translation_Imaginaire))); /* Translation horizontale ('dx') et verticale ('dy') du noyau de filtrage ; on */ /* n'oubliera pas que cette translation est exprimee dans des unites telles */ /* l'unite soit respectivement [Xmin,Xmax] et [Ymin,Ymax]. En effet, en general, */ /* les images "complexes" proviennent d'une transformee de Fourier, et l'origine */ /* des frequences se trouvent donc en (Xmin,Ymin), alors que bien souvent pour les */ /* noyaux, elle se trouve bien souvent en (Xcentre,Ycentre) ; voir par exemple */ /* les champs gaussiens... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Float,INIT(filtre_Reelle,FLOT__UNDEF)); DEFV(Float,INIT(filtre_Imaginaire,FLOT__UNDEF)); /* Valeur du filtre au point courant {X,Y}. */ DEFV(complexe,point_complexe_courant); /* Afin de manipuler le point complexe courant. */ /*..............................................................................................................................*/ EGAL(IJFfiltrage_additif_____minimum_Reelle____,F_INFINI); EGAL(IJFfiltrage_additif_____maximum_Reelle____,F_MOINS_L_INFINI); EGAL(IJFfiltrage_additif_____minimum_Imaginaire,F_INFINI); EGAL(IJFfiltrage_additif_____maximum_Imaginaire,F_MOINS_L_INFINI); begin_image Bblock EGAL(filtre_Reelle ,loadF_point_modulo(noyau_de_filtrage_Reelle ,ADD2(X,_lDENORMALISE_OX(ASI1(translation_Reelle,dx))) ,ADD2(Y,_lDENORMALISE_OY(ASI1(translation_Reelle,dy))) ) ); EGAL(filtre_Imaginaire ,loadF_point_modulo(noyau_de_filtrage_Imaginaire ,ADD2(X,_lDENORMALISE_OX(ASI1(translation_Imaginaire,dx))) ,ADD2(Y,_lDENORMALISE_OY(ASI1(translation_Imaginaire,dy))) ) ); /* La valeur du filtre au point courant {X,Y} est le niveau du point dans */ /* le noyau de filtrage ramene dans [0,1], les coordonnees ayant ete */ /* translatees de 'translation' sur un tore en 'X' et en 'Y'. */ /* */ /* On notera que jusqu'au 20240812112951, il y avait des 'load_point_modulo(...)'s au lieu */ /* des 'loadF_point_modulo(...)'s necessaires, par erreur. Cela n'avait aucune consequence, */ /* leurs definitions se faisant via 'load_point_modulo(...)' dans les deux cas. */ Cegal(point_complexe_courant,loadJ_point(imageA,X,Y)); /* Acces au point courant de l'image Argument a filtrer. */ EGAL(IJFfiltrage_additif_____minimum_Reelle____ ,MIN2(IJFfiltrage_additif_____minimum_Reelle____,Reelle(point_complexe_courant)) ); EGAL(IJFfiltrage_additif_____maximum_Reelle____ ,MAX2(IJFfiltrage_additif_____maximum_Reelle____,Reelle(point_complexe_courant)) ); EGAL(IJFfiltrage_additif_____minimum_Imaginaire ,MIN2(IJFfiltrage_additif_____minimum_Imaginaire,Imaginaire(point_complexe_courant)) ); EGAL(IJFfiltrage_additif_____maximum_Imaginaire ,MAX2(IJFfiltrage_additif_____maximum_Imaginaire,Imaginaire(point_complexe_courant)) ); EGAL(Reelle(point_complexe_courant) ,ADD2(Reelle(point_complexe_courant),filtre_Reelle) ); EGAL(Imaginaire(point_complexe_courant) ,ADD2(Imaginaire(point_complexe_courant),filtre_Imaginaire) ); /* Et on filtre... */ storeJ_point(point_complexe_courant,imageR,X,Y); /* Et on met a jour l'image Resultat. */ Eblock end_image RETIJ(imageR); Eblock EFonctionJ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* F I L T R A G E " M U L T I P L I C A T I F " D ' U N E I M A G E " C O M P L E X E " */ /* P A R U N " N O Y A U " D E F I N I P A R U N E */ /* D E U X I M A G E S " S T A N D A R D " S : */ /* */ /*************************************************************************************************************************************/ BFonctionJ DEFV(Common,DEFV(Float,SINT(IJfiltrage_multiplicatif_____minimum_Reelle____,FLOT__UNDEF))); DEFV(Common,DEFV(Float,SINT(IJfiltrage_multiplicatif_____maximum_Reelle____,FLOT__UNDEF))); DEFV(Common,DEFV(Float,SINT(IJfiltrage_multiplicatif_____minimum_Imaginaire,FLOT__UNDEF))); DEFV(Common,DEFV(Float,SINT(IJfiltrage_multiplicatif_____maximum_Imaginaire,FLOT__UNDEF))); /* Introduit le 20240707184716, cela peut servir pour la mise au points des parametres... */ DEFV(Common,DEFV(FonctionJ,POINTERJ(IJfiltrage_multiplicatif(imageR ,imageA ,noyau_de_filtrage_Reelle,noyau_de_filtrage_Imaginaire ,ARGUMENT_POINTERs(translation_Reelle) ,ARGUMENT_POINTERs(translation_Imaginaire) ) ) ) ) DEFV(Argument,DEFV(imageJ,imageR)); /* Image Resultat, telle que : imageR=imageA filtree par 'noyau'. */ DEFV(Argument,DEFV(imageJ,imageA)); /* Image Argument (a filtrer). */ DEFV(Argument,DEFV(image,noyau_de_filtrage_Reelle)); DEFV(Argument,DEFV(image,noyau_de_filtrage_Imaginaire)); /* Images definissant les noyaux de filtrage. */ /* */ /* Le 20240707133712 a ete introduit la possibilite de pouvoir filtres differement les */ /* parties Reelle et Imaginaire... */ DEFV(Argument,DEFV(deltaF_2D,POINTERs(translation_Reelle))); DEFV(Argument,DEFV(deltaF_2D,POINTERs(translation_Imaginaire))); /* Translation horizontale ('dx') et verticale ('dy') du noyau de filtrage ; on */ /* n'oubliera pas que cette translation est exprimee dans des unites telles */ /* l'unite soit respectivement [Xmin,Xmax] et [Ymin,Ymax]. En effet, en general, */ /* les images "complexes" proviennent d'une transformee de Fourier, et l'origine */ /* des frequences se trouvent donc en (Xmin,Ymin), alors que bien souvent pour les */ /* noyaux, elle se trouve bien souvent en (Xcentre,Ycentre) ; voir par exemple */ /* les champs gaussiens... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Float,INIT(filtre_Reelle,FLOT__UNDEF)); DEFV(Float,INIT(filtre_Imaginaire,FLOT__UNDEF)); /* Valeur du filtre au point courant {X,Y}. */ DEFV(complexe,point_complexe_courant); /* Afin de manipuler le point complexe courant. */ /*..............................................................................................................................*/ EGAL(IJfiltrage_multiplicatif_____minimum_Reelle____,F_INFINI); EGAL(IJfiltrage_multiplicatif_____maximum_Reelle____,F_MOINS_L_INFINI); EGAL(IJfiltrage_multiplicatif_____minimum_Imaginaire,F_INFINI); EGAL(IJfiltrage_multiplicatif_____maximum_Imaginaire,F_MOINS_L_INFINI); begin_image Bblock EGAL(filtre_Reelle ,______NORMALISE_NIVEAU(load_point_modulo(noyau_de_filtrage_Reelle ,ADD2(X,_lDENORMALISE_OX(ASI1(translation_Reelle,dx))) ,ADD2(Y,_lDENORMALISE_OY(ASI1(translation_Reelle,dy))) ) ) ); EGAL(filtre_Imaginaire ,______NORMALISE_NIVEAU(load_point_modulo(noyau_de_filtrage_Imaginaire ,ADD2(X,_lDENORMALISE_OX(ASI1(translation_Imaginaire,dx))) ,ADD2(Y,_lDENORMALISE_OY(ASI1(translation_Imaginaire,dy))) ) ) ); /* La valeur du filtre au point courant {X,Y} est le niveau du point dans */ /* le noyau de filtrage ramene dans [0,1], les coordonnees ayant ete */ /* translatees de 'translation' sur un tore en 'X' et en 'Y'. */ Cegal(point_complexe_courant,loadJ_point(imageA,X,Y)); /* Acces au point courant de l'image Argument a filtrer. */ EGAL(IJfiltrage_multiplicatif_____minimum_Reelle____ ,MIN2(IJfiltrage_multiplicatif_____minimum_Reelle____,Reelle(point_complexe_courant)) ); EGAL(IJfiltrage_multiplicatif_____maximum_Reelle____ ,MAX2(IJfiltrage_multiplicatif_____maximum_Reelle____,Reelle(point_complexe_courant)) ); EGAL(IJfiltrage_multiplicatif_____minimum_Imaginaire ,MIN2(IJfiltrage_multiplicatif_____minimum_Imaginaire,Imaginaire(point_complexe_courant)) ); EGAL(IJfiltrage_multiplicatif_____maximum_Imaginaire ,MAX2(IJfiltrage_multiplicatif_____maximum_Imaginaire,Imaginaire(point_complexe_courant)) ); EGAL(Reelle(point_complexe_courant) ,MUL2(filtre_Reelle,Reelle(point_complexe_courant)) ); EGAL(Imaginaire(point_complexe_courant) ,MUL2(filtre_Imaginaire,Imaginaire(point_complexe_courant)) ); /* Et on filtre... */ storeJ_point(point_complexe_courant,imageR,X,Y); /* Et on met a jour l'image Resultat. */ Eblock end_image RETIJ(imageR); Eblock EFonctionJ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* F I L T R A G E " M U L T I P L I C A T I F " D ' U N E I M A G E " C O M P L E X E " */ /* P A R U N " N O Y A U " D E F I N I P A R U N E */ /* I M A G E " F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionJ DEFV(Common,DEFV(Float,SINT(IJFfiltrage_multiplicatif_____minimum_Reelle____,FLOT__UNDEF))); DEFV(Common,DEFV(Float,SINT(IJFfiltrage_multiplicatif_____maximum_Reelle____,FLOT__UNDEF))); DEFV(Common,DEFV(Float,SINT(IJFfiltrage_multiplicatif_____minimum_Imaginaire,FLOT__UNDEF))); DEFV(Common,DEFV(Float,SINT(IJFfiltrage_multiplicatif_____maximum_Imaginaire,FLOT__UNDEF))); DEFV(Common,DEFV(FonctionJ,POINTERJ(IJFfiltrage_multiplicatif(imageR ,imageA ,noyau_de_filtrage_Reelle,noyau_de_filtrage_Imaginaire ,ARGUMENT_POINTERs(translation_Reelle) ,ARGUMENT_POINTERs(translation_Imaginaire) ) ) ) ) /* Fonction introduite le 20240812120253... */ DEFV(Argument,DEFV(imageJ,imageR)); /* Image Resultat, telle que : imageR=imageA filtree par 'noyau'. */ DEFV(Argument,DEFV(imageJ,imageA)); /* Image Argument (a filtrer). */ DEFV(Argument,DEFV(imageF,noyau_de_filtrage_Reelle)); DEFV(Argument,DEFV(imageF,noyau_de_filtrage_Imaginaire)); /* Images definissant les noyaux de filtrage. */ DEFV(Argument,DEFV(deltaF_2D,POINTERs(translation_Reelle))); DEFV(Argument,DEFV(deltaF_2D,POINTERs(translation_Imaginaire))); /* Translation horizontale ('dx') et verticale ('dy') du noyau de filtrage ; on */ /* n'oubliera pas que cette translation est exprimee dans des unites telles */ /* l'unite soit respectivement [Xmin,Xmax] et [Ymin,Ymax]. En effet, en general, */ /* les images "complexes" proviennent d'une transformee de Fourier, et l'origine */ /* des frequences se trouvent donc en (Xmin,Ymin), alors que bien souvent pour les */ /* noyaux, elle se trouve bien souvent en (Xcentre,Ycentre) ; voir par exemple */ /* les champs gaussiens... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Float,INIT(filtre_Reelle,FLOT__UNDEF)); DEFV(Float,INIT(filtre_Imaginaire,FLOT__UNDEF)); /* Valeur du filtre au point courant {X,Y}. */ DEFV(complexe,point_complexe_courant); /* Afin de manipuler le point complexe courant. */ /*..............................................................................................................................*/ EGAL(IJFfiltrage_multiplicatif_____minimum_Reelle____,F_INFINI); EGAL(IJFfiltrage_multiplicatif_____maximum_Reelle____,F_MOINS_L_INFINI); EGAL(IJFfiltrage_multiplicatif_____minimum_Imaginaire,F_INFINI); EGAL(IJFfiltrage_multiplicatif_____maximum_Imaginaire,F_MOINS_L_INFINI); begin_image Bblock EGAL(filtre_Reelle ,loadF_point_modulo(noyau_de_filtrage_Reelle ,ADD2(X,_lDENORMALISE_OX(ASI1(translation_Reelle,dx))) ,ADD2(Y,_lDENORMALISE_OY(ASI1(translation_Reelle,dy))) ) ); EGAL(filtre_Imaginaire ,loadF_point_modulo(noyau_de_filtrage_Imaginaire ,ADD2(X,_lDENORMALISE_OX(ASI1(translation_Imaginaire,dx))) ,ADD2(Y,_lDENORMALISE_OY(ASI1(translation_Imaginaire,dy))) ) ); /* La valeur du filtre au point courant {X,Y} est le niveau du point dans le noyau de */ /* filtrage, les coordonnees ayant ete translatees de 'translation' sur un tore en 'X' */ /* et en 'Y'. */ Cegal(point_complexe_courant,loadJ_point(imageA,X,Y)); /* Acces au point courant de l'image Argument a filtrer. */ EGAL(IJFfiltrage_multiplicatif_____minimum_Reelle____ ,MIN2(IJFfiltrage_multiplicatif_____minimum_Reelle____,Reelle(point_complexe_courant)) ); EGAL(IJFfiltrage_multiplicatif_____maximum_Reelle____ ,MAX2(IJFfiltrage_multiplicatif_____maximum_Reelle____,Reelle(point_complexe_courant)) ); EGAL(IJFfiltrage_multiplicatif_____minimum_Imaginaire ,MIN2(IJFfiltrage_multiplicatif_____minimum_Imaginaire,Imaginaire(point_complexe_courant)) ); EGAL(IJFfiltrage_multiplicatif_____maximum_Imaginaire ,MAX2(IJFfiltrage_multiplicatif_____maximum_Imaginaire,Imaginaire(point_complexe_courant)) ); EGAL(Reelle(point_complexe_courant) ,MUL2(filtre_Reelle,Reelle(point_complexe_courant)) ); EGAL(Imaginaire(point_complexe_courant) ,MUL2(filtre_Imaginaire,Imaginaire(point_complexe_courant)) ); /* Et on filtre... */ storeJ_point(point_complexe_courant,imageR,X,Y); /* Et on met a jour l'image Resultat. */ Eblock end_image RETIJ(imageR); Eblock EFonctionJ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D I V I S I O N ( Q U O T I E N T ) D E D E U X I M A G E S ( I M A G E 1 / I M A G E 2 ) : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Idivision(imageR,imageA1,imageA2,avertissement)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1/imageA2 sans entreprendre d'actions */ /* particulieres au cas ou le diviseur serait nul si ce n'est le signaler et */ /* donner la valeur "NIVEAU_UNDEF" aux elements correspondants... */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(Logical,avertissement)); /* Argument indiquant si les divisions par zero doivent etre signalees ('VRAI') */ /* ou pas ('FAUX') ; dans les deux cas la valeur 'NIVEAU_UNDEF' est donnee */ /* au point resultant. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_p,INIT(diviseur,load_point(imageA2,X,Y))); Test(IZEQ(diviseur)) Bblock Test(EST_VRAI(avertissement)) Bblock CAL1(Prer2("ATTENTION, DIVISION PAR ZERO pour X=%d et Y=%d\n",X,Y)); Eblock ATes Bblock Eblock ETes store_point(NIVEAU_UNDEF,imageR,X,Y,FVARIABLE); Eblock ATes Bblock /* Le 20190927171857, le test 'IZNE(diviseur)' a ete supprime au benefice du 'ATes'... */ PDIV(X,Y,imageA1,imageA2,imageR); Eblock ETes Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D I V I S I O N ( Q U O T I E N T ) D E D E U X I M A G E S ( I M A G E 1 / I M A G E 2 ) */ /* A V E C R E N O R M A L I S A T I O N : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Idivision_avec_renormalisation(imageR,imageA1,imageA2,avertissement)))) /* Fonction introduite le 20190927175256... */ DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1/imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(Logical,avertissement)); /* Argument indiquant si les divisions par zero doivent etre signalees ('VRAI') */ /* ou pas ('FAUX') ; dans les deux cas la valeur 'FLOT__NIVEAU_UNDEF' est donnee */ /* au point resultant. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,quotient_flottant); /* Image intermediaire flottante avant renormalisation... */ /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_p,INIT(dividende,load_point(imageA1,X,Y))); DEFV(genere_p,INIT(diviseur_,load_point(imageA2,X,Y))); Test(IZEQ(diviseur_)) Bblock Test(EST_VRAI(avertissement)) Bblock CAL1(Prer2("ATTENTION, DIVISION PAR ZERO pour X=%d et Y=%d\n",X,Y)); Eblock ATes Bblock Eblock ETes storeF_point(FLOT__NIVEAU_UNDEF,quotient_flottant,X,Y); Eblock ATes Bblock storeF_point(NIVA(DIVI(FLOT(NIVR(dividende)) ,FLOT(NIVR(diviseur_)) ) ) ,quotient_flottant ,X,Y ); Eblock ETes Eblock end_image CALS(Ifloat_std_avec_renormalisation(imageR,quotient_flottant)); /* Et renormalisation de la difference... */ EDEFV(imageF,quotient_flottant); /* Image intermediaire flottante avant renormalisation... */ RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D I V I S I O N ( Q U O T I E N T ) F L O T T A N T E D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFdivision(imageR,imageA1,imageA2,avertissement)))) /* Fonction introduite le 20190927173733... */ DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1/imageA2 sans entreprendre d'actions */ /* particulieres au cas ou le diviseur serait nul si ce n'est le signaler et */ /* donner la valeur "NIVEAU_UNDEF" aux elements correspondants... */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(Logical,avertissement)); /* Argument indiquant si les divisions par zero doivent etre signalees ('VRAI') */ /* ou pas ('FAUX') ; dans les deux cas la valeur 'FLOT__NIVEAU_UNDEF' est donnee */ /* au point resultant. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(dividende,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(diviseur_,loadF_point(imageA2,X,Y))); Test(IZEQ(diviseur_)) Bblock Test(EST_VRAI(avertissement)) Bblock CAL1(Prer2("ATTENTION, DIVISION PAR ZERO pour X=%d et Y=%d\n",X,Y)); Eblock ATes Bblock Eblock ETes storeF_point(FLOT__NIVEAU_UNDEF,imageR,X,Y); Eblock ATes Bblock storeF_point(DIVI(dividende,diviseur_),imageR,X,Y); Eblock ETes Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A X I M U M D E D E U X I M A G E S ( ' O U ' F L O U ) : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Imaximum(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=max(imageA1,imageA2) pour chaque point, */ /* c'est-a-dire : imageR[X][Y]=max(imageA1[X][Y],imageA2[X][Y]). */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock PMAX(X,Y,imageA1,imageA2,imageR); Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A X I M U M F L O T T A N T D E D E U X I M A G E S F L O T T A N T E S ( ' O U ' F L O U ) : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFmaximum(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=max(imageA1,imageA2). */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(MAX2(niveau_imageA1 ,niveau_imageA2 ) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M I N I M U M D E D E U X I M A G E S ( ' E T ' F L O U ) : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iminimum(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=min(imageA1,imageA2) pour chaque point, */ /* c'est-a-dire : imageR[X][Y]=min(imageA1[X][Y],imageA2[X][Y]). */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock PMIN(X,Y,imageA1,imageA2,imageR); Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M I N I M U M F L O T T A N T D E D E U X I M A G E S F L O T T A N T E S ( ' E T ' F L O U ) : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(FonctionF,POINTERF(IFminimum(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=min(imageA1,imageA2). */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ storeF_point(MIN2(niveau_imageA1 ,niveau_imageA2 ) ,imageR ,X,Y ); Eblock end_image RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* " O U " E X C L U S I F F L O U D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(Logical,SINT(Iminmax_____remplacer_MINMAX_par_MAXMIN,FAUX))); /* Introduit le 20061023092643 afin de permettre, si necessaire, de remplacer 'MINMAX(...)' */ /* par 'MAXMIN(...)'. La valeur par defaut assure la compatibilite anterieure... */ /* */ /* On notera le 20061023100011 : */ /* */ /* PMAXMIN(a,b) = PCOMP(PMINMAX(a,b)) */ /* */ /* mais comme cela n'est plus vrai, en general dans 'IFminmax(...)' (par definition de */ /* 'IFcomplementation(...)'), on conserve cette possibilite pour 'Iminmax(...)' par */ /* "symetrie"... */ DEFV(Common,DEFV(FonctionP,POINTERp(Iminmax(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que pour chaque point {X,Y}, on est : */ /* imageR[X][Y]=max(min(comp(imageA1[X][Y]),imageA2[X][Y]), */ /* min(imageA1[X][Y],comp(imageA2[X][Y]))). */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock Test(IL_NE_FAUT_PAS(Iminmax_____remplacer_MINMAX_par_MAXMIN)) /* Test introduit le 20061023092643... */ Bblock PMINMAX(X,Y,imageA1,imageA2,imageR); Eblock ATes Bblock PMAXMIN(X,Y,imageA1,imageA2,imageR); Eblock ETes Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* " O U " E X C L U S I F F L O U D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Logical,SINT(IFminmax_____remplacer_MINMAX_par_MAXMIN,FAUX))); /* Introduit le 20061023092643 afin de permettre, si necessaire, de remplacer 'MINMAX(...)' */ /* par 'MAXMIN(...)'. La valeur par defaut assure la compatibilite anterieure... */ DEFV(Common,DEFV(FonctionF,POINTERF(IFminmax(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=minmax(imageA1,imageA2). */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,complement_de_imageA1); BDEFV(imageF,complement_de_imageA2); /* Complements des deux images Argument... */ /*..............................................................................................................................*/ CALS(IFcomplementation(complement_de_imageA1,imageA1)); CALS(IFcomplementation(complement_de_imageA2,imageA2)); /* Complementation des deux images Argument... */ begin_image Bblock DEFV(genere_Float,INIT(niveau_imageA1,loadF_point(imageA1,X,Y))); DEFV(genere_Float,INIT(complement_du_niveau_imageA1,loadF_point(complement_de_imageA1,X,Y))); DEFV(genere_Float,INIT(niveau_imageA2,loadF_point(imageA2,X,Y))); DEFV(genere_Float,INIT(complement_du_niveau_imageA2,loadF_point(complement_de_imageA2,X,Y))); /* Acces aux niveaux courants en {X,Y} dans les deux images Argument et leurs complements */ /* (et ce pour alleger le travail des compilateurs dans ce qui suit...). */ Test(IL_NE_FAUT_PAS(IFminmax_____remplacer_MINMAX_par_MAXMIN)) /* Test introduit le 20061023092643... */ Bblock storeF_point(MAX2(MIN2(niveau_imageA1,complement_du_niveau_imageA2) ,MIN2(complement_du_niveau_imageA1,niveau_imageA2) ) ,imageR ,X,Y ); /* A cause de l'usage des images 'complement_de_imageA?', il est malheureusement */ /* impossible d'utiliser l'operateur 'v $xil/defi_K2$vv$DEF MINMAX'. On notera que l'on */ /* utilise ces images 'complement_de_imageA?', plutot que 'COMP(...)' dans un 'MINMAX(...)' */ /* car, en effet, la fonction 'IFcomplementation(...)' est beuacoup plus generale que */ /* 'COMP(...)'... */ Eblock ATes Bblock storeF_point(MIN2(MAX2(niveau_imageA1,complement_du_niveau_imageA2) ,MAX2(complement_du_niveau_imageA1,niveau_imageA2) ) ,imageR ,X,Y ); /* A cause de l'usage des images 'complement_de_imageA?', il est malheureusement */ /* impossible d'utiliser l'operateur 'v $xil/defi_K2$vv$DEF MAXMIN'. On notera que l'on */ /* utilise ces images 'complement_de_imageA?', plutot que 'COMP(...)' dans un 'MAXMIN(...)' */ /* car, en effet, la fonction 'IFcomplementation(...)' est beuacoup plus generale que */ /* 'COMP(...)'... */ Eblock ETes Eblock end_image EDEFV(imageF,complement_de_imageA2); EDEFV(imageF,complement_de_imageA1); /* Complements des deux images Argument... */ RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ #if ((Format_p==Format_char)||(Format_p==Format_int)) /* Common,DEFV(Fonction,) : la generation depend des conditions... */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* ' O R ' L O G I Q U E D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(Logical,SINT(Ior_____complementer,FAUX))); /* Introduit le 20120408101714 par symetrie avec 'Ieor(...)'... */ DEFV(Common,DEFV(FonctionP,POINTERp(Ior(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1.OR.imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock POR(X,Y,imageA1,imageA2,imageR); Eblock end_image Test(IL_FAUT(Ior_____complementer)) /* Test introduit le 20120408101714... */ Bblock CALi(Icomplementation(imageR,imageR)); Eblock ATes Bblock Eblock ETes RETI(imageR); Eblock EFonctionP #Aif ((Format_p==Format_char)||(Format_p==Format_int)) /* Common,DEFV(Fonction,) : la generation depend des conditions... */ #Eif ((Format_p==Format_char)||(Format_p==Format_int)) /* Common,DEFV(Fonction,) : la generation depend des conditions... */ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ #if ((Format_p==Format_char)||(Format_p==Format_int)) /* Common,DEFV(Fonction,) : la generation depend des conditions... */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* ' A N D ' L O G I Q U E D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(Logical,SINT(Iand_____complementer,FAUX))); /* Introduit le 20120408101714 par symetrie avec 'Ieor(...)'... */ DEFV(Common,DEFV(FonctionP,POINTERp(Iand(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1.AND.imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock PAND(X,Y,imageA1,imageA2,imageR); Eblock end_image Test(IL_FAUT(Iand_____complementer)) /* Test introduit le 20120408101714... */ Bblock CALi(Icomplementation(imageR,imageR)); Eblock ATes Bblock Eblock ETes RETI(imageR); Eblock EFonctionP #Aif ((Format_p==Format_char)||(Format_p==Format_int)) /* Common,DEFV(Fonction,) : la generation depend des conditions... */ #Eif ((Format_p==Format_char)||(Format_p==Format_int)) /* Common,DEFV(Fonction,) : la generation depend des conditions... */ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ #if ((Format_p==Format_char)||(Format_p==Format_int)) /* Common,DEFV(Fonction,) : la generation depend des conditions... */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* ' E O R ' L O G I Q U E D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(Logical,SINT(Ieor_____complementer,FAUX))); /* Introduit le 20120408101714 afin de pouvoir faire des operations compatibles avec ce */ /* Jean-Paul Delahaye fait dans son article "La cryptographie visuelle" dans le numero */ /* numero 416 (06/2012) de Pour La Science, ou pour lui 'NOIR=VRAI' et 'BLANC=FAUX'... */ DEFV(Common,DEFV(FonctionP,POINTERp(Ieor(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1.EOR.imageA2. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ begin_image Bblock PEOR(X,Y,imageA1,imageA2,imageR); Eblock end_image Test(IL_FAUT(Ieor_____complementer)) /* Test introduit le 20120408101714... */ Bblock CALi(Icomplementation(imageR,imageR)); Eblock ATes Bblock Eblock ETes RETI(imageR); Eblock EFonctionP #Aif ((Format_p==Format_char)||(Format_p==Format_int)) /* Common,DEFV(Fonction,) : la generation depend des conditions... */ #Eif ((Format_p==Format_char)||(Format_p==Format_int)) /* Common,DEFV(Fonction,) : la generation depend des conditions... */ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* R E C H E R C H E D E S N I V E A U X C O M M U N S A D E U X I M A G E S F L O T T A N T E S */ /* M A I S E N G E N E R A L E N D E S P O I N T S D E C O O R D O N N E E S D I F F E R E N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF #define RECHERCHE_DES_NIVEAUX_COMMUNS_A_2_IMAGES(image1,image2) \ Bblock \ begin_image \ Bblock \ DEFV(genere_Float,INIT(niveau_courant_de_image1,loadF_point(image1,X,Y))); \ /* Niveau courant de 'image1'... */ \ \ begin_image \ Bblock \ DEFV(genere_Float,INIT(niveau_courant_de_image2,loadF_point(image2,X,Y))); \ /* Niveau courant de 'image2'... */ \ \ Test(IFOU(IFET(IL_FAUT(IFniveaux_communs_a_peu_pres_____executer_IFEQ_a_peu_pres_relatif) \ ,IFEQ_a_peu_pres_relatif(niveau_courant_de_image1 \ ,niveau_courant_de_image2 \ ,IFniveaux_communs_a_peu_pres_____pourcentage_egalite_des_niveaux \ ) \ ) \ /* On notera que si le pourcentage est nul, alors l'egalite est stricte... */ \ ,IFET(IL_NE_FAUT_PAS(IFniveaux_communs_a_peu_pres_____executer_IFEQ_a_peu_pres_relatif) \ ,IFEQ_a_peu_pres_absolu(niveau_courant_de_image1 \ ,niveau_courant_de_image2 \ ,IFniveaux_communs_a_peu_pres_____epsilon_egalite_des_niveaux \ ) \ ) \ ) \ ) \ Bblock \ storeF_point(CHOI(niveau_courant_de_image2,niveau_courant_de_image1) \ ,imageR \ ,X,Y \ ); \ /* Ainsi, on marque tous les points {X,Y} de 'image2' qui ont un niveau existant quelque */ \ /* part dans 'image1' (en general en des coordonnees en general differentes de {X,Y}). On */ \ /* notera donc bien qu'ainsi on ne marque pas les points {X,Y} qui ont le meme niveau dans */ \ /* 'image1' et dans 'image2'... */ \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ Eblock \ end_image \ Eblock \ end_image \ Eblock \ /* Balayage d'une premiere image pour chaque point d'une seconde image... */ DEFV(Common,DEFV(Float,SINT(IFniveaux_communs_a_peu_pres_____valeur_des_niveaux_non_communs,FZERO))); /* Valeur des niveaux qui ne sont pas communs a 'imageA1' et a 'imageA2'... */ DEFV(Common,DEFV(Logical,SINT(IFniveaux_communs_a_peu_pres_____executer_IFEQ_a_peu_pres_relatif,VRAI))); /* Afin de choisir entre le test relatif 'IFEQ_a_peu_pres_relatif(...)' ('VRAI') et le */ /* test absolu 'IFEQ_a_peu_pres_absolu(...)' ('FAUX'). */ DEFV(Common,DEFV(Float,SINT(IFniveaux_communs_a_peu_pres_____pourcentage_egalite_des_niveaux,FRA10(FRA10(FRA10(FRA10(FU))))))); DEFV(Common,DEFV(Float,SINT(IFniveaux_communs_a_peu_pres_____epsilon_egalite_des_niveaux,FRA10(FRA10(FU))))); /* Pourcentage et epsilon des tests ci-dessus. On notera que si le pourcentage est nul, */ /* alors l'egalite est stricte (dans le cas du test relatif...). */ DEFV(Common,DEFV(FonctionF,POINTERF(IFniveaux_communs_a_peu_pres(imageR,imageA1,imageA2)))) /* Fonction introduite le 20060417175238 dans le but (peut-etre de generer des intersections */ /* de surface via 'v $xrs/project2D.02$Z'...). */ DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=NiveauxCommuns(imageA1,imageA2). */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ CALi(IFinitialisation(imageR,IFniveaux_communs_a_peu_pres_____valeur_des_niveaux_non_communs)); /* Initialisation de 'imageR'... */ RECHERCHE_DES_NIVEAUX_COMMUNS_A_2_IMAGES(imageA1,imageA2); /* Premiere passe avec balayage de 'imageA2' pour chaque point de 'imageA1'... */ RECHERCHE_DES_NIVEAUX_COMMUNS_A_2_IMAGES(imageA2,imageA1); /* Premiere passe avec balayage de 'imageA1' pour chaque point de 'imageA2'... */ RETIF(imageR); Eblock #undef RECHERCHE_DES_NIVEAUX_COMMUNS_A_2_IMAGES EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P R O D U I T G E N E R A L I S E D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iproduit_generalise(imageR,imageA1,imageA2,table_de_multiplication)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=imageA1#imageA2, ou '#' symbolise un */ /* produit generalise. */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(table_de_multiplication_generalisee,table_de_multiplication)); /* Matrice donnant la table de multiplication courante... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ Test(IFET(IFID(table_de_multiplication,table_de_multiplication_standard) ,EST_INVALIDE(initialisation_table_de_multiplication_standard) ) ) Bblock PRINT_ERREUR("la table de multiplication standard n'est pas initialisee"); Eblock ATes Bblock traite_image_BH_GD(BLOC(store_point(ACCES_A_UN_PRODUIT_GENERALISE(table_de_multiplication ,load_point(imageA1,X,Y) ,load_point(imageA2,X,Y) ) ,imageR ,X,Y ,FVARIABLE ); ) ); /* La procedure 'ACCES_A_UN_PRODUIT_GENERALISE(...)' a ete introduite le 20021003102723 */ /* en changeant de nom le 20021105170823... */ Eblock ETes RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A S Q U A G E D ' U N E I M A G E P A R U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iproduit_de_masquage(imageR,premier_plan,arriere_plan)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=deuxieme image cachee par la premiere. */ DEFV(Argument,DEFV(image,premier_plan)); DEFV(Argument,DEFV(image,arriere_plan)); /* Images Arguments de premier- et d'arriere-plans */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(table_de_multiplication_generalisee,table_de_masquage); /* Table de multiplication generalisee donnant la fonction de masquage. */ /*..............................................................................................................................*/ INITIALISATION_TABLE_DE_MULTIPLICATION(table_de_masquage,PRODUIT_MASQUE); /* Initialisation de la table de multiplication generalisee */ /* donnant la fonction de masquage. */ CALS(Iproduit_generalise(imageR,premier_plan,arriere_plan,table_de_masquage)); RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* A N T I - M A S Q U A G E D ' U N E I M A G E P A R U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iproduit_d_anti_masquage(imageR,premier_plan,arriere_plan)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=deuxieme image la ou n'est pas la premiere. */ DEFV(Argument,DEFV(image,premier_plan)); DEFV(Argument,DEFV(image,arriere_plan)); /* Images Arguments de premier- et d'arriere-plans */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(table_de_multiplication_generalisee,table_d_anti_masquage); /* Table de multiplication generalisee donnant la fonction d'anti-masquage. */ /*..............................................................................................................................*/ INITIALISATION_TABLE_DE_MULTIPLICATION(table_d_anti_masquage,PRODUIT_ANTI_MASQUE); /* Initialisation de la table de multiplication generalisee */ /* donnant la fonction d'anti-masquage. */ CALS(Iproduit_generalise(imageR,premier_plan,arriere_plan,table_d_anti_masquage)); RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A S Q U A G E " A N T I - A L I A S E " D ' U N E I M A G E P A R U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iproduit_de_masquage_anti_aliase(imageR,premier_plan,arriere_plan)))) /* Fonction introduite le 20090126110755... */ DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=deuxieme image cachee par la premiere. */ DEFV(Argument,DEFV(image,premier_plan)); DEFV(Argument,DEFV(image,arriere_plan)); /* Images Arguments de premier- et d'arriere-plans */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(table_de_multiplication_generalisee,table_de_masquage); /* Table de multiplication generalisee donnant la fonction de masquage. */ /*..............................................................................................................................*/ INITIALISATION_TABLE_DE_MULTIPLICATION(table_de_masquage,PRODUIT_MASQUE_ANTI_ALIASE); /* Initialisation de la table de multiplication generalisee */ /* donnant la fonction de masquage. */ CALS(Iproduit_generalise(imageR,premier_plan,arriere_plan,table_de_masquage)); RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* " D E P T H - C U E I N G " D ' U N E I M A G E P A R U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iproduit_de_depth_cueing(imageR,profondeur,imageA)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=deuxieme image attenuee par la premiere. */ DEFV(Argument,DEFV(image,profondeur)); DEFV(Argument,DEFV(image,imageA)); /* Images Arguments. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(table_de_multiplication_generalisee,table_de_depth_cueing); /* Table de multiplication generalisee donnant la fonction de "depth-cueing". */ /*..............................................................................................................................*/ INITIALISATION_TABLE_DE_MULTIPLICATION(table_de_depth_cueing,PRODUIT_DEPTH_CUEING); /* Initialisation de la table de multiplication generalisee */ /* donnant la fonction de "depth-cueing". */ CALS(Iproduit_generalise(imageR,profondeur,imageA,table_de_depth_cueing)); RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* " B R O U I L L A R D " D ' U N E I M A G E P A R U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iproduit_de_brume(imageR,profondeur,imageA)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=deuxieme image attenuee par la premiere. */ DEFV(Argument,DEFV(image,profondeur)); DEFV(Argument,DEFV(image,imageA)); /* Images Arguments. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(table_de_multiplication_generalisee,table_de_brume); /* Table de multiplication generalisee donnant la fonction de "brume". */ /*..............................................................................................................................*/ INITIALISATION_TABLE_DE_MULTIPLICATION(table_de_brume,PRODUIT_BRUME); /* Initialisation de la table de multiplication generalisee */ /* donnant la fonction de "brume". */ CALS(Iproduit_generalise(imageR,profondeur,imageA,table_de_brume)); RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D E F I N I T I O N D E T O U T E S L E S F O N C T I O N S D E */ /* T R A N S P A R E N C E Q U E L C O N Q U E D ' U N E I M A G E V U E D E R R I E R E U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ #pragma xcg__gen_ext_Z__gen_Fonction_SE__GENERE__Fonction GENERE__FonctionP_I_TRANSPARENCE POINTERp /* Introduit le 20040520121121. */ #define GENERE__FonctionP_I_TRANSPARENCE(nom_et_arguments_de_la_fonction,nom_de_la_transparence) \ /* ATTENTION : le nom de la fonction est suivi de ses arguments pour des raisons liees */ \ /* a la recuperation automatique des fichiers d'arguments ; on trouvera donc : */ \ /* */ \ /* GENERE__FonctionP_I_TRANSPARENCE(nom_de_la_fonction(imageR,avant,arriere)) */ \ /* */ \ /* ou 'avant' designe 'premier_plan' et 'arriere', 'arriere_plan'. */ \ DEFV(FonctionP,POINTERp(nom_et_arguments_de_la_fonction)) \ /* ATTENTION, il ne faut pas ecrire : */ \ /* */ \ /* DEFV(Common,DEFV(FonctionP,POINTERp(nom_et_arguments_de_la_fonction))) */ \ /* */ \ /* puisqu'en effet la directive 'Common' est utilisee lors de l'appel par : */ \ /* */ \ /* DEFV(Common,GENERE__FonctionP_I_TRANSPARENCE(...)) */ \ /* */ \ /* Actuellement cette redondance ne serait pas genante, mais plus tard... */ \ DEFV(Argument,DEFV(image,imageR)); \ /* Image Resultat, telle que : imageR=deuxieme image vue derriere la premiere. */ \ DEFV(Argument,DEFV(image,premier_plan)); \ DEFV(Argument,DEFV(image,arriere_plan)); \ /* Images Arguments de premier- et d'arriere-plans ; de temps en temps */ \ /* l'image de premier plan sera appelee "vitre"... */ \ /*-----------------------------------------------------------------------------------------------------------------------------------*/ \ Bblock \ DEFV(table_de_multiplication_generalisee,table_de_transparence); \ /* Table de multiplication generalisee donnant la fonction de transparence. */ \ /*..............................................................................................................................*/ \ INITIALISATION_TABLE_DE_MULTIPLICATION(table_de_transparence,PRODUIT_TRANSPARENCE`nom_de_la_transparence); \ /* Initialisation de la table de multiplication generalisee */ \ /* donnant la fonction de transparence. */ \ CALS(Iproduit_generalise(imageR,premier_plan,arriere_plan,table_de_transparence)); \ \ RETI(imageR); \ Eblock /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* T R A N S P A R E N C E ' 0 1 ' D ' U N E I M A G E V U E D E R R I E R E U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,GENERE__FonctionP_I_TRANSPARENCE(Itransparence_01(imageR,premier_plan,arriere_plan),_01)) /* Common,DEFV(Fonction,) : */ EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* T R A N S P A R E N C E ' 0 2 ' D ' U N E I M A G E V U E D E R R I E R E U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,GENERE__FonctionP_I_TRANSPARENCE(Itransparence_02(imageR,premier_plan,arriere_plan),_02)) /* Common,DEFV(Fonction,) : */ EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* T R A N S P A R E N C E ' 0 3 ' D ' U N E I M A G E V U E D E R R I E R E U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,GENERE__FonctionP_I_TRANSPARENCE(Itransparence_03(imageR,premier_plan,arriere_plan),_03)) /* Common,DEFV(Fonction,) : */ EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* T R A N S P A R E N C E ' 0 4 ' D ' U N E I M A G E V U E D E R R I E R E U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,GENERE__FonctionP_I_TRANSPARENCE(Itransparence_04(imageR,premier_plan,arriere_plan),_04)) /* Common,DEFV(Fonction,) : */ EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* T R A N S P A R E N C E ' 0 5 ' D ' U N E I M A G E V U E D E R R I E R E U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,GENERE__FonctionP_I_TRANSPARENCE(Itransparence_05(imageR,premier_plan,arriere_plan),_05)) /* Common,DEFV(Fonction,) : */ EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* T R A N S P A R E N C E ' 0 6 ' D ' U N E I M A G E V U E D E R R I E R E U N E A U T R E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,GENERE__FonctionP_I_TRANSPARENCE(Itransparence_06(imageR,premier_plan,arriere_plan),_06)) /* Common,DEFV(Fonction,) : */ EFonctionP /* Fonction introduite le 20070312095307... */ #undef GENERE__FonctionP_I_TRANSPARENCE /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* R E C H E R C H E D E S P O I N T S C O M M U N S A D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Ipoints_communs(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=l'ensemble des points de meme niveau des deux */ /* images Arguments (voir 'POINTS_DE_MEME_NIVEAU' et 'POINTS_DE_NIVEAUX_DIFFERENTS'). */ DEFV(Argument,DEFV(image,imageA1)); /* Images Arguments a "comparer"... */ DEFV(Argument,DEFV(image,imageA2)); /* Images Arguments a "comparer"... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(table_de_multiplication_generalisee,table_d_identite); /* Table de multiplication generalisee donnant la fonction d'identite. */ /*..............................................................................................................................*/ INITIALISATION_TABLE_DE_MULTIPLICATION(table_d_identite,PRODUIT_IDENTITE); /* Initialisation de la table de multiplication generalisee */ /* donnant la fonction d'identite. */ CALS(Iproduit_generalise(imageR,imageA1,imageA2,table_d_identite)); RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* R E C H E R C H E D E L A " D I S T A N C E " ' N O I R ' D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Idistance_NOIR_des_points(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=un degrade de 'NOIR' (pour les points identiques) */ /* a 'BLANC' (pour les points les plus differents, et en fait l'un valant 'NOIR' et l'autre */ /* 'BLANC'...). */ DEFV(Argument,DEFV(image,imageA1)); /* Images Arguments a "comparer"... */ DEFV(Argument,DEFV(image,imageA2)); /* Images Arguments a "comparer"... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(table_de_multiplication_generalisee,table_de_distance); /* Table de multiplication generalisee donnant la fonction de distance 'NOIR' (c'est-a-dire */ /* donnant le 'NOIR' pour la coincidence...). */ /*..............................................................................................................................*/ INITIALISATION_TABLE_DE_MULTIPLICATION(table_de_distance,PRODUIT_DISTANCE_NOIR); /* Initialisation de la table de multiplication generalisee */ /* donnant la fonction d'identite. */ CALS(Iproduit_generalise(imageR,imageA1,imageA2,table_de_distance)); RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* R E C H E R C H E D E L A " D I S T A N C E " ' B L A N C ' D E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Idistance_BLANC_des_points(imageR,imageA1,imageA2)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=un degrade de 'BLANC' (pour les points identiques) */ /* a 'NOIR' (pour les points les plus differents). */ DEFV(Argument,DEFV(image,imageA1)); /* Images Arguments a "comparer"... */ DEFV(Argument,DEFV(image,imageA2)); /* Images Arguments a "comparer"... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(table_de_multiplication_generalisee,table_de_distance); /* Table de multiplication generalisee donnant la fonction de distance 'BLANC' (c'est-a-dire */ /* donnant le 'BLANC' pour la coincidence...). */ /*..............................................................................................................................*/ INITIALISATION_TABLE_DE_MULTIPLICATION(table_de_distance,PRODUIT_DISTANCE_BLANC); /* Initialisation de la table de multiplication generalisee */ /* donnant la fonction d'identite. */ CALS(Iproduit_generalise(imageR,imageA1,imageA2,table_de_distance)); RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P R O D U I T G E N E R A L I S E D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_____faire_IFnormalisation_automatique_des_operandes,VRAI))); /* Indicateur introduit le 20040129090203 pour permettre, par exemple, de traiter de */ /* facon identique un triplet {ROUGE,VERTE,BLEUE} en utilisant, par exemple, la commande */ /* 'v $xci/acces_RVB.22$Z'. La valeur implicite assure la compatibilite anterieure... */ #define EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(parametre_en_cause,valeur_inversible_de_ce_parametre,message,format) \ Bblock \ Test(IFNE(parametre_en_cause,valeur_inversible_de_ce_parametre)) \ Bblock \ DEFV(CHAR,INIC(POINTERc(format_EGAq____EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE) \ ,chain_Aconcaten5("Le parametre '%s' vaut " \ ,format \ ," alors que seule la valeur " \ ,format \ ," permet l'inversibilite du produit generalise.\n" \ ) \ ) \ ); \ \ CAL1(Prer3(format_EGAq____EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE \ ,message \ ,parametre_en_cause \ ,valeur_inversible_de_ce_parametre \ ) \ ); \ \ CALZ_FreCC(format_EGAq____EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE); \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ Eblock \ /* Pour editer les parametres non inversibles (introduit le 20040229174106). */ DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_____avertir_de_la_non_inversibilite_eventuelle,VRAI))); /* Indicateur introduit le 20040229092317... */ DEFV(Common,DEFV(Float,SINT(IFproduit_generalise_____facteur_des_coordonnees_X,FU))); DEFV(Common,DEFV(Int,SINT(IFproduit_generalise_____translateur_des_coordonnees_X,ZERO))); DEFV(Common,DEFV(Float,SINT(IFproduit_generalise_____facteur_des_coordonnees_Y,FU))); DEFV(Common,DEFV(Int,SINT(IFproduit_generalise_____translateur_des_coordonnees_Y,ZERO))); /* Modificateurs de {coordonnee_X_du_produit,coordonnee_Y_du_produit} introduits le */ /* 20040228091122. On notera que les "translateurs" sont dans [Xmin,Xmax]x[Ymin,Ymax]... */ DEFV(Common,DEFV(Float,SINT(IFproduit_generalise_____ponderation_des_coordonnees_X_n,FU))); DEFV(Common,DEFV(Float,SINT(IFproduit_generalise_____ponderation_des_coordonnees_X_X,FZERO))); DEFV(Common,DEFV(Float,SINT(IFproduit_generalise_____ponderation_des_coordonnees_X_Y,FZERO))); DEFV(Common,DEFV(Float,SINT(IFproduit_generalise_____ponderation_des_coordonnees_Y_n,FU))); DEFV(Common,DEFV(Float,SINT(IFproduit_generalise_____ponderation_des_coordonnees_Y_X,FZERO))); DEFV(Common,DEFV(Float,SINT(IFproduit_generalise_____ponderation_des_coordonnees_Y_Y,FZERO))); /* Ponderations des niveaux et des coordonnees {X,Y} lors du calcul des coordonnees */ /* {coordonnee_X_du_produit,coordonnee_Y_du_produit} introduites le 20040831142515 et */ /* initialisees par {1,0,0} de facon a garantir la compatibilite anterieure... */ DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_____periodiser_X,VRAI))); DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_____periodiser_Y,VRAI))); DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_____symetriser_X,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_____symetriser_Y,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_____prolonger_X,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_____prolonger_Y,FAUX))); DEFV(Common,DEFV(genere_Float,SINT(IFproduit_generalise_____niveau_hors_image,COORDONNEE_BARYCENTRIQUE_MINIMALE))); /* Pour remplacer 'loadF_point_valide(...)' par 'FFload_point(...)' le 20040228091122. */ /* Le 'Float' est devenu logiquement un 'genere_Float' le 20041107115559... */ /* La possibilite de symetriser a ete introduite le 20050721105359... */ DEFV(Common,DEFV(FonctionF,POINTERF(IFproduit_generalise(imageR,imageA1,imageA2,table_de_multiplication)))) /* Fonction introduite le 20040127141401... */ DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1#imageA2, ou '#' symbolise un */ /* produit generalise. */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(imageF,table_de_multiplication)); /* Image donnant la table de multiplication courante... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,imageA1_normalisee); BDEFV(imageF,imageA2_normalisee); /* Images intermediaires normalisees... */ /*..............................................................................................................................*/ Test(IZEQ(ADD3(IFproduit_generalise_____ponderation_des_coordonnees_X_n ,IFproduit_generalise_____ponderation_des_coordonnees_X_X ,IFproduit_generalise_____ponderation_des_coordonnees_X_Y ) ) ) Bblock PRINT_ATTENTION("la somme des trois ponderations {niveau,X,Y} relative a la coordonnee 'X' est nulle"); /* Effectivement, cela va provoquer des divisions par zero lors du 'LRZ3(...)' correspondant */ /* ci-apres... */ Eblock ATes Bblock Eblock ETes Test(IZEQ(ADD3(IFproduit_generalise_____ponderation_des_coordonnees_Y_n ,IFproduit_generalise_____ponderation_des_coordonnees_Y_X ,IFproduit_generalise_____ponderation_des_coordonnees_Y_Y ) ) ) Bblock PRINT_ATTENTION("la somme des trois ponderations {niveau,X,Y} relative a la coordonnee 'Y' est nulle"); /* Effectivement, cela va provoquer des divisions par zero lors du 'LRZ3(...)' correspondant */ /* ci-apres... */ Eblock ATes Bblock Eblock ETes Test(IL_FAUT(IFproduit_generalise_____avertir_de_la_non_inversibilite_eventuelle)) Bblock Test(I4OU(IFOU(IFNE(IFproduit_generalise_____facteur_des_coordonnees_X,FLOT__NEUTRE) ,IZNE(IFproduit_generalise_____translateur_des_coordonnees_X) ) ,IFOU(IFNE(IFproduit_generalise_____facteur_des_coordonnees_Y,FLOT__NEUTRE) ,IZNE(IFproduit_generalise_____translateur_des_coordonnees_Y) ) ,I3OU(IFNE(IFproduit_generalise_____ponderation_des_coordonnees_X_n,FLOT__NEUTRE) ,IZNE(IFproduit_generalise_____ponderation_des_coordonnees_X_X) ,IZNE(IFproduit_generalise_____ponderation_des_coordonnees_X_Y) ) ,I3OU(IFNE(IFproduit_generalise_____ponderation_des_coordonnees_Y_n,FLOT__NEUTRE) ,IZNE(IFproduit_generalise_____ponderation_des_coordonnees_Y_X) ,IZNE(IFproduit_generalise_____ponderation_des_coordonnees_Y_Y) ) ) ) Bblock PRINT_ATTENTION("ce produit generalise n'est pas inversible"); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____facteur_des_coordonnees_X ,FLOT__NEUTRE ,"facteur de la coordonnee X" ,"%f" ); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____translateur_des_coordonnees_X ,ZERO ,"translateur de la coordonnee X" ,"%d" ); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____facteur_des_coordonnees_Y ,FLOT__NEUTRE ,"facteur de la coordonnee Y" ,"%f" ); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____translateur_des_coordonnees_Y ,ZERO ,"translateur de la coordonnee Y" ,"%d" ); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____ponderation_des_coordonnees_X_n ,FLOT__NEUTRE ,"ponderateur du niveau pour la coordonnee X" ,"%f" ); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____ponderation_des_coordonnees_X_X ,FZERO ,"ponderateur de X pour la coordonnee X" ,"%f" ); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____ponderation_des_coordonnees_X_Y ,FZERO ,"ponderateur de Y pour la coordonnee X" ,"%f" ); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____ponderation_des_coordonnees_Y_n ,FLOT__NEUTRE ,"ponderateur du niveau pour la coordonnee Y" ,"%f" ); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____ponderation_des_coordonnees_Y_X ,FZERO ,"ponderateur de X pour la coordonnee Y" ,"%f" ); EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE(IFproduit_generalise_____ponderation_des_coordonnees_Y_Y ,FZERO ,"ponderateur de Y pour la coordonnee Y" ,"%f" ); Eblock ATes Bblock Eblock ETes Eblock ATes Bblock Eblock ETes Test(IL_FAUT(IFproduit_generalise_____faire_IFnormalisation_automatique_des_operandes)) Bblock CALS(IFnormalisation_automatique(imageA1_normalisee,imageA1)); CALS(IFnormalisation_automatique(imageA2_normalisee,imageA2)); /* Normalisation de 'imageA1' et de 'imageA2'... */ Eblock ATes Bblock CALS(IFmove(imageA1_normalisee,imageA1)); CALS(IFmove(imageA2_normalisee,imageA2)); /* Transfert de 'imageA1' et de 'imageA2' en conservant leurs niveaux... */ Eblock ETes traite_image_BH_GD(BLOC(DEFV(Int,INIT(coordonnee_X_du_produit ,ADD2(_cDENORMALISE_OX(MUL2(IFproduit_generalise_____facteur_des_coordonnees_X ,LRZ3(IFproduit_generalise_____ponderation_des_coordonnees_X_n ,loadF_point(imageA1_normalisee,X,Y) ,IFproduit_generalise_____ponderation_des_coordonnees_X_X ,_____cNORMALISE_OX(X) ,IFproduit_generalise_____ponderation_des_coordonnees_X_Y ,_____cNORMALISE_OY(Y) ) ) ) ,IFproduit_generalise_____translateur_des_coordonnees_X ) ) ); DEFV(Int,INIT(coordonnee_Y_du_produit ,ADD2(_cDENORMALISE_OY(MUL2(IFproduit_generalise_____facteur_des_coordonnees_Y ,LRZ3(IFproduit_generalise_____ponderation_des_coordonnees_Y_n ,loadF_point(imageA2_normalisee,X,Y) ,IFproduit_generalise_____ponderation_des_coordonnees_Y_X ,_____cNORMALISE_OX(X) ,IFproduit_generalise_____ponderation_des_coordonnees_Y_Y ,_____cNORMALISE_OY(Y) ) ) ) ,IFproduit_generalise_____translateur_des_coordonnees_Y ) ) ); storeF_point(FFload_point(table_de_multiplication ,coordonnee_X_du_produit ,coordonnee_Y_du_produit ,IFproduit_generalise_____periodiser_X ,IFproduit_generalise_____periodiser_Y ,IFproduit_generalise_____symetriser_X ,IFproduit_generalise_____symetriser_Y ,IFproduit_generalise_____prolonger_X ,IFproduit_generalise_____prolonger_Y ,IFproduit_generalise_____niveau_hors_image ) ,imageR ,X,Y ); /* Et calcul du produit... */ /* */ /* Principe du produit generalise : */ /* */ /* */ /* A1 (gauche) A2 (droite) */ /* ============ ============ */ /* */ /* ------------------ ------------------ */ /* | | | | */ /* | | | | */ /* | | | | */ /* Y |----[X'] . . . | Y |----[Y'] . . . | */ /* | | . | | | . | */ /* | | . | | | . | */ /* ------------------ ------------------ */ /* X . X . */ /* . . */ /* . . */ /* (1) . . (2) */ /* . Table Multiplication . */ /* . ==================== . */ /* . . */ /* . . . . . . . . . . */ /* . . */ /* . . */ /* \./ . */ /* ------------------ . */ /* | | . */ /* Y' |--------[N] . . |< . . . . . . . */ /* | | . | */ /* | | . | */ /* | | . | */ /* | | . | */ /* ------------------ */ /* X' . */ /* . */ /* . */ /* . (3) */ /* . */ /* R . */ /* = . */ /* . */ /* ------------------ */ /* | . | */ /* | . | */ /* | . | */ /* Y |----[N] < . . . | */ /* | | | */ /* | | | */ /* ------------------ */ /* X */ /* */ ) ); EDEFV(imageF,imageA2_normalisee); EDEFV(imageF,imageA1_normalisee); /* Images intermediaires normalisees... */ RETIF(imageR); Eblock #undef EDITION_DES_PARAMETRES_DE_NON_INVERSIBILITE EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ #ifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 /* Introduit le 20040228084922... */ @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxDebian_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxMandrake_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxRedHat_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUbuntu_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUbuntu_ICC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUlmint_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUlmint_ICC /* Introduit le 20040204122603 pour corriger le probleme du 20040203155703 ci-apres... */ /* */ /* Le 20040209153210, le programme 'v $Dbugs/APC$D/LinuxDebian$D/GCC$D/flottant.01$c' a */ /* definitivement mis en cause la compilation et l'optimisation ; ce n'est donc pas moi */ /* qui suis reponsable... */ /* */ /* Le 20040220111107, grace a 'v $Fcompilers 20040220103647', l'optimisation a pu etre */ /* retablie. */ #Aifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 #Eifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N V E R S I O N A G A U C H E ( I N C O N N U E ' A1 ') D U P R O D U I T G E N E R A L I S E */ /* D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_inverse_a_gauche_A1_____faire_IFnormalisation_automatique_des_operandes,VRAI))); /* Indicateur introduit le 20040203094008 pour permettre, par exemple, de traiter de */ /* facon identique un triplet {ROUGE,VERTE,BLEUE} en utilisant, par exemple, la commande */ /* 'v $xci/acces_RVB.22$Z'. La valeur implicite assure la compatibilite anterieure... */ DEFV(Common,DEFV(FonctionF,POINTERF(IFproduit_generalise_inverse_a_gauche_A1(imageR_A1,imageA1_R,imageA2,table_de_multiplication)))) /* Fonction introduite le 20040203121217... */ DEFV(Argument,DEFV(imageF,imageR_A1)); /* Image Resultat, telle que : imageA1_R=imageR_A1#imageA2, ou '#' symbolise un */ /* produit generalise. Elle correspond a 'imageA1' de 'IFproduit_generalise(...)', */ /* d'ou l'expression "inverse a gauche", l'image 'imageR_A1' etant a gauche de '#'... */ DEFV(Argument,DEFV(imageF,imageA1_R)); /* Premiere image Argument. Elle correspond a 'imageR' de 'IFproduit_generalise(...)'. */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(imageF,table_de_multiplication)); /* Image donnant la table de multiplication courante... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,imageA2_normalisee); /* Image intermediaire normalisee... */ /*..............................................................................................................................*/ Test(IL_FAUT(IFproduit_generalise_inverse_a_gauche_A1_____faire_IFnormalisation_automatique_des_operandes)) Bblock CALS(IFnormalisation_automatique(imageA2_normalisee,imageA2)); /* Normalisation de 'imageA2'... */ Eblock ATes Bblock CALS(IFmove(imageA2_normalisee,imageA2)); /* Transfert de 'imageA2' en conservant ses niveaux... */ Eblock ETes begin_image Bblock DEFV(Int,INIT(coordonnee_X_du_produit,Xmin)); DEFV(Int,INIT(coordonnee_Y_du_produit,_cDENORMALISE_OY(loadF_point(imageA2_normalisee,X,Y)))); DEFV(genere_Float,INIT(niveau_courant_de_imageA1_R,loadF_point(imageA1_R,X,Y))); DEFV(genere_Float,INIT(distance_minimale_des_niveaux_de_imageA1_R_et_de_table_de_multiplication,F_INFINI)); Test(TEST_HORS_IMAGE(coordonnee_X_du_produit,coordonnee_Y_du_produit)) Bblock PRINT_ERREUR("les coordonnees du produit generalise inverse a gauche sont incorrectes"); CAL1(Prer3("X=%d : doit etre dans [%d,%d]\n",coordonnee_X_du_produit,Xmin,Xmax)); CAL1(Prer3("Y=%d : doit etre dans [%d,%d]\n",coordonnee_Y_du_produit,Ymin,Ymax)); Eblock ATes Bblock Eblock ETes begin_ligne /* Principe du produit generalise inverse a GAUCHE : */ /* */ /* */ /* A1 (gauche) A2 (droite) */ /* ============ ============ */ /* ------------------ ------------------ */ /* | | | | */ /* | ? | | | */ /* | | | | */ /* Y |------[X'] < . | Y |------[Y'] . . | */ /* | | . | | | . | */ /* | | . | | | . | */ /* ------------------ ------------------ */ /* X . X . */ /* . . */ /* (1) . . (2) */ /* . . */ /* . Table Multiplication . */ /* . ==================== . */ /* . . */ /* . . . . . . . . . . */ /* . . */ /* X' . */ /* ------------------ . */ /* | . | . */ /* balayage HORIZONTAL : Y' |--------[N']------| Y' < . . . . . */ /* | . | */ /* | . . . | */ /* | . | */ /* | . | */ /* ------------------ */ /* X' . */ /* . */ /* . */ /* (3) comparaison (N ~ N') */ /* . */ /* . */ /* R . */ /* = . */ /* ------------------ */ /* | . | */ /* | . | */ /* | . | */ /* Y |------[N]. . . | */ /* | | | */ /* | | | */ /* ------------------ */ /* X */ /* */ /* */ /* ATTENTION : le processus consiste donc a balayer horizontalement ('Y' est constant et 'X' */ /* varie) l'image 'table_de_multiplication'. Dans ces conditions, si cette image est faite */ /* de bandes horizontales, le resultat de ce balayage sera : */ /* */ /* coordonnee_X_du_produit = Xmin \-/ Y */ /* */ /* L'image Resultat ('imageR_A1') sera donc parfaitement uniforme (et meme nulle...). */ /* */ /* Dans tous les cas, les niveaux de l'image Resultat ('imageR_A1') sont dans [0,1]... */ Bblock DEFV(genere_Float,INIT(niveau_courant_de_table_de_multiplication,FLOT__NIVEAU_UNDEF)); DEFV(Float,INIT(distance_courante_des_niveaux_de_imageA1_R_et_de_table_de_multiplication,FLOT__UNDEF)); EGAL(niveau_courant_de_table_de_multiplication ,loadF_point_valide(table_de_multiplication,X,coordonnee_Y_du_produit) ); EGAL(distance_courante_des_niveaux_de_imageA1_R_et_de_table_de_multiplication ,SOUA(niveau_courant_de_table_de_multiplication,niveau_courant_de_imageA1_R) ); Test(sfIFGT(distance_minimale_des_niveaux_de_imageA1_R_et_de_table_de_multiplication ,distance_courante_des_niveaux_de_imageA1_R_et_de_table_de_multiplication ) ) /* Le 20040305100050, la procedure 'sfIFGT(...)' a remplace 'IFGT(...)' au cas ou */ /* 'BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01' se manifesterait malgre tout, bien */ /* que n'ayant pas ete detecte... */ Bblock #ifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 /* Jusqu'au 20040228084922, il y a eu ici : */ /* */ /* DEFV(genere_Float,INIT(variable_inutile */ /* ,loadF_point(table_de_multiplication */ /* ,X */ /* ,coordonnee_Y_du_produit */ /* ) */ /* ) */ /* ); */ /* */ /* Ceci avait ete introduit le 20040203155703 car, en effet, il a ete note qu'avec une image */ /* 'table_de_multiplication' faite de lignes horizontales uniformes generee, par exemple, */ /* par : */ /* */ /* $xci/sinus$X standard=faux cx=0 cy=16 R=... $formatI */ /* */ /* le comportement etait anormal ; en effet, 'niveau_courant_de_table_de_multiplication' */ /* est constant sur chaque ligne et ainsi le 'Test(...)' precedent n'est VRAI qu'une seule */ /* fois par ligne (le 'IFGT(...)' etant un test strict). Or il apparait que pour environ */ /* 50% des lignes, ce 'Test(...)' est VRAI pour tous leurs points. La definition */ /* precedente fait disparaitre le probleme. Il est a noter qu'il en est de meme si l'on */ /* supprime l'optimisation dans la definition de '$Cc' ; malheureusement, cette solution */ /* est mauvaise car alors les performances chutent brutalement ; en contre-partie, elle */ /* s'applique partout ou ce "bug" existe (a condition de recompiler...), alors que le */ /* solution ici utilisee demande a ce que les fonctions problematiques aient ete recensees. */ /* */ /* On notera qu'a compter du 20040204122533 le 'DEFV(...)' precedent n'est plus utile car */ /* ce "bug" a ete desactive dans 'v $xil/defi_c1$vv$DEF 20040204122533' car il est plus */ /* subtil et plus fin de le corriger localement en desactivant l'optimisation pour cette */ /* fonction. Mais par prudence on conserve ce 'DEFV(...)' car, en effet, on ne sait jamais. */ /* */ /* Le 20040209153210, le programme 'v $Dbugs/APC$D/LinuxDebian$D/GCC$D/flottant.01$c' a */ /* definitivement mis en cause la compilation et l'optimisation ; ce n'est donc pas moi */ /* qui suis reponsable... */ #Aifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 #Eifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 EGAL(distance_minimale_des_niveaux_de_imageA1_R_et_de_table_de_multiplication ,distance_courante_des_niveaux_de_imageA1_R_et_de_table_de_multiplication ); EGAL(coordonnee_X_du_produit,X); /* Ainsi, on recupere les coordonnees {coordonnee_X_du_produit,coordonnee_Y_du_produit} du */ /* point de 'table_de_multiplication' dont le niveau est le plus proche de celui du point */ /* {X,Y} de 'imageA1_R', ceci se faisant grace a un parcours horizontal de la ligne */ /* d'ordonnee 'coordonnee_Y_du_produit'. */ Eblock ATes Bblock Eblock ETes Eblock end_ligne storeF_point(_____cNORMALISE_OX(COXR(coordonnee_X_du_produit)) ,imageR_A1 ,X,Y ); /* Et calcul de l'inverse "a gauche" (c'est-a-dire 'imageR_A1') du produit... */ Eblock end_image EDEFV(imageF,imageA2_normalisee); /* Image intermediaire normalisee... */ RETIF(imageR_A1); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ #ifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 /* Introduit le 20040228084922... */ @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxDebian_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxMandrake_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxRedHat_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUbuntu_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUbuntu_ICC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUlmint_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUlmint_ICC /* Introduit le 20040204122603 pour corriger le probleme du 20040203162407 ci-apres... */ /* */ /* Le 20040209153210, le programme 'v $Dbugs/APC$D/LinuxDebian$D/GCC$D/flottant.01$c' a */ /* definitivement mis en cause la compilation et l'optimisation ; ce n'est donc pas moi */ /* qui suis reponsable... */ /* */ /* Le 20040220111107, grace a 'v $Fcompilers 20040220103647', l'optimisation a pu etre */ /* retablie. */ #Aifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 #Eifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N V E R S I O N A D R O I T E ( I N C O N N U E ' A2 ') D U P R O D U I T G E N E R A L I S E */ /* D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_inverse_a_droite_A2_____faire_IFnormalisation_automatique_des_operandes,VRAI))); /* Indicateur introduit le 20040203094008 pour permettre, par exemple, de traiter de */ /* facon identique un triplet {ROUGE,VERTE,BLEUE} en utilisant, par exemple, la commande */ /* 'v $xci/acces_RVB.22$Z'. La valeur implicite assure la compatibilite anterieure... */ DEFV(Common,DEFV(FonctionF,POINTERF(IFproduit_generalise_inverse_a_droite_A2(imageR_A2,imageA1,imageA2_R,table_de_multiplication)))) /* Fonction introduite le 20040203094008... */ DEFV(Argument,DEFV(imageF,imageR_A2)); /* Image Resultat, telle que : imageA2_R=imageA1#imageR_A2, ou '#' symbolise un */ /* produit generalise. Elle correspond a 'imageA2' de 'IFproduit_generalise(...)', */ /* d'ou l'expression "inverse a droite", l'image 'imageR_A2' etant a droite de '#'... */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2_R)); /* Seconde image Argument. Elle correspond a 'imageR' de 'IFproduit_generalise(...)'. */ DEFV(Argument,DEFV(imageF,table_de_multiplication)); /* Image donnant la table de multiplication courante... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,imageA1_normalisee); /* Image intermediaire normalisee... */ /*..............................................................................................................................*/ Test(IL_FAUT(IFproduit_generalise_inverse_a_droite_A2_____faire_IFnormalisation_automatique_des_operandes)) Bblock CALS(IFnormalisation_automatique(imageA1_normalisee,imageA1)); /* Normalisation de 'imageA1'... */ Eblock ATes Bblock CALS(IFmove(imageA1_normalisee,imageA1)); /* Transfert de 'imageA1' en conservant ses niveaux... */ Eblock ETes begin_image Bblock DEFV(Int,INIT(coordonnee_X_du_produit,_cDENORMALISE_OX(loadF_point(imageA1_normalisee,X,Y)))); DEFV(Int,INIT(coordonnee_Y_du_produit,Ymin)); DEFV(genere_Float,INIT(niveau_courant_de_imageA2_R,loadF_point(imageA2_R,X,Y))); DEFV(genere_Float,INIT(distance_minimale_des_niveaux_de_imageA2_R_et_de_table_de_multiplication,F_INFINI)); Test(TEST_HORS_IMAGE(coordonnee_X_du_produit,coordonnee_Y_du_produit)) Bblock PRINT_ERREUR("les coordonnees du produit generalise inverse a droite sont incorrectes"); CAL1(Prer3("X=%d : doit etre dans [%d,%d]\n",coordonnee_X_du_produit,Xmin,Xmax)); CAL1(Prer3("Y=%d : doit etre dans [%d,%d]\n",coordonnee_Y_du_produit,Ymin,Ymax)); Eblock ATes Bblock Eblock ETes begin_colonne /* Principe du produit generalise inverse a DROITE : */ /* */ /* */ /* A1 (gauche) A2 (droite) */ /* ============ ============ */ /* ------------------ ------------------ */ /* | | | | */ /* | | | ? | */ /* | | | | */ /* Y |------[X'] . . | Y |------[Y'] < . | */ /* | | . | | | . | */ /* | | . | | | . | */ /* ------------------ ------------------ */ /* X . X . */ /* . . */ /* (1) . . (2) */ /* . . */ /* . Table Multiplication . */ /* . ==================== . */ /* . . . . . . . . . . */ /* . . */ /* \./ . */ /* X' . */ /* ------------------ . */ /* | | | . */ /* balayage VERTICAL : Y' |. . . . [N']. . . | Y' . . . . . . */ /* | | . | */ /* | | . | */ /* | | . | */ /* | | . | */ /* ------------------ */ /* X' . */ /* . */ /* . */ /* (3) comparaison (N ~ N') */ /* . */ /* . */ /* R . */ /* = . */ /* ------------------ */ /* | . | */ /* | . | */ /* | . | */ /* Y |------[N]. . . | */ /* | | | */ /* | | | */ /* ------------------ */ /* X */ /* */ /* */ /* ATTENTION : le processus consiste donc a balayer verticalement ('X' est constant et 'Y' */ /* varie) l'image 'table_de_multiplication'. Dans ces conditions, si cette image est faite */ /* de bandes verticales, le resultat de ce balayage sera : */ /* */ /* coordonnee_Y_du_produit = Ymin \-/ X */ /* */ /* L'image Resultat ('imageR_A2') sera donc parfaitement uniforme (et meme nulle...). Ceci */ /* s'est vu lors des tests initiaux avec une table de multiplication generee a l'aide de : */ /* */ /* $xci/sinus$X standard=faux cx=16 cy=0 R=... $formatI */ /* */ /* Dans tous les cas, les niveaux de l'image Resultat ('imageR_A2') sont dans [0,1]... */ Bblock DEFV(genere_Float,INIT(niveau_courant_de_table_de_multiplication,FLOT__NIVEAU_UNDEF)); DEFV(Float,INIT(distance_courante_des_niveaux_de_imageA2_R_et_de_table_de_multiplication,FLOT__UNDEF)); EGAL(niveau_courant_de_table_de_multiplication ,loadF_point_valide(table_de_multiplication,coordonnee_X_du_produit,Y) ); EGAL(distance_courante_des_niveaux_de_imageA2_R_et_de_table_de_multiplication ,SOUA(niveau_courant_de_table_de_multiplication,niveau_courant_de_imageA2_R) ); Test(sfIFGT(distance_minimale_des_niveaux_de_imageA2_R_et_de_table_de_multiplication ,distance_courante_des_niveaux_de_imageA2_R_et_de_table_de_multiplication ) ) /* Le 20040305100050, la procedure 'sfIFGT(...)' a remplace 'IFGT(...)' au cas ou */ /* 'BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01' se manifesterait malgre tout, bien */ /* que n'ayant pas ete detecte... */ Bblock #ifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 /* Jusqu'au 20040228084922, il y a eu ici : */ /* */ /* DEFV(genere_Float,INIT(variable_inutile */ /* ,loadF_point(table_de_multiplication */ /* ,coordonnee_X_du_produit */ /* ,Y */ /* ) */ /* ) */ /* ); */ /* */ /* Ceci avait ete introduit le 20040203162407 car, en effet, il a ete note qu'avec une image */ /* 'table_de_multiplication' faite de lignes horizontales uniformes generee, par exemple, */ /* par : */ /* */ /* $xci/sinus$X standard=faux cx=10 cy=0 R=... $formatI */ /* */ /* le comportement etait anormal ; en effet, 'niveau_courant_de_table_de_multiplication' */ /* est constant sur chaque colonne et ainsi le 'Test(...)' precedent n'est VRAI qu'une seule */ /* fois par colonne (le 'IFGT(...)' etant un test strict). Or il apparait que pour environ */ /* 50% des colonnes, ce 'Test(...)' est VRAI pour tous leurs points. La definition */ /* precedente fait disparaitre le probleme. Il est a noter qu'il en est de meme si l'on */ /* supprime l'optimisation dans la definition de '$Cc' ; malheureusement, cette solution */ /* est mauvaise car alors les performances chutent brutalement ; en contre-partie, elle */ /* s'applique partout ou ce "bug" existe (a condition de recompiler...), alors que le */ /* solution ici utilisee demande a ce que les fonctions problematiques aient ete recensees. */ /* */ /* On notera qu'a compter du 20040204122533 le 'DEFV(...)' precedent n'est plus utile car */ /* ce "bug" a ete desactive dans 'v $xil/defi_c1$vv$DEF 20040204122533' car il est plus */ /* subtil et plus fin de le corriger localement en desactivant l'optimisation pour cette */ /* fonction. Mais par prudence on conserve ce 'DEFV(...)' car, en effet, on ne sait jamais. */ /* */ /* Aux environs du 20040206173024 je reprends ces tests en inhibant la non optimisation */ /* (en supprimant les 'PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_Linux...'). Alors a ce */ /* niveau de la fonction, juste apres le 'Test(...)' ci-dessus, un 'printf(...)' d'edition */ /* de 'distance_minimale_des_niveaux_de_imageA2_R_et_de_table_de_multiplication' et de */ /* 'distance_courante_des_niveaux_de_imageA2_R_et_de_table_de_multiplication' (appelee par */ /* la suite respectivement 'dm' et 'dc') a ete implante ; il editait de plus la difference */ /* 'dm-dc' multipliee par 1e10. Le test fut fait avec les images suivantes : */ /* */ /* A1 generee par : $xci/sinus$X standard=faux cx=0 cy=10 */ /* A2 = T generees par : $xci/sinus$X standard=faux cx=10 cy=0 */ /* */ /* (avec les options "inverse=VRAI droite=VRAI" de '$xci/multi_02.04$X) et en format : */ /* */ /* Pal */ /* */ /* Le resultat fut le suivant pour X=249 (premiere colonne presentant une anomalie) : */ /* */ /* dm=0.4372669301948342 dc=0.4372669301948342 diff=0.0000002775557562 */ /* */ /* (ou 'diff' est egal a 'dm-dc' multiplie par 1e10). Ainsi, 'dm' et 'dc' different l'un */ /* de l'autre de 0.0000002x1e-10 soit 2e-17. Il semble donc que leur dernier bit (celui de */ /* leur representation flottante 64 bits) differe. On notera qu'un 'PETIT_DODO(...)' place */ /* devant le fameux 'Test(...)' ci-dessus (avec une attente d'une seule nanoseconde) fasse */ /* disparaitre l'anomalie, mais peut-etre que les temporisations bloquent l'optimisation. */ /* En tout etat de cause, 'dm' et 'dc' devraient etre identiques et different d'un bit. Il */ /* semble donc qu'il y a bien un probleme d'ordonnancement des instructions : une donnee */ /* ('dm' ou 'dc') pourrait etre utilisee alors qu'elle n'est pas encore entierement */ /* disponible (un seul bit ne le serait pas...). */ /* */ /* Le 20040209153210, le programme 'v $Dbugs/APC$D/LinuxDebian$D/GCC$D/flottant.01$c' a */ /* definitivement mis en cause la compilation et l'optimisation ; ce n'est donc pas moi */ /* qui suis reponsable... */ #Aifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 #Eifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 EGAL(distance_minimale_des_niveaux_de_imageA2_R_et_de_table_de_multiplication ,distance_courante_des_niveaux_de_imageA2_R_et_de_table_de_multiplication ); EGAL(coordonnee_Y_du_produit,Y); /* Ainsi, on recupere les coordonnees {coordonnee_X_du_produit,coordonnee_Y_du_produit} du */ /* point de 'table_de_multiplication' dont le niveau est le plus proche de celui du point */ /* {X,Y} de 'imageA2_R', ceci se faisant grace a un parcours vertical de la ligne */ /* d'abscisse 'coordonnee_X_du_produit'. */ Eblock ATes Bblock Eblock ETes Eblock end_colonne storeF_point(_____cNORMALISE_OY(COYR(coordonnee_Y_du_produit)) ,imageR_A2 ,X,Y ); /* Et calcul de l'inverse "a droite" (c'est-a-dire 'imageR_A2') du produit... */ Eblock end_image EDEFV(imageF,imageA1_normalisee); /* Image intermediaire normalisee... */ RETIF(imageR_A2); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ #ifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 /* Introduit le 20040229172003... */ @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxDebian_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxMandrake_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxRedHat_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUbuntu_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUbuntu_ICC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUlmint_GCC @ define PRAGMA_CL_____BLOC_NON_OPTIMISABLE_SYSTEME_APC_LinuxUlmint_ICC /* Introduit le 20040229172003 par "symetrie" avec ce qui a ete fait pour corriger le */ /* probleme du 20040203162407 ci-dessus... */ #Aifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 #Eifdef BUG_SYSTEME_APC_GCC_ExcessPrecisionProblem_01 /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N V E R S I O N A U C E N T R E ( I N C O N N U E ' T ') D U P R O D U I T G E N E R A L I S E */ /* D E D E U X I M A G E S F L O T T A N T E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Logical,SINT(IFproduit_generalise_inverse_au_centre_T_____faire_IFnormalisation_automatique_des_operandes,VRAI))); /* Indicateur introduit le 20040205085139 pour permettre, par exemple, de traiter de */ /* facon identique un triplet {ROUGE,VERTE,BLEUE} en utilisant, par exemple, la commande */ /* 'v $xci/acces_RVB.22$Z'. La valeur implicite assure la compatibilite anterieure... */ DEFV(Common,DEFV(genere_Float,SINT(IFproduit_generalise_inverse_au_centre_T_____niveau_des_points_non_calcules_de_imageR_T,FZERO))); /* Valeur introduite le 20040206091001 afin de pouvoir distinguer, si besoin etait, les */ /* les points calcules de 'imageR_T' de ceux qui ne le sont pas, puisqu'en toute generalite, */ /* de nombreux points de 'imageR_T' ne sont pas atteints... */ DEFV(Common,DEFV(FonctionF,POINTERF(IFproduit_generalise_inverse_au_centre_T(imageR_T,imageA1,imageA2,imageT_R)))) /* Fonction introduite le 20040205085139... */ DEFV(Argument,DEFV(imageF,imageR_T)); /* Image Resultat, donnant la table de multiplication du produit generalise... */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(imageF,imageT_R)); /* Image donnant le produit : imageT_R=imageA1#imageA2, ou '#' symbolise un */ /* produit generalise via la table de multiplication 'imageR_T'. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,imageA1_normalisee); BDEFV(imageF,imageA2_normalisee); /* Images intermediaires normalisees... */ /*..............................................................................................................................*/ Test(IL_FAUT(IFproduit_generalise_inverse_au_centre_T_____faire_IFnormalisation_automatique_des_operandes)) Bblock CALS(IFnormalisation_automatique(imageA1_normalisee,imageA1)); CALS(IFnormalisation_automatique(imageA2_normalisee,imageA2)); /* Normalisation de 'imageA1' et de 'imageA2'... */ Eblock ATes Bblock CALS(IFmove(imageA1_normalisee,imageA1)); CALS(IFmove(imageA2_normalisee,imageA2)); /* Transfert de 'imageA1' et de 'imageA2' en conservant leurs niveaux... */ Eblock ETes CALi(IFinitialisation(imageR_T,IFproduit_generalise_inverse_au_centre_T_____niveau_des_points_non_calcules_de_imageR_T)); /* Afin de pouvoir reperer, si besoin est (en donnant a ce parametre une valeur differente */ /* de sa valeur implicite et, par exemple, une valeur negative...) les points non calcules */ /* de 'imageR_T' puisqu'en general tous ne sont pas atteints par l'inversion... */ traite_image_BH_GD(BLOC(DEFV(Int,INIT(coordonnee_X_du_produit,_cDENORMALISE_OX(loadF_point(imageA1_normalisee,X,Y)))); DEFV(Int,INIT(coordonnee_Y_du_produit,_cDENORMALISE_OY(loadF_point(imageA2_normalisee,X,Y)))); Test(TEST_HORS_IMAGE(coordonnee_X_du_produit,coordonnee_Y_du_produit)) Bblock PRINT_ERREUR("les coordonnees du produit generalise inverse au centre sont incorrectes"); CAL1(Prer3("X=%d : doit etre dans [%d,%d]\n",coordonnee_X_du_produit,Xmin,Xmax)); CAL1(Prer3("Y=%d : doit etre dans [%d,%d]\n",coordonnee_Y_du_produit,Ymin,Ymax)); Eblock ATes Bblock Eblock ETes storeF_point_valide(loadF_point(imageT_R,X,Y) ,imageR_T ,coordonnee_X_du_produit ,coordonnee_Y_du_produit ); /* Et calcul de l'inverse "au centre" (c'est-a-dire 'imageR_T') du produit en notant bien */ /* que tous les points de 'imageR_T' ne seront pas positionnes car il y a en effet peu de */ /* chances pour que 'coordonnee_X_du_produit' et 'coordonnee_Y_du_produit' balayent */ /* exhaustivement [Xmin,Xmax] et [Ymin,Ymax] respectivement... */ /* */ /* Principe du produit generalise inverse au CENTRE : */ /* */ /* */ /* A1 (gauche) A2 (droite) */ /* ============ ============ */ /* ------------------ ------------------ */ /* | | | | */ /* | | | | */ /* | | | | */ /* Y |------[X'] . . | Y |------[Y'] . . | */ /* | | . | | | . | */ /* | | . | | | . | */ /* ------------------ ------------------ */ /* X . X . */ /* . . */ /* . . */ /* (1) . . (2) */ /* . Table Multiplication . */ /* . ==================== . */ /* . . . . . . . . . . */ /* . . */ /* . . */ /* \./ . */ /* ------------------ . */ /* | | . */ /* Y' |--------[N] < . |< . . . . . . . */ /* | | . | */ /* | | . | */ /* | | . | */ /* | | . | */ /* ------------------ */ /* X' . */ /* . */ /* . */ /* . (3) */ /* . */ /* R . */ /* = . */ /* ------------------ */ /* | . | */ /* | . | */ /* | . | */ /* Y |------[N] . . . | */ /* | | | */ /* | | | */ /* ------------------ */ /* X */ /* */ ) ); EDEFV(imageF,imageA2_normalisee); EDEFV(imageF,imageA1_normalisee); /* Images intermediaires normalisees... */ RETIF(imageR_T); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P R O D U I T G E N E R A L I S E D E T R O I S I M A G E S F L O T T A N T E S : */ /* */ /* */ /* Nota : */ /* */ /* On notera le 20050608091609 l'interet de */ /* cette methode. En effet, une image en couleurs */ /* 'RVB' est faite de trois images. On peut donc */ /* par ce produit generalise les combiner entre */ /* elles (voir le generateur 'v $xiia/.PRO3.1.11.$U' */ /* et, par exemple, l'image 'v $xiia/VORO.11.2'), */ /* d'autant plus que ce produit n'est en general */ /* pas commutatif... */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____faire_IFnormalisation_automatique_des_operandes,VRAI))); /* Indicateur introduit le 20040129090203 pour permettre, par exemple, de traiter de */ /* facon identique un triplet {ROUGE,VERTE,BLEUE} en utilisant, par exemple, la commande */ /* 'v $xci/acces_RVB.22$Z'. La valeur implicite assure la compatibilite anterieure... */ DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____facteur_des_coordonnees_X,FU))); DEFV(Common,DEFV(Int,SINT(IFAproduit_generalise_____translateur_des_coordonnees_X,ZERO))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____facteur_des_coordonnees_Y,FU))); DEFV(Common,DEFV(Int,SINT(IFAproduit_generalise_____translateur_des_coordonnees_Y,ZERO))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____facteur_des_coordonnees_Z,FU))); DEFV(Common,DEFV(Int,SINT(IFAproduit_generalise_____translateur_des_coordonnees_Z,ZERO))); /* Modificateurs des {coordonnee_01_?_du_produit}. On notera que les "translateurs" sont */ /* dans [0,1] contrairement a 'v $xiii/tri_image$FON IFproduit_generalise'... */ DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____ponderation_des_coordonnees_X_n,FU))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____ponderation_des_coordonnees_X_X,FZERO))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____ponderation_des_coordonnees_X_Y,FZERO))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____ponderation_des_coordonnees_Y_n,FU))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____ponderation_des_coordonnees_Y_X,FZERO))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____ponderation_des_coordonnees_Y_Y,FZERO))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____ponderation_des_coordonnees_Z_n,FU))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____ponderation_des_coordonnees_Z_X,FZERO))); DEFV(Common,DEFV(Float,SINT(IFAproduit_generalise_____ponderation_des_coordonnees_Z_Y,FZERO))); /* Ponderations des niveaux et des coordonnees {X,Y} lors du calcul des coordonnees */ /* {coordonnee_01_X_du_produit,coordonnee_01_Y_du_produit,coordonnee_01_Z_du_produit}. */ DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____periodiser_X,VRAI))); DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____periodiser_Y,VRAI))); DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____periodiser_Z,VRAI))); DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____symetriser_X,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____symetriser_Y,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____symetriser_Z,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____prolonger_X,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____prolonger_Y,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFAproduit_generalise_____prolonger_Z,FAUX))); DEFV(Common,DEFV(genere_Float,SINT(IFAproduit_generalise_____niveau_hors_album,COORDONNEE_BARYCENTRIQUE_MINIMALE))); /* Pour parametrer 'FFAload_point_coordonnees_01(...)'. */ /* La possibilite de symetriser a ete introduite le 20050721105359... */ DEFV(Common,DEFV(FonctionF,POINTERF(IFAproduit_generalise(imageR,imageA1,imageA2,imageA3,table_de_multiplication)))) /* Fonction introduite le 20040127141401... */ DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA1#imageA2#imageA3, ou '#' symbolise un */ /* produit generalise. */ DEFV(Argument,DEFV(imageF,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(imageF,imageA2)); /* Seconde image Argument, */ DEFV(Argument,DEFV(imageF,imageA3)); /* Troisieme image Argument. */ DEFV(Argument,DEFV(albumF,table_de_multiplication)); /* Album donnant la table de multiplication courante... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,imageA1_normalisee); BDEFV(imageF,imageA2_normalisee); BDEFV(imageF,imageA3_normalisee); /* Images intermediaires normalisees... */ /*..............................................................................................................................*/ Test(IZEQ(ADD3(IFAproduit_generalise_____ponderation_des_coordonnees_X_n ,IFAproduit_generalise_____ponderation_des_coordonnees_X_X ,IFAproduit_generalise_____ponderation_des_coordonnees_X_Y ) ) ) Bblock PRINT_ATTENTION("la somme des trois ponderations {niveau,X,Y} relative a la coordonnee 'X' est nulle"); /* Effectivement, cela va provoquer des divisions par zero lors du 'LRZ3(...)' correspondant */ /* ci-apres... */ Eblock ATes Bblock Eblock ETes Test(IZEQ(ADD3(IFAproduit_generalise_____ponderation_des_coordonnees_Y_n ,IFAproduit_generalise_____ponderation_des_coordonnees_Y_X ,IFAproduit_generalise_____ponderation_des_coordonnees_Y_Y ) ) ) Bblock PRINT_ATTENTION("la somme des trois ponderations {niveau,X,Y} relative a la coordonnee 'Y' est nulle"); /* Effectivement, cela va provoquer des divisions par zero lors du 'LRZ3(...)' correspondant */ /* ci-apres... */ Eblock ATes Bblock Eblock ETes Test(IZEQ(ADD3(IFAproduit_generalise_____ponderation_des_coordonnees_Z_n ,IFAproduit_generalise_____ponderation_des_coordonnees_Z_X ,IFAproduit_generalise_____ponderation_des_coordonnees_Z_Y ) ) ) Bblock PRINT_ATTENTION("la somme des trois ponderations {niveau,X,Y} relative a la coordonnee 'Z' est nulle"); /* Effectivement, cela va provoquer des divisions par zero lors du 'LRZ3(...)' correspondant */ /* ci-apres... */ Eblock ATes Bblock Eblock ETes Test(IL_FAUT(IFAproduit_generalise_____faire_IFnormalisation_automatique_des_operandes)) Bblock CALS(IFnormalisation_automatique(imageA1_normalisee,imageA1)); CALS(IFnormalisation_automatique(imageA2_normalisee,imageA2)); CALS(IFnormalisation_automatique(imageA3_normalisee,imageA3)); /* Normalisation de 'imageA1', 'imageA2' et de 'imageA3'... */ Eblock ATes Bblock CALS(IFmove(imageA1_normalisee,imageA1)); CALS(IFmove(imageA2_normalisee,imageA2)); CALS(IFmove(imageA3_normalisee,imageA3)); /* Transfert de 'imageA1', 'imageA2' et de 'imageA3' en conservant leurs niveaux... */ Eblock ETes traite_image_BH_GD(BLOC(DEFV(Float,INIT(coordonnee_01_X_du_produit ,AXPB(IFAproduit_generalise_____facteur_des_coordonnees_X ,LRZ3(IFAproduit_generalise_____ponderation_des_coordonnees_X_n ,loadF_point(imageA1_normalisee,X,Y) ,IFAproduit_generalise_____ponderation_des_coordonnees_X_X ,_____cNORMALISE_OX(X) ,IFAproduit_generalise_____ponderation_des_coordonnees_X_Y ,_____cNORMALISE_OY(Y) ) ,IFAproduit_generalise_____translateur_des_coordonnees_X ) ) ); DEFV(Float,INIT(coordonnee_01_Y_du_produit ,AXPB(IFAproduit_generalise_____facteur_des_coordonnees_Y ,LRZ3(IFAproduit_generalise_____ponderation_des_coordonnees_Y_n ,loadF_point(imageA2_normalisee,X,Y) ,IFAproduit_generalise_____ponderation_des_coordonnees_Y_X ,_____cNORMALISE_OX(X) ,IFAproduit_generalise_____ponderation_des_coordonnees_Y_Y ,_____cNORMALISE_OY(Y) ) ,IFAproduit_generalise_____translateur_des_coordonnees_Y ) ) ); DEFV(Float,INIT(coordonnee_01_Z_du_produit ,AXPB(IFAproduit_generalise_____facteur_des_coordonnees_Z ,LRZ3(IFAproduit_generalise_____ponderation_des_coordonnees_Z_n ,loadF_point(imageA3_normalisee,X,Y) ,IFAproduit_generalise_____ponderation_des_coordonnees_Z_X ,_____cNORMALISE_OX(X) ,IFAproduit_generalise_____ponderation_des_coordonnees_Z_Y ,_____cNORMALISE_OY(Y) ) ,IFAproduit_generalise_____translateur_des_coordonnees_Z ) ) ); /* ATTENTION, contrairement a 'v $xiii/tri_image$FON IFproduit_generalise', les */ /* {coordonnee_01_?_du_produit} sont dans [0,1[... */ storeF_point(FFAload_point_coordonnees_01(table_de_multiplication ,coordonnee_01_X_du_produit ,coordonnee_01_Y_du_produit ,coordonnee_01_Z_du_produit ,IFAproduit_generalise_____periodiser_X ,IFAproduit_generalise_____periodiser_Y ,IFAproduit_generalise_____periodiser_Z ,IFAproduit_generalise_____symetriser_X ,IFAproduit_generalise_____symetriser_Y ,IFAproduit_generalise_____symetriser_Z ,IFAproduit_generalise_____prolonger_X ,IFAproduit_generalise_____prolonger_Y ,IFAproduit_generalise_____prolonger_Z ,IFAproduit_generalise_____niveau_hors_album ) ,imageR ,X,Y ); /* Et calcul du produit... */ /* */ /* Principe du produit generalise : */ /* */ /* */ /* A1 A2 A3 */ /* == == == */ /* */ /* ------------------ ------------------ ------------------ */ /* | | | | | | */ /* | | | | | | */ /* | | | | | | */ /* Y |----[X'] . . . | Y |----[Y']. . . | Y |----[Z'] . . . | */ /* | | . | | | . | | | . | */ /* | | . | | | . | | | . | */ /* ------------------ ------------------ ------------------ */ /* X . X . X . */ /* . . . . . . . . . . . . . . */ /* . . . */ /* (1) . (2) . . (3) */ /* . . . */ /* . . . */ /* . . Table Multiplication . */ /* . . ==================== . */ /* . . . */ /* . . . */ /* . . . */ /* . . /------------------/ . */ /* . . / /| . */ /* . . / / | . */ /* . . / / | . */ /* . . /------------------/ | . */ /* . . | | | . */ /* . . | /|-------[N] . . | | . */ /* . . |/ | / | . | / . */ /* . . . > Y' /---------/ | . | / . */ /* . | / | / . | /< . . . . . . . . . . . */ /* . |/ |/ . |/ Z' */ /* . /------------------/ */ /* . X' . */ /* . . */ /* . /|\ . */ /* . . . */ /* . . . . . . . . . . . . . . . */ /* . */ /* . */ /* . (4) */ /* . */ /* R . */ /* = . */ /* . */ /* ------------------ */ /* | . | */ /* | . | */ /* | . | */ /* Y |----[N] < . . . . | */ /* | | | */ /* | | | */ /* ------------------ */ /* X */ /* */ ) ); EDEFV(imageF,imageA3_normalisee); EDEFV(imageF,imageA2_normalisee); EDEFV(imageF,imageA1_normalisee); /* Images intermediaires normalisees... */ RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D E V E L O P P E M E N T T R I D I M E N S I O N N E L D ' U N E I M A G E F L O T T A N T E : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Logical,SINT(IFdeveloppement_tridimensionnel_____faire_IFnormalisation_automatique_des_operandes,VRAI))); /* Indicateur introduit le 20040129090203 pour permettre, par exemple, de traiter de */ /* facon identique un triplet {ROUGE,VERTE,BLEUE} en utilisant, par exemple, la commande */ /* 'v $xci/acces_RVB.22$Z'. La valeur implicite assure la compatibilite anterieure... */ DEFV(Common,DEFV(Logical,SINT(IFdeveloppement_tridimensionnel_____periodiser_X,VRAI))); DEFV(Common,DEFV(Logical,SINT(IFdeveloppement_tridimensionnel_____periodiser_Y,VRAI))); DEFV(Common,DEFV(Logical,SINT(IFdeveloppement_tridimensionnel_____symetriser_X,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFdeveloppement_tridimensionnel_____symetriser_Y,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFdeveloppement_tridimensionnel_____prolonger_X,FAUX))); DEFV(Common,DEFV(Logical,SINT(IFdeveloppement_tridimensionnel_____prolonger_Y,FAUX))); DEFV(Common,DEFV(genere_Float,SINT(IFdeveloppement_tridimensionnel_____niveau_hors_image,COORDONNEE_BARYCENTRIQUE_MINIMALE))); /* Pour remplacer 'loadF_point_valide(...)' par 'FFload_point(...)' le 20040228091122. */ /* Le 'Float' est devenu logiquement un 'genere_Float' le 20041107115559... */ /* La possibilite de symetriser a ete introduite le 20050721105359... */ DEFV(Common,DEFV(FonctionF,POINTERF(IFdeveloppement_tridimensionnel(imageR ,imageA ,ponderation_imageAX,imageAX ,ponderation_imageAY,imageAY ) ) ) ) /* Fonction introduite le 20040907144708... */ DEFV(Argument,DEFV(imageF,imageR)); /* Image Resultat, telle que : imageR=imageA developpee suivant {imageAX,imageAY}. */ DEFV(Argument,DEFV(imageF,imageA)); /* Image Argument a developper... */ DEFV(Argument,DEFV(Float,ponderation_imageAX)); DEFV(Argument,DEFV(imageF,imageAX)); /* Premiere image Argument et sa ponderation, */ DEFV(Argument,DEFV(Float,ponderation_imageAY)); DEFV(Argument,DEFV(imageF,imageAY)); /* Seconde image Argument et sa ponderation. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock BDEFV(imageF,imageA_normalisee); /* Image intermediaire normalisee... */ /*..............................................................................................................................*/ Test(IL_FAUT(IFdeveloppement_tridimensionnel_____faire_IFnormalisation_automatique_des_operandes)) Bblock CALS(IFnormalisation_automatique(imageA_normalisee,imageA)); /* Normalisation de 'imageA'... */ Eblock ATes Bblock CALS(IFmove(imageA_normalisee,imageA)); /* Transfert de 'imageA' en conservant ses niveaux... */ Eblock ETes traite_image_BH_GD(BLOC(DEFV(Float,INIT(coordonnee_X_normalisee,_____cNORMALISE_OX(X))); DEFV(Float,INIT(coordonnee_Y_normalisee,_____cNORMALISE_OY(Y))); DEFV(Float,INIT(coordonnee_Z_normalisee,loadF_point(imageA_normalisee,X,Y))); /* Coordonnees {X,Y,Z} normalisees... */ storeF_point(LIZ2(ponderation_imageAX ,FFload_point(imageAX ,_cDENORMALISE_OX(coordonnee_X_normalisee) ,_cDENORMALISE_OY(coordonnee_Z_normalisee) ,IFdeveloppement_tridimensionnel_____periodiser_X ,IFdeveloppement_tridimensionnel_____periodiser_Y ,IFdeveloppement_tridimensionnel_____symetriser_X ,IFdeveloppement_tridimensionnel_____symetriser_Y ,IFdeveloppement_tridimensionnel_____prolonger_X ,IFdeveloppement_tridimensionnel_____prolonger_Y ,IFdeveloppement_tridimensionnel_____niveau_hors_image ) ,ponderation_imageAY ,FFload_point(imageAY ,_cDENORMALISE_OX(coordonnee_Y_normalisee) ,_cDENORMALISE_OY(coordonnee_Z_normalisee) ,IFdeveloppement_tridimensionnel_____periodiser_X ,IFdeveloppement_tridimensionnel_____periodiser_Y ,IFdeveloppement_tridimensionnel_____symetriser_X ,IFdeveloppement_tridimensionnel_____symetriser_Y ,IFdeveloppement_tridimensionnel_____prolonger_X ,IFdeveloppement_tridimensionnel_____prolonger_Y ,IFdeveloppement_tridimensionnel_____niveau_hors_image ) ) ,imageR ,X,Y ); /* Et calcul du "developpement tridimensionnel" suivant la formule : */ /* */ /* R[X,Y] = pAX.AX[X,A[X,Y]] + pAY.AY[Y,A[X,Y]] */ /* ------ ------ */ /* . */ /* /|\ */ /* | */ /* --- ATTENTION : c'est bien 'Y' et */ /* non pas 'X' qui figure ici... */ /* */ /* ainsi, l'on voit que 'A[X,Y]' fait office de deuxieme coordonnee de 'AX' et de 'AY'. */ /* On a donc : */ /* */ /* */ /* AY /| */ /* / | */ /* / | */ /* / | */ /* / | */ /* / | */ /* / | */ /* / | */ /* / | */ /* / | */ /* / / */ /* / / */ /* AY{Y,A[X,Y]} / *---------* A[X,Y] AX */ /* ----------------------------- */ /* | . . / + | */ /* | . . / + | */ /* | . . * AX{X,A[X,Y]} | */ /* | . ........+...............|_____ A */ /* | .. . + | / */ /* | Y + + + . + + | / */ /* | . . + | / */ /* | . . + | / */ /* |. .+ |/ */ /* O---------+------------------- */ /* X */ /* */ /* */ /* l'image 'A' est donc horizontale, alors que 'AX' et 'AY' sont verticales ; 'AX' est */ /* alignee avec l'axe 'OX' de 'A' et 'AY' avec l'axe 'OY de 'A' (d'ou leurs noms...). */ /* */ /* ATTENTION : on notera que 'coordonnee_Y_normalisee' etant utilisee comme coordonnee */ /* de type 'X' (premiere coordonnee) pour 'imageAY', lorsque les images ne sont pas carrees */ /* (par exemple 'Pal'), cela peut introduire des artefacts se manifestant sous forme de */ /* structures horizontales (dans le cas ou le format est de type "landscape" -par exemple */ /* 'Pal'- ; dans le cas ou le format est de type "portrait", ces structures seraient fort */ /* probablement verticales...). */ ) ); EDEFV(imageF,imageA_normalisee); /* Normalisation de 'imageA'... */ RETIF(imageR); Eblock EFonctionF _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D E F I N I T I O N S D E S " B U G S " P R E S E N T S : */ /* */ /*************************************************************************************************************************************/ #ifdef BUG_SYSTEME_DPX5000_SPIX_CC_LACT11_ZONE_DE_SWAP_2 /* Common,DEFV(Fonction,) : bug... */ DEFV(Common,DEFV(Logical,_____BUG_SYSTEME_DPX5000_SPIX_CC_LACT11_ZONE_DE_SWAP_2)); #Aifdef BUG_SYSTEME_DPX5000_SPIX_CC_LACT11_ZONE_DE_SWAP_2 /* Common,DEFV(Fonction,) : bug... */ #Eifdef BUG_SYSTEME_DPX5000_SPIX_CC_LACT11_ZONE_DE_SWAP_2 /* Common,DEFV(Fonction,) : bug... */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C U M U L D E D E U X I M A G E S P O U R L E C A L C U L I T E R A T I F D E T R A I N E E S : */ /* */ /*************************************************************************************************************************************/ #ifdef BUG_SYSTEME_DPX5000_SPIX_CC_LACT11_ZONE_DE_SWAP_2 /* Common,DEFV(Fonction,) : cumul des trainees... */ /* sur 'SYSTEME_DPX5000_SPIX_CC', le calcul des trainees n'est pas compile afin d'eviter un */ /* "debordement" de la zone de swap lors de la compilation... */ #Aifdef BUG_SYSTEME_DPX5000_SPIX_CC_LACT11_ZONE_DE_SWAP_2 /* Common,DEFV(Fonction,) : cumul des trainees... */ BFonctionP # define COMBINAISON_DE_TRAINEES(fonction_de_trainee,niveau1,niveau2) \ Bblock \ DEFV(Float,INIT(alpha_niveau1,NIVR(ATTENUATION_DE_TRAINEES(alpha,niveau1)))); \ DEFV(Float,INIT(beta__niveau2,NIVR(ATTENUATION_DE_TRAINEES(beta_,niveau2)))); \ /* Autrefois, l'expression suivante s'ecrivait : */ \ /* */ \ /* EGAL(niveau_combine */ \ /* ,TRNP(NIVA(fonction_de_trainee(NIVR(ATTENUATION_DE_TRAINEES(alpha,niveau1)) */ \ /* ,NIVR(ATTENUATION_DE_TRAINEES(beta_,niveau2)) */ \ /* ) */ \ /* ) */ \ /* ) */ \ /* ); */ \ /* */ \ /* or, malheureusement, sur 'SYSTEME_VAX9000_ULTRIX_GCC', cela provoquait, au niveau de */ \ /* l'assemblage, le message d'erreur "Case will branch too far: try -bswitch flag". Mais, */ \ /* l'assembleur utilise (pour des raisons liees a un bug dans l'assembleur 'gcc-as') est */ \ /* '/bin/as', et l'option "-bswitch" qu'il reclame est aussi une option de 'gcc' identique */ \ /* a l'option '-B' ; en consequence de quoi, 'gcc' filtre "-bswitch" et '/bin/as' ne la */ \ /* recoit pas. La seule solution, compatible avec tous les SYSTEMEs est donc (je l'esoere) */ \ /* de creer les deux variables intermediaires 'alpha_niveau1' et 'beta__niveau2' de facon a */ \ /* reduire la complexite des expressions suivantes (en particulier au niveau des fonctions */ \ /* 'MAX2(...)',...). */ \ DEFV(Float,INIT(alpha_plus_beta,COND(IL_FAUT(renormaliser),ADD2(alpha,beta_),FU))); \ /* Afin de renormaliser (si necessaire) les niveaux calcules. On notera que la valeur 'FU' */ \ /* permet d'assurer la compatibilite avec la version anterieure... */ \ EGAL(niveau_combine \ ,GENP(TRNP(NIVA(DIVI(fonction_de_trainee(alpha_niveau1 \ ,beta__niveau2 \ ) \ ,alpha_plus_beta \ ) \ ) \ ) \ ) \ ); \ Eblock \ /* Combinaison de deux niveaux pour le calcul de l'effet de trainee. On notera la validation */ \ /* 'TRNP(...)' destinee a eviter des "debordements" des niveaux (en particulier avec une */ \ /* operation comme 'ADD2(...)'). ATTENTION : 'niveau_combine' est un 'genere_p', et donc */ \ /* faire 'EGAL(niveau_combine,...)' provoque une troncation automatique, ce qui fait que */ \ /* le 'TRNP(...)' doit etre obligatoirement dans cette affectation, et non point dans une */ \ /* suivante (a moins de rajouter une variable intermediaire 'Float'...). */ # define TRAINEE_D_UN_NIVEAU(niveau1,niveau2) \ Bblock \ Choi(mode) \ Bblock \ Ca1e(CALCUL_STANDARD_DES_TRAINEES) \ Bblock \ COMBINAISON_DE_TRAINEES(ADD2,niveau1,niveau2); \ Eblock \ ECa1 \ \ Ca1e(CALCUL_SIMPLIFIE_DES_TRAINEES) \ Bblock \ COMBINAISON_DE_TRAINEES(MAX2,niveau1,niveau2); \ Eblock \ ECa1 \ \ Ca1e(CALCUL_PAR__TRANSPARENCE__01_DES_TRAINEES) \ Bblock \ COMBINAISON_DE_TRAINEES(PRODUIT_TRANSPARENCE__01,niveau1,niveau2); \ Eblock \ ECa1 \ \ Ca1e(CALCUL_PAR__TRANSPARENCE__02_DES_TRAINEES) \ Bblock \ COMBINAISON_DE_TRAINEES(PRODUIT_TRANSPARENCE__02,niveau1,niveau2); \ Eblock \ ECa1 \ \ Ca1e(CALCUL_PAR__TRANSPARENCE__03_DES_TRAINEES) \ Bblock \ COMBINAISON_DE_TRAINEES(PRODUIT_TRANSPARENCE__03,niveau1,niveau2); \ Eblock \ ECa1 \ \ Ca1e(CALCUL_PAR__TRANSPARENCE__04_DES_TRAINEES) \ Bblock \ COMBINAISON_DE_TRAINEES(PRODUIT_TRANSPARENCE__04,niveau1,niveau2); \ Eblock \ ECa1 \ \ Ca1e(CALCUL_PAR__TRANSPARENCE__05_DES_TRAINEES) \ Bblock \ COMBINAISON_DE_TRAINEES(PRODUIT_TRANSPARENCE__05,niveau1,niveau2); \ Eblock \ ECa1 \ \ Defo \ Bblock \ PRINT_ERREUR("le mode de trainee n'est pas reconnu, on choisit le mode standard"); \ COMBINAISON_DE_TRAINEES(ADD2,niveau1,niveau2); \ Eblock \ EDef \ Eblock \ ECho \ Eblock \ /* Combinaison de deux niveaux pour le calcul de l'effet de trainee suivant une fonction */ \ /* donnee... */ DEFV(Common,DEFV(FonctionP,Icalcul_iteratif_des_trainees(imageR,alpha,imageA1,beta_,imageA2,mode,trainee_du_BLANC,renormaliser))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=trainee(imageA1,imageA2), soit pour simplifier : */ /* */ /* imageR = alpha*imageA1 + beta*imageA2 */ /* */ /* si 'renormaliser' est 'FAUX', et : */ /* */ /* alpha*imageA1 + beta*imageA2 */ /* imageR = ------------------------------ */ /* alpha + beta */ /* */ /* si 'renormaliser' est 'VRAI'... */ DEFV(Argument,DEFV(Float,alpha)); /* Ponderateur de 'imageA1', */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument ('imageA1'). */ DEFV(Argument,DEFV(Float,beta_)); /* Ponderateur de 'imageA2', */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument ('imageA2'). */ DEFV(Argument,DEFV(Int,mode)); /* Mode de combinaison des deux images Arguments. */ DEFV(Argument,DEFV(genere_p,trainee_du_BLANC)); /* Trainee courante du BLANC ; rappelons que 'Icalcul_iteratif_des_trainees' est, comme */ /* son nom l'indique, un processus iteratif. Cette fonction renvoie donc a chaque appel */ /* l'image courante du BLANC suivant donc : */ /* */ /* I (BLANC) = alpha.I (BLANC) + beta.BLANC */ /* n+1 n */ /* */ /* ou 'I (BLANC)' designe l'image du BLANC avant l'appel, */ /* n */ /* */ /* et 'I (BLANC)' designe l'image du BLANC apres l'appel (voir le 'RETU(...)'). */ /* n+1 */ DEFV(Argument,DEFV(Logical,renormaliser)); /* Cet indicateur precise s'il faut diviser ('VRAI') ou pas ('FAUX') les niveaux calcules */ /* par la somme des ponderations (alpha+beta). */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(genere_p,INIT(niveau_combine,NIVEAU_UNDEF)); /* Valeur flottante du niveau Resultat courant. */ /*..............................................................................................................................*/ begin_image Bblock TRAINEE_D_UN_NIVEAU(load_point(imageA1,X,Y),load_point(imageA2,X,Y)); /* Combinaison des niveaux courants des deux images Argument 'imageA1' et 'imageA2'. */ store_point(niveau_combine,imageR,X,Y,FVARIABLE); /* Rangement du niveau resultant... */ Eblock end_image TRAINEE_D_UN_NIVEAU(trainee_du_BLANC,BLANC); /* Calcul de l'image courante du BLANC afin de permettre, par exemple, une renormalisation */ /* de 'imageR' au retour, puisqu'ainsi, on sait finalement quel est le niveau maximal... */ RETU(niveau_combine); /* Et enfin, renvoi de 'I (BLANC)' : */ /* n+1 */ /* */ /* I (BLANC) = alpha.I (BLANC) + beta.BLANC */ /* n+1 n */ /* */ Eblock # undef TRAINEE_D_UN_NIVEAU # undef COMBINAISON_DE_TRAINEES EFonctionP #Eifdef BUG_SYSTEME_DPX5000_SPIX_CC_LACT11_ZONE_DE_SWAP_2 /* Common,DEFV(Fonction,) : cumul des trainees... */ _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C E N T R E D E G R A V I T E D ' U N N O Y A U A U T O U R D ' U N P O I N T : */ /* */ /*************************************************************************************************************************************/ BFonctionI DEFV(Common,DEFV(Positive,SINT(Pcentre_de_gravite_____nombre_de_points_sautes,NOMBRE_DE_POINTS_SAUTES_SUR_LA_SPIRALE))); /* Afin de pouvoir sauter des points sur la spirale utilisee par 'Pcentre_de_gravite(...)' ; */ /* mais a l'etat initial, tous les points seront pris en compte... */ DEFV(Local,DEFV(FonctionI,Pcentre_de_gravite(ARGUMENT_POINTERs(centre_de_gravite),imageA,X,Y,nombre_de_points,noyau))) DEFV(Argument,DEFV(pointI_2D,POINTERs(centre_de_gravite))); /* Renvoie les coordonnees dans [Xmin,Xmax][Ymin,Ymax] du centre de gravite */ /* du pave "pondere" par 'noyau' autour du point courant {X,Y}. */ DEFV(Argument,DEFV(image,imageA)); /* Image Argument. */ DEFV(Argument,DEFV(Int,X)); DEFV(Argument,DEFV(Int,Y)); /* Coordonnees entieres 'X' et 'Y' du point central de la spirale. */ DEFV(Argument,DEFV(Int,nombre_de_points)); /* Nombre de points contenus dans le noyau, y compris son centre. */ DEFV(Argument,DEFV(Float,DTb0(noyau))); /* Noyau de ponderation : il est defini par une liste contenant une spirale */ /* carree parcourant le noyau de forme carree, et ce a partir de son centre ; */ /* le premier element donne le poids du centre, que l'on va noter NOYAU(0,0), */ /* puis le second donne NOYAU(1,0), puis NOYAU(1,1), NOYAU(0,1), NOYAU(-1,1), */ /* NOYAU(-1,0), NOYAU(-1,-1),... Cette spirale est parcourue dans le sens */ /* trigonometrique. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock INIT_ERROR; /* ATTENTION : 'INIT_ERROR' est mis en tete des variables locales au cas ou des couples */ /* ('BDEFV','EDEFV') suivraient... */ DEFV(Int,INIT(X_courant,X)); /* Abscisse courante initialisee sur le point argument, */ DEFV(Int,INIT(Y_courant,Y)); /* Ordonnee courante initialisee sur le point argument. */ DEFV(Float,INIT(ponderation_courante,FZERO)); /* Masse courante ponderee au point courant lors du parcours de la spirale. */ DEFV(Float,INIT(masse_courante,FZERO)); /* Cumul de la masse courante ponderee lors du parcours de la spirale. */ DEFV(Float,INIT(cumul_courant_des_X,FZERO)); /* Cumul de la coordonnee 'X' ponderee par 'masse_courante' lors du parcours */ /* de la spirale, */ DEFV(Float,INIT(cumul_courant_des_Y,FZERO)); /* Cumul de la coordonnee 'Y' ponderee par 'masse_courante' lors du parcours */ /* de la spirale. */ SPIRALE_DEFINITION /* Donnees de generation d'une spirale de parcours d'une image. */ DEFV(Int,INIT(nombre_courant_de_points,UNDEF)); /* Nombre courant de points parcourus sur la spirale. */ DEFV(Int,INIT(nombre_reel_de_points,ZERO)); /* Nombre reel (a cause des sorties d'ecran) de points traites sur la spirale. */ /*..............................................................................................................................*/ SPIRALE_VALIDATION; /* Validation des pas de parcours (pasX,pasY) des images. */ Test(IZLE(nombre_de_points)) Bblock PRINT_ERREUR("le nombre de points du noyau de convolution est bizarre"); Eblock ATes Bblock Eblock ETes DoIn(nombre_courant_de_points,PREMIER_POINT,nombre_de_points,I) Bblock Test(TEST_DANS_L_IMAGE(X_courant,Y_courant)) Bblock INCR(nombre_reel_de_points,I); /* On compte les points traites. */ EGAL(ponderation_courante ,MUL2(ITb0(noyau,INDX(nombre_courant_de_points,PREMIER_POINT)) ,FLOT(NIVR(load_point(imageA,X_courant,Y_courant))) ) ); /* Calcul de la ponderation au point courant (produit de la masse locale */ /* 'load_point(...)' par la ponderation de 'noyau'). */ /* ATTENTION, le 1995082800, 'FLOT(NIVR(...))' a ete substitue a 'FLOT(...)'. */ INCR(cumul_courant_des_X ,MUL2(ponderation_courante,FLOT(X_courant)) ); /* Cumul pondere des abscisses, */ INCR(cumul_courant_des_Y ,MUL2(ponderation_courante,FLOT(Y_courant)) ); /* Cumul pondere des ordonnees, */ INCR(masse_courante,ponderation_courante); /* Et enfin cumul de la masse. */ Eblock ATes Bblock Eblock ETes SPIRALE_DEPLACEMENT_ET_PARCOURS(X_courant,Y_courant,Pcentre_de_gravite_____nombre_de_points_sautes); /* Deplacement du point courant de la spirale... */ Eblock EDoI Test(IZLE(masse_courante)) Bblock EGAL(ASI1(centre_de_gravite,x),X); EGAL(ASI1(centre_de_gravite,y),Y); /* Lorsque l'on n'a trouve aucune masse sur la spirale, on renvoie comme */ /* centre de gravite, le point courant {X,Y}. */ Eblock ATes Bblock EGAL(ASI1(centre_de_gravite,x) ,INTE(DIVI(cumul_courant_des_X,masse_courante)) ); EGAL(ASI1(centre_de_gravite,y) ,INTE(DIVI(cumul_courant_des_Y,masse_courante)) ); /* Dans le cas contraire, {x,y} etant donne sur une spirale et 'N(x,y)' */ /* designant le niveau au point {x,y} : */ /* */ /* ----- */ /* \ */ /* / noyau(x,y).N(x,y).x */ /* ----- */ /* {x,y} */ /* X(centre_de_gravite) = --------------------------- */ /* ----- */ /* \ */ /* / noyau(x,y).N(x,y) */ /* ----- */ /* {x,y} */ /* */ /* */ /* ----- */ /* \ */ /* / noyau(x,y).N(x,y).y */ /* ----- */ /* {x,y} */ /* Y(centre_de_gravite) = --------------------------- */ /* ----- */ /* \ */ /* / noyau(x,y).N(x,y) */ /* ----- */ /* {x,y} */ /* */ /* ce qui correspond a la definition standard du centre de gravite, a laquelle */ /* on a ajoute la ponderation par un 'noyau'... */ Eblock ETes RETU_ERROR; Eblock EFonctionI /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N T E R P O L A T I O N P O N D E R E E E N T R E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Iinterpolation_ponderee(imageR,alpha,imageA1,beta_,imageA2,nombre_de_points,noyau)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=alpha*imageA1+beta*imageA2, mais */ /* en translatant virtuellement 'imageA2' en chaque point d'un vecteur */ /* allant de 'G1' a 'G2' ('G1' et 'G2' representant les centres de gravite */ /* "ponderes" des paves de points definis par la spirale carree dans chacune */ /* des deux images arguments). */ DEFV(Argument,DEFV(Float,alpha)); /* Premier coefficient d'interpolation, */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(Float,beta_)); /* Second coefficient d'interpolation. */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(Int,nombre_de_points)); /* Nombre de points contenus dans le noyau, y compris son centre. */ DEFV(Argument,DEFV(Float,DTb0(noyau))); /* Noyau de convolution : il est defini par une liste contenant une spirale */ /* carree parcourant le noyau de forme carree, et ce a partir de son centre ; */ /* le premier element donne le poids du centre, que l'on va noter NOYAU(0,0), */ /* puis le second donne NOYAU(1,0), puis NOYAU(1,1), NOYAU(0,1), NOYAU(-1,1), */ /* NOYAU(-1,0), NOYAU(-1,-1),... Cette spirale est parcourue dans le sens */ /* trigonometrique. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(pointI_2D,centre_de_gravite_A1); /* Coordonnees dans [Xmin,Xmax][Ymin,Ymax] du centre de gravite du pave "pondere" */ /* par 'noyau' autour du point courant {X,Y} dans l'image 'imageA1'. */ DEFV(pointI_2D,centre_de_gravite_A2); /* Coordonnees dans [Xmin,Xmax][Ymin,Ymax] du centre de gravite du pave "pondere" */ /* par 'noyau' autour du point courant {X,Y} dans l'image 'imageA2'. */ /*..............................................................................................................................*/ SPIRALE_VALIDATION; /* Validation des pas de parcours (pasX,pasY) des images. */ Test(IZLE(nombre_de_points)) Bblock PRINT_ERREUR("le nombre de points du noyau de convolution est bizarre"); Eblock ATes Bblock Eblock ETes begin_image Bblock Pcentre_de_gravite(ADRESSE(centre_de_gravite_A1),imageA1,X,Y,nombre_de_points,noyau); /* Recherche du centre de gravite 'G1' du pave courant de 'imageA1'. */ Pcentre_de_gravite(ADRESSE(centre_de_gravite_A2),imageA2,X,Y,nombre_de_points,noyau); /* Recherche du centre de gravite 'G2' du pave courant de 'imageA2'. */ store_point(NIVA(VADD(VMULF(alpha ,NIVR(load_point(imageA1,X,Y)) ) ,VMULF(beta_ ,NIVR(load_point_valide(imageA2 ,ADD2(X,SOUS(ASD1(centre_de_gravite_A2,x),ASD1(centre_de_gravite_A1,x))) ,ADD2(Y,SOUS(ASD1(centre_de_gravite_A2,y),ASD1(centre_de_gravite_A1,y))) ) ) ) ) ) ,imageR ,X,Y ,FVARIABLE ); /* Et on interpole entre les deux images arguments en translatant */ /* virtuellement 'imageA2' d'un vecteur menant du centre de gravite */ /* 'G1' au centre de gravite 'G2'... */ /* */ /* */ /* Y ^ Espace de 'imageA1' et 'imageA2' */ /* | . */ /* | . */ /* | . */ /* | + + + + + + + + + + pave defini par la spirale */ /* | + G2. + carree centree au point (Xc,Yc) */ /* | + / . M2 + */ /* | + / . / + */ /* | +G1 . / + */ /* Yc|..................+........M1.......+............. */ /* | + . + */ /* | + . + */ /* | + . + */ /* | + . + */ /* | + + + + + + + + + + */ /* | . */ /* | . */ /* | . */ /* -----------------------------------------------------------> */ /* O Xc X */ /* */ /* on interpole entre le point 'M1' de 'imageA1' et le point 'M2' de */ /* 'imageA2', 'M2' etant obtenu par translation de 'M1' suivant le */ /* vecteur (G1,G2) : (M1,M2)=(G1,G2). */ Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* A S S O C I A T I O N D E V O I S I N A G E D E D E U X I M A G E S : */ /* */ /* */ /* imageA1 imageA2 */ /* */ /* ------------------ ------------------ */ /* | | | +-----+ | */ /* | | | |+---+| | */ /* | | | ||+-+|| | */ /* Y1.|.....* | Y1.|.....*-|| | */ /* | . | | ||+.-+| | */ /* | . | | |+-.--+| | */ /* | . | Y2.|..+--.--*+ | */ /* | . | | . . | */ /* | . | | . . | */ /* | . | | . . | */ /* ------------------ ------------------ */ /* . . . */ /* X1 X1 X2 */ /* */ /* */ /* Iassociation_de_voisinage_____X */ /* Iassociation_de_voisinage_____Y */ /* */ /* ------------------ ------------------ */ /* | | | | */ /* | | | | */ /* | X2 | | Y2 | */ /* Y1.|.....* | Y1.|.....* | */ /* | . | | . | */ /* | . | | . | */ /* | . | | . | */ /* | . | | . | */ /* | . | | . | */ /* | . | | . | */ /* ------------------ ------------------ */ /* . . */ /* X1 X1 */ /* */ /* */ /* {X1,Y1} -0-> {X2,Y2} */ /* */ /* */ /*************************************************************************************************************************************/ /* Les donnees utiles ont ete mises dans 'v $xiii/Images$STR 20101011185144' car c'est en */ /* plus logique que cela soit ici et ce en particulier depuis l'introduction de la fonction */ /* 'v $xiii/pent_image$FON IFinterpolation_locale_de_voisinage'... */ #define X_ASSOCIATION_IMPLICITE \ COND(IL_FAUT(Iassociation_de_voisinage_____compatibilite_20120421),Xmin,PREX(Xmin)) \ /* Pour initialiser la matrice 'Iassociation_de_voisinage_____X', */ \ /* */ \ /* A compter du 20120421082842, l'initialisation se fait avec une coordonnee hors-image, ce */ \ /* permet de tester ulterieurement la non association, ce qui est donc compatible avec */ \ /* 'v $xiii/pent_image$FON Test.TEST_DANS_L_IMAGE.X_associe.Y_associe.)'... */ #define Y_ASSOCIATION_IMPLICITE \ COND(IL_FAUT(Iassociation_de_voisinage_____compatibilite_20120421),Ymin,PREY(Ymin)) \ /* Pour initialiser la matrice 'Iassociation_de_voisinage_____Y', */ \ /* */ \ /* A compter du 20120421082842, l'initialisation se fait avec une coordonnee hors-image, ce */ \ /* permet de tester ulterieurement la non association, ce qui est donc compatible avec */ \ /* 'v $xiii/pent_image$FON Test.TEST_DANS_L_IMAGE.X_associe.Y_associe.)'... */ BFonctionI DEFV(Common,DEFV(Logical,SINT(Iassociation_de_voisinage_____accelerer_l_association,VRAI))); /* Introduit le 20120424153903 afin de permettre la construction d'un accelerateur... */ /* */ /* Le 20120424175011 je note que cette modification ainsi que l'introduction des variables */ /* 'niveau_courant_imageA1' et 'niveau_courant_imageA2' ont conduit a une division par 3 */ /* du temps d'interpolation de : */ /* */ /* */ /* :Debut_listG_Acceleration_interpole_12: */ /* */ /* $Z Std */ /* */ /* $Z setenv xTV $xTG */ /* */ /* $Z $xci/gauss$X \ */ /* $Z R=$xTV/GAUSS \ */ /* $Z $formatI */ /* */ /* $Z $xci/trefle$X \ */ /* $Z R=$xTV/TREFLE \ */ /* $Z $formatI */ /* */ /* $Z $xci/interpole.12$X \ */ /* $Z A1=$xTV/GAUSS \ */ /* $Z A2=$xTV/TREFLE \ */ /* $Z P=$xiio/MIRE \ */ /* $Z points=10000 \ */ /* $Z $formatI */ /* */ /* :Fin_listG_Acceleration_interpole_12: */ /* */ /* */ /* avec un passage de 38 secondes avant toutes ces modifications, a 11 secondes apres les */ /* modifications et avec "accelerer=VRAI"... */ /* */ /* Le 20120424181654, je suis donc passe de 'FAUX' a 'VRAI'... */ /* */ /* Aux environs du 20120427112548, j'ai fait le meme test de performance sur la MACHINE */ /* '$CMAP28 ex "robespierre"'. Le temps de calcul est passe de 42.35 a 19.34 secondes, */ /* c'est-a-dire d'une part un gain inferieur a celui de '$LACT19' et d'autre part une */ /* performance gblobale inferieure a celle de '$LACT19' ! */ DEFV(Common,DEFV(Int,SINT(Iassociation_de_voisinage_____pas_de_parcours_de_l_accelerateur,I))); /* Introduit le 20120427093025 "pour le plaisir" car, en effet, cela n'a que peu de sens, */ /* mais on ne sait jamais... */ /* */ /* On notera au passage que cela a fait passer le temps de calcul precedent (11 secondes) */ /* a 12 secondes, ce que je n'arrive pas a reproduire aux environs du 20120428100903... */ DEFV(Common,DEFV(Logical,SINT(Iassociation_de_voisinage_____compatibilite_20101012,FAUX))); /* Permet d'assurer la compatibilite anterieure en ce qui concerne la condiition de fin */ /* du 'Tant(...)' (introduit le 20101012223214). */ DEFV(Common,DEFV(Logical,SINT(Iassociation_de_voisinage_____compatibilite_20120421,FAUX))); /* Permet d'assurer la compatibilite anterieure en ce qui concerne ce qui est memorise dans */ /* le cas ou aucune coincidence n'a ete trouvee (introduit le 20120421082842)... */ #define CALCUL_DE_L_HISTOGRAMME(image) \ Bblock \ CALS(Ihistogramme(image)); \ /* Calcul de l'histogramme de l'image courante... */ \ \ BoIn(niveau,NOIR,BLANC,PAS_COULEURS) \ Bblock \ EGAL(ITb1(histogramme`image,INDX(niveau,NOIR)),ACCES_HISTOGRAMME(niveau)); \ /* Memorisation de l'histogramme de l'image courante... */ \ Eblock \ EBoI \ Eblock \ /* Procedure introduite le 20101013102232... */ #define LES_DEUX_NIVEAUX_SONT_DIFFERENTS \ IFNE_a_peu_pres_absolu(niveau_courant_imageA1 \ ,niveau_courant_imageA2 \ ,Iassociation_de_voisinage_____seuil_de_discrimination_des_niveaux \ ) \ /* Procedure introduite le 20101013112245... */ #define IL_FAUT_POURSUIVRE_LA_RECHERCHE_D_ASSOCIATION_DE_VOISINAGE \ IFOU(IFET(IL_NE_FAUT_PAS(Iassociation_de_voisinage_____compatibilite_20101012) \ ,IFOU(IFET(IL_FAUT(Iassociation_de_voisinage_____s_arreter_sur_le_premier_point_hors_image) \ ,IFET(TEST_DANS_L_IMAGE(ASD1(point_courant,x),ASD1(point_courant,y)) \ ,LES_DEUX_NIVEAUX_SONT_DIFFERENTS \ ) \ ) \ ,IFET(IL_NE_FAUT_PAS(Iassociation_de_voisinage_____s_arreter_sur_le_premier_point_hors_image) \ ,IFOU(TEST_HORS_IMAGE(ASD1(point_courant,x),ASD1(point_courant,y)) \ ,LES_DEUX_NIVEAUX_SONT_DIFFERENTS \ ) \ ) \ ) \ ) \ ,IFET(IL_FAUT(Iassociation_de_voisinage_____compatibilite_20101012) \ ,IFNE(niveau_courant_imageA1 \ ,niveau_courant_imageA2 \ ) \ ) \ ) \ /* Procedure introduite le 20120424153903... */ #define MISE_A_JOUR_DE_L_ASSOCIATION_DE_VOISINAGE \ Bblock \ Test(IFOU(IL_FAUT(Iassociation_de_voisinage_____compatibilite_20120421) \ ,IFET(IL_NE_FAUT_PAS(Iassociation_de_voisinage_____compatibilite_20120421) \ ,EST_VRAI(l_association_a_ete_trouvee) \ ) \ ) \ ) \ /* Test mis en place le 20120421082842... */ \ Bblock \ storeI_point(ASD1(point_courant,x),Iassociation_de_voisinage_____X,X,Y); \ storeI_point(ASD1(point_courant,y),Iassociation_de_voisinage_____Y,X,Y); \ /* Ainsi, on memorise la premiere coincidence... */ \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ Eblock \ /* Procedure introduite le 20120424153903... */ DEFV(Common,DEFV(Logical,SINT(Iassociation_de_voisinage_____valider_la_compatibilite_des_images,FAUX))); /* Introduit le 20101013102232 pour 'v $xci/interpole.12$K'. */ DEFV(Common,DEFV(Logical,SINT(Iassociation_de_voisinage_____s_arreter_sur_le_premier_point_hors_image,VRAI))); /* Introduit le 20101012211109 pour 'v $xci/interpole.12$K'. */ DEFV(Common,DEFV(Positive,SINT(Iassociation_de_voisinage_____seuil_de_discrimination_des_niveaux,ZERO))); /* Introduit le 20101013112054 pour 'v $xci/interpole.12$K'. */ DEFV(Common,DEFV(Positive,SINT(Iassociation_de_voisinage_____verifier_les_non_associations,FAUX))); /* Introduit le 20220120084609... */ DEFV(Common,DEFV(FonctionI,Iassociation_de_voisinage(imageA1,imageA2,nombre_maximal_de_points_a_traiter))) DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument ; c'est elle dont les coordonnees {X,Y} indexeront les matrices */ /* d'associations 'Iassociation_de_voisinage_____X' et 'Iassociation_de_voisinage_____Y'. */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument ; c'est elle dont les coordonnees 'X' et 'Y' se trouvent */ /* memorisees dans les matrices d'associations 'Iassociation_de_voisinage_____X' et */ /* 'Iassociation_de_voisinage_____Y' ; on notera donc que 'imageA1' et 'imageA2' ne */ /* commutent pas... */ DEFV(Argument,DEFV(Positive,nombre_maximal_de_points_a_traiter)); /* Nombre maximale de points a tester sur une spirale. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock INIT_ERROR; /* ATTENTION : 'INIT_ERROR' est mis en tete des variables locales au cas ou des couples */ /* ('BDEFV','EDEFV') suivraient... */ DEFV(pointI_2D,point_courant); /* Point (entier) courant. */ SPIRALE_DEFINITION /* Donnees de generation d'une spirale de parcours d'une image. */ /*..............................................................................................................................*/ Test(IFGT(nombre_maximal_de_points_a_traiter,MUL2(DOUB(dimX),DOUB(dimY)))) /* Test introduit le 20120427093025... */ Bblock PRINT_ATTENTION("le nombre de points est inutilement important (le quadruple de 'dimXY' suffit pour atteindre tout point)"); CAL1(Prer1("(il vaut %d)\n",nombre_maximal_de_points_a_traiter)); /* On notera que malgre tout, cette valeur est conservee, on ne sait jamais... */ Eblock ATes Bblock Eblock ETes Test(IL_FAUT(Iassociation_de_voisinage_____valider_la_compatibilite_des_images)) Bblock DEFV(Int,DTb1(histogramme_imageA1,COULEURS)); DEFV(Int,DTb1(histogramme_imageA2,COULEURS)); CALCUL_DE_L_HISTOGRAMME(imageA1); CALCUL_DE_L_HISTOGRAMME(imageA2); /* Calcul des histogrammes des deux images Argument... */ BoIn(niveau,NOIR,BLANC,PAS_COULEURS) Bblock Test(IFOU(IFET(IZEQ(ITb1(histogramme_imageA1,INDX(niveau,NOIR))),IZNE(ITb1(histogramme_imageA2,INDX(niveau,NOIR)))) ,IFET(IZNE(ITb1(histogramme_imageA1,INDX(niveau,NOIR))),IZEQ(ITb1(histogramme_imageA2,INDX(niveau,NOIR)))) ) ) Bblock PRINT_ATTENTION("un niveau est occupe dans une image et inoccupe dans l'autre"); CAL1(Prer1("niveau=%d\n",niveau)); /* Validation introduite le 20101013102232 pour detecter des incompatibilites possibles */ /* entre deux images pour lesquelles des niveaux ne pourraient etre associes... */ Eblock ATes Bblock Eblock ETes Eblock EBoI Eblock ATes Bblock Eblock ETes SPIRALE_VALIDATION; /* Validation des pas de parcours (pasX,pasY) des images. */ CALS(IIinitialisation(Iassociation_de_voisinage_____X,X_ASSOCIATION_IMPLICITE)); CALS(IIinitialisation(Iassociation_de_voisinage_____Y,Y_ASSOCIATION_IMPLICITE)); /* Initialisation des matrices d'associations... */ INITIALISATION_POINT_2D(point_courant,Xmin,Ymin); /* Initialisation du point courant (Xmin,Ymin). */ Test(IL_FAUT(Iassociation_de_voisinage_____accelerer_l_association)) /* Possibilite mise en place le 20120424153903... */ Bblock DEFV(Int,INIT(X,Xmin)); DEFV(Int,INIT(Y,Ymin)); /* On se place ainsi a l'origine des coordonnees (mais ce choix est en fait arbitraire...). */ DEFV(Local,DEFV(Int,DdTb1(POINTERi,translation_des_X,nombre_maximal_de_points_a_traiter,ADRESSE_NON_ENCORE_DEFINIE))); DEFV(Local,DEFV(Int,DdTb1(POINTERi,translation_des_Y,nombre_maximal_de_points_a_traiter,ADRESSE_NON_ENCORE_DEFINIE))); MdTb1(translation_des_X,nombre_maximal_de_points_a_traiter,Int,ADRESSE_NON_ENCORE_DEFINIE); MdTb1(translation_des_Y,nombre_maximal_de_points_a_traiter,Int,ADRESSE_NON_ENCORE_DEFINIE); /* L'accelerateur est fait de deux listes qui memorisent les translations en 'X' et en 'Y' */ /* necessaires pour parcourir une spirale carree centree en point {X,Y} quelconque... */ Test(IZLE(Iassociation_de_voisinage_____pas_de_parcours_de_l_accelerateur)) /* Test introduit le 20120427093025... */ Bblock PRINT_ERREUR("le pas de l'accelerateur est negatif ou nul : sa valeur par defaut est retablie"); CAL1(Prer1("(la valeur demandee etait %d, ",Iassociation_de_voisinage_____pas_de_parcours_de_l_accelerateur)); EGAL(Iassociation_de_voisinage_____pas_de_parcours_de_l_accelerateur,I); CAL1(Prer1("la valeur retablie est %d)\n",Iassociation_de_voisinage_____pas_de_parcours_de_l_accelerateur)); Eblock ATes Bblock Eblock ETes SPIRALE_REINITIALISATION_BRAS_ET_DELTAS; SPIRALE_REINITIALISATION_COMPTAGE; /* Reinitialisation de la spirale en son centre... */ Repe(nombre_maximal_de_points_a_traiter) Bblock EGAL(IdTb1(translation_des_X,INDX(compteur_des_repetitions_du_Repe,PREMIER_POINT),nombre_maximal_de_points_a_traiter) ,SOUS(ASD1(point_courant,x),X) ); EGAL(IdTb1(translation_des_Y,INDX(compteur_des_repetitions_du_Repe,PREMIER_POINT),nombre_maximal_de_points_a_traiter) ,SOUS(ASD1(point_courant,y),Y) ); /* Generation de l'accelerateur... */ SPIRALE_INITIALISATION; /* Initialisation dynamique de 'spirale_nombre_de_points_a_traiter'. */ SPIRALE_COMPTAGE; /* Comptage des points traites... */ SPIRALE_DEPLACEMENT(ASD1(point_courant,x),ASD1(point_courant,y)); /* Deplacement du point courant de la spirale... */ /* ATTENTION : on n'utilise pas 'SPIRALE_DEPLACEMENT_ET_PARCOURS(...)' afin de garantir la */ /* terminaison du processus 'Tant(...)'. */ SPIRALE_PARCOURS; /* Parcours de la spirale avec rotation eventuelle de PI/2 du bras courant... */ Eblock ERep begin_image Bblock DEFV(genere_p,INIT(niveau_courant_imageA1,load_point(imageA1,X,Y))); /* Le 20120425085606, j'ai note que l'usage de la procedure 'load_point_valide(...)' pouvait */ /* etre simplifie en 'load_point(...)' a cause de la presence de {begin_image,end_image}. */ DEFV(Int,INIT(index_des_translations_X_et_Y,PREMIER_POINT)); /* Index d'acces a l'accelerateur... */ DEFV(Int,INIT(nombre_maximal_courant_de_points_a_traiter ,MIN2(nombre_maximal_de_points_a_traiter ,EXP2(TRPU(DOUB(MAX2(MAX2(SOUS(X,Xmin) ,SOUS(Xmax,X) ) ,MAX2(SOUS(Y,Ymin) ,SOUS(Ymax,Y) ) ) ) ) ) ) ) ); /* Petite optimisation introduite le 20120426130539 qui consiste n'utiliser que les points */ /* de l'accelerateur contenu dans un carre de meme centre que l'accelerateur et tel qu'une */ /* fois centre sur le point courant {X,Y} il soit le plus petit carre contenant l'image */ /* Argument. En fait cela ne servira que peu souvent, mais enfin... */ DEFV(Logical,INIT(rechercher_l_association,VRAI)); DEFV(Logical,INIT(l_association_a_ete_trouvee,FAUX)); Tant(IL_FAUT(rechercher_l_association)) Bblock Test(IFLE(index_des_translations_X_et_Y,LSTX(PREMIER_POINT,nombre_maximal_courant_de_points_a_traiter))) Bblock DEFV(genere_p,INIT(niveau_courant_imageA2,NIVEAU_UNDEF)); /* Introduit le 20120424174235 afin d'accelerer le processus... */ INITIALISATION_POINT_2D(point_courant ,ADD2(X ,IdTb1(translation_des_X ,INDX(index_des_translations_X_et_Y,PREMIER_POINT) ,nombre_maximal_de_points_a_traiter ) ) ,ADD2(Y ,IdTb1(translation_des_Y ,INDX(index_des_translations_X_et_Y,PREMIER_POINT) ,nombre_maximal_de_points_a_traiter ) ) ); /* Mise en place du point courant {X,Y} translate... */ EGAL(niveau_courant_imageA2 ,load_point_valide(imageA2,ASD1(point_courant,x),ASD1(point_courant,y)) ); /* Introduit le 20120424174235 afin d'accelerer le processus... */ Test(IL_FAUT_POURSUIVRE_LA_RECHERCHE_D_ASSOCIATION_DE_VOISINAGE) Bblock Eblock ATes Bblock EGAL(l_association_a_ete_trouvee,VRAI); EGAL(rechercher_l_association,FAUX); /* C'est le cas le plus favorable : l'association a ete trouvee... */ Eblock ETes INCR(index_des_translations_X_et_Y,Iassociation_de_voisinage_____pas_de_parcours_de_l_accelerateur); Eblock ATes Bblock EGAL(rechercher_l_association,FAUX); /* On a teste trop de points : on doit arreter... */ Eblock ETes Eblock ETan MISE_A_JOUR_DE_L_ASSOCIATION_DE_VOISINAGE; Eblock end_image FdTb1(translation_des_Y,nombre_maximal_de_points_a_traiter,Int,ADRESSE_NON_ENCORE_DEFINIE); FdTb1(translation_des_X,nombre_maximal_de_points_a_traiter,Int,ADRESSE_NON_ENCORE_DEFINIE); Eblock ATes Bblock begin_image Bblock DEFV(genere_p,INIT(niveau_courant_imageA1,load_point(imageA1,X,Y))); /* Introduit le 20120424140235 afin d'accelerer le processus... */ /* */ /* Le 20120425085606, j'ai note que l'usage de la procedure 'load_point_valide(...)' pouvait */ /* etre simplifie en 'load_point(...)' a cause de la presence de {begin_image,end_image}. */ DEFV(Logical,INIT(rechercher_l_association,VRAI)); DEFV(Logical,INIT(l_association_a_ete_trouvee,FAUX)); /* Introduits le 20120421082842... */ SPIRALE_REINITIALISATION_BRAS_ET_DELTAS; SPIRALE_REINITIALISATION_COMPTAGE; /* Reinitialisation de la spirale en son centre... */ INITIALISATION_POINT_2D(point_courant,X,Y); /* Mise en place du point courant {X,Y}. */ Tant(IL_FAUT(rechercher_l_association)) Bblock Test(IFLT(nombre_de_points_sur_la_spirale,nombre_maximal_de_points_a_traiter)) Bblock DEFV(genere_p,INIT(niveau_courant_imageA2 ,load_point_valide(imageA2,ASD1(point_courant,x),ASD1(point_courant,y)) ) ); /* Introduit le 20120424174235 afin d'accelerer le processus... */ Test(IL_FAUT_POURSUIVRE_LA_RECHERCHE_D_ASSOCIATION_DE_VOISINAGE) Bblock /* Ainsi, on cherche "en spirale" la premiere coincidence du point "fixe" {X,Y} de */ /* 'imageA1' et d'un point mobile 'point_courant' de 'imageA2' ; on notera que la */ /* boucle 'Tant' s'arrete d'elle-meme des que par exemple les deux points sont tous */ /* deux hors de l'image... */ SPIRALE_INITIALISATION; /* Initialisation dynamique de 'spirale_nombre_de_points_a_traiter'. */ SPIRALE_COMPTAGE; /* Comptage des points traites... */ SPIRALE_DEPLACEMENT(ASD1(point_courant,x),ASD1(point_courant,y)); /* Deplacement du point courant de la spirale... */ /* ATTENTION : on n'utilise pas 'SPIRALE_DEPLACEMENT_ET_PARCOURS(...)' afin de garantir la */ /* terminaison du processus 'Tant(...)'. */ SPIRALE_PARCOURS; /* Parcours de la spirale avec rotation eventuelle de PI/2 du bras courant... */ Eblock ATes Bblock EGAL(l_association_a_ete_trouvee,VRAI); EGAL(rechercher_l_association,FAUX); /* C'est le cas le plus favorable : l'association a ete trouvee... */ Eblock ETes Eblock ATes Bblock EGAL(rechercher_l_association,FAUX); /* On a teste trop de points : on doit arreter... */ Eblock ETes Eblock ETan MISE_A_JOUR_DE_L_ASSOCIATION_DE_VOISINAGE; Eblock end_image Eblock ETes Test(IL_FAUT(Iassociation_de_voisinage_____verifier_les_non_associations)) Bblock DEFV(Positive,INIT(compteur_des_non_associations,ZERO)); begin_image Bblock Test(TEST_HORS_IMAGE(loadI_point(Iassociation_de_voisinage_____X,X,Y),loadI_point(Iassociation_de_voisinage_____Y,X,Y))) Bblock INCR(compteur_des_non_associations,I); Eblock ATes Bblock Eblock ETes Eblock end_image Test(IZGT(compteur_des_non_associations)) Bblock PRINT_ATTENTION("il y a au moins un point qui n'a pas pu etre associe a un voisin"); CAL1(Prer1("(il y en a effectivement %d)\n",compteur_des_non_associations)); Eblock ATes Bblock Eblock ETes Eblock ATes Bblock Eblock ETes Iassociation_de_voisinage_____X_association__ET__Y_association__SONT_INITIALISEES; /* Afin de savoir qu'on est passe au moins une fois dans 'Iassociation_de_voisinage(...)'. */ RETU_ERROR; Eblock #undef MISE_A_JOUR_DE_L_ASSOCIATION_DE_VOISINAGE #undef IL_FAUT_POURSUIVRE_LA_RECHERCHE_D_ASSOCIATION_DE_VOISINAGE #undef LES_DEUX_NIVEAUX_SONT_DIFFERENTS #undef CALCUL_DE_L_HISTOGRAMME EFonctionI /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N T E R P O L A T I O N D E V O I S I N A G E E N T R E D E U X I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(Logical,SINT(Iinterpolation_de_voisinage_____renormaliser_l_image_Resultat,VRAI))); /* Introduit le 20220123142321 a cause de 'v $xiii/tri_image$FON 20220123133744'... */ DEFV(Common,DEFV(FonctionP,POINTERp(Iinterpolation_de_voisinage(imageR ,alpha ,imageA1 ,beta_ ,imageA2 ,interpoler_les_coordonnees ,choisir_la_coordonnee_associee ) ) ) ) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR=alpha*imageA1+beta*imageA2, sachant que les */ /* coordonnees utilisees sont pour : */ /* imageA1 : {X,Y}, */ /* imageA2 : {X,Y}, */ /* imageR : {Iassociation_de_voisinage_____X(X,Y),Iassociation_de_voisinage_____Y(X,Y)}. */ DEFV(Argument,DEFV(Float,alpha)); /* Premier coefficient d'interpolation, */ DEFV(Argument,DEFV(image,imageA1)); /* Premiere image Argument, */ DEFV(Argument,DEFV(Float,beta_)); /* Second coefficient d'interpolation. */ DEFV(Argument,DEFV(image,imageA2)); /* Seconde image Argument. */ DEFV(Argument,DEFV(Logical,interpoler_les_coordonnees)); /* Indique s'il faut ('VRAI') ou pas ('FAUX') interpoler les coordonnees, c'est-a-dire */ /* si l'on prend 'alpha*t+beta*f(t)' ('VRAI') ou 't' ('FAUX'), ou 'f(t)' represente */ /* 'Iassociation_de_voisinage_____X' ou 'Iassociation_de_voisinage_____Y'. */ DEFV(Argument,DEFV(Logical,choisir_la_coordonnee_associee)); /* Dans le cas ou 'IL_NE_FAUT_PAS(interpoler_les_coordonnees)' indique si l'on doit */ /* utiliser 'f(t)' ('VRAI') ou 't' ('FAUX'). Ceci fut introduit le 20220118171346... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ Test(EST_VRAI(Iassociation_de_voisinage_____X_association__et__Y_association__sont_initialisees)) Bblock begin_image Bblock DEFV(genere_Int,INIT(niveau_Iassociation_de_voisinage_____X,loadI_point(Iassociation_de_voisinage_____X,X,Y))); DEFV(genere_Int,INIT(niveau_Iassociation_de_voisinage_____Y,loadI_point(Iassociation_de_voisinage_____Y,X,Y))); /* Introduit le 20181204130744 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ DEFV(genere_p,INIT(niveau_associe,NIVEAU_UNDEF)); DEFV(Int,INIT(coordonnee_X_associee,UNDEF)); DEFV(Int,INIT(coordonnee_Y_associee,UNDEF)); /* Introduit le 20220120084609 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ EGAL(niveau_associe ,NIVA(VADD(VMULF(alpha ,NIVR(load_point(imageA1 ,X,Y ) ) ) ,VMULF(beta_ ,NIVR(load_point_valide(imageA2 ,niveau_Iassociation_de_voisinage_____X ,niveau_Iassociation_de_voisinage_____Y ) ) ) ) ) ); /* On notera le 20220123133744 un probleme vu a cette date lors de la mise au point de */ /* 'v $xiirk/CRAQ.23' en essayant : */ /* */ /* set _____Alpha=0.83 */ /* set _____Beta=0.17 */ /* */ /* dans 'v $xiirk/$Fnota Debut_listG_CRAQ_23'... */ /* */ /* On trouve en fait ici : */ /* */ /* (0.83*255) + (0.17*255) = 254 */ /* */ /* ce qui est evidemment ennuyeux... Au passage communiquer cette expression directement */ /* a 'calcul' donne bien 255. Par contre le programme : */ /* */ /* #include <stdio.h> */ /* */ /* main() */ /* { */ /* double alpha=0.83,beta=0.17; */ /* int A1=255,A2=255; */ /* */ /* printf("%.16f+%.16f=%.16f\n" */ /* ,alpha,beta,alpha+beta */ /* ); */ /* printf("(%.16f*%d)+(%.16f*%d)=%d\n" */ /* ,alpha,A1,beta,A2,(int)((alpha*A1)+(beta*A2)) */ /* ); */ /* } */ /* */ /* donne : */ /* */ /* 0.8300000000000000+0.1700000000000000 = 1.0000000000000000 */ /* */ /* (0.8300000000000000*255)+(0.1700000000000000*255) = 254 */ /* */ /* Ennuyeux ! */ /* */ /* Le 20220124105103, on testera avec interet 'v $xtc/InterpolationErreursDArrondi.01$c'... */ EGAL(coordonnee_X_associee ,COND(IL_FAUT(interpoler_les_coordonnees) ,COXA(VADD(VMULF(alpha ,FLOT(COXR(X)) ) ,VMULF(beta_ ,FLOT(COXR(niveau_Iassociation_de_voisinage_____X)) ) ) ) ,COND(IL_FAUT(choisir_la_coordonnee_associee) ,niveau_Iassociation_de_voisinage_____X ,X ) ) ); EGAL(coordonnee_Y_associee ,COND(IL_FAUT(interpoler_les_coordonnees) ,COYA(VADD(VMULF(alpha ,FLOT(COYR(Y)) ) ,VMULF(beta_ ,FLOT(COYR(niveau_Iassociation_de_voisinage_____Y)) ) ) ) ,COND(IL_FAUT(choisir_la_coordonnee_associee) ,niveau_Iassociation_de_voisinage_____Y ,Y ) ) ); store_point_valide(niveau_associe ,imageR ,coordonnee_X_associee ,coordonnee_Y_associee ,FVARIABLE ); /* Le passage de 'store_point(...)' a 'store_point_valide(...)' a eu lieu le 20020617114730 */ /* apres la modification de 'v $xci/craque$K faire_appel_a_Iassociation_de_voisinage'. Il en */ /* est de meme pour le passage de 'load_point(...)' a 'load_point_valide(...)'. */ Eblock end_image Test(IL_FAUT(Iinterpolation_de_voisinage_____renormaliser_l_image_Resultat)) /* Test introduit le 20220123142321 a cause de 'v $xiii/tri_image$FON 20220123133744'... */ Bblock CALS(Irenormalisation(imageR,imageR)); Eblock ATes Bblock Eblock ETes Eblock ATes Bblock PRINT_ERREUR("l'initialisation par 'Iassociation_de_voisinage(...)' n'a pas encore ete faite"); /* Les matrices 'Iassociation_de_voisinage_____X' et 'Iassociation_de_voisinage_____Y' */ /* n'ont pas encore ete initialisees... */ Eblock ETes RETI(imageR); Eblock EFonctionP #undef Y_ASSOCIATION_IMPLICITE #undef X_ASSOCIATION_IMPLICITE _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* " B R O U I L L A G E " D ' U N E I M A G E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(FonctionP,POINTERp(Ibrouillage(imageR,imageA,matrice_de_brouillage,sens_direct,marquer_les_points_atteints)))) DEFV(Argument,DEFV(image,imageR)); /* Image Resultat, telle que : imageR[brouillage(X)][brouillage(Y)]=imageA[X][Y], ou */ /* imageR[X][Y]=imageA[brouillage(X)][brouillage(Y)]. */ DEFV(Argument,DEFV(image,imageA)); /* Image Argument a "brouiller"... */ DEFV(Argument,DEFV(imageJ,matrice_de_brouillage)); /* Matrice de "brouillage", les coordonnees 'X' et 'Y' qu'elle contient etant dans [0,1[. */ DEFV(Argument,DEFV(Logical,sens_direct)); /* Cet indicateur precise le sens du brouillage : */ /* */ /* 'VRAI' : imageR[brouillage(X)][brouillage(Y)]=imageA[X][Y], */ /* 'FAUX' : imageR[X][Y]=imageA[brouillage(X)][brouillage(Y)]. */ /* */ DEFV(Argument,DEFV(Logical,marquer_les_points_atteints)); /* Cet indicateur precise s'il faut ('VRAI') ou pas ('FAUX') generer une image 'Marqueur' */ /* distinguant les points atteints des points non atteints par le brouillage... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock /*..............................................................................................................................*/ Test(IL_FAUT(marquer_les_points_atteints)) Bblock MARQUAGE_VALIDATION_ET_INITIALISATION; /* Lorsqu'il faut marquer les points, on initialise l'image 'Marqueur'... */ Eblock ATes Bblock Eblock ETes begin_image Bblock DEFV(pointI_2D,point_brouille); INITIALISATION_POINT_2D(point_brouille ,_cDENORMALISE_OX(loadRJ_point(matrice_de_brouillage,X,Y)) ,_cDENORMALISE_OY(loadIJ_point(matrice_de_brouillage,X,Y)) ); /* Point entier brouille courant. Cette structure intermediaire a ete introduite a cause de */ /* 'SYSTEME_SUN4NCUBE2S_SUNOS_CC' qui nous gratifiait alors du message : */ /* */ /* ... line ...: compiler error: out of tree space; try simplifying */ /* */ /* et suite a cette aimable demande, j'ai simplifie... */ Test(IL_FAUT(sens_direct)) Bblock store_point_valide(load_point(imageA,X,Y) ,imageR ,ASD1(point_brouille,x) ,ASD1(point_brouille,y) ,FVARIABLE ); /* Et on "brouille" dans le sens direct : imageR[brouillage(X)][brouillage(Y)]=imageA[X][Y]. */ Test(IL_FAUT(marquer_les_points_atteints)) Bblock MARQUAGE_POINT(ASD1(point_brouille,x) ,ASD1(point_brouille,y) ); /* Marquage du point brouille dans le sens direct (si les deux coordonnees brouillees */ /* obtenue par 'matrice_de_brouillage' sont valides). */ Eblock ATes Bblock Eblock ETes Eblock ATes Bblock store_point(load_point_valide(imageA ,ASD1(point_brouille,x) ,ASD1(point_brouille,y) ) ,imageR ,X,Y ,FVARIABLE ); /* Et on "brouille" dans l'autre sens : imageR[X][Y]=imageA[brouillage(X)][brouillage(Y)]. */ Test(IL_FAUT(marquer_les_points_atteints)) Bblock Test(TEST_DANS_L_IMAGE(ASD1(point_brouille,x) ,ASD1(point_brouille,y) ) ) Bblock MARQUAGE_POINT(X,Y); /* Marquage du point brouille dans le sens inverse (uniquement si le point courant {X,Y} */ /* est l'image dans point valide via 'matrice_de_brouillage'). */ Eblock ATes Bblock Eblock ETes Eblock ATes Bblock Eblock ETes Eblock ETes Eblock end_image RETI(imageR); Eblock EFonctionP _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T I O N D E T R O I S L I S T E S D E S U B S T I T U T I O N */ /* A P A R T I R D E T R O I S I M A G E S : */ /* */ /*************************************************************************************************************************************/ BFonctionI #define NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS \ dimXY \ /* En effet, il ne peut pas y avoir plus de niveaux differents qu'il n'y a de points... */ #define PREMIER_NIVEAU_DIFFERENT \ INDEX0 #define DERNIER_NIVEAU_DIFFERENT \ LSTX(PREMIER_NIVEAU_DIFFERENT,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS) /* Premier et dernier niveaux differents. */ #define LISTE_NIVEAUX_DIFFERENTS(index,coordonnee) \ ASD1(IdTb1(liste_des_niveaux_differents \ ,INDX(index,PREMIER_NIVEAU_DIFFERENT) \ ,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS \ ) \ ,coordonnee \ ) #define LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index) \ IdTb1(liste_des_collisions_des_niveaux_identiques \ ,INDX(index,PREMIER_NIVEAU_DIFFERENT) \ ,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS \ ) #define LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index) \ IdTb1(liste_du_niveau_voisin_le_plus_proche \ ,INDX(index,PREMIER_NIVEAU_DIFFERENT) \ ,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS \ ) #define LISTE_DISTANCES_AU_PLUS_PROCHE_VOISIN(index) \ IdTb1(liste_des_distances_au_plus_proche_voisin \ ,INDX(index,PREMIER_NIVEAU_DIFFERENT) \ ,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS \ ) /* Procedures d'acces aux differentes listes... */ #define CALCUL_DES_DISTANCES_AU_PLUS_PROCHE_VOISIN(index_1_des_niveaux) \ Bblock \ DEFV(Int,INIT(index_2_des_niveaux,UNDEF)); \ /* Definition des index utiles... */ \ EGAL(LISTE_DISTANCES_AU_PLUS_PROCHE_VOISIN(index_1_des_niveaux),F_INFINI); \ /* Initialisation de la distance au plus proche voisin sur une valeur gigantesque... */ \ DoIn(index_2_des_niveaux,PREMIER_NIVEAU_DIFFERENT,index_du_dernier_niveau_range,PAS_COULEURS) \ /* ATTENTION, on n'optimise pas de la facon suivante : */ \ /* */ \ /* DoIn(index_2_des_niveaux,SUCC(index_1_des_niveaux),index_du_dernier_niveau_range,...) */ \ /* */ \ /* afin d'etre sur que toutes les entrees sont bien initialisees... */ \ Bblock \ Test(IFET(IZGT(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_1_des_niveaux)) \ ,IZGT(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_2_des_niveaux)) \ ) \ ) \ /* En effet, on ne regarde, bien entendu, que des couples de niveaux qui n'ont pas ete */ \ /* invalides par un 'CLIR(...)' dans une etape anterieure... */ \ Bblock \ DEFV(Float,INIT(distance_courante \ ,RdisI3D(LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,x) \ ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,y) \ ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,z) \ ,LISTE_NIVEAUX_DIFFERENTS(index_2_des_niveaux,x) \ ,LISTE_NIVEAUX_DIFFERENTS(index_2_des_niveaux,y) \ ,LISTE_NIVEAUX_DIFFERENTS(index_2_des_niveaux,z) \ ) \ ) \ ); \ /* Distance entre les deux niveaux courants (au sens euclidien). */ \ Test(IFLT(distance_courante,LISTE_DISTANCES_AU_PLUS_PROCHE_VOISIN(index_1_des_niveaux))) \ Bblock \ Test(IZGT(distance_courante)) \ Bblock \ EGAL(LISTE_DISTANCES_AU_PLUS_PROCHE_VOISIN(index_1_des_niveaux),distance_courante); \ /* A chaque fois que l'on trouve une distance plus petite, on la prend en compte... */ \ EGAL(LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_1_des_niveaux),index_2_des_niveaux); \ /* Et on memorise le voisin le plus proche (provisoire...). */ \ Eblock \ ATes \ Bblock \ Test(IFEQ(index_1_des_niveaux,index_2_des_niveaux)) \ /* Cas ou 'index_1_des_niveaux' et 'index_2_des_niveaux' sont egaux... */ \ Bblock \ Eblock \ ATes \ Bblock \ PRINT_ERREUR("la distance courante ne peut etre nulle"); \ CAL1(Prer4("niveau1(%04d)=(%g,%g,%g)\n" \ ,index_1_des_niveaux \ ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,x) \ ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,y) \ ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,z) \ ) \ ); \ CAL1(Prer4("niveau2(%04d)=(%g,%g,%g)\n" \ ,index_2_des_niveaux \ ,LISTE_NIVEAUX_DIFFERENTS(index_2_des_niveaux,x) \ ,LISTE_NIVEAUX_DIFFERENTS(index_2_des_niveaux,y) \ ,LISTE_NIVEAUX_DIFFERENTS(index_2_des_niveaux,z) \ ) \ ); \ Eblock \ ETes \ Eblock \ ETes \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ Eblock \ EDoI \ Eblock \ /* Calcul des distances au plus proche voisin pour 'index_1_des_niveaux'... */ DEFV(Common,DEFV(FonctionI,Ireduction_du_nombre_de_niveaux_1(imageA_ROUGE,imageA_VERTE,imageA_BLEUE ,epsilon_voisinage_ROUGE,epsilon_voisinage_VERTE,epsilon_voisinage_BLEUE ) ) ) DEFV(Argument,DEFV(image,imageA_ROUGE)); DEFV(Argument,DEFV(image,imageA_VERTE)); DEFV(Argument,DEFV(image,imageA_BLEUE)); /* Images Argument dites {ROUGE,VERTE,BLEUE}, bien que cela ne soit pas obligatoire. En */ /* effet, on suppose a priori que ce triplet d'image defini une image vraies couleurs dans */ /* l'espace 'RVB', mais cela peut etre aussi l'espace 'HLS', ou tout autre chose... */ DEFV(Argument,DEFV(Int,epsilon_voisinage_ROUGE)); DEFV(Argument,DEFV(Int,epsilon_voisinage_VERTE)); DEFV(Argument,DEFV(Int,epsilon_voisinage_BLEUE)); /* Parametres permettant de definir la notion de collision. Une valeur nulle fait que l'on */ /* distingue precisemment les niveaux qui sont differents, alors que pour une valeur */ /* strictement positive, on fait des regroupements sur des niveaux voisins... */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock INIT_ERROR; DEFV(pointI_3D,DdTb1(POINTERs ,liste_des_niveaux_differents ,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS ,tMalo(MUL2(NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS,SIZE(pointI_3D)),pointI_3D) ) ); /* Allocation du vecteur contenant la liste des niveaux {ROUGE,VERTE,BLEUE} (appeles */ /* ici {x,y,z}) differents a {epsilon_ROUGE,epsilon_VERTE,epsilon_BLEUE} pres. */ DEFV(Int,DdTb1(POINTERi ,liste_des_collisions_des_niveaux_identiques ,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS ,iMalo(MUL2(NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS,size_Int)) ) ); /* Allocation du vecteur contenant les compteurs de collisions des niveaux identiques. On */ /* trouve donc ici le nombre de points de l'image {imageA_ROUGE,imageA_VERTE,imageA_BLEUE} */ /* qui possedent la couleur a {epsilon_ROUGE,epsilon_VERTE,epsilon_BLEUE} pres. Cette liste */ /* est en fait un histogramme de l'image, mais non ordonne... */ DEFV(Int,DdTb1(POINTERi ,liste_du_niveau_voisin_le_plus_proche ,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS ,iMalo(MUL2(NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS,size_Int)) ) ); /* Allocation du vecteur contenant le voisin le plus proche. Pour chaque triplet */ /* {ROUGE,VERTE,BLEUE} (soit {x,y,z}) on trouve ici le triplet qui lui est le plus proche */ /* au sens de la distance euclidienne dans l'espace 'RVB' (ou tout autre...). */ DEFV(Float,DdTb1(POINTERf ,liste_des_distances_au_plus_proche_voisin ,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS ,fMalo(MUL2(NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS,size_Float)) ) ); /* Allocation du vecteur contenant les distances au plus proche voisin. Pour chaque triplet */ /* {ROUGE,VERTE,BLEUE} (soit {x,y,z}) on trouve ici la distance au triplet qui lui est le */ /* plus proche au sens de la distance euclidienne dans l'espace 'RVB' (ou tout autre...). */ DEFV(Int,INIT(index_1_des_niveaux,UNDEF)); /* Definition des index utiles... */ DEFV(Int,INIT(index_du_dernier_niveau_range,PRED(PREMIER_NIVEAU_DIFFERENT))); /* Definition de l'index du dernier niveau range dans la liste. */ DEFV(Int,INIT(nombre_de_niveaux_utiles,UNDEF)); /* Nombre de niveaux reellement utiles. */ DEFV(Int,INIT(niveau_courant_de_generation_des_listes_de_SUBSTITUTION,UNDEF)); /* Definition de l'index de generation des listes {ROUGE,VERTE,BLEUE}. */ /*..............................................................................................................................*/ MISE_A_L_ETAT_INITIAL_LISTE_DE_SUBSTITUTION; /* Au cas ou elles n'auraient pas encore ete initialisees... */ DoIn(index_1_des_niveaux,PREMIER_NIVEAU_DIFFERENT,DERNIER_NIVEAU_DIFFERENT,PAS_COULEURS) Bblock CLIR(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_1_des_niveaux)); /* Nettoyage de la liste des collisions (et mise a l'etat vide...). */ Eblock EDoI begin_image Bblock DEFV(Logical,INIT(on_a_trouve_une_collision,FAUX)); /* Indicateur de collisions rencontree. A priori, pour le point courant {X,Y}, on n'a pas */ /* encore vu si sa couleur (ou du moins ce que l'on appelle couleur puisque, rappelons-le */ /* le triplet d'images Argument ne sont pas necessairement dans l'espace 'RVB') etait deja */ /* connu dans 'LISTE_NIVEAUX_DIFFERENTS(...)'. */ DEFV(pointI_3D,niveau_courant); /* Definition du niveau courant... */ EGAL(ASD1(niveau_courant,x),load_point(imageA_ROUGE,X,Y)); EGAL(ASD1(niveau_courant,y),load_point(imageA_VERTE,X,Y)); EGAL(ASD1(niveau_courant,z),load_point(imageA_BLEUE,X,Y)); /* Definition du niveau courant. On notera la correspondance arbitraire suivante : */ /* */ /* ROUGE --> x */ /* VERTE --> y */ /* BLEUE --> z */ /* */ /* en rappelant que {ROUGE,VERTE,BLEUE} peuvent designer autre chose que des couleurs... */ DoIn(index_1_des_niveaux,PREMIER_NIVEAU_DIFFERENT,index_du_dernier_niveau_range,PAS_COULEURS) Bblock Test(EST_FAUX(on_a_trouve_une_collision)) Bblock /* Tant que 'niveau_courant' n'a pas ete retrouve dans 'LISTE_NIVEAUX_DIFFERENTS(...)', on */ /* continue a le chercher... */ Test(I3ET(IFEQ_a_peu_pres_absolu(ASD1(niveau_courant,x) ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,x) ,epsilon_voisinage_ROUGE ) ,IFEQ_a_peu_pres_absolu(ASD1(niveau_courant,y) ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,y) ,epsilon_voisinage_VERTE ) ,IFEQ_a_peu_pres_absolu(ASD1(niveau_courant,z) ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,z) ,epsilon_voisinage_BLEUE ) ) ) Bblock /* Le 'niveau_courant' a ete retrouve dans 'LISTE_NIVEAUX_DIFFERENTS(...)' : */ INCR(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_1_des_niveaux),I); /* Comptage des collisions, */ EGAL(on_a_trouve_une_collision,VRAI); /* Et on peut arreter en fait... */ Eblock ATes Bblock /* Le 'niveau_courant' n'a pas encore ete retrouve dans 'LISTE_NIVEAUX_DIFFERENTS(...)', */ /* on continue a explorer la liste des niveaux deja connus. */ Eblock ETes Eblock ATes Bblock Eblock ETes Eblock EDoI Test(EST_FAUX(on_a_trouve_une_collision)) Bblock /* Le 'niveau_courant' etait donc inconnu : */ INCR(index_du_dernier_niveau_range,PAS_COULEURS); /* Lorsque l'on n'a pas detecte de collisions, il convient de creer un nouveau niveau, */ EGAL(LISTE_NIVEAUX_DIFFERENTS(index_du_dernier_niveau_range,x),ASD1(niveau_courant,x)); EGAL(LISTE_NIVEAUX_DIFFERENTS(index_du_dernier_niveau_range,y),ASD1(niveau_courant,y)); EGAL(LISTE_NIVEAUX_DIFFERENTS(index_du_dernier_niveau_range,z),ASD1(niveau_courant,z)); /* Et de le ranger... */ INCR(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_du_dernier_niveau_range),I); /* Enfin, on initialise son compteur de collisions (a 1). */ Eblock ATes Bblock Eblock ETes Eblock end_image DoIn(index_1_des_niveaux,PREMIER_NIVEAU_DIFFERENT,index_du_dernier_niveau_range,PAS_COULEURS) Bblock CALCUL_DES_DISTANCES_AU_PLUS_PROCHE_VOISIN(index_1_des_niveaux); /* Calcul des distances au plus proche voisin pour 'index_1_des_niveaux'. Ainsi, pour */ /* chaque niveau (connu a {epsilon_ROUGE,epsilon_VERTE,epsilon_BLEUE} pres rappelons-le) on */ /* memorise quel est son niveau voisin le plus proche (au sens de la distance euclidienne). */ Eblock EDoI EGAL(nombre_de_niveaux_utiles,NBRE(PREMIER_NIVEAU_DIFFERENT,index_du_dernier_niveau_range)); /* Nombre de niveaux reellement utiles, c'est-a-dire de niveaux recuperes dans le triplet */ /* d'image Argument (connu a {epsilon_ROUGE,epsilon_VERTE,epsilon_BLEUE} pres rappelons-le). */ Tant(IFGT(nombre_de_niveaux_utiles,COULEURS)) /* Lors de chacune de ces iterations (et tant que l'on n'a pas atteint le seuil fatidique */ /* de 'COULEURS' niveaux) on va eliminer un niveau de la liste des niveaux connus. Pour */ /* choisir celui-ci, on recherche en fait celui qui est, dans toute la liste, le plus */ /* proche d'un autre ; lorsqu'il est trouve, il est fusionne avec son voisin. Le niveau */ /* unique ainsi obtenu remplace le plus peuple des deux qui viennent de fusionner... */ Bblock DEFV(Float,INIT(plus_petite_distance,F_INFINI)); DEFV(Int,INIT(index_plus_petite_distance,UNDEF)); /* Recherche de la plus petite distance courante. C'est en effet le niveau correspondant */ /* qui va etre regroupe avec son plus proche voisin... */ DEFV(Logical,INIT(on_a_trouve_la_plus_petite_distance,FAUX)); /* Afin de savoir si la recherche a ete fructueuse ou pas... */ DoIn(index_1_des_niveaux,PREMIER_NIVEAU_DIFFERENT,index_du_dernier_niveau_range,PAS_COULEURS) Bblock Test(IFET(IZGT(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_1_des_niveaux)) ,IZGT(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_1_des_niveaux))) ) ) Bblock Test(IFLT(LISTE_DISTANCES_AU_PLUS_PROCHE_VOISIN(index_1_des_niveaux),plus_petite_distance)) Bblock EGAL(plus_petite_distance,LISTE_DISTANCES_AU_PLUS_PROCHE_VOISIN(index_1_des_niveaux)); EGAL(index_plus_petite_distance,index_1_des_niveaux); /* Recherche du niveau 'index_plus_petite_distance' qui est, de tous, le plus proche d'un */ /* autre niveau, ces deux niveaux devant fusionner par la suite... */ EGAL(on_a_trouve_la_plus_petite_distance,VRAI); /* On a trouve une plus petite distance... */ Eblock ATes Bblock Eblock ETes Eblock ATes Bblock Eblock ETes Eblock EDoI Test(EST_VRAI(on_a_trouve_la_plus_petite_distance)) /* Ceci est le cas "normal"... */ Bblock /* La fusion entre le niveau 'index_plus_petite_distance' et son niveau le plus proche */ /* voisin 'LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance) va se faire */ /* sur le niveau le plus peuple des deux, ce que l'on determine dans le test ci-apres... */ Test(IZGT(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance)))) Bblock Eblock ATes Bblock PRINT_ERREUR("le plus proche voisin d'une plus petite distance est vide"); CAL1(Prer1("index de la plus petite distance=%d\n" ,index_plus_petite_distance ) ); CAL1(Prer1("index de son plus proche voisin.=%d\n" ,LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance) ) ); Eblock ETes Test(IFGE(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_plus_petite_distance) ,LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance)) ) ) Bblock /* Cas ou 'index_plus_petite_distance' est le plus peuple : c'est lui qui survit... */ INCR(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_plus_petite_distance) ,LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance)) ); CLIR(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance))); /* On transfere les collisions du niveau le moins peuple vers le niveau le plus peuple */ /* (soit 'index_plus_petite_distance'). */ EGAL(index_1_des_niveaux,index_plus_petite_distance); EGAL(index_plus_petite_distance,LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance)); /* Pour mettre a jour les distances ci-apres... */ Eblock ATes Bblock /* Cas ou 'LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance)' est le plus */ /* peuple : c'est lui qui survit... */ INCR(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance)) ,LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_plus_petite_distance) ); CLIR(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_plus_petite_distance)); /* On transfere les collisions du niveau le moins peuple (a savoir le niveau */ /* 'index_plus_petite_distance') vers le niveau le plus peuple. */ EGAL(index_1_des_niveaux,LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_plus_petite_distance)); /* Pour mettre a jour les distances ci-apres... */ Eblock ETes CALCUL_DES_DISTANCES_AU_PLUS_PROCHE_VOISIN(index_1_des_niveaux); /* Mise a jour des distances au plus proche voisin pour 'index_1_des_niveaux'... */ DoIn(index_1_des_niveaux,PREMIER_NIVEAU_DIFFERENT,index_du_dernier_niveau_range,PAS_COULEURS) Bblock Test(IZGT(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_1_des_niveaux))) Bblock Test(IFEQ(LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE(index_1_des_niveaux),index_plus_petite_distance)) Bblock CALCUL_DES_DISTANCES_AU_PLUS_PROCHE_VOISIN(index_1_des_niveaux); /* Mise a jour des distances au plus proche voisin pour 'index_1_des_niveaux', c'est-a-dire */ /* pour tous les niveaux qui referencaient le niveau qui vient d'etre regroupe avec un autre */ /* (et qu'on appelle maintenant 'index_plus_petite_distance'). */ Eblock ATes Bblock Eblock ETes Eblock ATes Bblock Eblock ETes Eblock EDoI DECR(nombre_de_niveaux_utiles,I); /* Et on decompte les niveaux reellement utilises... */ Eblock ATes /* Ceci est un cas anormal, qui theoriquement ne peut se produire... */ Bblock PRINT_ERREUR("le processus va boucler"); Eblock ETes Eblock ETan EGAL(niveau_courant_de_generation_des_listes_de_SUBSTITUTION,NOIR); /* Index de generation des listes de 'SUBSTITUTION'. */ DoIn(index_1_des_niveaux,PREMIER_NIVEAU_DIFFERENT,index_du_dernier_niveau_range,PAS_COULEURS) Bblock Test(IZGT(LISTE_COLLISIONS_NIVEAUX_IDENTIQUES(index_1_des_niveaux))) /* Balayage de la liste des niveaux reellement utilises. On notera que les entrees "vides" */ /* (c'est-a-dire celles qui contiennent '0') sont celles qui ont ete fusionnees ci-dessus, */ /* puis nettoyees par les 'CLIR(...)'... */ Bblock Test(IFLE(niveau_courant_de_generation_des_listes_de_SUBSTITUTION,BLANC)) Bblock MODIFICATION_LISTE_DE_COLORIAGE(niveau_courant_de_generation_des_listes_de_SUBSTITUTION ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,x) ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,y) ,LISTE_NIVEAUX_DIFFERENTS(index_1_des_niveaux,z) ); /* Generation des listes {ROUGE,VERTE,BLEUE}. N'oublions pas qu'il y a eu au tout debut */ /* un 'MISE_A_L_ETAT_INITIAL_LISTE_DE_SUBSTITUTION' tres utile au cas ou il y aurait un */ /* nombre de niveaux inferieurs a 'COULEURS'. */ INCR(niveau_courant_de_generation_des_listes_de_SUBSTITUTION,PAS_COULEURS); /* Et passage au niveau suivant... */ Eblock ATes Bblock PRINT_ERREUR("il y a trop de niveaux utiles"); CAL1(Prer1("niveau=%d\n",niveau_courant_de_generation_des_listes_de_SUBSTITUTION)); Eblock ETes Eblock ATes Bblock Eblock ETes Eblock EDoI /* Les 'ADRESSE_PLUS_DEFINIE's ci-dessous ont ete introduits le 20050221164730... */ FdTb1(liste_des_distances_au_plus_proche_voisin,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS,Float,ADRESSE_PLUS_DEFINIE); /* Liberation du vecteur contenant les distances au plus proche voisin. */ FdTb1(liste_du_niveau_voisin_le_plus_proche,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS,Int,ADRESSE_PLUS_DEFINIE); /* Liberation du vecteur contenant le voisin le plus proche. */ FdTb1(liste_des_collisions_des_niveaux_identiques,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS,Int,ADRESSE_PLUS_DEFINIE); /* Liberation du vecteur contenant les compteurs de collisions des niveaux identiques. */ FdTb1(liste_des_niveaux_differents,NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS,pointI_3D,ADRESSE_PLUS_DEFINIE); /* Liberation du vecteur contenant la liste des niveaux differents. */ /* Les 'ADRESSE_PLUS_DEFINIE's ci-dessus ont ete introduits le 20050221164730... */ RETU_ERROR; Eblock #undef CALCUL_DES_DISTANCES_AU_PLUS_PROCHE_VOISIN #undef LISTE_DISTANCES_AU_PLUS_PROCHE_VOISIN #undef LISTE_NIVEAU_VOISIN_LE_PLUS_PROCHE #undef LISTE_COLLISIONS_NIVEAUX_IDENTIQUES #undef LISTE_NIVEAUX_DIFFERENTS #undef DERNIER_NIVEAU_DIFFERENT #undef PREMIER_NIVEAU_DIFFERENT #undef NOMBRE_MAXIMAL_DE_NIVEAUX_DIFFERENTS EFonctionI _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O N V E R S I O N P O L A I R E --> C A R T E S I E N N E D E S C O O R D O N N E E S : */ /* */ /*************************************************************************************************************************************/ #define GENERE__FonctionF_conver_RT_XY(nom_et_arguments_de_la_fonction,Fconversion) \ /* Ce generateur a ete introduit le 20080920094533... */ \ DEFV(FonctionF,POINTERF(nom_et_arguments_de_la_fonction)) \ /* Fonction introduite le 20080821101117. */ \ DEFV(Argument,DEFV(imageF,iR)); \ /* Image Resultat, telle que : iR=Fconversion(iAR,iAT). */ \ DEFV(Argument,DEFV(imageF,iAR)); \ /* Premiere image Argument definissant 'RHO', */ \ DEFV(Argument,DEFV(imageF,iAT)); \ /* Seconde image Argument definissant 'THETA'. */ \ /*-----------------------------------------------------------------------------------------------------------------------------------*/ \ Bblock \ /*..............................................................................................................................*/ \ begin_image \ Bblock \ DEFV(genere_Float,INIT(niveau_iAR,loadF_point(iAR,X,Y))); \ DEFV(genere_Float,INIT(niveau_iAT,loadF_point(iAT,X,Y))); \ /* Introduit le 20181204120940 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ \ \ storeF_point(ADD2(Fconversion(niveau_iAR \ ,niveau_iAT \ ) \ ,NomDeLaFonctionCourante QD@@__ _____Post___Translation \ ) \ ,iR \ ,X,Y \ ); \ Eblock \ end_image \ \ RETIF(iR); \ Eblock /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O N V E R S I O N P O L A I R E --> C A R T E S I E N N E { X } D E S C O O R D O N N E E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(IFconversion_RT_X_____Post___Translation,FZERO))); /* Le 20080821112342, 'NEUT(FDU)' a ete remplace par 'FZERO', plus logique... */ DEFV(Common,GENERE__FonctionF_conver_RT_XY(IFconversion_RT_X(iR,iAR,iAT),Xcartesienne_2D)) /* Common,DEFV(Fonction,) : */ EFonctionF /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O N V E R S I O N P O L A I R E --> C A R T E S I E N N E { Y } D E S C O O R D O N N E E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(IFconversion_RT_Y_____Post___Translation,FZERO))); /* Le 20080821112342, 'NEUT(FDU)' a ete remplace par 'FZERO', plus logique... */ DEFV(Common,GENERE__FonctionF_conver_RT_XY(IFconversion_RT_Y(iR,iAR,iAT),Ycartesienne_2D)) /* Common,DEFV(Fonction,) : */ EFonctionF #undef GENERE__FonctionF_conver_RT_XY _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O N V E R S I O N C A R T E S I E N N E --> P O L A I R E D E S C O O R D O N N E E S : */ /* */ /*************************************************************************************************************************************/ #define GENERE__FonctionF_conver_XY_RT(nom_et_arguments_de_la_fonction,Fconversion) \ /* Ce generateur a ete introduit le 20080920094533... */ \ DEFV(FonctionF,POINTERF(nom_et_arguments_de_la_fonction)) \ /* Fonction introduite le 20080821101117. */ \ DEFV(Argument,DEFV(imageF,iR)); \ /* Image Resultat, telle que : iR=Fconversion(iAX,iAY). */ \ DEFV(Argument,DEFV(imageF,iAX)); \ /* Premiere image Argument definissant 'X', */ \ DEFV(Argument,DEFV(imageF,iAY)); \ /* Seconde image Argument definissant 'Y', */ \ /*-----------------------------------------------------------------------------------------------------------------------------------*/ \ Bblock \ /*..............................................................................................................................*/ \ begin_image \ Bblock \ DEFV(genere_Float,INIT(niveau_iAX,loadF_point(iAX,X,Y))); \ DEFV(genere_Float,INIT(niveau_iAY,loadF_point(iAY,X,Y))); \ /* Introduit le 20181204130744 afin d'alleger 'v $xbii/tri_image$K 20181203171953'... */ \ \ storeF_point(Fconversion(SOUS(niveau_iAX,NomDeLaFonctionCourante QD@@__ _____PreAntiTranslation_X) \ ,SOUS(niveau_iAY,NomDeLaFonctionCourante QD@@__ _____PreAntiTranslation_Y) \ ) \ ,iR \ ,X,Y \ ); \ Eblock \ end_image \ \ RETIF(iR); \ Eblock /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O N V E R S I O N C A R T E S I E N N E --> P O L A I R E { RHO } D E S C O O R D O N N E E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(IFconversion_XY_R_____PreAntiTranslation_X,FZERO))); DEFV(Common,DEFV(Float,SINT(IFconversion_XY_R_____PreAntiTranslation_Y,FZERO))); /* Le 20080821112342, 'NEUT(FDU)' a ete remplace par 'FZERO', plus logique... */ DEFV(Common,GENERE__FonctionF_conver_XY_RT(IFconversion_XY_R(iR,iAX,iAY),Rho_2D)) /* Common,DEFV(Fonction,) : */ EFonctionF /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O N V E R S I O N C A R T E S I E N N E --> P O L A I R E { THETA } D E S C O O R D O N N E E S : */ /* */ /*************************************************************************************************************************************/ BFonctionF DEFV(Common,DEFV(Float,SINT(IFconversion_XY_T_____PreAntiTranslation_X,FZERO))); DEFV(Common,DEFV(Float,SINT(IFconversion_XY_T_____PreAntiTranslation_Y,FZERO))); /* Le 20080821112342, 'NEUT(FDU)' a ete remplace par 'FZERO', plus logique... */ DEFV(Common,GENERE__FonctionF_conver_XY_RT(IFconversion_XY_T(iR,iAX,iAY),Theta_2D)) /* Common,DEFV(Fonction,) : */ EFonctionF #undef GENERE__FonctionF_conver_XY_RT _______________________________________________________________________________________________________________________________________ _______________________________________________________________________________________________________________________________________ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O M P R E S S I O N / D E C O M P R E S S I O N M A S Q U E E D ' U N E I M A G E : */ /* */ /*************************************************************************************************************************************/ #define COMPRESSION_DECOMPRESSION_MASQUEE(X1,Y1,X2,Y2,seuil,editer,nombre_de_points_transferes) \ Bblock \ CLIR(nombre_de_points_transferes); \ \ begin_image \ Bblock \ Test(IFLE(load_point(masque,X,Y),seuil)) \ Bblock \ /* Cas d'un point qui ne doit pas etre transfere... */ \ Eblock \ ATes \ Bblock \ /* Cas d'un point qui doit etre transfere : */ \ store_point(load_point(imageA,X1,Y1),imageR,X2,Y2,FVARIABLE); \ /* Deplacement de 'imageA' vers 'imageR'. */ \ \ INCR(nombre_de_points_transferes,I); \ \ EGAL(Xcourant,SUCX(Xcourant)); \ /* Progression de l'abscisse de 'imageA'. */ \ \ Test(IFGT(Xcourant,Xmax)) \ Bblock \ EGAL(Xcourant,Xmin); \ EGAL(Ycourant,SUCY(Ycourant)); \ /* Progression de l'ordonnee de 'imageA'. */ \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ Eblock \ ETes \ Eblock \ end_image \ \ Test(IL_FAUT(editer)) \ \ Bblock \ CAL3(Prme1("NombreDePointsTransferes=%d\n",nombre_de_points_transferes)); \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ Eblock /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* C O M P R E S S I O N M A S Q U E E D ' U N E I M A G E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(Logical,SINT(Icompression_masquee_____nettoyer,VRAI))); DEFV(Common,DEFV(genere_p,SINT(Icompression_masquee_____seuil,NOIR))); DEFV(Common,DEFV(Logical,SINT(Icompression_masquee_____editer,FAUX))); DEFV(Common,DEFV(Int,SINT(Icompression_masquee_____nombre_de_points_transferes,ZERO))); /* Le 'nombre_de_points_transferes' a ete place ici le 20140623104044 afin d'etre utilisable */ /* a l'exterieur ('v $xci/CompressionDeCompressionMasquee$K nombre_de_points_transferes'). */ DEFV(Common,DEFV(FonctionP,POINTERp(Icompression_masquee(imageR,imageA,masque)))) /* Fonction introduite le 20140619131106... */ DEFV(Argument,DEFV(image,imageR)); /* Image Resultat. */ DEFV(Argument,DEFV(image,imageA)); /* Image Argument, */ DEFV(Argument,DEFV(image,masque)); /* Masque. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Int,INIT(Xcourant,Xmin)); DEFV(Int,INIT(Ycourant,Ymin)); /* Coordonnees de generation de 'imageR'. */ /*..............................................................................................................................*/ Test(IL_FAUT(Icompression_masquee_____nettoyer)) Bblock CALi(Inoir(imageR)); Eblock ATes Bblock Eblock ETes COMPRESSION_DECOMPRESSION_MASQUEE(X,Y ,Xcourant,Ycourant ,Icompression_masquee_____seuil ,Icompression_masquee_____editer ,Icompression_masquee_____nombre_de_points_transferes ); RETI(imageR); Eblock EFonctionP /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* D E C O M P R E S S I O N M A S Q U E E D ' U N E I M A G E : */ /* */ /*************************************************************************************************************************************/ BFonctionP DEFV(Common,DEFV(genere_p,SINT(Idecompression_masquee_____seuil,NOIR))); DEFV(Common,DEFV(Logical,SINT(Idecompression_masquee_____editer,FAUX))); DEFV(Common,DEFV(Int,SINT(Idecompression_masquee_____nombre_de_points_transferes,ZERO))); /* Le 'nombre_de_points_transferes' a ete place ici le 20140623104044 afin d'etre utilisable */ /* a l'exterieur ('v $xci/CompressionDeCompressionMasquee$K nombre_de_points_transferes'). */ DEFV(Common,DEFV(FonctionP,POINTERp(Idecompression_masquee(imageR,imageA,masque)))) /* Fonction introduite le 20140619131106... */ DEFV(Argument,DEFV(image,imageR)); /* Image Resultat. */ DEFV(Argument,DEFV(image,imageA)); /* Image Argument, */ DEFV(Argument,DEFV(image,masque)); /* Masque. */ /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(Int,INIT(Xcourant,Xmin)); DEFV(Int,INIT(Ycourant,Ymin)); /* Coordonnees de generation de 'imageR'. */ /*..............................................................................................................................*/ COMPRESSION_DECOMPRESSION_MASQUEE(Xcourant,Ycourant ,X,Y ,Idecompression_masquee_____seuil ,Idecompression_masquee_____editer ,Idecompression_masquee_____nombre_de_points_transferes ); RETI(imageR); Eblock EFonctionP #undef COMPRESSION_DECOMPRESSION_MASQUEE _______________________________________________________________________________________________________________________________________