+GArray *
+drop_dup_frames (GArray *points, int n)
+{
+ GArray *frames;
+ Point *point;
+ Point *next;
+ int i;
+ int j;
+ int inc;
+ int thre;
+ int err;
+ inc = n;
+ frames = g_array_new (FALSE, TRUE, sizeof (Point));
+ for (i = 0; i < points->len;)
+ {
+ j = i + 1;
+ point = next = &(g_array_index (points, Point, j));
+ while (next->name == NULL && j < points->len)
+ {
+ j++;
+ next = &(g_array_index (points, Point, j));
+ }
+ thre = j - i;
+ err = 0;
+ g_array_append_val (frames, g_array_index (points, Point, i));
+ for (; i < j; i++)
+ {
+ err += inc;
+ while (err > thre)
+ {
+ err -= thre;
+ g_array_append_val (frames, g_array_index (points, Point, i));
+ }
+ }
+ }
+ return frames;
+}
+
+GArray *
+get_scales (int n)
+{
+ GArray *scales;
+ double scale;
+ double factor;
+ scales = g_array_new (FALSE, TRUE, sizeof (double));
+ factor = pow (4.0, 1.0/((double) n/2));
+ factor = 1.0/factor;
+ for (scale = 4.00; scale > 1.0 && scales->len < n/2; scale *= factor)
+ scales = g_array_append_val (scales, scale);
+ factor = 1.0/factor;
+ for (scale = 1.0; scale < 4.0 && scales->len < n; scale *= factor)
+ scales = g_array_append_val (scales, scale);
+ return scales;
+}
+