Changeset 204

Show
Ignore:
Timestamp:
03/21/06 21:05:40 (3 years ago)
Author:
goodea
Message:

scanline only

Files:

Legend:

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

    r202 r204  
    244244 
    245245 
    246 uint8_t *cc3_malloc_row (void
     246uint8_t *cc3_malloc_rows (uint32_t rows
    247247{ 
    248248  int channels; 
     
    254254  } 
    255255 
    256   return (uint8_t *) malloc (cc3_g_current_frame.width * channels); 
     256  return (uint8_t *) malloc (cc3_g_current_frame.width * channels * rows); 
    257257} 
    258258 
     
    267267 * Returns -1 if requesting too many rows 
    268268 */ 
    269 int cc3_pixbuf_read_rows (void *mem, uint32_t rows) 
     269int cc3_pixbuf_read_rows (void * mem, uint32_t rows) 
    270270{ 
    271271 
  • trunk/include/cc3.h

    r203 r204  
    9696extern cc3_frame_t cc3_g_current_frame; // global that keeps clip, stride 
    9797 
    98 uint8_t *cc3_malloc_row (void); 
     98uint8_t *cc3_malloc_rows (uint32_t rows); 
    9999 
    100100void cc3_pixbuf_load (void); 
  • trunk/lib/cc3_ilp/cc3_color_track.c

    r202 r204  
    44#include <stdbool.h> 
    55#include <stdio.h> 
     6#include <stdlib.h> 
    67 
    78/** 
     
    2021{ 
    2122  uint16_t y, x; 
     23 
     24  uint8_t *row, *pixel; 
    2225 
    2326  x = pkt->scratch_x; 
     
    2831      (pkt->lower_bound.channel[2] > pkt->upper_bound.channel[2])) 
    2932    return 0; 
     33 
    3034  pkt->num_pixels = 0; 
    3135  pkt->x0 = UINT16_MAX; 
     
    3640  pkt->centroid_y = 0; 
    3741 
    38  
    39   for (y = 0; y < cc3_g_current_frame.height; y++) 
     42  pixel = row = cc3_malloc_rows(1); 
     43   
     44  for (y = 0; y < cc3_g_current_frame.height; y++) { 
     45    cc3_pixbuf_read_rows(row, 1); 
     46 
    4047    for (x = 0; x < cc3_g_current_frame.width; x++) { 
    4148      bool pixel_good = 0; 
    42       cc3_pixbuf_read (); 
     49 
    4350      if (cc3_g_current_frame.coi == CC3_ALL) { 
    44         if (cc3_g_current_pixel.channel[0] >= pkt->lower_bound.channel[0] 
    45             && cc3_g_current_pixel.channel[0] <= pkt->upper_bound.channel[0] 
    46             && cc3_g_current_pixel.channel[1] >= pkt->lower_bound.channel[1] 
    47             && cc3_g_current_pixel.channel[1] <= pkt->upper_bound.channel[1] 
    48             && cc3_g_current_pixel.channel[2] >= pkt->lower_bound.channel[2] 
    49             && cc3_g_current_pixel.channel[2] <= pkt->upper_bound.channel[2]) 
    50           pixel_good = 1; 
     51        if (pixel[0] >= pkt->lower_bound.channel[0] 
     52            && pixel[0] <= pkt->upper_bound.channel[0] 
     53            && pixel[1] >= pkt->lower_bound.channel[1] 
     54            && pixel[1] <= pkt->upper_bound.channel[1] 
     55            && pixel[2] >= pkt->lower_bound.channel[2] 
     56            && pixel[2] <= pkt->upper_bound.channel[2]) 
     57          pixel_good = 1; 
     58           
     59          pixel += 3; 
    5160      } 
    5261      else { 
    53         if (cc3_g_current_pixel.channel[cc3_g_current_frame.coi] >= 
     62        if (*pixel >= 
    5463            pkt->lower_bound.channel[cc3_g_current_frame.coi] 
    55             && cc3_g_current_pixel.channel[cc3_g_current_frame.coi] <= 
     64            && pixel [cc3_g_current_frame.coi] <= 
    5665            pkt->upper_bound.channel[cc3_g_current_frame.coi]) 
    5766          pixel_good = 1; 
     67           
     68          pixel++; 
    5869      } 
    5970 
     
    7283      } 
    7384    } 
    74  
     85  } 
    7586 
    7687  if (pkt->num_pixels > 0) { 
     
    92103 
    93104  } 
     105 
     106  free(row); 
     107 
    94108  return 1; 
    95109} 
  • trunk/lib/cc3_ilp/cc3_ilp.c

    r202 r204  
    33#include <stdbool.h> 
    44#include <stdio.h> 
     5#include <stdlib.h> 
    56 
    67void cc3_send_image_direct (void) 
     
    89  uint32_t x, y; 
    910  uint32_t size_x, size_y; 
     11  uint8_t *row = cc3_malloc_rows(1); 
    1012 
    1113  cc3_set_led (1); 
     
    2022  for (y = 0; y < size_y; y++) { 
    2123    putchar (2); 
    22     for (x = 0; x < size_x; x++) { 
    23       cc3_pixbuf_read (); 
    24       putchar (cc3_g_current_pixel.channel[CC3_RED]); 
    25       putchar (cc3_g_current_pixel.channel[CC3_GREEN]); 
    26       putchar (cc3_g_current_pixel.channel[CC3_BLUE]); 
     24     
     25    cc3_pixbuf_read_rows(row, 1); 
     26    for (x = 0; x < size_x * 3; x++) { 
     27      putchar (row[x]); 
    2728    } 
    2829  } 
    2930  putchar (3); 
     31   
     32  free(row); 
    3033} 
    3134