diff options
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 10 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_multi.h | 8 | ||||
-rw-r--r-- | source/blender/render/intern/source/initrender.c | 14 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 21 | ||||
-rw-r--r-- | source/blender/render/intern/source/renderdatabase.c | 12 |
5 files changed, 24 insertions, 41 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index c5f5a33a5d1..8f94c2cec3d 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -362,6 +362,7 @@ typedef struct ExrHandle { 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 @@ void IMB_exr_begin_write(void *handle, char *filename, int width, int height, in 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 @@ void IMB_exrtile_begin_write(void *handle, char *filename, int width, int height 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 @@ void IMB_exrtile_clear_channels(void *handle) 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 @@ void IMB_exrtile_write_channels(void *handle, int partx, int party) 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; diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index ca4f7405f44..be4d1314a80 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -46,13 +46,13 @@ void IMB_exr_add_channel (void *handle, const char *layname, const char *passn 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 @@ void IMB_exr_add_channel (void *handle, const char *layname, const char *chann 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, diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 3ea8c6edffa..add89d6249f 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -603,24 +603,20 @@ void initparts(Render *re) /* 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; - - /* if remainder pixel, add one, then parts are more equal in size for large panoramas */ - if(re->rectx % partx) - partx++; + partx= ceil(re->rectx/(float)xparts); + party= ceil(re->recty/(float)yparts); re->xparts= xparts; re->yparts= yparts; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 0a982a21174..6dbec35ce33 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -709,7 +709,7 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart) 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 @@ static void save_empty_result_tiles(Render *re) 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 @@ static void threaded_tile_processor(Render *re) 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 @@ static int render_initialize_from_scene(Render *re, Scene *scene) /* 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); diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 5a749515416..d78b5936fd5 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -541,7 +541,7 @@ float *RE_strandren_get_surfnor(ObjectRen *obr, StrandRen *strand, int verify) 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 *RE_strandren_get_uv(ObjectRen *obr, StrandRen *strand, int n, char **name 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 *RE_strandren_get_mcol(ObjectRen *obr, StrandRen *strand, int n, char **nam 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 @@ float *RE_strandren_get_simplify(struct ObjectRen *obr, struct StrandRen *strand 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 @@ int *RE_strandren_get_face(ObjectRen *obr, StrandRen *strand, int verify) 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 @@ float *RE_strandren_get_winspeed(ObjectInstanceRen *obi, StrandRen *strand, int 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; |