[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30432] trunk/blender: PNG Compression can now be set, writing uncompressed PNG' s is significantly faster for high resolution images - 2k.

Campbell Barton ideasman42 at gmail.com
Sat Jul 17 15:29:55 CEST 2010


Revision: 30432
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30432
Author:   campbellbarton
Date:     2010-07-17 15:29:55 +0200 (Sat, 17 Jul 2010)

Log Message:
-----------
PNG Compression can now be set, writing uncompressed PNG's is significantly faster for high resolution images - 2k.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_render.py
    trunk/blender/source/blender/blenkernel/intern/image.c
    trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
    trunk/blender/source/blender/imbuf/intern/png.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c

Modified: trunk/blender/release/scripts/ui/properties_render.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_render.py	2010-07-17 13:18:11 UTC (rev 30431)
+++ trunk/blender/release/scripts/ui/properties_render.py	2010-07-17 13:29:55 UTC (rev 30432)
@@ -295,6 +295,7 @@
         layout = self.layout
 
         rd = context.scene.render
+        file_format = rd.file_format
         wide_ui = context.region.width > narrowui
 
         layout.prop(rd, "output_path", text="")
@@ -310,11 +311,15 @@
         col.prop(rd, "use_overwrite")
         col.prop(rd, "use_placeholder")
 
-        if rd.file_format in ('AVI_JPEG', 'JPEG'):
+        if file_format in ('AVI_JPEG', 'JPEG'):
             split = layout.split()
             split.prop(rd, "file_quality", slider=True)
+        
+        if file_format == 'PNG':
+            split = layout.split()
+            split.prop(rd, "file_quality", slider=True, text="Compression")
 
-        elif rd.file_format == 'MULTILAYER':
+        elif file_format == 'MULTILAYER':
             split = layout.split()
 
             col = split.column()
@@ -323,7 +328,7 @@
             if wide_ui:
                 col = split.column()
 
-        elif rd.file_format == 'OPEN_EXR':
+        elif file_format == 'OPEN_EXR':
             split = layout.split()
 
             col = split.column()
@@ -340,7 +345,7 @@
                 col = subsplit.column()
             col.prop(rd, "exr_preview")
 
-        elif rd.file_format == 'JPEG2000':
+        elif file_format == 'JPEG2000':
             split = layout.split()
             col = split.column()
             col.label(text="Depth:")
@@ -351,7 +356,7 @@
             col.prop(rd, "jpeg2k_preset", text="")
             col.prop(rd, "jpeg2k_ycc")
 
-        elif rd.file_format in ('CINEON', 'DPX'):
+        elif file_format in ('CINEON', 'DPX'):
             split = layout.split()
             col = split.column()
             col.prop(rd, "cineon_log", text="Convert to Log")
@@ -363,15 +368,15 @@
             col.prop(rd, "cineon_white", text="White")
             col.prop(rd, "cineon_gamma", text="Gamma")
 
-        elif rd.file_format == 'TIFF':
+        elif file_format == 'TIFF':
             split = layout.split()
             split.prop(rd, "tiff_bit")
 
-        elif rd.file_format == 'QUICKTIME_CARBON':
+        elif file_format == 'QUICKTIME_CARBON':
             split = layout.split()
             split.operator("scene.render_data_set_quicktime_codec")
 
-        elif rd.file_format == 'QUICKTIME_QTKIT':
+        elif file_format == 'QUICKTIME_QTKIT':
             split = layout.split()
             col = split.column()
             col.prop(rd, "quicktime_codec_type", text="Video Codec")

Modified: trunk/blender/source/blender/blenkernel/intern/image.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image.c	2010-07-17 13:18:11 UTC (rev 30431)
+++ trunk/blender/source/blender/blenkernel/intern/image.c	2010-07-17 13:29:55 UTC (rev 30432)
@@ -1180,6 +1180,10 @@
 	}
 	else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
 		ibuf->ftype= PNG;
+
+		if(imtype==R_PNG)
+			ibuf->ftype |= quality;  /* quality is actually compression 0-100 --> 0-9 */
+
 	}
 #ifdef WITH_DDS
 	else if ((imtype==R_DDS)) {

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2010-07-17 13:18:11 UTC (rev 30431)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_draw.c	2010-07-17 13:29:55 UTC (rev 30432)
@@ -850,8 +850,6 @@
 		/* border */
 		setlinestyle(3);
 
-		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
 		UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 1.0, 0);
 
 		glBegin(GL_LINE_LOOP);
@@ -873,14 +871,16 @@
 			y1+= a;
 			y2-= a;
 
+			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
 			uiSetRoundBox(15);
 			gl_round_box(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
 
+			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
 		}
 
 		setlinestyle(0);
-
-		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 	}
 	
 	/* draw grease-pencil (image aligned) */

Modified: trunk/blender/source/blender/imbuf/intern/png.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/png.c	2010-07-17 13:18:11 UTC (rev 30431)
+++ trunk/blender/source/blender/imbuf/intern/png.c	2010-07-17 13:29:55 UTC (rev 30432)
@@ -103,6 +103,11 @@
 	int i, bytesperpixel, color_type = PNG_COLOR_TYPE_GRAY;
 	FILE *fp = 0;
 
+	/* use the jpeg quality setting for compression */
+	int compression;
+	compression= (int)(((float)(ibuf->ftype & 0xff) / 11.1111f));
+	compression= compression < 0 ? 0 : (compression > 9 ? 9 : compression);
+
 	bytesperpixel = (ibuf->depth + 7) >> 3;
 	if ((bytesperpixel > 4) || (bytesperpixel == 2)) {
 		printf("imb_savepng: unsupported bytes per pixel: %d\n", bytesperpixel);
@@ -201,10 +206,10 @@
 		PNG_FILTER_AVG   | PNG_FILTER_VALUE_AVG  |
 		PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
 		PNG_ALL_FILTERS);
-
-	png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
 	*/
 
+	png_set_compression_level(png_ptr, compression);
+
 	// png image settings
 	png_set_IHDR(png_ptr,
 		 info_ptr,

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-07-17 13:18:11 UTC (rev 30431)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-07-17 13:29:55 UTC (rev 30432)
@@ -2037,8 +2037,8 @@
 	
 	prop= RNA_def_property(srna, "file_quality", PROP_INT, PROP_PERCENTAGE);
 	RNA_def_property_int_sdna(prop, NULL, "quality");
-	RNA_def_property_range(prop, 1, 100);
-	RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies");
+	RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
+	RNA_def_property_ui_text(prop, "Quality", "Quality of JPEG images, AVI Jpeg and SGI movies, Compression for PNG's");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
 	/* Tiff */





More information about the Bf-blender-cvs mailing list