Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * $Id$ | |
3 * | |
4 * ***** BEGIN GPL LICENSE BLOCK ***** | 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
5 * | 3 * |
6 * This program is free software; you can redistribute it and/or | 4 * This program is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU General Public License | 5 * modify it under the terms of the GNU General Public License |
8 * as published by the Free Software Foundation; either version 2 | 6 * as published by the Free Software Foundation; either version 2 |
9 * of the License, or (at your option) any later version. | 7 * of the License, or (at your option) any later version. |
10 * | 8 * |
11 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 | 72 |
75 #include "IMB_imbuf_types.h" | 73 #include "IMB_imbuf_types.h" |
76 #include "IMB_imbuf.h" | 74 #include "IMB_imbuf.h" |
77 | 75 |
78 /*********************** movieclip buffer loaders *************************/ | 76 /*********************** movieclip buffer loaders *************************/ |
79 | 77 |
80 static int sequence_guess_offset(const char *full_name, int head_len, int numlen ) | 78 static int sequence_guess_offset(const char *full_name, int head_len, int numlen ) |
81 { | 79 { |
82 char num[FILE_MAX]= {0}; | 80 char num[FILE_MAX]= {0}; |
83 | 81 |
84 strncpy(num, full_name+head_len, numlen); | 82 strncpy(num, full_name+head_len, numlen); |
brechtvl
2011/10/25 16:01:36
Use BLI_strncpy, strncpy does not do null terminat
nazgul
2011/10/25 19:04:58
Argh, always forgot about this.
| |
85 | 83 |
86 return atoi(num); | 84 return atoi(num); |
87 } | 85 } |
88 | 86 |
89 static int rendersize_to_proxy(MovieClipUser *user, int flag) | 87 static int rendersize_to_proxy(MovieClipUser *user, int flag) |
90 { | 88 { |
91 if((flag&MCLIP_USE_PROXY)==0) | 89 if((flag&MCLIP_USE_PROXY)==0) |
92 return IMB_PROXY_NONE; | 90 return IMB_PROXY_NONE; |
93 | 91 |
94 switch(user->render_size) { | 92 switch(user->render_size) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 else | 160 else |
163 BLI_path_abs(name, G.main->name); | 161 BLI_path_abs(name, G.main->name); |
164 } | 162 } |
165 | 163 |
166 /* supposed to work with sequences only */ | 164 /* supposed to work with sequences only */ |
167 static void get_proxy_fname(MovieClip *clip, int proxy_render_size, int undistor ted, int framenr, char *name) | 165 static void get_proxy_fname(MovieClip *clip, int proxy_render_size, int undistor ted, int framenr, char *name) |
168 { | 166 { |
169 int size= rendersize_to_number(proxy_render_size); | 167 int size= rendersize_to_number(proxy_render_size); |
170 char dir[FILE_MAX], clipdir[FILE_MAX], clipfile[FILE_MAX]; | 168 char dir[FILE_MAX], clipdir[FILE_MAX], clipfile[FILE_MAX]; |
171 | 169 |
172 » BLI_split_dirfile(clip->name, clipdir, clipfile); | 170 » BLI_split_dirfile(clip->name, clipdir, clipfile, FILE_MAX, FILE_MAX); |
173 | 171 |
174 if(clip->flag&MCLIP_USE_PROXY_CUSTOM_DIR) { | 172 if(clip->flag&MCLIP_USE_PROXY_CUSTOM_DIR) { |
175 strcpy(dir, clip->proxy.dir); | 173 strcpy(dir, clip->proxy.dir); |
176 } else { | 174 } else { |
177 BLI_snprintf(dir, FILE_MAX, "%s/BL_proxy", clipdir); | 175 BLI_snprintf(dir, FILE_MAX, "%s/BL_proxy", clipdir); |
178 } | 176 } |
179 | 177 |
180 if(undistorted) | 178 if(undistorted) |
181 BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d_undistorted/%08d", dir, clipfile, size, framenr); | 179 BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d_undistorted/%08d", dir, clipfile, size, framenr); |
182 else | 180 else |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 | 252 |
255 ibuf= IMB_anim_absolute(clip->anim, fra, tc, proxy); | 253 ibuf= IMB_anim_absolute(clip->anim, fra, tc, proxy); |
256 } | 254 } |
257 | 255 |
258 return ibuf; | 256 return ibuf; |
259 } | 257 } |
260 | 258 |
261 /*********************** image buffer cache *************************/ | 259 /*********************** image buffer cache *************************/ |
262 | 260 |
263 typedef struct MovieClipCache { | 261 typedef struct MovieClipCache { |
264 /* regular moive cache */ | 262 /* regular moive cache */ |
brechtvl
2011/10/25 16:01:36
moive => movie
| |
265 struct MovieCache *moviecache; | 263 struct MovieCache *moviecache; |
266 | 264 |
267 /* cache for stable shot */ | 265 /* cache for stable shot */ |
268 int stable_framenr; | 266 int stable_framenr; |
269 float stable_loc[2], stable_scale, stable_angle; | 267 float stable_loc[2], stable_scale, stable_angle; |
270 ImBuf *stableibuf; | 268 ImBuf *stableibuf; |
271 int proxy; | 269 int proxy; |
272 short render_flag; | 270 short render_flag; |
273 | 271 |
274 /* cache for undistorted shot */ | 272 /* cache for undistorted shot */ |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 { | 405 { |
408 MovieClip *clip; | 406 MovieClip *clip; |
409 MovieClipUser user; | 407 MovieClipUser user; |
410 int file, len, width, height; | 408 int file, len, width, height; |
411 const char *libname; | 409 const char *libname; |
412 char str[FILE_MAX], strtest[FILE_MAX]; | 410 char str[FILE_MAX], strtest[FILE_MAX]; |
413 | 411 |
414 BLI_strncpy(str, name, sizeof(str)); | 412 BLI_strncpy(str, name, sizeof(str)); |
415 BLI_path_abs(str, G.main->name); | 413 BLI_path_abs(str, G.main->name); |
416 | 414 |
417 /* exists? */ | 415 /* exists? */ |
brechtvl
2011/10/25 16:01:36
BLI_exists can be used instead.
nazgul
2011/10/25 19:04:58
Was thinking about this. BLI_exists behaves a bit
| |
418 file= open(str, O_BINARY|O_RDONLY); | 416 file= open(str, O_BINARY|O_RDONLY); |
419 if(file== -1) return NULL; | 417 if(file== -1) return NULL; |
420 close(file); | 418 close(file); |
421 | 419 |
422 /* ** first search an identical clip ** */ | 420 /* ** first search an identical clip ** */ |
423 for(clip= G.main->movieclip.first; clip; clip= clip->id.next) { | 421 for(clip= G.main->movieclip.first; clip; clip= clip->id.next) { |
424 BLI_strncpy(strtest, clip->name, sizeof(clip->name)); | 422 BLI_strncpy(strtest, clip->name, sizeof(clip->name)); |
425 BLI_path_abs(strtest, G.main->name); | 423 BLI_path_abs(strtest, G.main->name); |
426 | 424 |
427 if(strcmp(strtest, str)==0) { | 425 if(strcmp(strtest, str)==0) { |
(...skipping 12 matching lines...) Expand all Loading... | |
440 while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\') len--; | 438 while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\') len--; |
441 libname= name+len; | 439 libname= name+len; |
442 | 440 |
443 clip= movieclip_alloc(libname); | 441 clip= movieclip_alloc(libname); |
444 BLI_strncpy(clip->name, name, sizeof(clip->name)); | 442 BLI_strncpy(clip->name, name, sizeof(clip->name)); |
445 | 443 |
446 if(BLI_testextensie_array(name, imb_ext_movie)) clip->source= MCLIP_SRC_ MOVIE; | 444 if(BLI_testextensie_array(name, imb_ext_movie)) clip->source= MCLIP_SRC_ MOVIE; |
447 else clip->source= MCLIP_SRC_SEQUENCE; | 445 else clip->source= MCLIP_SRC_SEQUENCE; |
448 | 446 |
449 user.framenr= 1; | 447 user.framenr= 1; |
450 » BKE_movieclip_acquire_size(clip, &user, &width, &height); | 448 » BKE_movieclip_get_size(clip, &user, &width, &height); |
451 if(width && height) { | 449 if(width && height) { |
452 clip->tracking.camera.principal[0]= ((float)width)/2; | 450 clip->tracking.camera.principal[0]= ((float)width)/2; |
453 clip->tracking.camera.principal[1]= ((float)height)/2; | 451 clip->tracking.camera.principal[1]= ((float)height)/2; |
454 | 452 |
455 clip->tracking.camera.focal= 24.f*width/clip->tracking.camera.se nsor_width; | 453 clip->tracking.camera.focal= 24.f*width/clip->tracking.camera.se nsor_width; |
456 } | 454 } |
457 | 455 |
458 return clip; | 456 return clip; |
459 } | 457 } |
460 | 458 |
461 static void real_ibuf_size(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, in t *width, int *height) | 459 static void real_ibuf_size(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, in t *width, int *height) |
brechtvl
2011/10/25 16:01:36
If the size of the original image is not a multipl
nazgul
2011/10/25 19:04:58
Was thinking about this. In fact, it's not so big
| |
462 { | 460 { |
463 *width= ibuf->x; | 461 *width= ibuf->x; |
464 *height= ibuf->y; | 462 *height= ibuf->y; |
465 | 463 |
466 if(clip->flag&MCLIP_USE_PROXY) { | 464 if(clip->flag&MCLIP_USE_PROXY) { |
467 switch(user->render_size) { | 465 switch(user->render_size) { |
468 case MCLIP_PROXY_RENDER_SIZE_25: | 466 case MCLIP_PROXY_RENDER_SIZE_25: |
469 (*width)*= 4; | 467 (*width)*= 4; |
470 (*height)*= 4; | 468 (*height)*= 4; |
471 break; | 469 break; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 | 521 |
524 return cache->undistibuf; | 522 return cache->undistibuf; |
525 } | 523 } |
526 | 524 |
527 static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *dist oriton, ImBuf *ibuf) | 525 static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *dist oriton, ImBuf *ibuf) |
528 { | 526 { |
529 ImBuf *undistibuf; | 527 ImBuf *undistibuf; |
530 | 528 |
531 /* XXX: because of #27997 do not use float buffers to undistort, | 529 /* XXX: because of #27997 do not use float buffers to undistort, |
532 otherwise, undistorted proxy can be darker than it should */ | 530 otherwise, undistorted proxy can be darker than it should */ |
533 imb_freerectfloatImBuf(ibuf); | 531 imb_freerectfloatImBuf(ibuf); |
brechtvl
2011/10/25 16:01:36
I think the problem here may be that IMB_dupImBuf
nazgul
2011/10/25 19:04:58
Did you read comment above? It _is_ bug, and i kno
| |
534 | 532 |
535 if(distoriton) | 533 if(distoriton) |
536 undistibuf= BKE_tracking_distortion_exec(distoriton, &clip->trac king, ibuf, ibuf->x, ibuf->y, 0.f, 1); | 534 undistibuf= BKE_tracking_distortion_exec(distoriton, &clip->trac king, ibuf, ibuf->x, ibuf->y, 0.f, 1); |
537 else | 535 else |
538 undistibuf= BKE_tracking_undistort(&clip->tracking, ibuf, ibuf-> x, ibuf->y, 0.f); | 536 undistibuf= BKE_tracking_undistort(&clip->tracking, ibuf, ibuf-> x, ibuf->y, 0.f); |
539 | 537 |
540 if(undistibuf->userflags|= IB_RECT_INVALID) { | 538 if(undistibuf->userflags|= IB_RECT_INVALID) { |
541 ibuf->userflags&= ~IB_RECT_INVALID; | 539 ibuf->userflags&= ~IB_RECT_INVALID; |
542 IMB_rect_from_float(undistibuf); | 540 IMB_rect_from_float(undistibuf); |
543 } | 541 } |
(...skipping 21 matching lines...) Expand all Loading... | |
565 /* force stable buffer be re-calculated */ | 563 /* force stable buffer be re-calculated */ |
566 IMB_freeImBuf(cache->stableibuf); | 564 IMB_freeImBuf(cache->stableibuf); |
567 cache->stableibuf= NULL; | 565 cache->stableibuf= NULL; |
568 } | 566 } |
569 | 567 |
570 IMB_refImBuf(cache->undistibuf); | 568 IMB_refImBuf(cache->undistibuf); |
571 | 569 |
572 return cache->undistibuf; | 570 return cache->undistibuf; |
573 } | 571 } |
574 | 572 |
575 ImBuf *BKE_movieclip_acquire_ibuf(MovieClip *clip, MovieClipUser *user) | 573 ImBuf *BKE_movieclip_get_ibuf(MovieClip *clip, MovieClipUser *user) |
576 { | 574 { |
577 ImBuf *ibuf= NULL; | 575 ImBuf *ibuf= NULL; |
578 int framenr= user?user->framenr:clip->lastframe; | 576 int framenr= user?user->framenr:clip->lastframe; |
579 int cache_undistorted= 0; | 577 int cache_undistorted= 0; |
580 | 578 |
581 /* cache isn't threadsafe itself and also loading of movies | 579 /* cache isn't threadsafe itself and also loading of movies |
582 can't happen from concurent threads that's why we use lock here */ | 580 can't happen from concurent threads that's why we use lock here */ |
583 BLI_lock_thread(LOCK_MOVIECLIP); | 581 BLI_lock_thread(LOCK_MOVIECLIP); |
brechtvl
2011/10/25 16:01:36
This lock doesn't really make the movie cache thre
nazgul
2011/10/25 19:04:58
Hrm. In fact problem is not cause by cache size. T
| |
584 | 582 |
585 /* try to obtain cached undistorted image first */ | 583 /* try to obtain cached undistorted image first */ |
586 if(need_undistorted_cache(user, clip->flag)) { | 584 if(need_undistorted_cache(user, clip->flag)) { |
587 ibuf= get_undistorted_cache(clip, user); | 585 ibuf= get_undistorted_cache(clip, user); |
588 if(!ibuf) | 586 if(!ibuf) |
589 cache_undistorted= 1; | 587 cache_undistorted= 1; |
590 } | 588 } |
591 | 589 |
592 if(!ibuf) | 590 if(!ibuf) |
593 ibuf= get_imbuf_cache(clip, user, clip->flag); | 591 ibuf= get_imbuf_cache(clip, user, clip->flag); |
(...skipping 25 matching lines...) Expand all Loading... | |
619 ibuf= put_undistorted_cache(clip, user, tmpibuf); | 617 ibuf= put_undistorted_cache(clip, user, tmpibuf); |
620 IMB_freeImBuf(tmpibuf); | 618 IMB_freeImBuf(tmpibuf); |
621 } | 619 } |
622 } | 620 } |
623 | 621 |
624 BLI_unlock_thread(LOCK_MOVIECLIP); | 622 BLI_unlock_thread(LOCK_MOVIECLIP); |
625 | 623 |
626 return ibuf; | 624 return ibuf; |
627 } | 625 } |
628 | 626 |
629 ImBuf *BKE_movieclip_acquire_ibuf_flag(MovieClip *clip, MovieClipUser *user, int flag) | 627 ImBuf *BKE_movieclip_get_ibuf_flag(MovieClip *clip, MovieClipUser *user, int fla g) |
630 { | 628 { |
631 ImBuf *ibuf= NULL; | 629 ImBuf *ibuf= NULL; |
632 int framenr= user?user->framenr:clip->lastframe; | 630 int framenr= user?user->framenr:clip->lastframe; |
633 int cache_undistorted= 0; | 631 int cache_undistorted= 0; |
634 | 632 |
635 /* cache isn't threadsafe itself and also loading of movies | 633 /* cache isn't threadsafe itself and also loading of movies |
636 can't happen from concurent threads that's why we use lock here */ | 634 can't happen from concurent threads that's why we use lock here */ |
637 BLI_lock_thread(LOCK_MOVIECLIP); | 635 BLI_lock_thread(LOCK_MOVIECLIP); |
638 | 636 |
639 /* try to obtain cached undistorted image first */ | 637 /* try to obtain cached undistorted image first */ |
(...skipping 26 matching lines...) Expand all Loading... | |
666 ImBuf *tmpibuf= ibuf; | 664 ImBuf *tmpibuf= ibuf; |
667 ibuf= put_undistorted_cache(clip, user, tmpibuf); | 665 ibuf= put_undistorted_cache(clip, user, tmpibuf); |
668 IMB_freeImBuf(tmpibuf); | 666 IMB_freeImBuf(tmpibuf); |
669 } | 667 } |
670 | 668 |
671 BLI_unlock_thread(LOCK_MOVIECLIP); | 669 BLI_unlock_thread(LOCK_MOVIECLIP); |
672 | 670 |
673 return ibuf; | 671 return ibuf; |
674 } | 672 } |
675 | 673 |
676 ImBuf *BKE_movieclip_acquire_stable_ibuf(MovieClip *clip, MovieClipUser *user, f loat loc[2], float *scale, float *angle) | 674 ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float loc[2], float *scale, float *angle) |
677 { | 675 { |
678 ImBuf *ibuf, *stableibuf= NULL; | 676 ImBuf *ibuf, *stableibuf= NULL; |
679 int framenr= user?user->framenr:clip->lastframe; | 677 int framenr= user?user->framenr:clip->lastframe; |
680 | 678 |
681 » ibuf= BKE_movieclip_acquire_ibuf(clip, user); | 679 » ibuf= BKE_movieclip_get_ibuf(clip, user); |
682 | 680 |
683 if(!ibuf) | 681 if(!ibuf) |
684 return NULL; | 682 return NULL; |
685 | 683 |
686 if(clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) { | 684 if(clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) { |
687 float tloc[2], tscale, tangle; | 685 float tloc[2], tscale, tangle; |
688 short proxy= IMB_PROXY_NONE; | 686 short proxy= IMB_PROXY_NONE; |
689 int render_flag= 0; | 687 int render_flag= 0; |
690 | 688 |
691 if(clip->flag&MCLIP_USE_PROXY) { | 689 if(clip->flag&MCLIP_USE_PROXY) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
738 IMB_freeImBuf(ibuf); | 736 IMB_freeImBuf(ibuf); |
739 ibuf= stableibuf; | 737 ibuf= stableibuf; |
740 } | 738 } |
741 | 739 |
742 return ibuf; | 740 return ibuf; |
743 | 741 |
744 } | 742 } |
745 | 743 |
746 int BKE_movieclip_has_frame(MovieClip *clip, MovieClipUser *user) | 744 int BKE_movieclip_has_frame(MovieClip *clip, MovieClipUser *user) |
747 { | 745 { |
748 » ImBuf *ibuf= BKE_movieclip_acquire_ibuf(clip, user); | 746 » ImBuf *ibuf= BKE_movieclip_get_ibuf(clip, user); |
749 | 747 |
750 if(ibuf) { | 748 if(ibuf) { |
751 IMB_freeImBuf(ibuf); | 749 IMB_freeImBuf(ibuf); |
752 return 1; | 750 return 1; |
753 } | 751 } |
754 | 752 |
755 return 0; | 753 return 0; |
756 } | 754 } |
757 | 755 |
758 void BKE_movieclip_acquire_size(MovieClip *clip, MovieClipUser *user, int *width , int *height) | 756 void BKE_movieclip_get_size(MovieClip *clip, MovieClipUser *user, int *width, in t *height) |
759 { | 757 { |
760 if(!user || user->framenr==clip->lastframe) { | 758 if(!user || user->framenr==clip->lastframe) { |
761 *width= clip->lastsize[0]; | 759 *width= clip->lastsize[0]; |
762 *height= clip->lastsize[1]; | 760 *height= clip->lastsize[1]; |
763 } else { | 761 } else { |
764 » » ImBuf *ibuf= BKE_movieclip_acquire_ibuf(clip, user); | 762 » » ImBuf *ibuf= BKE_movieclip_get_ibuf(clip, user); |
765 | 763 |
766 if(ibuf && ibuf->x && ibuf->y) { | 764 if(ibuf && ibuf->x && ibuf->y) { |
767 real_ibuf_size(clip, user, ibuf, width, height); | 765 real_ibuf_size(clip, user, ibuf, width, height); |
768 } else { | 766 } else { |
769 *width= 0; | 767 *width= 0; |
770 *height= 0; | 768 *height= 0; |
771 } | 769 } |
772 | 770 |
773 if(ibuf) | 771 if(ibuf) |
774 IMB_freeImBuf(ibuf); | 772 IMB_freeImBuf(ibuf); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
876 scopes->track= NULL; | 874 scopes->track= NULL; |
877 | 875 |
878 if(clip) { | 876 if(clip) { |
879 if(clip->tracking.act_track) { | 877 if(clip->tracking.act_track) { |
880 MovieTrackingTrack *track= clip->tracking.act_track; | 878 MovieTrackingTrack *track= clip->tracking.act_track; |
881 MovieTrackingMarker *marker= BKE_tracking_get_marker(tra ck, user->framenr); | 879 MovieTrackingMarker *marker= BKE_tracking_get_marker(tra ck, user->framenr); |
882 | 880 |
883 if(marker->flag&MARKER_DISABLED) { | 881 if(marker->flag&MARKER_DISABLED) { |
884 scopes->track_disabled= 1; | 882 scopes->track_disabled= 1; |
885 } else { | 883 } else { |
886 » » » » ImBuf *ibuf= BKE_movieclip_acquire_ibuf(clip, us er); | 884 » » » » ImBuf *ibuf= BKE_movieclip_get_ibuf(clip, user); |
887 | 885 |
888 scopes->track_disabled= 0; | 886 scopes->track_disabled= 0; |
889 | 887 |
890 if(ibuf && ibuf->rect) { | 888 if(ibuf && ibuf->rect) { |
891 ImBuf *tmpibuf; | 889 ImBuf *tmpibuf; |
892 MovieTrackingMarker undist_marker= *mark er; | 890 MovieTrackingMarker undist_marker= *mark er; |
893 | 891 |
894 if(user->render_flag&MCLIP_PROXY_RENDER_ UNDISTORT) { | 892 if(user->render_flag&MCLIP_PROXY_RENDER_ UNDISTORT) { |
895 int width, height; | 893 int width, height; |
896 float aspy= 1.f/clip->tracking.c amera.pixel_aspect;; | 894 float aspy= 1.f/clip->tracking.c amera.pixel_aspect;; |
897 | 895 |
898 » » » » » » BKE_movieclip_acquire_size(clip, user, &width, &height); | 896 » » » » » » BKE_movieclip_get_size(clip, use r, &width, &height); |
899 | 897 |
900 undist_marker.pos[0]*= width; | 898 undist_marker.pos[0]*= width; |
901 undist_marker.pos[1]*= height*as py; | 899 undist_marker.pos[1]*= height*as py; |
902 | 900 |
903 BKE_tracking_invert_intrinsics(& clip->tracking, undist_marker.pos, undist_marker.pos); | 901 BKE_tracking_invert_intrinsics(& clip->tracking, undist_marker.pos, undist_marker.pos); |
904 | 902 |
905 undist_marker.pos[0]/= width; | 903 undist_marker.pos[0]/= width; |
906 undist_marker.pos[1]/= height*as py; | 904 undist_marker.pos[1]/= height*as py; |
907 } | 905 } |
908 | 906 |
909 » » » » » tmpibuf= BKE_tracking_acquire_pattern_im buf(ibuf, track, &undist_marker, 1, 1, scopes->track_pos, NULL); | 907 » » » » » tmpibuf= BKE_tracking_get_pattern_imbuf( ibuf, track, &undist_marker, 1, 1, scopes->track_pos, NULL); |
910 | 908 |
911 if(tmpibuf->rect_float) | 909 if(tmpibuf->rect_float) |
912 IMB_rect_from_float(tmpibuf); | 910 IMB_rect_from_float(tmpibuf); |
913 | 911 |
914 if(tmpibuf->rect) | 912 if(tmpibuf->rect) |
915 scopes->track_preview= tmpibuf; | 913 scopes->track_preview= tmpibuf; |
916 else | 914 else |
917 IMB_freeImBuf(tmpibuf); | 915 IMB_freeImBuf(tmpibuf); |
918 } | 916 } |
919 | 917 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
968 } | 966 } |
969 | 967 |
970 void BKE_movieclip_build_proxy_frame(MovieClip *clip, struct MovieDistortion *di stortion, | 968 void BKE_movieclip_build_proxy_frame(MovieClip *clip, struct MovieDistortion *di stortion, |
971 int cfra, int *build_sizes, int build_count, int undisto rted) | 969 int cfra, int *build_sizes, int build_count, int undisto rted) |
972 { | 970 { |
973 ImBuf *ibuf; | 971 ImBuf *ibuf; |
974 MovieClipUser user; | 972 MovieClipUser user; |
975 | 973 |
976 user.framenr= cfra; | 974 user.framenr= cfra; |
977 | 975 |
978 » ibuf= BKE_movieclip_acquire_ibuf_flag(clip, &user, 0); | 976 » ibuf= BKE_movieclip_get_ibuf_flag(clip, &user, 0); |
979 | 977 |
980 if(ibuf) { | 978 if(ibuf) { |
981 ImBuf *tmpibuf= ibuf; | 979 ImBuf *tmpibuf= ibuf; |
982 int i; | 980 int i; |
983 | 981 |
984 if(undistorted) | 982 if(undistorted) |
985 tmpibuf= get_undistorted_ibuf(clip, distortion, ibuf); | 983 tmpibuf= get_undistorted_ibuf(clip, distortion, ibuf); |
986 | 984 |
987 for(i= 0; i<build_count; i++) | 985 for(i= 0; i<build_count; i++) |
988 movieclip_build_proxy_ibuf(clip, tmpibuf, cfra, build_si zes[i], undistorted); | 986 movieclip_build_proxy_ibuf(clip, tmpibuf, cfra, build_si zes[i], undistorted); |
989 | 987 |
990 IMB_freeImBuf(ibuf); | 988 IMB_freeImBuf(ibuf); |
991 | 989 |
992 if(tmpibuf!=ibuf) | 990 if(tmpibuf!=ibuf) |
993 IMB_freeImBuf(tmpibuf); | 991 IMB_freeImBuf(tmpibuf); |
994 } | 992 } |
995 } | 993 } |
996 | 994 |
997 void free_movieclip(MovieClip *clip) | 995 void free_movieclip(MovieClip *clip) |
998 { | 996 { |
999 free_buffers(clip); | 997 free_buffers(clip); |
1000 | 998 |
1001 BKE_tracking_free(&clip->tracking); | 999 BKE_tracking_free(&clip->tracking); |
1002 } | 1000 } |
1003 | 1001 |
1004 void unlink_movieclip(Main *bmain, MovieClip *clip) | 1002 void unlink_movieclip(Main *bmain, MovieClip *clip) |
brechtvl
2011/10/25 16:01:36
This doesn't seem to set all clip references to NU
nazgul
2011/10/25 19:04:58
You're right. Totally forgot to maintain this func
| |
1005 { | 1003 { |
1006 bScreen *scr; | 1004 bScreen *scr; |
1007 ScrArea *area; | 1005 ScrArea *area; |
1008 SpaceLink *sl; | 1006 SpaceLink *sl; |
1009 | 1007 |
1010 /* text space */ | 1008 /* text space */ |
brechtvl
2011/10/25 16:01:36
text space => clip space
| |
1011 for(scr= bmain->screen.first; scr; scr= scr->id.next) { | 1009 for(scr= bmain->screen.first; scr; scr= scr->id.next) { |
1012 for(area= scr->areabase.first; area; area= area->next) { | 1010 for(area= scr->areabase.first; area; area= area->next) { |
1013 for(sl= area->spacedata.first; sl; sl= sl->next) { | 1011 for(sl= area->spacedata.first; sl; sl= sl->next) { |
1014 if(sl->spacetype==SPACE_CLIP) { | 1012 if(sl->spacetype==SPACE_CLIP) { |
1015 SpaceClip *sc= (SpaceClip*) sl; | 1013 SpaceClip *sc= (SpaceClip*) sl; |
1016 | 1014 |
1017 if(sc->clip==clip) { | 1015 if(sc->clip==clip) { |
1018 sc->clip= NULL; | 1016 sc->clip= NULL; |
1019 } | 1017 } |
1020 } | 1018 } |
1021 } | 1019 } |
1022 } | 1020 } |
1023 } | 1021 } |
1024 | 1022 |
1025 clip->id.us= 0; | 1023 clip->id.us= 0; |
1026 } | 1024 } |
LEFT | RIGHT |