From 8d0258ade77813bba84d561387884d51df8dc672 Mon Sep 17 00:00:00 2001 From: benoit128 Date: Tue, 3 Dec 2024 09:48:33 +0100 Subject: [PATCH] CPlot: add spec post --- Cassiopee/CPlot/CPlot/Plugins/screenDump.cpp | 15 +++++++++++---- Cassiopee/CPlot/CPlot/PyTree.py | 11 +++++------ Cassiopee/CPlot/CPlot/blur.cpp | 4 ++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Cassiopee/CPlot/CPlot/Plugins/screenDump.cpp b/Cassiopee/CPlot/CPlot/Plugins/screenDump.cpp index b2a87c759..1e9792a5b 100644 --- a/Cassiopee/CPlot/CPlot/Plugins/screenDump.cpp +++ b/Cassiopee/CPlot/CPlot/Plugins/screenDump.cpp @@ -26,6 +26,8 @@ void accumulateSlit(E_Int ni, E_Int nj, char* imf, char* imt, char* imb, E_Int i, E_Int nil, E_Int njl, char* imOut); +void specPostProcess(char* in, E_Int ni, E_Int nj, float* depth, char* out); + //============================================================================= // Screen dump plugins //============================================================================= @@ -332,8 +334,16 @@ char* Data::export2Image(E_Int exportWidth, E_Int exportHeight) } free(localBuf); free(localDepth); } - free(depth); + // software postprocessing on final buffer (just before screen dump) + if (rank == 0) + { + char* bfl = new char [_view.w * _view.h]; + for (E_Int i = 0; i < 3*_view.w*_view.h; i++) bfl[i] = buffer[i]; + specPostProcess(bfl, _view.w, _view.h, depth, buffer); + delete [] bfl; + } + free(depth); MPI_Barrier(MPI_COMM_WORLD); // seems needed #else @@ -429,9 +439,6 @@ char* Data::export2Image(E_Int exportWidth, E_Int exportHeight) glDeleteFramebuffersEXT(1, &fb); #endif - // software postprocessing on final buffer (just before screen dump) - - return buffer; } diff --git a/Cassiopee/CPlot/CPlot/PyTree.py b/Cassiopee/CPlot/CPlot/PyTree.py index 9493eaf7b..9dbd4460f 100644 --- a/Cassiopee/CPlot/CPlot/PyTree.py +++ b/Cassiopee/CPlot/CPlot/PyTree.py @@ -1535,7 +1535,7 @@ def display360ODS2__(t, posCam, posEye, dirCam, offscreen, exportRez, stereoShif # display360 (offscreen=1, 2 or 7) # type360=0 (360 degres), =1 (180 degres) #============================================================================== -def display360(t, type360=0, blurSigma=-1., **kwargs): +def display360(t, type360=0, **kwargs): """Display for 360 images.""" import KCore.Vector as Vector import Converter.Mpi as Cmpi @@ -1564,7 +1564,7 @@ def display360(t, type360=0, blurSigma=-1., **kwargs): display360__(t, posCam, posEye, dirCam, offscreen, exportRez, kwargs) # Create the 360 image from cube images if Cmpi.rank == 0: - panorama(export, exportRez, type360=type360, blurSigma=blurSigma) + panorama(export, exportRez, type360=type360) Cmpi.barrier() # wait for completion elif stereo == 1: # stereo ODS internal (only offscreen=1 or 7) @@ -1635,14 +1635,14 @@ def display360(t, type360=0, blurSigma=-1., **kwargs): posCam0 = Vector.add(posCam, dv) display360__(t, posCam0, posEye, dirCam, offscreen, exportRez, kwargs) if Cmpi.rank == 0: - panorama(export1, exportRez, type360=type360, blueSigma=blurSigma) + panorama(export1, exportRez, type360=type360) Cmpi.barrier() # wait for completion # left eye posCam0 = Vector.sub(posCam, dv) display360__(t, posCam0, posEye, dirCam, offscreen, exportRez, kwargs) if Cmpi.rank == 0: - panorama(export2, exportRez, type360=type360, blueSigma=blurSigma) + panorama(export2, exportRez, type360=type360) Cmpi.barrier() # wait for completion # stitch @@ -1683,7 +1683,7 @@ def display360(t, type360=0, blurSigma=-1., **kwargs): # assemble 6 cube images en une image panoramique # type360=0 -> 360, type360=1 -> 180 -def panorama(export, exportRez, type360=0, blurSigma=-1.): +def panorama(export, exportRez, type360=0): res = exportRez.split('x') if type360 == 0: resx = int(res[0]); resy = int(res[1]) else: resx = int(res[1]); resy = int(res[1]) @@ -1705,7 +1705,6 @@ def panorama(export, exportRez, type360=0, blurSigma=-1.): C._addVars(a7, ['r','g','b','a']) a7f = C.getFields('nodes', a7, api=3)[0] CPlot.cplot.panorama(a1, a2, a3, a4, a5, a6, a7f, type360) - CPlot.cplot.blur(a7f, blurSigma) C.convertPyTree2File(a7, export) return a7 diff --git a/Cassiopee/CPlot/CPlot/blur.cpp b/Cassiopee/CPlot/CPlot/blur.cpp index c1ff67933..b4a831ba3 100644 --- a/Cassiopee/CPlot/CPlot/blur.cpp +++ b/Cassiopee/CPlot/CPlot/blur.cpp @@ -94,8 +94,8 @@ void gaussianBlur2(E_Float* in, E_Int ni, E_Int nj, E_Float* c, E_Int n, E_Float } } -// identical but applied to interlaced color buffer (3), return out -void gaussianBlur3(char* in, E_Int ni, E_Int nj, E_Float* c, E_Int n, float* depth, char* out) +// specific post-processing applied to interlaced color buffer (3), return out +void specPostProcess(char* in, E_Int ni, E_Int nj, float* depth, char* out) { float dmin, dmax; // compute min/max of depth