~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/snake/cvr_infr.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /** @(#)Snake infrastructure
  2  **/
  3 #include <stdio.h>
  4 #include <math.h>
  5 #include <tina/sys.h>
  6 #include <tina/sysfuncs.h>
  7 #include <tina/math.h>
  8 #include <tina/mathfuncs.h>
  9 #include <tina/vision.h>
 10 #include <tina/visionfuncs.h>
 11 #include <tina/cvr.h>
 12 #include <tina/snakefuncs.h>
 13 
 14 
 15 /* STATIC GLOBALS */
 16 static Imstack *imstack = NULL; /* Current imstack */
 17 static IcImage *icimage = NULL; /* Current icimage */
 18 
 19 /* Get the current imstack */
 20 Imstack *imstack_get(void)
 21 {
 22     return imstack;
 23 }
 24 
 25 /* Set the current imstack */
 26 void    imstack_set(Imstack * imstack_new)
 27 {
 28     imstack = imstack_new;
 29 }
 30 
 31 /* Get the current imrect */
 32 Imrect *imrect_get(void)
 33 {
 34     Imrect *imrect = NULL;
 35 
 36     if (imstack)
 37     {
 38         imrect = imstack->imrect[imstack->slice];
 39     }
 40     return imrect;
 41 }
 42 
 43 /* Destroy (free) an imstack. (DESTROYS its imrects, BUT not their
 44  * image data.) */
 45 void    imstack_deep_destroy(Imstack * imstack)
 46 {
 47     if (imstack)
 48     {
 49         int     slice;
 50 
 51         for (slice = imstack->first; slice < imstack->end; slice++)
 52         {
 53             IMRECT_FREE(imstack->imrect[slice]);        /* IMRECT_FREE handles
 54                                                          * NULL imrects */
 55         }
 56         imstack_struct_destroy(imstack);
 57     }
 58 }
 59 
 60 /* Create an imstack. (Does NOT create its imrects.) */
 61 Imstack *imstack_struct_create(int first, int end)
 62 {
 63     Imstack *imstack = IMSTACK_STRUCT_CREATE;
 64 
 65     imstack->imrect = (Imrect **) pvector_alloc(first, end);
 66     imstack->end = end;
 67     imstack->slice = imstack->first = first;
 68     imstack->data = NULL;
 69 
 70     return imstack;
 71 }
 72 
 73 /* Destroy (free) an imstack. (Does NOT destroy its imrects.) */
 74 void    imstack_struct_destroy(Imstack * imstack)
 75 {
 76     if (imstack)
 77     {
 78         /* free array of pointers to imrects */
 79         ivector_free((void *) imstack->imrect, imstack->first);
 80 
 81         rfree((void *) imstack);
 82     }
 83 }
 84 
 85 /* Set current icimage */
 86 void    icimage_set(IcImage * icimage_new)
 87 {
 88     icimage = icimage_new;
 89 }
 90 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.