[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13500] trunk/blender/source/blender: == Sequencer ==

Peter Schlaile peter at schlaile.de
Thu Jan 31 16:28:17 CET 2008


Revision: 13500
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13500
Author:   schlaile
Date:     2008-01-31 16:28:16 +0100 (Thu, 31 Jan 2008)

Log Message:
-----------
== Sequencer ==

Updated image preview a lot:
* Added a histogram-scope
* Added optional title-safe margins
* Re-arranged header, so that only usefull buttons are shown in image
  preview mode
* Added zebra-mode for visual feedback of over-exposure regions
  (helps in before and especially after color correction :)
* Added color-seperation-mode for waveform-display
* Show 10%, 70% and 90% hints in waveform-display

Modified Paths:
--------------
    trunk/blender/source/blender/include/BSE_seqscopes.h
    trunk/blender/source/blender/makesdna/DNA_space_types.h
    trunk/blender/source/blender/src/drawseq.c
    trunk/blender/source/blender/src/header_seq.c
    trunk/blender/source/blender/src/seqscopes.c

Modified: trunk/blender/source/blender/include/BSE_seqscopes.h
===================================================================
--- trunk/blender/source/blender/include/BSE_seqscopes.h	2008-01-31 14:25:52 UTC (rev 13499)
+++ trunk/blender/source/blender/include/BSE_seqscopes.h	2008-01-31 15:28:16 UTC (rev 13500)
@@ -32,7 +32,10 @@
 struct ImBuf;
 
 struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf);
+struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf);
 struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf);
+struct ImBuf *make_zebra_view_from_ibuf(struct ImBuf * ibuf, float perc);
+struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf);
 
 #endif
 

Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h	2008-01-31 14:25:52 UTC (rev 13499)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h	2008-01-31 15:28:16 UTC (rev 13500)
@@ -150,7 +150,7 @@
 	float xof, yof;	/* offset for drawing the image preview */
 	short mainb, zoom;
 	short chanshown;
-	short pad2;
+	short zebra;
 	int flag;
 	int pad;
 } SpaceSeq;
@@ -618,10 +618,13 @@
 #define SEQ_DRAW_IMG_IMBUF        1
 #define SEQ_DRAW_IMG_WAVEFORM     2
 #define SEQ_DRAW_IMG_VECTORSCOPE  3
+#define SEQ_DRAW_IMG_HISTOGRAM    4
 
 /* sseq->flag */
-#define SEQ_DRAWFRAMES  1
+#define SEQ_DRAWFRAMES   1
 #define SEQ_MARKER_TRANS 2
+#define SEQ_DRAW_COLOR_SEPERATED     4
+#define SEQ_DRAW_SAFE_MARGINS        8
 
 /* space types, moved from DNA_screen_types.h */
 enum {

Modified: trunk/blender/source/blender/src/drawseq.c
===================================================================
--- trunk/blender/source/blender/src/drawseq.c	2008-01-31 14:25:52 UTC (rev 13499)
+++ trunk/blender/source/blender/src/drawseq.c	2008-01-31 15:28:16 UTC (rev 13500)
@@ -793,6 +793,7 @@
 	int free_ibuf = 0;
 	static int recursive= 0;
 	float zoom;
+	float zoomx, zoomy;
 
 	glClearColor(0.0, 0.0, 0.0, 0.0);
 	glClear(GL_COLOR_BUFFER_BIT);
@@ -837,19 +838,38 @@
 	
 	if(ibuf==NULL) 
 		return;
-	if(ibuf->rect_float && ibuf->rect==NULL)
-		IMB_rect_from_float(ibuf);
-	if(ibuf->rect==NULL) 
+
+	if(ibuf->rect==NULL && ibuf->rect_float == NULL) 
 		return;
 
-	if (sseq->mainb == SEQ_DRAW_IMG_WAVEFORM) {
-		ibuf = make_waveform_view_from_ibuf(ibuf);
+	switch(sseq->mainb) {
+	case SEQ_DRAW_IMG_IMBUF:
+		if (sseq->zebra != 0) {
+			ibuf = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
+			free_ibuf = 1;
+		}
+		break;
+	case SEQ_DRAW_IMG_WAVEFORM:
+		if ((sseq->flag & SEQ_DRAW_COLOR_SEPERATED) != 0) {
+			ibuf = make_sep_waveform_view_from_ibuf(ibuf);
+		} else {
+			ibuf = make_waveform_view_from_ibuf(ibuf);
+		}
 		free_ibuf = 1;
-	} else if (sseq->mainb == SEQ_DRAW_IMG_VECTORSCOPE) {
+		break;
+	case SEQ_DRAW_IMG_VECTORSCOPE:
 		ibuf = make_vectorscope_view_from_ibuf(ibuf);
 		free_ibuf = 1;
+		break;
+	case SEQ_DRAW_IMG_HISTOGRAM:
+		ibuf = make_histogram_view_from_ibuf(ibuf);
+		free_ibuf = 1;
+		break;
 	}
 
+	if(ibuf->rect_float && ibuf->rect==NULL)
+		IMB_rect_from_float(ibuf);
+
 	if (sseq->zoom > 0) {
 		zoom = sseq->zoom;
 	} else if (sseq->zoom == 0) {
@@ -864,13 +884,44 @@
 
 	/* needed for gla draw */
 	glaDefine2DArea(&curarea->winrct);
+
+	zoomx = zoom * ((float)G.scene->r.xasp / (float)G.scene->r.yasp);
+	zoomy = zoom;
 	
-	glPixelZoom(zoom * ((float)G.scene->r.xasp / (float)G.scene->r.yasp), zoom);
+	glPixelZoom(zoomx, zoomy);
 	
 	glaDrawPixelsSafe(x1, y1, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 	
 	glPixelZoom(1.0, 1.0);
 
+	/* safety border */
+	if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && 
+	    (sseq->flag & SEQ_DRAW_SAFE_MARGINS) != 0) {
+		float fac= 0.1;
+		float x2 = x1 + ibuf->x * zoomx;
+		float y2 = y1 + ibuf->y * zoomy;
+		
+		float a= fac*(x2-x1);
+		x1+= a; 
+		x2-= a;
+	
+		a= fac*(y2-y1);
+		y1+= a;
+		y2-= a;
+	
+		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
+		setlinestyle(3);
+
+		BIF_ThemeColorBlendShade(TH_WIRE, TH_BACK, 1.0, 0);
+		
+		uiSetRoundBox(15);
+		gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
+
+		setlinestyle(0);
+		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+	}
+
+
 	if (free_ibuf) {
 		IMB_freeImBuf(ibuf);
 	} 

Modified: trunk/blender/source/blender/src/header_seq.c
===================================================================
--- trunk/blender/source/blender/src/header_seq.c	2008-01-31 14:25:52 UTC (rev 13499)
+++ trunk/blender/source/blender/src/header_seq.c	2008-01-31 15:28:16 UTC (rev 13500)
@@ -658,22 +658,23 @@
 		xmax= GetButStringLength("View");
 		uiDefPulldownBut(block,seq_viewmenu, NULL, "View", xco, -2, xmax-3, 24, "");
 		xco+=xmax;
+		if (sseq->mainb == 0) {
+			xmax= GetButStringLength("Select");
+			uiDefPulldownBut(block,seq_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, "");
+			xco+=xmax;
 
-		xmax= GetButStringLength("Select");
-		uiDefPulldownBut(block,seq_selectmenu, NULL, "Select", xco, -2, xmax-3, 24, "");
-		xco+=xmax;
-
-		xmax= GetButStringLength("Marker");
-		uiDefPulldownBut(block,seq_markermenu, NULL, "Marker", xco, -2, xmax-3, 24, "");
-		xco+=xmax;
+			xmax= GetButStringLength("Marker");
+			uiDefPulldownBut(block,seq_markermenu, NULL, "Marker", xco, -2, xmax-3, 24, "");
+			xco+=xmax;
 		
-		xmax= GetButStringLength("Add");
-		uiDefPulldownBut(block, seq_addmenu, NULL, "Add", xco, -2, xmax-3, 24, "");
-		xco+= xmax;
+			xmax= GetButStringLength("Add");
+			uiDefPulldownBut(block, seq_addmenu, NULL, "Add", xco, -2, xmax-3, 24, "");
+			xco+= xmax;
 
-		xmax= GetButStringLength("Strip");
-		uiDefPulldownBut(block, seq_editmenu, NULL, "Strip", xco, -2, xmax-3, 24, "");
-		xco+= xmax;
+			xmax= GetButStringLength("Strip");
+			uiDefPulldownBut(block, seq_editmenu, NULL, "Strip", xco, -2, xmax-3, 24, "");
+			xco+= xmax;
+		}
 
 		/* end of pull down menus */
 		uiBlockSetEmboss(block, UI_EMBOSS);
@@ -685,17 +686,19 @@
 			  "|Sequence %x0"
 			  "|Image Preview %x1"
 			  "|Luma Waveform %x2"
-			  "|Chroma Vectorscope %x3",
+			  "|Chroma Vectorscope %x3"
+			  "|Histogram %x4",
 			  xco,0,XIC+10,YIC, &sseq->mainb, 0.0, 3.0, 
 			  0, 0, 
 			  "Shows the sequence output image preview");
 	
 	xco+= 8 + XIC+10;
 	
-	/* CHANNEL shown in 3D preview */
 	if(sseq->mainb) {
 		int minchan = 0;
 
+		/* CHANNEL shown in image preview */
+
 		if (G.scene->ed && ((Editing*)G.scene->ed)->metastack.first)
 			minchan = -BLI_countlist(&((Editing*)G.scene->ed)->metastack);
 
@@ -705,22 +708,51 @@
 		"The channel number shown in the image preview. 0 is the result of all strips combined.");
 		
 		xco+= 8 + XIC*3.5;
-	}
 
-	
-	/* ZOOM and BORDER */
-	xco+= 8;
-	uiBlockBeginAlign(block);
-	uiDefIconButI(block, TOG, B_VIEW2DZOOM, ICON_VIEWZOOM,	xco,0,XIC,YIC, &viewmovetemp, 0, 0, 0, 0, "Zooms view in and out (Ctrl MiddleMouse)");
-	uiDefIconBut(block, BUT, B_IPOBORDER, ICON_BORDERMOVE,	xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms view to fit area");
-	uiBlockEndAlign(block);
+		if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+			uiDefButS(block, MENU, B_REDR, 
+				  "Show zebra: %t"
+				  "|Z 110 %x110"
+				  "|Z 100 %x100"
+				  "|Z 95  %x95"
+				  "|Z 90  %x90"
+				  "|Z 70  %x70"
+				  "|Z Off %x0", 
+				  xco,0,3.0 * XIC, YIC, &sseq->zebra, 
+				  0,0,0,0, 
+				  "Show overexposed "
+				  "areas with zebra stripes");
 
-	/* CLEAR MEM */
-	xco+= 8;
+			xco+= 8 + XIC*3.0;
 
-	/* CLEAR MEM */
-	xco+= 8;
-	uiDefBut(block, BUT, B_SEQCLEAR, "Refresh",	xco+=XIC,0,3*XIC,YIC, 0, 0, 0, 0, 0, "Clears all buffered images in memory");
+			uiDefButBitI(block, TOG, SEQ_DRAW_SAFE_MARGINS, 
+				     B_REDR, "T",
+				     xco,0,XIC,YIC, &sseq->flag, 
+				     0, 0, 0, 0, 
+				     "Draw title safe margins in preview");
+			xco+= 8 + XIC;
+		}
+		
+		if (sseq->mainb == SEQ_DRAW_IMG_WAVEFORM) {
+			uiDefButBitI(block, TOG, SEQ_DRAW_COLOR_SEPERATED, 
+				     B_REDR, "CS",
+				     xco,0,XIC,YIC, &sseq->flag, 
+				     0, 0, 0, 0, 
+				     "Seperate color channels in preview");
+			xco+= 8 + XIC;
+		}
+	} else {
+		/* ZOOM and BORDER */
+		xco+= 8;
+		uiBlockBeginAlign(block);
+		uiDefIconButI(block, TOG, B_VIEW2DZOOM, ICON_VIEWZOOM,	xco,0,XIC,YIC, &viewmovetemp, 0, 0, 0, 0, "Zooms view in and out (Ctrl MiddleMouse)");
+		uiDefIconBut(block, BUT, B_IPOBORDER, ICON_BORDERMOVE,	xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms view to fit area");
+		uiBlockEndAlign(block);
 
+		xco+= 16;
+	}
+
+	uiDefBut(block, BUT, B_SEQCLEAR, "Refresh", xco,0,3*XIC,YIC, 0, 0, 0, 0, 0, "Clears all buffered images in memory");
+
 	uiDrawBlock(block);
 }

Modified: trunk/blender/source/blender/src/seqscopes.c
===================================================================
--- trunk/blender/source/blender/src/seqscopes.c	2008-01-31 14:25:52 UTC (rev 13499)
+++ trunk/blender/source/blender/src/seqscopes.c	2008-01-31 15:28:16 UTC (rev 13500)
@@ -53,6 +53,14 @@
 	pos[3] = 255;
 }
 
+static void scope_put_pixel_single(unsigned char* table, unsigned char * pos,
+				   int col)
+{
+	char newval = table[pos[col]];
+	pos[col] = newval;
+	pos[3] = 255;
+}
+
 static void wform_put_line(int w,
 			   unsigned char * last_pos, unsigned char * new_pos)
 {
@@ -71,6 +79,67 @@
 	}
 }
 
+static void wform_put_line_single(
+	int w, unsigned char * last_pos, unsigned char * new_pos, int col)
+{
+	if (last_pos > new_pos) {
+		unsigned char* temp = new_pos;
+		new_pos = last_pos;
+		last_pos = temp;
+	}
+
+	while (last_pos < new_pos) {
+		if (last_pos[col] == 0) {
+			last_pos[col] = 32;
+			last_pos[3] = 255;
+		}
+		last_pos += 4*w;
+	}
+}
+
+static void wform_put_border(unsigned char * tgt, int w, int h)
+{
+	int x, y;
+
+	for (x = 0; x < w; x++) {
+		unsigned char * p = tgt + 4 * x;
+		p[1] = p[3] = 255.0;
+		p[4 * w + 1] = p[4 * w + 3] = 255.0;
+		p = tgt + 4 * (w * (h - 1) + x);
+		p[1] = p[3] = 255.0;
+		p[-4 * w + 1] = p[-4 * w + 3] = 255.0;
+	}
+
+	for (y = 0; y < h; y++) {
+		unsigned char * p = tgt + 4 * w * y;
+		p[1] = p[3] = 255.0;
+		p[4 + 1] = p[4 + 3] = 255.0;
+		p = tgt + 4 * (w * y + w - 1);
+		p[1] = p[3] = 255.0;
+		p[-4 + 1] = p[-4 + 3] = 255.0;
+	}
+}
+
+static void wform_put_gridrow(unsigned char * tgt, float perc, int w, int h)
+{
+	int i;
+
+	tgt += (int) (perc/100.0 * h) * w * 4;
+
+	for (i = 0; i < w*2; i++) {
+		tgt[0] = 255;
+
+		tgt += 4;
+	}
+}
+
+static void wform_put_grid(unsigned char * tgt, int w, int h)
+{
+	wform_put_gridrow(tgt, 90.0, w, h);
+	wform_put_gridrow(tgt, 70.0, w, h);
+	wform_put_gridrow(tgt, 10.0, w, h);
+}
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list