Changeset 210

Show
Ignore:
Timestamp:
03/26/06 15:35:17 (3 years ago)
Author:
goodea
Message:

re-add width and height

Files:

Legend:

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

    r209 r210  
    4040static uint8_t _cc3_second_green; 
    4141static bool _cc3_second_green_valid; 
     42 
     43static void _cc3_update_frame_bounds (); 
    4244 
    4345void cc3_pixbuf_load () 
     
    212214{ 
    213215  int channels; 
    214   int width = (cc3_g_current_frame.x1 - cc3_g_current_frame.x0) 
    215     / cc3_g_current_frame.x_step; 
     216  int width = cc3_g_current_frame.width; 
    216217 
    217218  if (cc3_g_current_frame.coi == CC3_ALL) { 
     
    242243  uint8_t off0, off1, off2; 
    243244 
    244   int width = (cc3_g_current_frame.x1 - cc3_g_current_frame.x0) 
    245     / cc3_g_current_frame.x_step; 
     245  int width = cc3_g_current_frame.width; 
    246246 
    247247  int row_limit = (cc3_g_current_frame.y1 - cc3_g_current_frame.y_loc) 
     
    349349    cc3_g_current_frame.x1 = x1; 
    350350    cc3_g_current_frame.y1 = y1; 
     351 
     352    _cc3_update_frame_bounds (&cc3_g_current_frame); 
     353 
    351354    return 1; 
    352355  } 
     
    375378  cc3_g_current_frame.y1 = cc3_g_current_frame.raw_height; 
    376379  cc3_g_current_frame.subsample_mode = mode; 
     380 
     381  _cc3_update_frame_bounds (&cc3_g_current_frame); 
    377382  return 1; 
    378383} 
     
    438443  cc3_g_current_frame.y_loc = 0; 
    439444  cc3_g_current_frame.subsample_mode = CC3_NEAREST; 
     445 
     446  _cc3_update_frame_bounds (&cc3_g_current_frame); 
    440447} 
    441448 
     
    582589} 
    583590 
     591void _cc3_update_frame_bounds (cc3_frame_t *f) 
     592{ 
     593  f->width = (f->x1 - f->x0) / f->x_step; 
     594  f->height = (f->y1 - f->y0) / f->y_step; 
     595} 
     596 
    584597/** 
    585598 * This sets the hardware colorspace that comes out of the camera. 
  • trunk/include/cc3.h

    r209 r210  
    8383  cc3_channel_t coi; 
    8484  cc3_subsample_mode_t subsample_mode; 
     85  uint16_t width, height; 
    8586} cc3_frame_t; 
    8687 
  • trunk/lib/cc3_ilp/cc3_color_track.c

    r209 r210  
    2121{ 
    2222  uint16_t y, x; 
    23   int height, width; 
    2423 
    2524  uint8_t *row, *pixel; 
     
    4342  pixel = row = cc3_malloc_rows(1); 
    4443   
    45   height = (cc3_g_current_frame.y1 - cc3_g_current_frame.y0) 
    46     / cc3_g_current_frame.y_step; 
    47   width = (cc3_g_current_frame.x1 - cc3_g_current_frame.x0) 
    48     / cc3_g_current_frame.x_step; 
    49  
    50   for (y = 0; y < height; y++) { 
     44  for (y = 0; y < cc3_g_current_frame.height; y++) { 
    5145    cc3_pixbuf_read_rows(row, 1); 
    5246 
    53     for (x = 0; x < width; x++) { 
     47    for (x = 0; x < cc3_g_current_frame.width; x++) { 
    5448      bool pixel_good = 0; 
    5549 
  • trunk/lib/cc3_ilp/cc3_ilp.c

    r209 r210  
    88{ 
    99  uint32_t x, y; 
    10   uint32_t size_x, size_y; 
    1110  uint8_t *row = cc3_malloc_rows(1); 
    1211 
    1312  cc3_set_led (1); 
    14   size_x = (cc3_g_current_frame.x1 - cc3_g_current_frame.x0)  
    15     / cc3_g_current_frame.x_step; 
    16   size_y = (cc3_g_current_frame.y1 - cc3_g_current_frame.y0) 
    17     / cc3_g_current_frame.y_step; 
    1813 
    1914  putchar (1); 
    20   putchar (size_x); 
    21   if (size_y > 255) 
    22     size_y = 255; 
    23   putchar (size_y); 
    24   for (y = 0; y < size_y; y++) { 
     15  putchar (cc3_g_current_frame.width); 
     16  if (cc3_g_current_frame.height > 255) 
     17    cc3_g_current_frame.height = 255; 
     18  putchar (cc3_g_current_frame.height); 
     19  for (y = 0; y < cc3_g_current_frame.height; y++) { 
    2520    putchar (2); 
    2621     
    2722    cc3_pixbuf_read_rows(row, 1); 
    28     for (x = 0; x < size_x * 3; x++) { 
     23    for (x = 0; x < cc3_g_current_frame.width * 3U; x++) { 
    2924      putchar (row[x]); 
    3025    } 
  • trunk/projects/cmucam2/cmucam2.c

    r209 r210  
    238238{ 
    239239  cc3_image_t img; 
    240   uint16_t i; 
    241240  img.channels = 3; 
    242   img.width = (cc3_g_current_frame.x1 - cc3_g_current_frame.x0)  
    243     / cc3_g_current_frame.x_step; 
     241  img.width = cc3_g_current_frame.width; 
    244242  img.height = 1;               // image will hold just 1 row for scanline processing 
    245243  img.pix = malloc (3 * img.width); 
     
    265263  cc3_image_t img; 
    266264  uint16_t i; 
    267   int height = (cc3_g_current_frame.y1 - cc3_g_current_frame.y0) / cc3_g_current_frame.y_step; 
    268265 
    269266  img.channels = 3; 
    270   img.width = (cc3_g_current_frame.x1 - cc3_g_current_frame.x0) / cc3_g_current_frame.x_step
     267  img.width = cc3_g_current_frame.width
    271268  img.height = 1;               // image will hold just 1 row for scanline processing 
    272269  img.pix = cc3_malloc_rows(1); 
     
    284281          lm_width++; 
    285282        putchar (0xAA); 
    286         if (height > 255) 
     283        if (cc3_g_current_frame.height > 255) 
    287284          lm_height = 255; 
    288285        else 
    289           lm_height = height; 
     286          lm_height = cc3_g_current_frame.height; 
    290287 
    291288        //putchar(lm_width); 
  • trunk/projects/hello_world/main.c

    r209 r210  
    6969    // setup an image structure 
    7070    img.channels=3; 
    71     img.width=(cc3_g_current_frame.x1 - cc3_g_current_frame.x0) / cc3_g_current_frame.x_step
     71    img.width=cc3_g_current_frame.width
    7272    img.height=1;  // image will hold just 1 row for scanline processing 
    7373    img.pix = cc3_malloc_rows(1); 
  • trunk/projects/jpeg-6b/main.c

    r209 r210  
    8181 
    8282  // parameters for jpeg image 
    83   cinfo.image_width = (cc3_g_current_frame.x1 - cc3_g_current_frame.x0) / cc3_g_current_frame.x_step
    84   cinfo.image_height = (cc3_g_current_frame.y1 - cc3_g_current_frame.y0) / cc3_g_current_frame.y_step
     83  cinfo.image_width = cc3_g_current_frame.width
     84  cinfo.image_height = cc3_g_current_frame.height
    8585  printf( "image width=%d image height=%d\n", cinfo.image_width, cinfo.image_height ); 
    8686  cinfo.input_components = 3;