Changeset 286

Show
Ignore:
Timestamp:
01/10/07 22:33:38 (2 years ago)
Author:
anthony_rowe
Message:

polly virtual-cam fix

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/common.mk

    r279 r286  
    2626 
    2727INCLUDES += ../../include/cc3.h 
    28  
    2928HALDIR=../../hal/$(hal) 
    3029 
  • trunk/lib/cc3_ilp/cc3_ilp.c

    r285 r286  
    6464} 
    6565 
    66 void cc3_get_pixel (cc3_image_t * img, uint16_t x, uint16_t y, 
     66inline void cc3_get_pixel (cc3_image_t * img, uint16_t x, uint16_t y, 
    6767                    cc3_pixel_t * out_pix) 
    6868{ 
     
    8181 
    8282 
    83 void cc3_set_pixel (cc3_image_t * img, uint16_t x, uint16_t y, 
     83inline void cc3_set_pixel (cc3_image_t * img, uint16_t x, uint16_t y, 
    8484                    cc3_pixel_t * in_pix) 
    8585{ 
  • trunk/projects/jpeg-6b/main.c

    r273 r286  
    9797  // allocate memory for 1 row 
    9898  row = cc3_malloc_rows(1); 
    99   if(row==NULL) printf( "FUCK, out of memory!\n" ); 
     99  if(row==NULL) printf( "Out of memory!\n" ); 
    100100} 
    101101 
  • trunk/projects/polly/main.c

    r285 r286  
    99 
    1010//#define VIRTUAL_CAM 
     11#define MMC_DEBUG 
    1112 
    1213#define COLOR_THRESH   25 
     
    3738int main (void) 
    3839{ 
    39   uint32_t start_time, val; 
     40  uint32_t last_time, val; 
    4041  char c; 
    4142  cc3_pixel_t p; 
     
    4344  cc3_image_t img; 
    4445  uint8_t range[WIDTH]; 
    45   //uint8_t p_img[WIDTH][HEIGHT]; 
    4646  uint8_t p_img[HEIGHT * WIDTH]; 
    4747 
     
    6666 
    6767  cc3_pixbuf_set_subsample (CC3_NEAREST, 2, 2); 
    68   cc3_pixbuf_set_coi (CC3_RED); 
     68  cc3_pixbuf_set_coi (CC3_GREEN); 
    6969 
    7070  cc3_clr_led (0); 
     
    100100    cc3_pixel_t down_pix; 
    101101 
     102#ifdef MMC_DEBUG 
    102103        cc3_set_led(2); 
    103104         while(!cc3_read_button()); 
    104105        cc3_clr_led(2); 
    105           
     106#endif   
    106107 
    107108    // clear polly working image 
     
    113114 
    114115    cc3_pixbuf_load (); 
     116 
     117#ifdef MMC_DEBUG 
    115118    cc3_pixbuf_set_coi (CC3_ALL); 
    116119    write_raw_fifo_ppm(); 
    117120    cc3_pixbuf_set_coi (CC3_GREEN); 
    118121    cc3_pixbuf_rewind(); 
     122#endif 
    119123 
    120124    cc3_pixbuf_read_rows (img.pix, cc3_g_current_frame.height); 
     
    132136        if (m < r - COLOR_THRESH || m > r + COLOR_THRESH) 
    133137          cc3_set_pixel (&polly_img, x, y, &p); 
    134         //p_img[x][y]=SELECTED;               
    135138        if (m < d - COLOR_THRESH || m > d + COLOR_THRESH) 
    136139          cc3_set_pixel (&polly_img, x, y, &p); 
    137         //p_img[x][y]=SELECTED;               
    138140 
    139141      } 
     
    141143 
    142144    connected_component_reduce (&polly_img, MIN_BLOB_SIZE); 
     145#ifdef MMC_DEBUG 
    143146    matrix_to_pgm (&polly_img); 
    144  
     147#endif 
    145148    generate_histogram (&polly_img, range); 
    146149    convert_histogram_to_ppm (&polly_img, range); 
     150#ifdef MMC_DEBUG 
    147151    matrix_to_pgm (&polly_img); 
    148      
    149     printf( "Frame done\n" ); 
     152#endif 
     153    printf( "Frame done, time=%d\n",cc3_timer()-last_time ); 
     154    last_time=cc3_timer(); 
    150155 
    151156  } 
     
    423428  do {  
    424429#ifdef VIRTUAL_CAM 
     430          sprintf(filename, "img%.5d.pgm", pgm_cnt); 
     431#else 
    425432          sprintf(filename, "c:/img%.5d.pgm", pgm_cnt); 
    426 #else 
    427           sprintf(filename, "img%.5d.pgm", pgm_cnt); 
    428433#endif 
    429434        fp = fopen(filename, "r"); 
     
    438443    // print file that you are going to write to stderr 
    439444    fprintf(stderr,"%s\r\n", filename); 
    440     fp = fopen(filename, "w"); 
     445    fp = fopen(filename, "w");   
    441446    if(fp==NULL || pgm_cnt>200 ) 
    442447    { 
     448        printf( "PGM Can't open file\n" ); 
    443449        cc3_set_led(3); 
    444450        while(1); 
     
    454460    } 
    455461  } 
    456   fflush(fp); 
    457462  fclose (fp); 
    458463 
     
    471476   do {  
    472477#ifdef VIRTUAL_CAM 
     478        sprintf(filename, "img%.5d.ppm", ppm_cnt); 
     479#else 
    473480        sprintf(filename, "c:/img%.5d.ppm", ppm_cnt); 
    474 #else 
    475         sprintf(filename, "img%.5d.ppm", ppm_cnt); 
    476481#endif 
    477482        f = fopen(filename, "r"); 
     
    486491    // print file that you are going to write to stderr 
    487492    fprintf(stderr,"%s\r\n", filename); 
    488     f = fopen(filename, "w"); 
     493    f = fopen(filename, "w");  
    489494    if(f==NULL || ppm_cnt>200 ) 
    490495    { 
     496        printf( "PPM Can't open file\n" ); 
    491497        cc3_set_led(3); 
    492498        while(1); 
     
    506512  fprintf(f,"\n"); 
    507513  } 
    508   fflush(f); 
    509514  fclose(f);  
    510515  free(row); 
  • trunk/projects/polly/polly_no_cc3.c

    r284 r286  
    3434int main (void) 
    3535{ 
    36     uint32_t start_time,val; 
     36    uint32_t last_time,val; 
    3737    int cnt; 
    3838    char c; 
     
    117117        generate_histogram(range ); 
    118118        convert_histogram_to_ppm(range ); 
    119         matrix_to_ppm(); 
    120  
     119        //matrix_to_ppm(); 
     120         
     121 printf( "Frame done. time=%d\n",cc3_timer()-last_time ); 
     122    last_time=cc3_timer(); 
    121123  
    122124    }