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

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

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

  1 /*
  2   temp_display.c
  3 
  4   Sequential display of images
  5 
  6   author: a.lacey
  7   date  : 9-2-93;  version 1.0
  8           4.12.95; version 2.0
  9 */
 10 
 11 #include <stdio.h>
 12 #include <math.h>
 13 #include <ctype.h>
 14 #include <signal.h>
 15 #include <sys/time.h>
 16 #include <tina/sys.h>
 17 #include <tina/sysfuncs.h>
 18 #include <tina/math.h>
 19 #include <tina/mathfuncs.h>
 20 #include <tina/vision.h>
 21 #include <tina/visionfuncs.h>
 22 #include <tina/tv.h>
 23 #include <tina/image.h>
 24 #include <tina/tempdefs.h>
 25 #include <tina/temporal.h>
 26 #include <tina/temppro.h>
 27 
 28            
 29 List        *find_frame(Sequence *data)
 30 {
 31 
 32   List      *im_ptr;  
 33   int          count = data->seq_start;
 34 
 35   if ((im_ptr = get_start_el()) == NULL)
 36     return (get_current_el());
 37 
 38   while(count < data->goto_frame)
 39     {
 40       if (im_ptr->next == NULL)
 41         return (get_current_el());
 42 
 43       im_ptr = im_ptr->next;
 44       count++;
 45     } 
 46 
 47   return (im_ptr);
 48 }
 49 
 50 int  which_frame(Sequence *data, void *tim_ptr)
 51 {
 52     int          count = data->seq_start;
 53     List      *im_ptr;
 54 
 55       if ((im_ptr = get_start_el()) == NULL)
 56     return (count);
 57 
 58   while(im_ptr->next != NULL)
 59     {
 60       if (im_ptr->to == tim_ptr)
 61         break;
 62 
 63       im_ptr = im_ptr->next;
 64       count++;
 65     }
 66 
 67   return (count);
 68 }
 69 
 70 void       timer_handler_install(long length)
 71 {
 72    void      timer_handler(int a);
 73    struct    itimerval  ivalue;
 74    struct    sigaction  action;
 75    long      secs, usecs;
 76    int       rval;
 77 
 78    secs = (long)floor((double)(length/1000000));
 79    usecs = (long)(length - (secs*1000000));
 80    
 81    ivalue.it_interval.tv_sec = secs;
 82    ivalue.it_interval.tv_usec = usecs;
 83    ivalue.it_value.tv_sec = secs;
 84    ivalue.it_value.tv_usec = usecs;
 85 
 86    if (setitimer(ITIMER_REAL, &ivalue, NULL) !=0)
 87       error("timer_handler_install: failure to set timer\n", warning); 
 88  
 89    action.sa_handler = timer_handler;
 90    action.sa_flags = 0x0;
 91    
 92    if (sigaction(SIGALRM, &action, NULL) != 0)
 93       error("timer_handler_install: failure to set timer\n", warning);  
 94    
 95 }
 96 
 97 
 98 void       timer_handler_uninstall()
 99 {
100    struct    itimerval  ivalue;
101    struct    sigaction action;
102 
103    ivalue.it_interval.tv_sec = 0;
104    ivalue.it_interval.tv_usec = 0;
105    ivalue.it_value.tv_sec = 0;
106    ivalue.it_value.tv_usec = 0;
107 
108    setitimer(ITIMER_REAL, &ivalue, NULL);
109    signal(SIGALRM, SIG_DFL);
110 }
111 
112 void       timer_handler(int a)
113 {
114     /* Do n'out */
115 }
116 
117 
118 void        play_seq(Sequence *data, Tv *tv)
119 {
120  
121   List   *ptr, *end;
122   int       i, count, w;
123   int       format = get_seq_format();
124 
125 
126   if (tv == NULL || tv->movie == NULL)
127     return;
128 
129   if (data->loop_times < 1)
130     {
131       error(" loop too small, set to 1", warning);
132       data->loop_times = 1;
133     }
134 
135   if (format == SINGLE)
136     count = 1;
137   else
138     count = data->loop_times;
139     
140   timer_handler_install(data->seq_delay);
141    
142   while (count != 0)
143     {
144       for(ptr = tv->movie; ptr != NULL; ptr = ptr->next)
145         {
146           tv_show_picture(tv, ptr->to);
147           tv_flush(tv);
148           end = ptr;
149           pause();
150         }
151 
152       if (format == BANDF)
153         {
154           for (ptr = end; ptr != NULL; ptr= ptr->last)
155             {
156               tv_show_picture(tv, ptr->to);
157               tv_flush(tv);
158               pause();
159             }
160 
161         }
162 
163       count--;
164     } 
165     
166   timer_handler_uninstall();
167 }
168         
169 
170 
171 
172 void        make_seq(Sequence *data, Tv *stv)
173 {
174 
175   List  *im_tp;
176   int      i, w;
177 
178   i = 0;
179   w = (data->seq_end) - (data->seq_start);
180 
181   if (w < 1)
182     return;
183 
184   im_tp = find_frame(data);
185 
186   if (im_tp == NULL)
187     return;
188 
189   set_current_el(im_tp);
190   temp_image_set(im_tp->to);
191 
192   tv_start_movie(stv);
193         
194   while ((im_tp != NULL) && (i < w))
195     {
196       tv_free_background(stv);
197       tv_repaint(stv);
198       temp_show_bits(data);
199       tv_make_movie(stv);
200 
201       set_current_el(im_tp->next);
202       im_tp = get_current_el();
203 
204       if (im_tp != NULL)
205         if (im_tp->to != NULL)
206           temp_image_set(im_tp->to);
207 
208       i++;      
209     }   
210         
211   set_current_el(get_start_el());
212 }
213 
214 
215 

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