Ignore:
Timestamp:
Mar 2, 2016, 3:08:27 PM (8 years ago)
Author:
meunier
Message:
  • Bug fixes in Rosenfeld
Location:
soft/giet_vm/applications/rosenfeld/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/rosenfeld/src/bmpNR.c

    r772 r798  
    1010#include <stdlib.h>
    1111#include <math.h>
    12 
    1312
    1413/* -- image -- */
     
    2019#include "nralloc.h"
    2120#endif
     21
     22#if TARGET_OS == LINUX
     23    #include <sys/types.h>
     24    #include <sys/stat.h>
     25    #include <fcntl.h>
     26    #include <unistd.h>
     27#endif
     28
    2229
    2330#include "palette.h"
     
    242249    //DEBUG(printf("BMP  : %d %d\n", sizeof( BitmapFileHeader), sizeof( BitmapInfoHeader)));
    243250    if (sizeof(BitmapFileHeader) != 14) {
    244         printf("*** Error SaveMBP: sizeof(BitmapFileHeader) = %d should be 14...\n", sizeof(BitmapFileHeader));
     251        printf("*** Error SaveMBP: sizeof(BitmapFileHeader) = %d should be 14...\n", (int) sizeof(BitmapFileHeader));
    245252    }
    246253
  • soft/giet_vm/applications/rosenfeld/src/dummy_func.c

    r792 r798  
    1010
    1111
    12 
    13 IMAGE_EXPORT(uint8 **) LoadPGM_ui8matrix(char *filename, int *nrl, int *nrh, int *ncl, int *nch) { return NULL; }
    14 IMAGE_EXPORT(void) SavePGM_ui8matrix(uint8 **m, int nrl, int nrh, int ncl, int nch, char *filename) {}
    15 
    1612void write_ui8matrix_positive (uint8  **m,int i0, int i1, int j0, int j1, int iformat, char *filename) {}
    1713
  • soft/giet_vm/applications/rosenfeld/src/ecc_common.c

    r777 r798  
    88#include <math.h>
    99
    10 
    1110#ifdef CLI
    1211#include "nrc_os_config.h"
    1312#include "nrc.h"
    1413#endif
     14
     15#if TARGET_OS == LINUX
     16    #include <sys/types.h>
     17    #include <sys/stat.h>
     18    #include <fcntl.h>
     19#endif
     20
    1521
    1622#include "ecc_common.h"
  • soft/giet_vm/applications/rosenfeld/src/ecc_features.c

    r772 r798  
    1919#include <malloc.h>
    2020
    21 #ifdef OPENMP
    22 #include <omp.h>
    23 #endif
    2421
    2522#ifdef CLI
    2623#include "nrc_os_config.h"
    2724#include "nrc.h"
     25#endif
     26
     27
     28
     29#if TARGET_OS == LINUX
     30    #include <sys/types.h>
     31    #include <sys/stat.h>
     32    #include <fcntl.h>
     33#endif
     34
     35
     36#ifdef OPENMP
     37#include <omp.h>
    2838#endif
    2939
     
    147157// ---------------------------------
    148158{
    149     int ne;
     159    int ne = 0;
    150160    // @QM giet
    151161    fscanf(fd, "%d", &ne);
     
    162172// --------------------------------------------------------------
    163173{
    164     int i, t;
     174    int i;
    165175   
    166176    for (i = 1; i <= ne; i++) {
  • soft/giet_vm/applications/rosenfeld/src/ecc_main_rosenfeld_sa.c

    r791 r798  
    159159// ---------------------------------------------------------------------
    160160{
    161     printf("[---------------------------]");
    162     printf("[--- main_rosenfeld_file ---]");
    163     printf("[---------------------------]");
    164    
    165     char *pathSrc = src_path;
    166     char *pathDst = dst_path;
    167    
    168     uint8 **X0, **X;
    169     uint8 **E8;
    170    
    171     uint32 **E32;
    172     uint32 *S; // Stack for Bailey algorithm
    173    
    174     uint32 *T;
    175     uint32 *A;
    176     uint32 *N;
    177     //uint32 *SNE; // memorisation de la somme des ne: sne
     161    printf("[---------------------------]\n");
     162    printf("[--- main_rosenfeld_file ---]\n");
     163    printf("[---------------------------]\n");
     164   
     165    char * pathSrc = src_path;
     166    char * pathDst = dst_path;
     167   
     168    uint8 ** X0;
     169    uint8 ** X;
     170    uint8 ** E8;
     171   
     172    uint32 ** E32;
     173    uint32 * S; // Stack for Bailey algorithm
     174   
     175    uint32 * T;
     176    uint32 * A;
     177    uint32 * N;
     178    //uint32 * SNE; // memorisation de la somme des ne: sne
    178179
    179180    int i0, i1, j0, j1;
    180     int height, width, border=1;
     181    int height, width, border = 1;
    181182    uint32 nemax, nermax;
    182183    int na;
     
    191192
    192193    // chargement d'une image depuis le disque
    193     //X0 = LoadPGM_ui8matrix(complete_filename, &i0, &i1, &j0, &j1);
    194     init_forme_boulon1(&X0, &i0, &i1, &j0, &j1);
    195    
     194    printf("Loading file %s... ", filename);
     195    X0 = LoadPGM_ui8matrix(complete_filename, &i0, &i1, &j0, &j1);
     196    //init_forme_boulon1(&X0, &i0, &i1, &j0, &j1);
     197    printf("done.\n");
     198
     199    printf("Allocating memory... ");
    196200    // allocation memoire
    197201    X   = ui8matrix (i0 - border, i1 + border, j0 - border, j1 + border);
     
    206210    // pre-traitements
    207211    binarisation_ui8matrix(X0, i0, i1, j0, j1, 20, 1, X); // pour le traitement
    208     //binarisation_ui8matrix(X0, i0, i1, j0, j1, 20, 255, X0); // pour la verif visuelle
    209     //generate_path_filename(pathDst, "verif.pgm", complete_filename, 1024);
    210     //SavePGM_ui8matrix(X0, i0, i1, j0, j1, complete_filename);
     212    binarisation_ui8matrix(X0, i0, i1, j0, j1, 20, 255, X0); // pour la verif visuelle
     213    printf("done.\n");
     214
     215    printf("Saving file %s for verification... ", complete_filename);
     216    generate_path_filename(pathDst, "verif.pgm", complete_filename, 1024);
     217    SavePGM_ui8matrix(X0, i0, i1, j0, j1, complete_filename);
     218    printf("done.\n");
    211219
    212220    height = i1 - i0 + 1;
     
    246254    /*na = Rosenfeld_UF_Org2_4C    (X, height, width, E32, T, A, nemax, Stats); ECC_VERBOSE(printf("na = %d\n", na)); filename = "Rosenfeld_UF_Org2_4C.bmp";     mod_ui32matrix_ui8matrix(E32, i0, i1, j0, j1, E8); generate_path_filename(pathDst, filename, complete_filename); SaveBMP2_ui8matrix(E8, width, height, palette, complete_filename); zero_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border); display_RegionStatsVector(Stats, 1, na, "Stats"); zero_RegionStatsVector(Stats, 0, nemax);*/
    247255
    248     free_ui8matrix (X0,  i0,        i1,        j0,        j1);
    249     free_ui8matrix (X,   i0-border, i1+border, j0-border, j1+border);
    250     free_ui8matrix (E8,  i0-border, i1+border, j0-border, j1+border);
    251     free_ui32matrix(E32, i0-border, i1+border, j0-border, j1+border);
     256    free_ui8matrix (X0,  i0,          i1,          j0,          j1);
     257    free_ui8matrix (X,   i0 - border, i1 + border, j0 - border, j1 + border);
     258    free_ui8matrix (E8,  i0 - border, i1 + border, j0 - border, j1 + border);
     259    free_ui32matrix(E32, i0 - border, i1 + border, j0 - border, j1 + border);
    252260   
    253261    free_ui32vector(T, 0, nemax);
     
    255263    free_ui32vector(N, 0, nemax);
    256264   
    257     free_ui32vector(S, 0, 2*nermax);
     265    free_ui32vector(S, 0, 2 * nermax);
    258266
    259267    return;
     
    267275    char *dst_path;
    268276   
    269     printf("[======================]");
    270     printf("[=== main_rosenfeld ===]");
    271     printf("[======================]");
    272    
    273     src_path = "./"; // ne pas oublier le / a la fin
     277    printf("[======================]\n");
     278    printf("[=== main_rosenfeld ===]\n");
     279    printf("[======================]\n");
     280   
     281    src_path = "/misc/"; // ne pas oublier le / a la fin
    274282    dst_path = "";
    275283   
     
    287295    int i;
    288296   
    289     printf("=================");
    290     printf("== display_arg ==");
    291     printf("=================");
    292     printf("");
     297    printf("=================\n");
     298    printf("== display_arg ==\n");
     299    printf("=================\n");
     300    printf("\n");
    293301   
    294302    printf("argc = %d\n", argc);
     
    297305        printf("%s ", argv[i]);
    298306    }
    299     printf("");
     307    printf("\n");
    300308}
    301309// -----------------------
     
    303311// -----------------------
    304312{
    305     printf("=====================");
    306     printf("== ecc_info_define ==");
    307     printf("=====================");
    308     printf("");
     313    printf("=====================\n");
     314    printf("== ecc_info_define ==\n");
     315    printf("=====================\n");
     316    printf("\n");
    309317    ecc_info_omp();
    310318    //Label_Display_Info();
    311     printf("");
     319    printf("\n");
    312320}
    313321// -----------------------------
    314 int main(int argc, char* argv[])
     322__attribute__((constructor)) void main(int argc, char* argv[])
    315323// -----------------------------
    316324{
    317 #if TARGET_OS==GIET_VM
     325#if TARGET_OS == GIETVM
    318326    giet_tty_alloc(1);
     327    heap_init(0, 0);
    319328#endif
    320329    display_arg(argc, argv);
     
    322331    main_rosenfeld(argc, argv);
    323332    printf("[main]: bye");
    324     return 0;
    325 }
     333    exit(0);
     334}
Note: See TracChangeset for help on using the changeset viewer.