[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13590] trunk/blender/source/blender:

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Feb 6 14:45:08 CET 2008


Revision: 13590
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13590
Author:   blendix
Date:     2008-02-06 14:45:07 +0100 (Wed, 06 Feb 2008)

Log Message:
-----------

- Removed the Save Buffers/FSA restriction that the width and height
  must be divisible by the number of parts.
- OpenEXR code also has some changes to allow writing mipmapped images,
  but that is unused at the moment.

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp
    trunk/blender/source/blender/imbuf/intern/openexr/openexr_multi.h
    trunk/blender/source/blender/render/intern/source/initrender.c
    trunk/blender/source/blender/render/intern/source/pipeline.c
    trunk/blender/source/blender/render/intern/source/renderdatabase.c

Modified: trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp
===================================================================
--- trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp	2008-02-06 11:10:34 UTC (rev 13589)
+++ trunk/blender/source/blender/imbuf/intern/openexr/openexr_api.cpp	2008-02-06 13:45:07 UTC (rev 13590)
@@ -362,6 +362,7 @@
 	OutputFile *ofile;
 	int tilex, tiley;
 	int width, height;
+	int mipmap;
 	
 	ListBase channels;	/* flattened out, ExrChannel */
 	ListBase layers;	/* hierarchical, pointing in end to ExrChannel */
@@ -450,7 +451,7 @@
 	data->ofile = new OutputFile(filename, header);
 }
 
-void IMB_exrtile_begin_write(void *handle, char *filename, int width, int height, int tilex, int tiley)
+void IMB_exrtile_begin_write(void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley)
 {
 	ExrHandle *data= (ExrHandle *)handle;
 	Header header (width, height);
@@ -460,11 +461,12 @@
 	data->tiley= tiley;
 	data->width= width;
 	data->height= height;
+	data->mipmap= mipmap;
 	
 	for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
 		header.channels().insert (echan->name, Channel (FLOAT));
 	
-	header.setTileDescription (TileDescription (tilex, tiley, ONE_LEVEL));
+	header.setTileDescription (TileDescription (tilex, tiley, (mipmap)? MIPMAP_LEVELS: ONE_LEVEL));
 	header.lineOrder() = RANDOM_Y;
 	header.compression() = RLE_COMPRESSION;
 	
@@ -533,7 +535,7 @@
 	BLI_freelistN(&data->channels);
 }
 
-void IMB_exrtile_write_channels(void *handle, int partx, int party)
+void IMB_exrtile_write_channels(void *handle, int partx, int party, int level)
 {
 	ExrHandle *data= (ExrHandle *)handle;
 	FrameBuffer frameBuffer;
@@ -550,7 +552,7 @@
 
 	try {
 		// printf("write tile %d %d\n", partx/data->tilex, party/data->tiley);
-		data->tofile->writeTile (partx/data->tilex, party/data->tiley);	
+		data->tofile->writeTile (partx/data->tilex, party/data->tiley, level);
 	}
 	catch (const std::exception &exc) {
 		std::cerr << "OpenEXR-writeTile: ERROR: " << exc.what() << std::endl;

Modified: trunk/blender/source/blender/imbuf/intern/openexr/openexr_multi.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/openexr/openexr_multi.h	2008-02-06 11:10:34 UTC (rev 13589)
+++ trunk/blender/source/blender/imbuf/intern/openexr/openexr_multi.h	2008-02-06 13:45:07 UTC (rev 13590)
@@ -46,13 +46,13 @@
 
 int		IMB_exr_begin_read			(void *handle, char *filename, int *width, int *height);
 void	IMB_exr_begin_write			(void *handle, char *filename, int width, int height, int compress);
-void	IMB_exrtile_begin_write		(void *handle, char *filename, int width, int height, int tilex, int tiley);
+void	IMB_exrtile_begin_write		(void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley);
 
 void	IMB_exr_set_channel			(void *handle, char *layname, char *passname, int xstride, int ystride, float *rect);
 
 void	IMB_exr_read_channels		(void *handle);
 void	IMB_exr_write_channels		(void *handle);
-void	IMB_exrtile_write_channels	(void *handle, int partx, int party);
+void	IMB_exrtile_write_channels	(void *handle, int partx, int party, int level);
 void	IMB_exrtile_clear_channels	(void *handle);
 
 void    IMB_exr_multilayer_convert	(void *handle, void *base,  
@@ -71,13 +71,13 @@
 
 int		IMB_exr_begin_read			(void *handle, char *filename, int *width, int *height) {return 0;}
 void	IMB_exr_begin_write			(void *handle, char *filename, int width, int height, int compress) {}
-void	IMB_exrtile_begin_write		(void *handle, char *filename, int width, int height, int tilex, int tiley) {}
+void	IMB_exrtile_begin_write		(void *handle, char *filename, int mipmap, int width, int height, int tilex, int tiley) {}
 
 void	IMB_exr_set_channel			(void *handle, char *layname, char *channame, int xstride, int ystride, float *rect) {}
 
 void	IMB_exr_read_channels		(void *handle) {}
 void	IMB_exr_write_channels		(void *handle) {}
-void	IMB_exrtile_write_channels	(void *handle, int partx, int party) {}
+void	IMB_exrtile_write_channels	(void *handle, int partx, int party, int level) {}
 void	IMB_exrtile_clear_channels	(void *handle) {}
 
 void    IMB_exr_multilayer_convert	(void *handle, void *base,  

Modified: trunk/blender/source/blender/render/intern/source/initrender.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/initrender.c	2008-02-06 11:10:34 UTC (rev 13589)
+++ trunk/blender/source/blender/render/intern/source/initrender.c	2008-02-06 13:45:07 UTC (rev 13590)
@@ -603,25 +603,21 @@
 	/* mininum part size, but for exr tile saving it was checked already */
 	if(!(re->r.scemode & R_EXR_TILE_FILE)) {
 		if(re->r.mode & R_PANORAMA) {
-			if(re->rectx/xparts < 8) 
+			if(ceil(re->rectx/(float)xparts) < 8) 
 				xparts= 1 + re->rectx/8;
 		}
 		else
-			if(re->rectx/xparts < 64) 
+			if(ceil(re->rectx/(float)xparts) < 64) 
 				xparts= 1 + re->rectx/64;
 		
-		if(re->recty/yparts < 64) 
+		if(ceil(re->recty/(float)yparts) < 64) 
 			yparts= 1 + re->recty/64;
 	}
 	
 	/* part size */
-	partx= re->rectx/xparts;
-	party= re->recty/yparts;
+	partx= ceil(re->rectx/(float)xparts);
+	party= ceil(re->recty/(float)yparts);
 	
-	/* if remainder pixel, add one, then parts are more equal in size for large panoramas */
-	if(re->rectx % partx)
-		partx++;
-	
 	re->xparts= xparts;
 	re->yparts= yparts;
 	re->partx= partx;

Modified: trunk/blender/source/blender/render/intern/source/pipeline.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/pipeline.c	2008-02-06 11:10:34 UTC (rev 13589)
+++ trunk/blender/source/blender/render/intern/source/pipeline.c	2008-02-06 13:45:07 UTC (rev 13590)
@@ -709,7 +709,7 @@
 
 	party= rrpart->tilerect.ymin + rrpart->crop;
 	partx= rrpart->tilerect.xmin + rrpart->crop;
-	IMB_exrtile_write_channels(rr->exrhandle, partx, party);
+	IMB_exrtile_write_channels(rr->exrhandle, partx, party, 0);
 
 	BLI_unlock_thread(LOCK_IMAGE);
 
@@ -727,7 +727,7 @@
 			if(pa->ready==0) {
 				int party= pa->disprect.ymin - re->disprect.ymin + pa->crop;
 				int partx= pa->disprect.xmin - re->disprect.xmin + pa->crop;
-				IMB_exrtile_write_channels(rr->exrhandle, partx, party);
+				IMB_exrtile_write_channels(rr->exrhandle, partx, party, 0);
 			}
 		}
 	}
@@ -1474,7 +1474,7 @@
 			render_unique_exr_name(re, str, rr->sample_nr);
 		
 			printf("write exr tmp file, %dx%d, %s\n", rr->rectx, rr->recty, str);
-			IMB_exrtile_begin_write(rr->exrhandle, str, rr->rectx, rr->recty, rr->rectx/re->xparts, rr->recty/re->yparts);
+			IMB_exrtile_begin_write(rr->exrhandle, str, 0, rr->rectx, rr->recty, re->partx, re->party);
 		}
 	}
 	
@@ -2425,21 +2425,6 @@
 	
 	/* check all scenes involved */
 	tag_scenes_for_render(re);
-	for(sce= G.main->scene.first; sce; sce= sce->id.next) {
-		if(sce->r.scemode & R_EXR_TILE_FILE) {
-			int partx= winx/sce->r.xparts, party= winy/sce->r.yparts;
-			
-			/* stupid exr tiles dont like different sizes */
-			if(winx != partx*sce->r.xparts || winy != party*sce->r.yparts) {
-				re->error("Sorry... exr tile saving only allowed with equally sized parts");
-				return 0;
-			}
-			if((sce->r.mode & R_FIELDS) && (party & 1)) {
-				re->error("Sorry... exr tile saving only allowed with equally sized parts");
-				return 0;
-			}
-		}
-	}
 	
 	if(scene->r.scemode & R_SINGLE_LAYER)
 		push_render_result(re);

Modified: trunk/blender/source/blender/render/intern/source/renderdatabase.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/renderdatabase.c	2008-02-06 11:10:34 UTC (rev 13589)
+++ trunk/blender/source/blender/render/intern/source/renderdatabase.c	2008-02-06 13:45:07 UTC (rev 13590)
@@ -541,7 +541,7 @@
 	surfnor= obr->strandnodes[nr].surfnor;
 	if(surfnor==NULL) {
 		if(verify) 
-			surfnor= obr->strandnodes[nr].surfnor= MEM_callocN(256*RE_SURFNOR_ELEMS*sizeof(float), "surfnor table");
+			surfnor= obr->strandnodes[nr].surfnor= MEM_callocN(256*RE_SURFNOR_ELEMS*sizeof(float), "surfnor strand table");
 		else
 			return NULL;
 	}
@@ -561,7 +561,7 @@
 			float *uv= node->uv;
 			int size= (n+1)*256;
 
-			node->uv= MEM_callocN(size*sizeof(float)*RE_UV_ELEMS, "Strand uv");
+			node->uv= MEM_callocN(size*sizeof(float)*RE_UV_ELEMS, "strand uv table");
 
 			if(uv) {
 				size= node->totuv*256;
@@ -595,7 +595,7 @@
 			MCol *mcol= node->mcol;
 			int size= (n+1)*256;
 
-			node->mcol= MEM_callocN(size*sizeof(MCol)*RE_MCOL_ELEMS, "Strand mcol");
+			node->mcol= MEM_callocN(size*sizeof(MCol)*RE_MCOL_ELEMS, "strand mcol table");
 
 			if(mcol) {
 				size= node->totmcol*256;
@@ -624,7 +624,7 @@
 	simplify= obr->strandnodes[nr].simplify;
 	if(simplify==NULL) {
 		if(verify) 
-			simplify= obr->strandnodes[nr].simplify= MEM_callocN(256*RE_SIMPLIFY_ELEMS*sizeof(float), "simplify table");
+			simplify= obr->strandnodes[nr].simplify= MEM_callocN(256*RE_SIMPLIFY_ELEMS*sizeof(float), "simplify strand table");
 		else
 			return NULL;
 	}
@@ -639,7 +639,7 @@
 	face= obr->strandnodes[nr].face;
 	if(face==NULL) {
 		if(verify) 
-			face= obr->strandnodes[nr].face= MEM_callocN(256*RE_FACE_ELEMS*sizeof(int), "face table");
+			face= obr->strandnodes[nr].face= MEM_callocN(256*RE_FACE_ELEMS*sizeof(int), "face strand table");
 		else
 			return NULL;
 	}
@@ -656,7 +656,7 @@
 	if(winspeed==NULL) {
 		if(verify) {
 			totvector= obi->obr->totvert + obi->obr->totstrand;
-			winspeed= obi->vectors= MEM_callocN(totvector*RE_WINSPEED_ELEMS*sizeof(float), "winspeed table");
+			winspeed= obi->vectors= MEM_callocN(totvector*RE_WINSPEED_ELEMS*sizeof(float), "winspeed strand table");
 		}
 		else
 			return NULL;





More information about the Bf-blender-cvs mailing list