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

Linux Cross Reference
Tina4/src/tools/temporal/temp_edit_seq.c

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

  1 /*
  2   temp_edit_seq.c 
  3 
  4   Functions used to manipulate sequences
  5 
  6   author: a.lacey
  7   date  : 11.2.93; version 1.0
  8           4.12.95; version 2.0
  9 */
 10 
 11 #include <stdio.h>
 12 #include <tina/sys.h>
 13 #include <tina/sysfuncs.h>
 14 #include <tina/math.h>
 15 #include <tina/mathfuncs.h>
 16 #include <tina/vision.h>
 17 #include <tina/visionfuncs.h>
 18 #include <tina/tv.h>
 19 #include <tina/image.h>
 20 #include <tina/tempdefs.h>
 21 #include <tina/temporal.h>
 22 #include <tina/temppro.h>
 23 
 24 
 25 
 26 void      push_frame()
 27 {
 28   push_data(temp_image_get());
 29   return;
 30 }
 31 
 32 
 33 void      label_sort_dec(List *dlptr)
 34 {
 35   Imrect  *im = NULL;
 36   int      label;
 37 
 38   while (dlptr != NULL)
 39     {
 40       im = dlptr->to;
 41       if (im != NULL)
 42         {
 43           label = get_frame_no(im);
 44           set_frame_no(im, (label - 1));
 45         }
 46       dlptr = dlptr->next;
 47     }
 48 
 49   return;
 50 }
 51 
 52 
 53 
 54 void      label_sort_inc(List *dlptr)
 55 {
 56   Imrect  *im = NULL;
 57   int      label; 
 58 
 59   while (dlptr != NULL)
 60     {
 61       im = dlptr->to;
 62       if (im != NULL)
 63         {
 64           label = get_frame_no(im);
 65           set_frame_no(im, (label + 1));
 66         }
 67       dlptr = dlptr->next;
 68 
 69     }
 70 
 71   return;
 72 }
 73 
 74 
 75 
 76 void      replace_frame(Sequence *data)
 77 {
 78   Imrect *im = NULL;
 79   Imrect *im1 = NULL;
 80   List *lptr = get_current_el();
 81   Tv     *tv_ptr = temp_tv_get();
 82   int     image_data;
 83 
 84   image_data = IMAGE_DATA;
 85 
 86   if (tv_ptr == NULL)
 87     return;
 88 
 89   if((lptr == NULL) || (lptr->to == NULL))
 90     {
 91       error("unable to replace here ", warning);
 92       return;
 93     }
 94 
 95   if ((im = (Imrect *)pop_data(im, image_data)) == NULL)
 96     return;
 97 
 98   im1 = temp_image_get();
 99   set_frame_no(im, get_frame_no(im1));
100   lptr->to = im;
101   im_free(im1);
102   temp_image_set(im);
103   tv_init(tv_ptr);
104   temp_show_bits(data);
105 
106   return;
107 }
108 
109 
110 
111 void      frame_insert(Imrect *im_in, Sequence *data)
112 {
113 /*
114         Low level frame insertion stuff
115 */
116   Imrect *im = NULL;
117   List *lp = get_current_el();
118   List *slp = get_start_el();
119   List *new = NULL;
120   int    image_data = IMAGE_DATA; 
121 
122 
123   if ((lp == NULL) && (slp == NULL))
124     {
125       set_frame_no(im_in, 0);
126       lp = dd_ref_addtostart(lp, (Imrect *)im_in, SEQ);
127       set_start_el(lp);
128       set_current_el(lp);
129       set_end_el(lp);
130       temp_image_set(im_in);
131     }
132 
133   else if (lp != NULL)
134     {
135       if ((new = dd_link_alloc(im_in, SEQ)) == NULL)
136         return;
137 
138       lp = lp->last;
139       im = temp_image_get();
140       set_frame_no(im_in, get_frame_no(im));
141       label_sort_inc(get_current_el());
142 
143       if (get_current_el() == get_start_el())
144         set_start_el(dd_link_addtostart(get_start_el(), new));
145       else
146         dd_link_addafter(lp, new);
147 
148       set_current_el(new);
149       temp_image_set(im_in);
150     }
151 
152   return;
153 }
154 
155 
156 
157 void       insert_frame(Sequence *data)
158 {
159   Imrect  *im = NULL;
160   Tv      *tv_ptr = temp_tv_get();
161   int      image_data = IMAGE_DATA; 
162 
163 
164   if (tv_ptr == NULL)
165     return;
166 
167   if ((im = (Imrect *)pop_data(im, image_data)) == NULL)
168     return;
169   frame_insert(im, data);
170   temp_show_bits(data);
171 
172   return;
173 
174 }
175 
176 
177 void      delete_frame(Sequence *data)
178 {
179   List  *lptr = get_current_el();
180   Tv      *tv_ptr = temp_tv_get();
181 
182   if ((lptr == NULL) || (tv_ptr == NULL))
183     return;
184 
185   if (lptr == get_end_el())
186     set_end_el(lptr->last);
187 
188   if (lptr == get_start_el())
189     set_start_el(lptr->next);
190   
191   lptr = dd_list_rm_el(lptr, lptr, im_free);
192 
193   if (lptr == NULL)
194     set_current_el(get_end_el());
195 
196   else
197     {
198       set_current_el(lptr);
199       label_sort_dec(lptr);
200     }
201 
202   if ((lptr = get_current_el()) != NULL)
203     temp_image_set(lptr->to);
204   tv_init(tv_ptr);
205   temp_show_bits(data);
206 
207   return;       
208 }
209 
210 
211 

~ [ 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.