Changeset 212

Show
Ignore:
Timestamp:
03/26/06 19:50:39 (3 years ago)
Author:
goodea
Message:

subsampling works

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/hal/lpc2106-cmucam3/cc3.c

    r211 r212  
    4141static bool _cc3_second_green_valid; 
    4242 
    43 static void _cc3_update_frame_bounds (); 
     43static void _cc3_update_frame_bounds (cc3_frame_t *); 
    4444 
    4545void cc3_pixbuf_load () 
     
    245245  int width = cc3_g_current_frame.width; 
    246246 
    247   int row_limit = (cc3_g_current_frame.y1 - cc3_g_current_frame.y_loc) 
     247  unsigned int row_limit = (cc3_g_current_frame.y1 - cc3_g_current_frame.y_loc) 
    248248    / cc3_g_current_frame.y_step; 
    249249 
     
    288288        } else if (cc3_g_current_frame.x_step + x  
    289289                   >= cc3_g_current_frame.raw_width) { 
    290           _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.raw_width - x) / 2); 
     290          //printf("outside the window\n"); 
     291          _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.raw_width - x - 1) / 2); 
    291292          // and we're done with this row 
    292293        } else { 
    293           _cc3_pixbuf_skip_pixels (cc3_g_current_frame.x_step / 2); 
     294          //printf("inside the window\n"); 
     295          _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.x_step - 1) / 2); 
    294296          x += cc3_g_current_frame.x_step; 
    295297        } 
     
    309311 * cc3_wait_ms(): 
    310312 * 
    311  * This function returns the time since startup in ms as a uint32 
    312313 */ 
    313314void cc3_wait_ms (uint32_t delay) 
     
    367368                              uint8_t y_step) 
    368369{ 
    369   // can't be < 0 if unsigned 
    370   /*  
    371      if (x_step < 0 || y_step < 0) 
    372      return 0; 
    373    */ 
     370  int result = 1; 
     371 
     372  if (x_step == 0) { 
     373    x_step = 1; 
     374    result = 0; 
     375  } 
     376  if (y_step == 0) { 
     377    y_step = 1; 
     378    result = 0; 
     379  } 
     380 
     381  // only allow even subsampling (or 1) 
     382  if (x_step != 1 && x_step % 2 != 0) { 
     383    x_step++; 
     384    result = 0; 
     385  } 
     386  if (y_step != 1 && y_step % 2 != 0) { 
     387    y_step++; 
     388    result = 0; 
     389  } 
     390 
     391 
    374392  cc3_g_current_frame.x_step = x_step; 
    375393  cc3_g_current_frame.y_step = y_step; 
     
    381399 
    382400  _cc3_update_frame_bounds (&cc3_g_current_frame); 
    383   return 1; 
     401 
     402  return result; 
    384403} 
    385404 
  • trunk/lib/cc3_ilp/cc3_ilp.c

    r211 r212  
    2828    cc3_pixbuf_read_rows(row, 1); 
    2929    for (x = 0; x < size_x * 3U; x++) { 
    30       putchar (row[x]); 
     30      uint8_t p = row[x]; 
     31      if (p < 14) { 
     32        p = 14; 
     33      } 
     34      putchar (p); 
    3135    } 
    3236  } 
  • trunk/projects/jpeg-6b/main.c

    r210 r212  
    2525 // cc3_set_colorspace(CC3_YCRCB); 
    2626  cc3_set_resolution(CC3_HIGH_RES); 
    27  // cc3_pixbuf_set_pixel_mode( CC3_DROP_2ND_GREEN ); 
     27  // cc3_pixbuf_set_subsample (CC3_NEAREST, 2, 2); 
    2828  cc3_wait_ms(1000); 
    2929