From fe41a56c66bdf23ff1c3a4c1e534a011f7e2feea Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Tue, 27 Nov 2018 15:49:24 +0100 Subject: [PATCH] documentation update --- doc/Doxyfile | 2 +- src/compress.c | 14 ++------------ src/ppm.c | 3 ++- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index 4aa53f4..6322651 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "Compression par surfaces unies" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.4 +PROJECT_NUMBER = 1.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/src/compress.c b/src/compress.c index 4537b08..0727c1a 100644 --- a/src/compress.c +++ b/src/compress.c @@ -57,18 +57,16 @@ void addPixelToSelectedZone(Image *t_img, int64_t t_idx, Zone *t_zone) { } for (left_limit = t_idx; left_limit - (y - 1) * (int64_t)t_img->sizeX >= 0; - --left_limit) { /* fetch right limit of segment */ + --left_limit) { current_pixel = darrayGet(t_img->pixels, (size_t)left_limit); if (current_pixel->visited || !sameColor(current_pixel, t_zone)) { break; } (*current_pixel).visited = 1; } - /* Add segment to its zone */ darrayPushBack(t_zone->segments, newSegment((uint32_t)right_limit, (uint32_t)left_limit)); - for (; left_limit <= right_limit; - ++left_limit) { /* process every pixel up and down the segment */ + for (; left_limit <= right_limit; ++left_limit) { addPixelToSelectedZone(t_img, t_idx + t_img->sizeX, t_zone); } } @@ -86,25 +84,17 @@ void chooseZoneForPixel(Image *t_img, int64_t t_idx, darray *t_zones) { Zone *current_zone; Pixel *pixel; size_t i; - pixel = darrayGet(t_img->pixels, (size_t)t_idx); - /* if the pixel has already been visited, no need to continue */ if (pixel->visited) { return; } - /* for each known zone, see if it matches the current pixel's color */ for (i = 0; i < darraySize(t_zones); ++i) { current_zone = darrayGet(t_zones, i); - /* if it does, add selected pixel and its neighbouring pixels of the same - * color */ if (sameColor(pixel, current_zone)) { addPixelToSelectedZone(t_img, t_idx, current_zone); return; } } - /* if none of the same color was found, create a new one, add it to the image - * and add the selected pixel and its neighbours of the same color to the zone - */ current_zone = newZone(pixel->red, pixel->green, pixel->blue); darrayPushBack(t_zones, current_zone); addPixelToSelectedZone(t_img, t_idx, current_zone); diff --git a/src/ppm.c b/src/ppm.c index f659081..c95840c 100644 --- a/src/ppm.c +++ b/src/ppm.c @@ -200,11 +200,12 @@ int imageLoadPPM(const char *t_filename, Image *t_img) { } /** -() * Ouvre le fichier image avec son nom de fichier passé par le paramètre + * Ouvre le fichier image avec son nom de fichier passé par le paramètre * `filename` et y écrit les informations trouvées dans l’objet `img`. * * \param[in] t_filename Nom du fichier image à ouvrir * \param[in] t_img Objet \ref Image à écrire + * \param[in] t_data Données décompressées de l’image au format natif ppm */ void imageSavePPM(const char *t_filename, Image *t_img, uint8_t *t_data) { FILE *fp;