60 
// Image dimensions and recursion depth. 
// Image dimensions and recursion depth. 
61 
// DEPTH = 2 is a reasonable value, 
// DEPTH = 2 is a reasonable value, 
62 
// DEPTH = 3 gives good quality, and higher values may improve the results even more but at the cost of significantly longer computation times. 
// DEPTH = 3 gives good quality, and higher values may improve the results even more but at the cost of significantly longer computation times. 

#define WIDTH 240 


#define HEIGHT 200 

63 
#define DEPTH 2 
#define DEPTH 2 
64 


65 


421 


422 
init_tables(); 
init_tables(); 
423 


424 

int width=sourcePicture.GetWidth(); 
425 

int height=sourcePicture.GetHeight(); 
426 


427 
// Load the image into a friendly array of fast integers. 
// Load the image into a friendly array of fast integers. 
428 
// We create it slightly bigger than the image so that we don't have to care about borders when propagating the error later 
// We create it slightly bigger than the image so that we don't have to care about borders when propagating the error later 
429 
int* src = (int*)calloc((WIDTH + 1) * (HEIGHT + 1) * 3, sizeof(int)); 
int* src = (int*)calloc((width + 1) * (height + 1) * 3, sizeof(int)); 
430 
int* dst = (int*)calloc((WIDTH + 1) * (HEIGHT + 1) * 3, sizeof(int)); 
int* dst = (int*)calloc((width + 1) * (height + 1) * 3, sizeof(int)); 
431 
int stride = (WIDTH + 1) * 3; 
int stride = (width + 1) * 3; 
432 


433 
unsigned int pictureWidth(sourcePicture.GetWidth()); 
unsigned int pictureWidth(sourcePicture.GetWidth()); 
434 


456 
{ 
{ 
457 
unsigned char bg = 0, fg = 7; 
unsigned char bg = 0, fg = 7; 
458 


459 
fprintf(stderr, "\rProcessing... %i%%", (y + 1) / 2); 
fprintf(stderr, "\rProcessing... %i%%", (y + 1)*100 / height); 
460 


461 
for (x = 0; x < pictureWidth; x += 6) 
for (x = 0; x < pictureWidth; x += 6) 
462 
{ 
{ 