Ignore:
Timestamp:
Mar 2, 2016, 3:08:27 PM (9 years ago)
Author:
meunier
Message:
  • Bug fixes in Rosenfeld
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.