Debug prints now only in debug builds
This commit is contained in:
parent
9c843e6af3
commit
87dfa5b2a6
23
src/common.c
23
src/common.c
@ -106,24 +106,25 @@ darray* imgToZones(Image* t_img) {
|
||||
}
|
||||
|
||||
void compress(const char *input_file) {
|
||||
Image* img;
|
||||
Image *img;
|
||||
darray *zones;
|
||||
img = newImage();
|
||||
imageLoadPPM(input_file, img);
|
||||
zones = imgToZones(img);
|
||||
|
||||
printf("Detected %zu zones\n", darraySize(zones));
|
||||
for(size_t i = 0; i < darraySize(zones); ++i) {
|
||||
Zone* zone = darrayGet(zones, i);
|
||||
printf("\n=== Zone %zu (%d %d %d) ===\n", i, zone->r, zone->g, zone->b);
|
||||
for(size_t j = 0; j < darraySize(zone->segments); ++j) {
|
||||
Segment* segm = darrayGet(zone->segments, j);
|
||||
printf("[%d: %d, %d]\t", segm->y, segm->xg, segm->xd);
|
||||
/* print segments for debug ************************************************/
|
||||
DEBUG {
|
||||
printf("Detected %zu zones\n", darraySize(zones));
|
||||
for (size_t i = 0; i < darraySize(zones); ++i) {
|
||||
Zone *zone = darrayGet(zones, i);
|
||||
printf("\n=== Zone %zu (%d %d %d) ===\n", i, zone->r, zone->g, zone->b);
|
||||
for (size_t j = 0; j < darraySize(zone->segments); ++j) {
|
||||
Segment *segm = darrayGet(zone->segments, j);
|
||||
printf("[%zu: %d, %d]\t", segm->xg / img->x, segm->xg, segm->xd);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
|
||||
deleteImage(img);
|
||||
printf("test\n");
|
||||
}
|
||||
|
@ -122,7 +122,9 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "ERROR: no input file.");
|
||||
help(ARGERROR);
|
||||
}
|
||||
printf("input: %s\noutput: %s\n", argresults.input, argresults.output);
|
||||
DEBUG {
|
||||
printf("input: %s\noutput: %s\n", argresults.input, argresults.output);
|
||||
}
|
||||
if(argresults.compress) {
|
||||
compress(argresults.input);
|
||||
} else {
|
||||
|
@ -111,7 +111,9 @@ unsigned long read_data(FILE *t_fp, Image *t_img, unsigned char **t_data,
|
||||
unsigned long size;
|
||||
/* allocation memoire */
|
||||
size = t_img->x * t_img->y * 3;
|
||||
printf("Size image %lu %lu => %lu\n", t_img->x, t_img->y, size);
|
||||
DEBUG {
|
||||
printf("Size image %lu %lu => %lu\n", t_img->x, t_img->y, t_img->x * t_img->y);
|
||||
}
|
||||
*t_data = (unsigned char *)malloc((size_t)size * sizeof(unsigned char));
|
||||
assert(*t_data);
|
||||
/* read pixel data from file */
|
||||
|
@ -63,7 +63,9 @@ Image *newImage() {
|
||||
* \param[in] self Conteneur d’image à détruire
|
||||
*/
|
||||
void deleteImage(Image *t_self) {
|
||||
printf("deleted all pixels\n");
|
||||
DEBUG {
|
||||
printf("deleted all pixels\n");
|
||||
}
|
||||
darrayDelete(t_self->pixels);
|
||||
free(t_self);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user