[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13544] trunk/blender/source/blender: == Sequencer ==
Peter Schlaile
peter at schlaile.de
Sun Feb 3 19:58:47 CET 2008
Revision: 13544
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13544
Author: schlaile
Date: 2008-02-03 19:58:46 +0100 (Sun, 03 Feb 2008)
Log Message:
-----------
== Sequencer ==
This adds low resolution proxy support to the blender sequencer, so
that even HD editing should be possible on slower machines.
The proxies are stored as directories of JPEG-files and are only
activated, if you use preview-resolution rendering.
For your final render, just switch back to full resolution and
the original files are used again.
It enables even proxying of whole effect pipelines and scene-strips
(but you have to your own custom directory for file storage then,
since blender has no filename, which could be taken as a sensible
default directory reference)
Modified Paths:
--------------
trunk/blender/source/blender/include/BSE_sequence.h
trunk/blender/source/blender/include/butspace.h
trunk/blender/source/blender/makesdna/DNA_sequence_types.h
trunk/blender/source/blender/src/buttons_scene.c
trunk/blender/source/blender/src/sequence.c
Modified: trunk/blender/source/blender/include/BSE_sequence.h
===================================================================
--- trunk/blender/source/blender/include/BSE_sequence.h 2008-02-03 18:50:03 UTC (rev 13543)
+++ trunk/blender/source/blender/include/BSE_sequence.h 2008-02-03 18:58:46 UTC (rev 13544)
@@ -61,6 +61,7 @@
void calc_sequence(struct Sequence *seq);
void calc_sequence_disp(struct Sequence *seq);
void reload_sequence_new_file(struct Sequence * seq);
+void seq_proxy_rebuild(struct Sequence * seq);
void sort_seq(void);
void clear_scene_in_allseqs(struct Scene *sce);
Modified: trunk/blender/source/blender/include/butspace.h
===================================================================
--- trunk/blender/source/blender/include/butspace.h 2008-02-03 18:50:03 UTC (rev 13543)
+++ trunk/blender/source/blender/include/butspace.h 2008-02-03 18:58:46 UTC (rev 13544)
@@ -364,6 +364,7 @@
#define B_SEQ_BUT_RELOAD_ALL 1694
#define B_SEQ_BUT_TRANSFORM 1695
#define B_SEQ_BUT_RELOAD_FILE 1696
+#define B_SEQ_BUT_REBUILD_PROXY 1697
/* *********************** */
#define B_ARMATUREBUTS 1800
Modified: trunk/blender/source/blender/makesdna/DNA_sequence_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_sequence_types.h 2008-02-03 18:50:03 UTC (rev 13543)
+++ trunk/blender/source/blender/makesdna/DNA_sequence_types.h 2008-02-03 18:58:46 UTC (rev 13544)
@@ -53,7 +53,7 @@
struct ImBuf *ibuf_comp;
struct TStripElem *se1, *se2, *se3;
short ok;
- short pad;
+ short flag;
int nr;
} TStripElem;
@@ -80,9 +80,6 @@
typedef struct StripProxy {
char dir[160];
- int format;
- int width;
- int height;
} StripProxy;
typedef struct Strip {
@@ -92,9 +89,9 @@
StripElem *stripdata;
char dir[160];
int orx, ory;
+ StripProxy *proxy;
StripCrop *crop;
StripTransform *transform;
- StripProxy *proxy;
StripColorBalance *color_balance;
TStripElem *tstripdata;
TStripElem *tstripdata_startstill;
@@ -259,6 +256,7 @@
#define SEQ_USE_TRANSFORM 65536
#define SEQ_USE_CROP 131072
#define SEQ_USE_COLOR_BALANCE 262144
+#define SEQ_USE_PROXY_CUSTOM_DIR 524288
#define SEQ_COLOR_BALANCE_INVERSE_GAIN 1
#define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2
@@ -294,6 +292,8 @@
#define STRIPELEM_OK 1
#define STRIPELEM_META 2
+#define STRIPELEM_PREVIEW_DONE 1
+
#define SEQ_BLEND_REPLACE 0
/* all other BLEND_MODEs are simple SEQ_EFFECT ids and therefore identical
to the table above. (Only those effects that handle _exactly_ two inputs,
Modified: trunk/blender/source/blender/src/buttons_scene.c
===================================================================
--- trunk/blender/source/blender/src/buttons_scene.c 2008-02-03 18:50:03 UTC (rev 13543)
+++ trunk/blender/source/blender/src/buttons_scene.c 2008-02-03 18:58:46 UTC (rev 13544)
@@ -1159,15 +1159,58 @@
uiDefButBitI(block, TOG, SEQ_USE_PROXY,
B_SEQ_BUT_RELOAD, "Use Proxy",
- 10,140,150,19, &last_seq->flag,
+ 10,140,120,19, &last_seq->flag,
0.0, 21.0, 100, 0,
"Use a preview proxy for this strip");
-
+
if (last_seq->flag & SEQ_USE_PROXY) {
+ if (!last_seq->strip->proxy) {
+ last_seq->strip->proxy =
+ MEM_callocN(sizeof(struct StripProxy),
+ "StripProxy");
+ }
+ uiDefButBitI(block, TOG, SEQ_USE_PROXY_CUSTOM_DIR,
+ B_SEQ_BUT_RELOAD, "Custom Dir",
+ 130,140,120,19, &last_seq->flag,
+ 0.0, 21.0, 100, 0,
+ "Use a custom directory to store data");
+ }
+ if (last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
+ uiDefBut(block, TEX,
+ B_SEQ_BUT_RELOAD, "Dir: ",
+ 10,120,240,19, last_seq->strip->proxy->dir,
+ 0.0, 160.0, 100, 0, "");
}
+ if (last_seq->flag & SEQ_USE_PROXY) {
+ if (G.scene->r.size == 100) {
+ uiDefBut(block, LABEL, 0,
+ "Full render size selected, ",
+ 10,100,240,19, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0,
+ "so no proxy enabled!",
+ 10,80,240,19, 0, 0, 0, 0, 0, "");
+ } else if (last_seq->type != SEQ_MOVIE
+ && last_seq->type != SEQ_IMAGE
+ && !(last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) {
+ uiDefBut(block, LABEL, 0,
+ "Cannot proxy this strip without ",
+ 10,100,240,19, 0, 0, 0, 0, 0, "");
+ uiDefBut(block, LABEL, 0,
+ "custom directory selection!",
+ 10,80,240,19, 0, 0, 0, 0, 0, "");
+
+ } else {
+ uiDefBut(block, BUT, B_SEQ_BUT_REBUILD_PROXY,
+ "Rebuild proxy",
+ 10,100,240,19, 0, 0, 0, 0, 0,
+ "Rebuild proxy for the "
+ "currently selected strip.");
+ }
+ }
+
uiBlockEndAlign(block);
}
@@ -1186,8 +1229,7 @@
panels = SEQ_PANEL_EDITING;
- if (type == SEQ_MOVIE || type == SEQ_IMAGE || type == SEQ_SCENE
- || type == SEQ_HD_SOUND) {
+ if (type == SEQ_MOVIE || type == SEQ_IMAGE || type == SEQ_SCENE) {
panels |= SEQ_PANEL_INPUT | SEQ_PANEL_FILTER | SEQ_PANEL_PROXY;
}
@@ -1237,6 +1279,9 @@
case B_SEQ_BUT_RELOAD_FILE:
reload_sequence_new_file(last_seq);
break;
+ case B_SEQ_BUT_REBUILD_PROXY:
+ seq_proxy_rebuild(last_seq);
+ break;
case B_SEQ_BUT_RELOAD:
case B_SEQ_BUT_RELOAD_ALL:
update_seq_ipo_rect(last_seq);
Modified: trunk/blender/source/blender/src/sequence.c
===================================================================
--- trunk/blender/source/blender/src/sequence.c 2008-02-03 18:50:03 UTC (rev 13543)
+++ trunk/blender/source/blender/src/sequence.c 2008-02-03 18:58:46 UTC (rev 13544)
@@ -76,6 +76,10 @@
int seqrectx, seqrecty;
+/* **********************************************************************
+ alloc / free functions
+ ********************************************************************** */
+
void free_tstripdata(int len, TStripElem *se)
{
TStripElem *seo;
@@ -101,11 +105,6 @@
}
-void seq_proxy_free(StripProxy * proxy)
-{
- MEM_freeN(proxy);
-}
-
void free_strip(Strip *strip)
{
strip->us--;
@@ -115,8 +114,10 @@
return;
}
- if(strip->stripdata) {
- MEM_freeN(strip->stripdata);
+ MEM_freeN(strip->stripdata);
+
+ if (strip->proxy) {
+ MEM_freeN(strip->proxy);
}
if (strip->crop) {
MEM_freeN(strip->crop);
@@ -124,9 +125,6 @@
if (strip->transform) {
MEM_freeN(strip->transform);
}
- if (strip->proxy) {
- seq_proxy_free(strip->proxy);
- }
if (strip->color_balance) {
MEM_freeN(strip->color_balance);
}
@@ -776,7 +774,7 @@
if(seq->startdisp >cfra || seq->enddisp <= cfra) return -1;
- if(seq->flag&SEQ_REVERSE_FRAMES) {
+ if(seq->flag&SEQ_REVERSE_FRAMES) {
/*reverse frame in this sequence */
if(cfra <= seq->start) nr= seq->len-1;
else if(cfra >= seq->start+seq->len-1) nr= 0;
@@ -826,12 +824,11 @@
here for all ibufs, since then, blending with IPOs won't work!
Rather common case, if you use a single image and try to fade
- it in and out...
-
- Performance TODO: seperate give_tstripelem for ibuf from
- give_tstripelem for ibuf_comp, so that caching works here again...
+ it in and out... or want to use your strip as a watermark in
+ alpha over mode...
*/
- if (seq->ipo && seq->ipo->curve.first && !(seq->type & SEQ_EFFECT)) {
+ if (seq->blend_mode != SEQ_BLEND_REPLACE ||
+ (seq->ipo && seq->ipo->curve.first && !(seq->type & SEQ_EFFECT))) {
Strip * s = seq->strip;
if (cfra < seq->start) {
se = s->tstripdata_startstill;
@@ -1013,6 +1010,211 @@
}
}
+/* **********************************************************************
+ proxy management
+ ********************************************************************** */
+
+#define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE)
+
+static int seq_proxy_get_fname(Sequence * seq, int cfra, char * name)
+{
+ int frameno;
+ char dir[FILE_MAXDIR];
+
+ if (seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) {
+ strcpy(dir, seq->strip->proxy->dir);
+ } else {
+ if (seq->type == SEQ_IMAGE || seq->type == SEQ_MOVIE) {
+ snprintf(dir, FILE_MAXDIR, "%s/BL_proxy",
+ seq->strip->dir);
+ } else {
+ return FALSE;
+ }
+ }
+
+ /* generate a seperate proxy directory for each preview size */
+
+ if (seq->type == SEQ_IMAGE) {
+ StripElem * se = give_stripelem(seq, cfra);
+ snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy",
+ dir, G.scene->r.size, se->name);
+ frameno = 1;
+ } else if (seq->type == SEQ_MOVIE) {
+ TStripElem * tse = give_tstripelem(seq, cfra);
+
+ frameno = tse->nr + seq->anim_startofs;
+
+ snprintf(name, PROXY_MAXFILE, "%s/%s/%d/#", dir,
+ seq->strip->stripdata->name,
+ G.scene->r.size);
+ } else {
+ TStripElem * tse = give_tstripelem(seq, cfra);
+
+ frameno = tse->nr + seq->anim_startofs;
+
+ snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/#", dir,
+ G.scene->r.size);
+ }
+
+ if (seq->strip->proxy == 0) {
+ return FALSE;
+ }
+
+
+ BLI_convertstringcode(name, G.sce, frameno);
+
+ strcat(name, ".jpg");
+
+ return TRUE;
+}
+
+static struct ImBuf * seq_proxy_fetch(Sequence * seq, int cfra)
+{
+ char name[PROXY_MAXFILE];
+
+ if (!(seq->flag & SEQ_USE_PROXY)) {
+ return 0;
+ }
+
+ /* rendering at 100% ? No real sense in proxy-ing, right? */
+ if (G.scene->r.size == 100.0) {
+ return 0;
+ }
+
+ if (!seq_proxy_get_fname(seq, cfra, name)) {
+ return 0;
+ }
+
+ if (BLI_exists(name)) {
+ return IMB_loadiffname(name, IB_rect);
+ } else {
+ return 0;
+ }
+}
+
+static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra,
+ int build_proxy_run);
+
+static void seq_proxy_build_frame(Sequence * seq, int cfra)
+{
+ char name[PROXY_MAXFILE];
+ int quality;
+ TStripElem * se;
+ int ok;
+ int rectx, recty;
+ struct ImBuf * ibuf;
+
+ if (!(seq->flag & SEQ_USE_PROXY)) {
+ return;
+ }
+
+ /* rendering at 100% ? No real sense in proxy-ing, right? */
+ if (G.scene->r.size == 100.0) {
+ return;
+ }
+
+ if (!seq_proxy_get_fname(seq, cfra, name)) {
+ return;
+ }
+
+ se = give_tstripelem(seq, cfra);
+
+ if(se->ibuf) {
+ IMB_freeImBuf(se->ibuf);
+ se->ibuf = 0;
+ }
+
+ do_build_seq_ibuf(seq, se, cfra, TRUE);
+
+ if (!se->ibuf) {
+ return;
+ }
+
+ rectx= (G.scene->r.size*G.scene->r.xsch)/100;
+ recty= (G.scene->r.size*G.scene->r.ysch)/100;
+
+ ibuf = se->ibuf;
+
+ if (ibuf->x != rectx || ibuf->y != recty) {
+ IMB_scalefastImBuf(ibuf, (short)rectx, (short)recty);
+ }
+
+ /* quality is fixed, otherwise one has to generate seperate
+ directories for every quality...
+
+ depth = 32 is intentionally left in, otherwise ALPHA channels
+ won't work... */
+ quality = 90;
+ ibuf->ftype= JPG | quality;
+
+ BLI_make_existing_file(name);
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list