gimp-gap r784 - in trunk: . gap



Author: wolfgangh
Date: Sun Oct 19 11:45:11 2008
New Revision: 784
URL: http://svn.gnome.org/viewvc/gimp-gap?rev=784&view=rev

Log:
Sztoryboard clip properties: fixed unique maskname check, support OddFirst/EvenFirst deinterlace modes

Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/gap/gap_story_file.c
   trunk/gap/gap_story_main.h
   trunk/gap/gap_story_properties.c
   trunk/gap/gap_story_render_lossless.c
   trunk/gap/gap_story_render_processor.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Sun Oct 19 11:45:11 2008
@@ -5,6 +5,9 @@
 - Player supports extracting audio track when playing clips
   that refere to a videofile that has one or more audiotrack(s)
 
+- Storyboard undo support
+- Storyboard clips support new deinterlace modes Odd First, Even First
+
 - Filtermacro processing now supports mapping to 
   persistent drawable id references.
   This allows applying recorded filtermacros in another gimp session
@@ -27,6 +30,10 @@
 - Modify Frames now supports creation of grayscale layer from
   alpha channel, or layermask or mix of both
 
+- wrapper for rotate any angle.
+  (provides support for animated apply in "filter all layers"
+  or in fltermacros for rotation effects in storyboard clips)
+
 
 Here is a short overview whats new in GIMP-GAP-2.3.0:
 -----------------------------------------------------

Modified: trunk/gap/gap_story_file.c
==============================================================================
--- trunk/gap/gap_story_file.c	(original)
+++ trunk/gap/gap_story_file.c	Sun Oct 19 11:45:11 2008
@@ -58,6 +58,7 @@
 #define MAX_CHARS_ERRORTEXT_GUI   50
 #define MAX_TOLERATED_UNPRINTABLE_CHARACTERS 500
 
+#define GAP_DELACE_MAX 5.0
 
   typedef enum
   {
@@ -3637,7 +3638,7 @@
 
       if(*l_seltrack_ptr)   { stb_elem->seltrack     = p_scan_gint32(l_seltrack_ptr,  1, 999999, stb); }
       if(*l_exact_seek_ptr) { stb_elem->exact_seek   = p_scan_gint32(l_exact_seek_ptr,  0, 1, stb); }
-      if(*l_delace_ptr)     { stb_elem->delace       = p_scan_gdouble(l_delace_ptr, 0.0, 3.0, stb); }
+      if(*l_delace_ptr)     { stb_elem->delace       = p_scan_gdouble(l_delace_ptr, 0.0, GAP_DELACE_MAX, stb); }
       if(*l_decoder_ptr)    { stb_elem->preferred_decoder = g_strdup(l_decoder_ptr);
                             }
 
@@ -4132,7 +4133,7 @@
 
       if(*l_seltrack_ptr)   { stb_elem->seltrack     = p_scan_gint32(l_seltrack_ptr,  1, 999999, stb); }
       if(*l_exact_seek_ptr) { stb_elem->exact_seek   = p_scan_gint32(l_exact_seek_ptr,  0, 1, stb); }
-      if(*l_delace_ptr)     { stb_elem->delace       = p_scan_gdouble(l_delace_ptr, 0.0, 3.0, stb); }
+      if(*l_delace_ptr)     { stb_elem->delace       = p_scan_gdouble(l_delace_ptr, 0.0, GAP_DELACE_MAX, stb); }
 
       if(*l_decoder_ptr)    { stb_elem->preferred_decoder = g_strdup(l_decoder_ptr);
                             }

Modified: trunk/gap/gap_story_main.h
==============================================================================
--- trunk/gap/gap_story_main.h	(original)
+++ trunk/gap/gap_story_main.h	Sun Oct 19 11:45:11 2008
@@ -60,7 +60,7 @@
 
 /* max flip request and delace modes (for dimensions of radio button tables) */
 #define GAP_MAX_FLIP_REQUEST  4
-#define GAP_MAX_DELACE_MODES  3
+#define GAP_MAX_DELACE_MODES  5
 
 typedef enum
   {

Modified: trunk/gap/gap_story_properties.c
==============================================================================
--- trunk/gap/gap_story_properties.c	(original)
+++ trunk/gap/gap_story_properties.c	Sun Oct 19 11:45:11 2008
@@ -160,6 +160,8 @@
 static void     p_radio_delace_none_callback(GtkWidget *widget, GapStbPropWidget *pw);
 static void     p_radio_delace_odd_callback(GtkWidget *widget, GapStbPropWidget *pw);
 static void     p_radio_delace_even_callback(GtkWidget *widget, GapStbPropWidget *pw);
+static void     p_radio_delace_odd_first_callback(GtkWidget *widget, GapStbPropWidget *pw);
+static void     p_radio_delace_even_first_callback(GtkWidget *widget, GapStbPropWidget *pw);
 static void     p_delace_spinbutton_cb(GtkObject *obj, GapStbPropWidget *pw);
 static void     p_maskstep_density_spinbutton_cb(GtkObject *obj, GapStbPropWidget *pw);
 static void     p_step_density_spinbutton_cb(GtkObject *obj, GapStbPropWidget *pw);
@@ -384,11 +386,14 @@
         return;
       }
       
-      if(FALSE == p_pw_mask_definition_name_update(pw))
+      if (pw->is_mask_definition)
       {
-        /* occurs if a non-unique mask definition name was entered.
-         */
-        return;
+        if(FALSE == p_pw_mask_definition_name_update(pw))
+        {
+          /* occurs if a non-unique mask definition name was entered.
+           */
+          return;
+        }
       }
       
       if(pw->pw_filesel)
@@ -2476,6 +2481,45 @@
   }
 }  /* end p_radio_delace_even_callback */
 
+
+/* ---------------------------------
+ * p_radio_delace_odd_first_callback
+ * ---------------------------------
+ */
+static void
+p_radio_delace_odd_first_callback(GtkWidget *widget, GapStbPropWidget *pw)
+{
+  if((pw) && (GTK_TOGGLE_BUTTON (widget)->active))
+  {
+    p_pw_push_undo_and_set_unsaved_changes(pw);
+    pw->delace_mode = 3;
+    gtk_widget_set_sensitive(pw->pw_spinbutton_delace, TRUE);
+    if(pw->stb_elem_refptr)
+    {
+      pw->stb_elem_refptr->delace = pw->delace_mode + CLAMP(pw->delace_threshold, 0.0, 0.999999);
+    }
+  }
+}  /* end p_radio_delace_odd_first_callback */
+
+/* ---------------------------------
+ * p_radio_delace_even_first_callback
+ * ---------------------------------
+ */
+static void
+p_radio_delace_even_first_callback(GtkWidget *widget, GapStbPropWidget *pw)
+{
+  if((pw) && (GTK_TOGGLE_BUTTON (widget)->active))
+  {
+    p_pw_push_undo_and_set_unsaved_changes(pw);
+    pw->delace_mode = 4;
+    gtk_widget_set_sensitive(pw->pw_spinbutton_delace, TRUE);
+    if(pw->stb_elem_refptr)
+    {
+      pw->stb_elem_refptr->delace = pw->delace_mode + CLAMP(pw->delace_threshold, 0.0, 0.999999);
+    }
+  }
+}  /* end p_radio_delace_even_first_callback */
+
 /* ---------------------------------
  * p_delace_spinbutton_cb
  * ---------------------------------
@@ -3606,6 +3650,46 @@
                        G_CALLBACK (p_radio_delace_even_callback),
                        pw);
 
+
+
+
+
+    l_idx++;
+    /* radio button delace_mode odd */
+    radio_button = gtk_radio_button_new_with_label ( radio_group, _("Odd First") );
+    radio_group = gtk_radio_button_get_group ( GTK_RADIO_BUTTON (radio_button) );
+    gtk_table_attach ( GTK_TABLE (radio_table), radio_button, l_idx, l_idx+1
+                     , 0, 1, 0, 0, 0, 0);
+
+    pw->pw_delace_mode_radio_button_arr[3] = radio_button;
+    l_radio_pressed = (pw->delace_mode == 3);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button),
+                                     l_radio_pressed);
+    gimp_help_set_help_data(radio_button, _("Apply odd-lines, switch to even lines on tween position >= 0.5"), NULL);
+
+    gtk_widget_show (radio_button);
+    g_signal_connect ( G_OBJECT (radio_button), "toggled",
+                       G_CALLBACK (p_radio_delace_odd_first_callback),
+                       pw);
+
+    l_idx++;
+    /* radio button delace_mode even */
+    radio_button = gtk_radio_button_new_with_label ( radio_group, _("Even First") );
+    radio_group = gtk_radio_button_get_group ( GTK_RADIO_BUTTON (radio_button) );
+    gtk_table_attach ( GTK_TABLE (radio_table), radio_button, l_idx, l_idx+1
+                     , 0, 1, 0, 0, 0, 0);
+
+    pw->pw_delace_mode_radio_button_arr[4] = radio_button;
+    l_radio_pressed = (pw->delace_mode == 4);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_button),
+                                     l_radio_pressed);
+    gimp_help_set_help_data(radio_button, _("Apply even-lines, switch to even lines on tween position >= 0.5"), NULL);
+
+    gtk_widget_show (radio_button);
+    g_signal_connect ( G_OBJECT (radio_button), "toggled",
+                       G_CALLBACK (p_radio_delace_even_first_callback),
+                       pw);
+
     gtk_widget_show (radio_table);
     gtk_table_attach_defaults (GTK_TABLE(table), radio_table, 1, 2, row, row+1);
   }

Modified: trunk/gap/gap_story_render_lossless.c
==============================================================================
--- trunk/gap/gap_story_render_lossless.c	(original)
+++ trunk/gap/gap_story_render_lossless.c	Sun Oct 19 11:45:11 2008
@@ -351,6 +351,7 @@
 
   gint32        l_localframe_index;
   gint32        l_local_stepcount;
+  gdouble       l_localframe_tween_rest;
   gboolean      l_keep_proportions;
   gboolean      l_fit_width;
   gboolean      l_fit_height;
@@ -384,6 +385,7 @@
                  , &l_trak_filtermacro_file
                  , &l_localframe_index   /* used for ANIMIMAGE and Videoframe Number, -1 for all other types */
                  , &l_local_stepcount
+                 , &l_localframe_tween_rest
                  , &l_keep_proportions
                  , &l_fit_width
                  , &l_fit_height

Modified: trunk/gap/gap_story_render_processor.c
==============================================================================
--- trunk/gap/gap_story_render_processor.c	(original)
+++ trunk/gap/gap_story_render_processor.c	Sun Oct 19 11:45:11 2008
@@ -78,6 +78,7 @@
 #include "gap_story_render_audio.h"
 #include "gap_story_render_processor.h"
 #include "gap_fmac_name.h"
+#include "gap_frame_fetcher.h"
 
 /*************************************************************
  *         STORYBOARD FUNCTIONS                              *
@@ -141,6 +142,7 @@
                             , char **filtermacro_file
                             , gint32   *localframe_index  /* used only for ANIMIMAGE and videoclip, -1 for all other types */
                             , gint32   *local_stepcount   /* nth frame within this clip, starts with 0 */
+                            , gdouble  *localframe_tween_rest /* non-integer part of the position. value < 1.0 for tween fetching */
                             , gboolean *keep_proportions
                             , gboolean *fit_width
                             , gboolean *fit_height
@@ -313,6 +315,11 @@
                       , char *basename             /* the videofile name */
                       , gint32 exact_seek
                       );
+static void       p_split_delace_value(gdouble delace
+                      , gdouble localframe_tween_rest
+                      , gint32 *deinterlace_ptr
+                      , gdouble *threshold_ptr);
+
 static gint32     p_story_render_fetch_composite_image_private(GapStoryRenderVidHandle *vidhand
                     , gint32 master_frame_nr  /* starts at 1 */
                     , gint32  vid_width       /* desired Video Width in pixels */
@@ -1024,6 +1031,7 @@
                  , char **filtermacro_file
                  , gint32   *localframe_index  /* starts at 1, used for ANIMIMAGE and VIDEOFILES, -1 for all other types */
                  , gint32   *local_stepcount   /* nth frame within this clip, starts with 0 */
+                 , gdouble  *localframe_tween_rest /* non-integer part of the position. value < 1.0 for tween fetching */
                  , gboolean *keep_proportions
                  , gboolean *fit_width
                  , gboolean *fit_height
@@ -1058,6 +1066,7 @@
   *move_y  = 0.0;
   *localframe_index = -1;
   *local_stepcount = 0;
+  *localframe_tween_rest = 0.0;
   *frn_type = GAP_FRN_SILENCE;
   *keep_proportions = FALSE;
   *fit_width        = TRUE;
@@ -1090,6 +1099,23 @@
         /* calculate framenumber local to the clip */
         l_fnr = (gint32)(frn_elem->frame_from + fnr);
 
+        {
+          gint32 fnrInt;
+          
+          fnrInt = fnr;  /* truncate to integer */
+          
+          *localframe_tween_rest = fnr - fnrInt;
+          
+          if(gap_debug)
+          {
+            printf("fnr:%.4f, fnrInt:%d localframe_tween_rest:%.4f\n"
+                     ,(float)fnr
+                     ,(int)fnrInt
+                     ,(float)*localframe_tween_rest
+                     );
+          }
+        }
+
         *local_stepcount = master_frame_nr - l_frame_group_count;
         *local_stepcount -= 1;
 
@@ -4517,6 +4543,74 @@
 }  /* end gap_story_render_fetch_composite_image */
 
 
+/* ------------------------------------------------
+ * p_split_delace_value
+ * ------------------------------------------------
+ * split the specified delace value: 
+ *    integer part is deinterlace mode, 
+ *      (0 NO,
+ *       1 Odd,
+ *       2 Even,
+ *       3 Odd First,
+ *       4 Even first)
+ *    rest is the threshold value.
+ * The localframe_tween_rest is a positive value < 1.0.
+ * This is only relevant in case delace mode is 3 Odd First or 4 Even first.
+ * For clips with standard stepsize 1 localframe_tween_rest is always 0.
+ * In Clips with non-integer stepsize localframe_tween_rest referes
+ * between 2 framenumbers, where the value 0.5 is the middle.
+ * An Interlaced frame contains 2 half-frames where one half-frame is represented by
+ * the even, the other half-frame by the odd lines.
+ * 
+ * therfore localframe_tween_rest values >= 0.5 selects the other half-frame,
+ * in case the enable_interlace_tween_pick option is enabled.
+ *
+ * OUT: *deinterlace_ptr
+ *       0 NO,
+ *       1 Odd,
+ *       2 Even,
+ * OUT: *threshold_ptr  The threshold < 1.0 for smooth mix of 2 pixel rows.
+ */
+static void
+p_split_delace_value(gdouble delace, gdouble localframe_tween_rest, gint32 *deinterlace_ptr, gdouble *threshold_ptr)
+{
+  gint32 delace_int;
+
+  delace_int = delace;
+  *threshold_ptr = delace - (gdouble)delace_int;
+
+  switch (delace_int)
+  {
+    case 4:
+      *deinterlace_ptr = 2;
+      if (localframe_tween_rest >= 0.5)
+      {
+        *deinterlace_ptr = 1;
+      }
+      break;
+    case 3:
+      *deinterlace_ptr = 1;
+      if (localframe_tween_rest >= 0.5)
+      {
+        *deinterlace_ptr = 2;
+      }
+      break;
+    case 2:
+      *deinterlace_ptr = 2;
+      break;
+    case 1:
+      *deinterlace_ptr = 1;
+      break;
+    default:
+      *deinterlace_ptr = 0;
+      break;
+  }
+
+}  /* end p_split_delace_value */
+
+
+
+
 static gint32
 p_story_render_fetch_composite_image_private(GapStoryRenderVidHandle *vidhand
                     , gint32 master_frame_nr  /* starts at 1 */
@@ -4545,6 +4639,7 @@
   gint32       *l_layers_list;
   gint32        l_localframe_index;
   gint32        l_local_stepcount;
+  gdouble       l_localframe_tween_rest;
   gboolean      l_keep_proportions;
   gboolean      l_fit_width;
   gboolean      l_fit_height;
@@ -4555,7 +4650,7 @@
   gdouble l_blue_f;
   gdouble l_alpha_f;
 
-
+  l_localframe_tween_rest = 0.0;
   l_comp_image_id   = -1;
   l_tmp_image_id    = -1;
   l_layer_id        = -1;
@@ -4608,6 +4703,7 @@
                  , &l_trak_filtermacro_file
                  , &l_localframe_index   /* used only for ANIMIMAGE, SECTION and Videoframe Number, -1 for all other types */
                  , &l_local_stepcount    /* nth frame within this clip */
+                 , &l_localframe_tween_rest  /* non integer part of local position (in case stepsize != 1) */
                  , &l_keep_proportions
                  , &l_fit_width
                  , &l_fit_height
@@ -4772,8 +4868,12 @@
                   t_GVA_RetCode  l_fcr;
 
                   /* split delace value: integer part is deinterlace mode, rest is threshold */
-                  l_deinterlace = l_frn_elem->delace;
-                  l_threshold = l_frn_elem->delace - (gdouble)l_deinterlace;
+                  p_split_delace_value(l_frn_elem->delace
+                          , l_localframe_tween_rest
+                          , &l_deinterlace
+                          , &l_threshold
+                          );
+
 
                   /* set image and layer in the gvahand structure invalid,
                    * to force creation of a new image in the following call of  GVA_frame_to_gimp_layer



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]