5.2.1.1 : Le header intrinsics_propagation_block.h



Écrivons le fichier intrinsics_propagation_block.h :



Comme d'habitude, il faut commencer par définir des macro qui éviterons les inclusions multiples de notre header :

1
2
#ifndef __INTRINSICS_PROPAGATION_BLOCK_H__
#define __INTRINSICS_PROPAGATION_BLOCK_H__


Nous aurons besoin de découper nos tenseurs en blocs :

1
#include "PTensor.h"


Le prototype de notre fonction :

1
2
3
4
5
6
void grayscott_propagation_block(PTensor<float> & outMatVecU, PTensor<float> & outMatVecV, const PTensor<float> & matVecVecU, const PTensor<float> & matVecVecV,
				std::vector<PBlock<float> > & vecBlockOutU, std::vector<PBlock<float> > & vecBlockOutV,
				std::vector<PBlock<float> > & vecBlockInU, std::vector<PBlock<float> > & vecBlockInV,
				size_t blockNbRow, size_t blockNbCol,
				const float * matBroadcastDeltaSquare, long nbStencilRow, long nbStencilCol,
				float diffusionRateU, float diffusionRateV, float feedRate, float killRate, float dt);


Où :
Le fait de garder les vecteurs de blocs permet de ne pas les réallouer à chaque fois que l'on traite une image.


Et finalement la fin de la condition du préprocesseur :

1
#endif


Le fichier intrinsics_propagation_block.h complet :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/***************************************
	Auteur : Pierre Aubert
	Mail : aubertp7@gmail.com
	Licence : CeCILL-C
****************************************/

#ifndef __INTRINSICS_PROPAGATION_BLOCK_H__
#define __INTRINSICS_PROPAGATION_BLOCK_H__

#include "PTensor.h"

void grayscott_propagation_block(PTensor<float> & outMatVecU, PTensor<float> & outMatVecV, const PTensor<float> & matVecVecU, const PTensor<float> & matVecVecV,
				std::vector<PBlock<float> > & vecBlockOutU, std::vector<PBlock<float> > & vecBlockOutV,
				std::vector<PBlock<float> > & vecBlockInU, std::vector<PBlock<float> > & vecBlockInV,
				size_t blockNbRow, size_t blockNbCol,
				const float * matBroadcastDeltaSquare, long nbStencilRow, long nbStencilCol,
				float diffusionRateU, float diffusionRateV, float feedRate, float killRate, float dt);

#endif


Vous pouvez le télécharger ici.