Revision: 38564
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38564
Author:   nazgul
Date:     2011-07-21 15:11:29 +0000 (Thu, 21 Jul 2011)
Log Message:
-----------
Merging r38547 through r38563 from soc-2011-tomato into soc-2011-salad

Revision Links:
--------------
    
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38547
    
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38563

Modified Paths:
--------------
    branches/soc-2011-salad/extern/libmv/libmv-capi.cpp
    branches/soc-2011-salad/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-salad/source/blender/blenkernel/intern/movieclip.c
    branches/soc-2011-salad/source/blender/blenkernel/intern/tracking.c
    branches/soc-2011-salad/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-salad/source/blender/editors/include/ED_clip.h
    branches/soc-2011-salad/source/blender/editors/space_clip/clip_editor.c
    branches/soc-2011-salad/source/blender/editors/space_clip/clip_ops.c
    branches/soc-2011-salad/source/blender/editors/space_clip/space_clip.c
    branches/soc-2011-salad/source/blender/editors/space_clip/tracking_ops.c
    
branches/soc-2011-salad/source/blender/editors/transform/transform_conversions.c
    branches/soc-2011-salad/source/blender/makesdna/DNA_movieclip_types.h
    branches/soc-2011-salad/source/blender/makesrna/intern/rna_movieclip.c

Property Changed:
----------------
    branches/soc-2011-salad/


Property changes on: branches/soc-2011-salad
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793,30797-30798,30815
/branches/soc-2011-carrot:36854,37548,37564,37602,37622,37848,38043,38064,38226,38231,38282
/branches/soc-2011-cucumber:36829-36994
/branches/soc-2011-onion:36833-38309
/branches/soc-2011-pepper:36830-38208
/branches/soc-2011-tomato:36831-38546
/trunk/blender:36834-38562
   + /branches/soc-2010-jwilkins:28499-37009
/branches/soc-2010-nicolasbishop:28448-30783,30792-30793,30797-30798,30815
/branches/soc-2011-carrot:36854,37548,37564,37602,37622,37848,38043,38064,38226,38231,38282
/branches/soc-2011-cucumber:36829-36994
/branches/soc-2011-onion:36833-38309
/branches/soc-2011-pepper:36830-38208
/branches/soc-2011-tomato:36831-38563
/trunk/blender:36834-38562

Modified: branches/soc-2011-salad/extern/libmv/libmv-capi.cpp
===================================================================
--- branches/soc-2011-salad/extern/libmv/libmv-capi.cpp 2011-07-21 15:08:57 UTC 
(rev 38563)
+++ branches/soc-2011-salad/extern/libmv/libmv-capi.cpp 2011-07-21 15:11:29 UTC 
(rev 38564)
@@ -26,7 +26,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/* define this to generate PNg images with content of search areas
+/* define this to generate PNG images with content of search areas
   tracking between which failed */
 #undef DUMP_FAILURE
 

Modified: branches/soc-2011-salad/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- branches/soc-2011-salad/release/scripts/startup/bl_ui/space_clip.py 
2011-07-21 15:08:57 UTC (rev 38563)
+++ branches/soc-2011-salad/release/scripts/startup/bl_ui/space_clip.py 
2011-07-21 15:11:29 UTC (rev 38564)
@@ -341,7 +341,12 @@
         layout.prop(sc, "lock_selection")
         layout.prop(sc, "use_mute_footage")
 
+        clip = sc.clip
+        if clip:
+            layout.label(text="Display Aspect:")
+            layout.prop(clip, "display_aspect", text="")
 
+
 class CLIP_PT_footage(bpy.types.Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'

Modified: branches/soc-2011-salad/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- branches/soc-2011-salad/source/blender/blenkernel/intern/movieclip.c        
2011-07-21 15:08:57 UTC (rev 38563)
+++ branches/soc-2011-salad/source/blender/blenkernel/intern/movieclip.c        
2011-07-21 15:11:29 UTC (rev 38564)
@@ -216,6 +216,8 @@
 
        clip= alloc_libblock(&G.main->movieclip, ID_MC, name);
 
+       clip->aspx= clip->aspy= 1.0f;
+
        clip->tracking.camera.sensor_width= 35.0f;
        clip->tracking.camera.sensor_height= 18.0f;
        clip->tracking.camera.units= CAMERA_UNITS_MM;

Modified: branches/soc-2011-salad/source/blender/blenkernel/intern/tracking.c
===================================================================
--- branches/soc-2011-salad/source/blender/blenkernel/intern/tracking.c 
2011-07-21 15:08:57 UTC (rev 38563)
+++ branches/soc-2011-salad/source/blender/blenkernel/intern/tracking.c 
2011-07-21 15:11:29 UTC (rev 38564)
@@ -390,14 +390,21 @@
 
 /*********************** tracking *************************/
 
+typedef struct TrackContext {
+       MovieTrackingTrack *track;
+
+#ifdef WITH_LIBMV
+       struct libmv_RegionTracker *region_tracker;
+#endif
+} TrackContext;
+
 typedef struct MovieTrackingContext {
        MovieClipUser user;
        MovieClip *clip;
 
-#ifdef WITH_LIBMV
-       struct libmv_RegionTracker *region_tracker;
-#endif
-       ListBase tracks;
+       TrackContext *track_context;
+       int num_tracks;
+
        GHash *hash;
        MovieTrackingSettings settings;
 
@@ -411,32 +418,68 @@
        MovieTracking *tracking= &clip->tracking;
        MovieTrackingSettings *settings= &tracking->settings;
        MovieTrackingTrack *track;
+       TrackContext *track_context;
 
-#ifdef WITH_LIBMV
-       context->region_tracker= libmv_regionTrackerNew(100, 4, 0.2);
-#endif
-
        context->settings= *settings;
        context->backwards= backwards;
        context->hash= BLI_ghash_new(BLI_ghashutil_ptrhash, 
BLI_ghashutil_ptrcmp, "tracking trackHash");
        context->sync_frame= user->framenr;
 
+       /* count */
        track= tracking->tracks.first;
        while(track) {
                if(TRACK_SELECTED(track) && (track->flag&TRACK_LOCKED)==0) {
                        MovieTrackingMarker *marker= 
BKE_tracking_get_marker(track, user->framenr);
 
-                       if((marker->flag&MARKER_DISABLED)==0) {
-                               MovieTrackingTrack *new_track= 
BKE_tracking_copy_track(track);
-
-                               BLI_addtail(&context->tracks, new_track);
-                               BLI_ghash_insert(context->hash, new_track, 
track);
-                       }
+                       if((marker->flag&MARKER_DISABLED)==0)
+                               context->num_tracks++;
                }
 
                track= track->next;
        }
 
+       if(context->num_tracks) {
+               int width, height;
+
+               BKE_movieclip_acquire_size(clip, user, &width, &height);
+
+               /* create tracking data */
+               context->track_context= 
MEM_callocN(sizeof(TrackContext)*context->num_tracks, "tracking track_context");
+
+               track_context= context->track_context;
+               track= tracking->tracks.first;
+               while(track) {
+                       if(TRACK_SELECTED(track) && 
(track->flag&TRACK_LOCKED)==0) {
+                               MovieTrackingMarker *marker= 
BKE_tracking_get_marker(track, user->framenr);
+
+                               if((marker->flag&MARKER_DISABLED)==0) {
+                                       MovieTrackingTrack *new_track= 
BKE_tracking_copy_track(track);
+
+                                       track_context->track= new_track;
+
+#ifdef WITH_LIBMV
+                                       {
+                                               float search_size_x= 
(track->search_max[0]-track->search_min[0])*width;
+                                               float search_size_y= 
(track->search_max[1]-track->search_min[1])*height;
+                                               float pattern_size_x= 
(track->pat_max[0]-track->pat_min[0])*width;
+                                               float pattern_size_y= 
(track->pat_max[1]-track->pat_min[1])*height;
+
+                                               int level= log2f(2.0f * 
MIN2(search_size_x, search_size_y) / MAX2(pattern_size_x, pattern_size_y));
+
+                                               track_context->region_tracker= 
libmv_regionTrackerNew(100, level, 0.2);
+                                       }
+#endif
+
+                                       BLI_ghash_insert(context->hash, 
new_track, track);
+
+                                       track_context++;
+                               }
+                       }
+
+                       track= track->next;
+               }
+       }
+
        context->clip= clip;
        context->user= *user;
 
@@ -445,19 +488,22 @@
 
 void BKE_tracking_context_free(MovieTrackingContext *context)
 {
-       MovieTrackingTrack *track;
+       int a;
+       TrackContext *track_context;
 
+       for(a= 0, track_context= context->track_context; a<context->num_tracks; 
a++, track_context++) {
+               BKE_tracking_free_track(context->track_context[a].track);
+
 #if WITH_LIBMV
-       libmv_regionTrackerDestroy(context->region_tracker);
+               libmv_regionTrackerDestroy(track_context->region_tracker);
 #endif
 
-       track= context->tracks.first;
-       while(track) {
-               BKE_tracking_free_track(track);
-               track= track->next;
+               MEM_freeN(track_context->track);
        }
-       BLI_freelistN(&context->tracks);
 
+       if(context->track_context)
+               MEM_freeN(context->track_context);
+
        BLI_ghash_free(context->hash, NULL, NULL);
 
        MEM_freeN(context);
@@ -587,20 +633,22 @@
 
 void BKE_tracking_sync(MovieTrackingContext *context)
 {
+       TrackContext *track_context;
        MovieTrackingTrack *track;
        ListBase tracks= {NULL, NULL};
        ListBase *old_tracks= &context->clip->tracking.tracks;
-       int sel_type, newframe;
+       int a, sel_type, newframe;
        void *sel;
 
        BKE_movieclip_last_selection(context->clip, &sel_type, &sel);
 
        /* duplicate currently tracking tracks to list of displaying tracks */
-       track= context->tracks.first;
-       while(track) {
+       for(a= 0, track_context= context->track_context; a<context->num_tracks; 
a++, track_context++) {
                int replace_sel= 0;
                MovieTrackingTrack *new_track, *old;
 
+               track= track_context->track;
+
                /* find original of tracking track in list of previously 
displayed tracks */
                old= BLI_ghash_lookup(context->hash, track);
                if(old) {
@@ -636,8 +684,6 @@
                        BKE_movieclip_set_selection(context->clip, 
MCLIP_SEL_TRACK, new_track);
 
                BLI_addtail(&tracks, new_track);
-
-               track= track->next;
        }
 
        /* move tracks, which could be added by user during tracking */
@@ -667,12 +713,11 @@
 int BKE_tracking_next(MovieTrackingContext *context)
 {
        ImBuf *ibuf, *ibuf_new;
-       MovieTrackingTrack *track;
        int curfra= context->user.framenr;
-       int ok= 0;
+       int a, ok= 0;
 
        /* nothing to track, avoid unneeded frames reading to save time and 
memory */
-       if(!context->tracks.first)
+       if(!context->num_tracks)
                return 0;
 
        ibuf= BKE_movieclip_acquire_ibuf(context->clip, &context->user);
@@ -687,25 +732,34 @@
                return 0;
        }
 
-       track= context->tracks.first;
-       while(track) {
+       #pragma omp parallel for private(a) shared(ibuf, ibuf_new, ok)
+       for(a= 0; a<context->num_tracks; a++) {
+               TrackContext *track_context= &context->track_context[a];
+               MovieTrackingTrack *track= track_context->track;
                MovieTrackingMarker *marker= BKE_tracking_get_marker(track, 
curfra);
 
                if(marker && (marker->flag&MARKER_DISABLED)==0 && 
marker->framenr==curfra) {
 #ifdef WITH_LIBMV
                        int width, height, origin[2];
                        float pos[2];
-                       float *patch= acquire_search_floatbuf(ibuf, track, 
marker, &width, &height, pos, origin);
-                       float *patch_new= acquire_search_floatbuf(ibuf_new, 
track, marker, &width, &height, pos, origin);
-                       double x1= pos[0], y1= pos[1];
-                       double x2= x1, y2= y1;
+                       float *patch, *patch_new;
+                       double x1, y1, x2, y2;
                        int wndx, wndy;
                        MovieTrackingMarker marker_new;
 
+                       patch= acquire_search_floatbuf(ibuf, track, marker, 
&width, &height, pos, origin);
+                       patch_new= acquire_search_floatbuf(ibuf_new, track, 
marker, &width, &height, pos, origin);
+
+                       x1= pos[0];
+                       y1= pos[1];
+
+                       x2= x1;
+                       y2= y1;
+
                        wndx= 
(int)((track->pat_max[0]-track->pat_min[0])*ibuf->x)/2;
                        wndy= 
(int)((track->pat_max[1]-track->pat_min[1])*ibuf->y)/2;
 
-                       if(libmv_regionTrackerTrack(context->region_tracker, 
patch, patch_new,
+                       
if(libmv_regionTrackerTrack(track_context->region_tracker, patch, patch_new,
                                                width, height, MAX2(wndx, wndy),
                                                x1, y1, &x2, &y2)) {
                                memset(&marker_new, 0, sizeof(marker_new));
@@ -716,27 +770,31 @@
                                if(context->backwards) marker_new.framenr= 
curfra-1;
                                else marker_new.framenr= curfra+1;
 
-                               BKE_tracking_insert_marker(track, &marker_new);
+                               #pragma omp critical
+                               {
+                                       BKE_tracking_insert_marker(track, 
&marker_new);
+                               }
 
                        } else {
                                marker_new= *marker;
 
                                if(context->backwards) marker_new.framenr--;
-                               else marker_new.framenr++;;
+                               else marker_new.framenr++;
 
                                marker_new.flag|= MARKER_DISABLED;
 
-                               BKE_tracking_insert_marker(track, &marker_new);
+                               #pragma omp critical
+                               {
+                                       BKE_tracking_insert_marker(track, 
&marker_new);

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to