From 84f048fda566c2098ec1baa2ff1ad6c00b7395d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 26 Aug 2021 12:27:17 +1000 Subject: Cleanup: use C style comments for descriptive text --- .../compositor/intern/COM_ExecutionGroup.cc | 2 +- source/blender/compositor/intern/COM_WorkPackage.h | 2 +- .../blender/compositor/nodes/COM_BokehBlurNode.cc | 5 +- .../blender/compositor/nodes/COM_ColorSpillNode.cc | 4 +- .../compositor/nodes/COM_Stabilize2dNode.cc | 4 +- .../operations/COM_ColorCurveOperation.cc | 2 +- .../operations/COM_ColorSpillOperation.cc | 2 +- .../operations/COM_CompositorOperation.cc | 6 +- .../operations/COM_DilateErodeOperation.cc | 2 +- .../operations/COM_GlareFogGlowOperation.cc | 68 +++++++++++----------- .../compositor/operations/COM_InpaintOperation.cc | 2 +- .../compositor/operations/COM_ScaleOperation.cc | 2 +- .../compositor/operations/COM_SplitOperation.cc | 2 +- .../operations/COM_VectorBlurOperation.cc | 4 +- .../compositor/operations/COM_ViewerOperation.cc | 2 +- .../operations/COM_WriteBufferOperation.cc | 8 +-- 16 files changed, 58 insertions(+), 59 deletions(-) (limited to 'source/blender/compositor') diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index 68bda8c70d6..a45c453d7ed 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -561,7 +561,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, return true; } - // Check if chunk is already executed or scheduled and not yet executed. + /* Check if chunk is already executed or scheduled and not yet executed. */ const int chunk_index = chunk_y * this->m_x_chunks_len + chunk_x; WorkPackage &work_package = m_work_packages[chunk_index]; if (work_package.state == eWorkPackageState::Executed) { diff --git a/source/blender/compositor/intern/COM_WorkPackage.h b/source/blender/compositor/intern/COM_WorkPackage.h index f0f53f300a5..20fca89aa4c 100644 --- a/source/blender/compositor/intern/COM_WorkPackage.h +++ b/source/blender/compositor/intern/COM_WorkPackage.h @@ -30,7 +30,7 @@ #include namespace blender::compositor { -// Forward Declarations. +/* Forward Declarations. */ class ExecutionGroup; /** diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cc b/source/blender/compositor/nodes/COM_BokehBlurNode.cc index 1d2a0dae390..c51a98c0f82 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cc +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cc @@ -64,9 +64,8 @@ void BokehBlurNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - // NOTE: on the bokeh blur operation the sockets are switched. - // for this reason the next two lines are correct. - // Fix for T43771 + /* NOTE: on the bokeh blur operation the sockets are switched. + * for this reason the next two lines are correct. Fix for T43771. */ converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(3)); converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(2)); diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.cc b/source/blender/compositor/nodes/COM_ColorSpillNode.cc index 119cff93e84..6119e635e59 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.cc +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cc @@ -39,8 +39,8 @@ void ColorSpillNode::convertToOperations(NodeConverter &converter, ColorSpillOperation *operation; operation = new ColorSpillOperation(); operation->setSettings((NodeColorspill *)editorsnode->storage); - operation->setSpillChannel(editorsnode->custom1 - 1); // Channel for spilling - operation->setSpillMethod(editorsnode->custom2); // Channel method + operation->setSpillChannel(editorsnode->custom1 - 1); /* Channel for spilling */ + operation->setSpillMethod(editorsnode->custom2); /* Channel method */ converter.addOperation(operation); converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cc b/source/blender/compositor/nodes/COM_Stabilize2dNode.cc index 7b2388bebca..90f62c6d562 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cc +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cc @@ -101,7 +101,7 @@ void Stabilize2dNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(), psoperation->getOutputSocket()); if (invert) { - // Translate -> Rotate -> Scale. + /* Translate -> Rotate -> Scale. */ converter.mapInputSocket(imageInput, translateOperation->getInputSocket(0)); converter.addLink(translateOperation->getOutputSocket(), @@ -111,7 +111,7 @@ void Stabilize2dNode::convertToOperations(NodeConverter &converter, converter.addLink(scaleOperation->getOutputSocket(), psoperation->getInputSocket(0)); } else { - // Scale -> Rotate -> Translate. + /* Scale -> Rotate -> Translate. */ converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cc b/source/blender/compositor/operations/COM_ColorCurveOperation.cc index 1b7ad0ea608..646238460ba 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cc +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cc @@ -128,7 +128,7 @@ void ColorCurveOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -// Constant level curve mapping +/* Constant level curve mapping. */ ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation() { diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cc b/source/blender/compositor/operations/COM_ColorSpillOperation.cc index 4b0e0520b75..5bf7a9ee9cd 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cc +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cc @@ -30,7 +30,7 @@ ColorSpillOperation::ColorSpillOperation() this->m_inputImageReader = nullptr; this->m_inputFacReader = nullptr; - this->m_spillChannel = 1; // GREEN + this->m_spillChannel = 1; /* GREEN */ this->m_spillMethod = 0; flags.can_be_constant = true; } diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cc b/source/blender/compositor/operations/COM_CompositorOperation.cc index 8752d764107..fb9e2e43c60 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cc +++ b/source/blender/compositor/operations/COM_CompositorOperation.cc @@ -62,7 +62,7 @@ void CompositorOperation::initExecution() return; } - // When initializing the tree during initial load the width and height can be zero. + /* When initializing the tree during initial load the width and height can be zero. */ this->m_imageInput = getInputSocketReader(0); this->m_alphaInput = getInputSocketReader(1); this->m_depthInput = getInputSocketReader(2); @@ -242,8 +242,8 @@ void CompositorOperation::determineResolution(unsigned int resolution[2], int width = this->m_rd->xsch * this->m_rd->size / 100; int height = this->m_rd->ysch * this->m_rd->size / 100; - // check actual render resolution with cropping it may differ with cropped border.rendering - // FIX for: [31777] Border Crop gives black (easy) + /* Check actual render resolution with cropping it may differ with cropped border.rendering + * Fix for T31777 Border Crop gives black (easy). */ Render *re = RE_GetSceneRender(this->m_scene); if (re) { RenderResult *rr = RE_AcquireResultRead(re); diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cc b/source/blender/compositor/operations/COM_DilateErodeOperation.cc index a27148f967d..c459d09f02c 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cc +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cc @@ -160,7 +160,7 @@ bool DilateErodeThresholdOperation::determineDependingAreaOfInterest( return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } -// Dilate Distance +/* Dilate Distance. */ DilateDistanceOperation::DilateDistanceOperation() { this->addInputSocket(DataType::Value); diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc index 1c1eaebd331..0026615f08b 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc @@ -27,7 +27,7 @@ namespace blender::compositor { using fREAL = float; -// returns next highest power of 2 of x, as well its log2 in L2 +/* Returns next highest power of 2 of x, as well its log2 in L2. */ static unsigned int nextPow2(unsigned int x, unsigned int *L2) { unsigned int pw, x_notpow2 = x & (x - 1); @@ -45,8 +45,8 @@ static unsigned int nextPow2(unsigned int x, unsigned int *L2) //------------------------------------------------------------------------------ -// from FXT library by Joerg Arndt, faster in order bitreversal -// use: r = revbin_upd(r, h) where h = N>>1 +/* From FXT library by Joerg Arndt, faster in order bit-reversal + * use: `r = revbin_upd(r, h)` where `h = N>>1`. */ static unsigned int revbin_upd(unsigned int r, unsigned int h) { while (!((r ^= h) & h)) { @@ -127,7 +127,7 @@ static void FHT(fREAL *data, unsigned int M, unsigned int inverse) //------------------------------------------------------------------------------ /* 2D Fast Hartley Transform, Mx/My -> log2 of width/height, * nzp -> the row where zero pad data starts, - * inverse -> see above */ + * inverse -> see above. */ static void FHT2D( fREAL *data, unsigned int Mx, unsigned int My, unsigned int nzp, unsigned int inverse) { @@ -136,14 +136,14 @@ static void FHT2D( Nx = 1 << Mx; Ny = 1 << My; - // rows (forward transform skips 0 pad data) + /* Rows (forward transform skips 0 pad data). */ maxy = inverse ? Ny : nzp; for (j = 0; j < maxy; j++) { FHT(&data[Nx * j], Mx, inverse); } - // transpose data - if (Nx == Ny) { // square + /* Transpose data. */ + if (Nx == Ny) { /* Square. */ for (j = 0; j < Ny; j++) { for (i = j + 1; i < Nx; i++) { unsigned int op = i + (j << Mx), np = j + (i << My); @@ -151,12 +151,12 @@ static void FHT2D( } } } - else { // rectangular + else { /* Rectangular. */ unsigned int k, Nym = Ny - 1, stm = 1 << (Mx + My); for (i = 0; stm > 0; i++) { #define PRED(k) (((k & Nym) << Mx) + (k >> My)) for (j = PRED(i); j > i; j = PRED(j)) { - /* pass */ + /* Pass. */ } if (j < i) { continue; @@ -172,12 +172,12 @@ static void FHT2D( SWAP(unsigned int, Nx, Ny); SWAP(unsigned int, Mx, My); - // now columns == transposed rows + /* Now columns == transposed rows. */ for (j = 0; j < Ny; j++) { FHT(&data[Nx * j], Mx, inverse); } - // finalize + /* Finalize. */ for (j = 0; j <= (Ny >> 1); j++) { unsigned int jm = (Ny - j) & (Ny - 1); unsigned int ji = j << Mx; @@ -199,7 +199,7 @@ static void FHT2D( //------------------------------------------------------------------------------ -/* 2D convolution calc, d1 *= d2, M/N - > log2 of width/height */ +/* 2D convolution calc, d1 *= d2, M/N - > log2 of width/height. */ static void fht_convolve(fREAL *d1, const fREAL *d2, unsigned int M, unsigned int N) { fREAL a, b; @@ -275,18 +275,18 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) 0, rdst->getWidth() * rdst->getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); - // convolution result width & height + /* Convolution result width & height. */ w2 = 2 * kernelWidth - 1; h2 = 2 * kernelHeight - 1; - // FFT pow2 required size & log2 + /* FFT pow2 required size & log2. */ w2 = nextPow2(w2, &log2_w); h2 = nextPow2(h2, &log2_h); - // alloc space + /* Allocate space. */ data1 = (fREAL *)MEM_callocN(3 * w2 * h2 * sizeof(fREAL), "convolve_fast FHT data1"); data2 = (fREAL *)MEM_callocN(w2 * h2 * sizeof(fREAL), "convolve_fast FHT data2"); - // normalize convolutor + /* Normalize convolutor. */ wt[0] = wt[1] = wt[2] = 0.0f; for (y = 0; y < kernelHeight; y++) { colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS]; @@ -310,10 +310,10 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) } } - // copy image data, unpacking interleaved RGBA into separate channels - // only need to calc data1 once + /* Copy image data, unpacking interleaved RGBA into separate channels + * only need to calc data1 once. */ - // block add-overlap + /* Block add-overlap. */ hw = kernelWidth >> 1; hh = kernelHeight >> 1; xbsz = (w2 + 1) - kernelWidth; @@ -329,13 +329,13 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) for (ybl = 0; ybl < nyb; ybl++) { for (xbl = 0; xbl < nxb; xbl++) { - // each channel one by one + /* Each channel one by one. */ for (ch = 0; ch < 3; ch++) { fREAL *data1ch = &data1[ch * w2 * h2]; - // only need to calc fht data from in2 once, can re-use for every block + /* Only need to calc fht data from in2 once, can re-use for every block. */ if (!in2done) { - // in2, channel ch -> data1 + /* in2, channel ch -> data1 */ for (y = 0; y < kernelHeight; y++) { fp = &data1ch[y * w2]; colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS]; @@ -345,7 +345,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) } } - // in1, channel ch -> data2 + /* in1, channel ch -> data2 */ memset(data2, 0, w2 * h2 * sizeof(fREAL)); for (y = 0; y < ybsz; y++) { int yy = ybl * ybsz + y; @@ -363,20 +363,20 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) } } - // forward FHT - // zero pad data start is different for each == height+1 + /* Forward FHT + * zero pad data start is different for each == height+1. */ if (!in2done) { FHT2D(data1ch, log2_w, log2_h, kernelHeight + 1, 0); } FHT2D(data2, log2_w, log2_h, kernelHeight + 1, 0); - // FHT2D transposed data, row/col now swapped - // convolve & inverse FHT + /* FHT2D transposed data, row/col now swapped + * convolve & inverse FHT. */ fht_convolve(data2, data1ch, log2_h, log2_w); FHT2D(data2, log2_h, log2_w, 0, 1); - // data again transposed, so in order again + /* Data again transposed, so in order again. */ - // overlap-add result + /* Overlap-add result. */ for (y = 0; y < (int)h2; y++) { const int yy = ybl * ybsz + y - hh; if ((yy < 0) || (yy >= imageHeight)) { @@ -416,8 +416,8 @@ void GlareFogGlowOperation::generateGlare(float *data, unsigned int sz = 1 << settings->size; const float cs_r = 1.0f, cs_g = 1.0f, cs_b = 1.0f; - // temp. src image - // make the convolution kernel + /* Temp. src image + * make the convolution kernel. */ rcti kernelRect; BLI_rcti_init(&kernelRect, 0, sz, 0, sz); ckrn = new MemoryBuffer(DataType::Color, kernelRect); @@ -433,9 +433,9 @@ void GlareFogGlowOperation::generateGlare(float *data, fcol[0] = expf(d * cs_r); fcol[1] = expf(d * cs_g); fcol[2] = expf(d * cs_b); - // linear window good enough here, visual result counts, not scientific analysis - // w = (1.0f-fabs(u))*(1.0f-fabs(v)); - // actually, Hanning window is ok, cos^2 for some reason is slower + /* Linear window good enough here, visual result counts, not scientific analysis: + * `w = (1.0f-fabs(u))*(1.0f-fabs(v));` + * actually, Hanning window is ok, `cos^2` for some reason is slower. */ w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI)); mul_v3_fl(fcol, w); ckrn->writePixel(x, y, fcol); diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cc b/source/blender/compositor/operations/COM_InpaintOperation.cc index 413ed2694a9..bfcd504177f 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cc +++ b/source/blender/compositor/operations/COM_InpaintOperation.cc @@ -28,7 +28,7 @@ namespace blender::compositor { #define ASSERT_XY_RANGE(x, y) \ BLI_assert(x >= 0 && x < this->getWidth() && y >= 0 && y < this->getHeight()) -// Inpaint (simple convolve using average of known pixels) +/* In-paint (simple convolve using average of known pixels). */ InpaintSimpleOperation::InpaintSimpleOperation() { this->addInputSocket(DataType::Color); diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cc b/source/blender/compositor/operations/COM_ScaleOperation.cc index ef34bc7bee6..bbb6de2f39e 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cc +++ b/source/blender/compositor/operations/COM_ScaleOperation.cc @@ -262,7 +262,7 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, return ScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } -// Absolute fixed size +/* Absolute fixed size. */ ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation() { this->addInputSocket(DataType::Color, ResizeMode::None); diff --git a/source/blender/compositor/operations/COM_SplitOperation.cc b/source/blender/compositor/operations/COM_SplitOperation.cc index d18ed3b8e14..b2a50e2c740 100644 --- a/source/blender/compositor/operations/COM_SplitOperation.cc +++ b/source/blender/compositor/operations/COM_SplitOperation.cc @@ -40,7 +40,7 @@ SplitOperation::SplitOperation() void SplitOperation::initExecution() { - // When initializing the tree during initial load the width and height can be zero. + /* When initializing the tree during initial load the width and height can be zero. */ this->m_image1Input = getInputSocketReader(0); this->m_image2Input = getInputSocketReader(1); } diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc index b5b5d426338..df65044afc1 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc @@ -48,8 +48,8 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove); VectorBlurOperation::VectorBlurOperation() { this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); // ZBUF - this->addInputSocket(DataType::Color); // SPEED + this->addInputSocket(DataType::Value); /* ZBUF */ + this->addInputSocket(DataType::Color); /* SPEED */ this->addOutputSocket(DataType::Color); this->m_settings = nullptr; this->m_cachedInstance = nullptr; diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index 37a45ac32cb..a038e8994d8 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -61,7 +61,7 @@ ViewerOperation::ViewerOperation() void ViewerOperation::initExecution() { - // When initializing the tree during initial load the width and height can be zero. + /* When initializing the tree during initial load the width and height can be zero. */ this->m_imageInput = getInputSocketReader(0); this->m_alphaInput = getInputSocketReader(1); this->m_depthInput = getInputSocketReader(2); diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cc b/source/blender/compositor/operations/COM_WriteBufferOperation.cc index e2dc6287baf..6380f6bf3df 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cc +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cc @@ -126,7 +126,7 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, * * NOTE: list of cl_mem will be filled by 2, and needs to be cleaned up by 4 */ - // STEP 1 + /* STEP 1 */ const unsigned int outputBufferWidth = outputBuffer->getWidth(); const unsigned int outputBufferHeight = outputBuffer->getHeight(); @@ -144,7 +144,7 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - // STEP 2 + /* STEP 2 */ std::list *clMemToCleanUp = new std::list(); clMemToCleanUp->push_back(clOutputBuffer); std::list *clKernelsToCleanUp = new std::list(); @@ -156,7 +156,7 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, clMemToCleanUp, clKernelsToCleanUp); - // STEP 3 + /* STEP 3 */ size_t origin[3] = {0, 0, 0}; size_t region[3] = {outputBufferWidth, outputBufferHeight, 1}; @@ -185,7 +185,7 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, this->getMemoryProxy()->getBuffer()->fill_from(*outputBuffer); - // STEP 4 + /* STEP 4 */ while (!clMemToCleanUp->empty()) { cl_mem mem = clMemToCleanUp->front(); error = clReleaseMemObject(mem); -- cgit v1.2.3