| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 
 |  
BOOL CImage::Compression(int qualite)
{
	//on suppose que les images ont des dimensions qui sont des multiples de 8       
	//Je rappelle que width est la largeur et height est la hauteur
	//nombre de matrice 8x8 dans la largeur de l'image
	int 	nb_mat8_larg = BmSrcInfo->biWidth/8;
	//nombre de matrice 8x8 dans la hauteur de l'image
	int     nb_mat8_haut = BmSrcInfo->biHeight/8;
 
 
	//Limitation du facteur de qualite
		if ( qualite>25)
		  qualite=25;
		else ( qualite<0)
		  qualite=1;
 
 if(BmSrcInfo->biBitCount==32) // 32 bits
	{
 
 
 for (x=0 ; x<nb_mat8_larg ; x++)
	{
	for (y=0 ; y<nb_mat8_haut ; y++)
		{
		//  -/----------------\-
		BYTE M88[8][8];
		BYTE M88_128[8][8];
		BYTE M88DCT[8][8];
		BYTE M_quantifiee[8][8];
		Get88Matrix32(lpSrcBits, BmSrcInfo->biWidth, x, y, M88, ROUGE);
		AjoutMatrix32(M88, BmSrcInfo->biWidth, x, y,-128, M88_128, ROUGE);
		DCTMatrix32(M88_128, BmSrcInfo->biWidth, x, y, M88DCT, ROUGE);
		qantiMatrix32(M88DCT, BmSrcInfo->biWidth, x, y, Fq, M_quantifiee, ROUGE);
		destiMatrix32(M_quantifiee, BmSrcInfo->biWidth, x, y, lpDestBits, ROUGE);
 
 
	}
		}
 
}
 GlobalUnlock(m_hDib);
	GlobalUnlock(hNewDib);
	GlobalFree(m_hDib);
 
	// On supprime l'ancien DIB et on le remplace par le nouveau:oops: :oops: 
	m_hDib = hNewDib;
	return TRUE;
} |