diff options
Diffstat (limited to 'source/blender/compositor')
13 files changed, 83 insertions, 79 deletions
diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h index e270eeb3386..73c4343a230 100644 --- a/source/blender/compositor/COM_defines.h +++ b/source/blender/compositor/COM_defines.h @@ -95,11 +95,11 @@ constexpr DataType COM_num_channels_data_type(const int num_channels) } } -// configurable items - -// chunk size determination - -// chunk order +/* Configurable items. + * + * Chunk size determination. + * + * Chunk order. */ /** * \brief The order of chunks to be scheduled * \ingroup Execution diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index a45c453d7ed..505a4066a25 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -446,7 +446,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo MEM_freeN(memoryBuffers); } if (this->m_bTree) { - // status report is only performed for top level Execution Groups. + /* Status report is only performed for top level Execution Groups. */ float progress = this->m_chunks_finished; progress /= this->m_chunks_len; this->m_bTree->progress(this->m_bTree->prh, progress); @@ -494,7 +494,7 @@ void ExecutionGroup::determineChunkRect(rcti *r_rect, const unsigned int chunkNu MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect) { - // we assume that this method is only called from complex execution groups. + /* We assume that this method is only called from complex execution groups. */ NodeOperation *operation = this->getOutputOperation(); if (operation->get_flags().is_write_buffer_operation) { WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation; @@ -510,8 +510,9 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area if (this->m_flags.single_threaded) { return scheduleChunkWhenPossible(graph, 0, 0); } - // find all chunks inside the rect - // determine minxchunk, minychunk, maxxchunk, maxychunk where x and y are chunknumbers + /* Find all chunks inside the rect + * determine `minxchunk`, `minychunk`, `maxxchunk`, `maxychunk` + * where x and y are chunk-numbers. */ int indexx, indexy; int minx = max_ii(area->xmin - m_viewerBorder.xmin, 0); diff --git a/source/blender/compositor/nodes/COM_GlareNode.cc b/source/blender/compositor/nodes/COM_GlareNode.cc index 0537074552a..cd0b5306be1 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cc +++ b/source/blender/compositor/nodes/COM_GlareNode.cc @@ -46,13 +46,13 @@ void GlareNode::convertToOperations(NodeConverter &converter, case 3: glareoperation = new GlareGhostOperation(); break; - case 2: // streaks + case 2: /* Streaks. */ glareoperation = new GlareStreaksOperation(); break; - case 1: // fog glow + case 1: /* Fog glow. */ glareoperation = new GlareFogGlowOperation(); break; - case 0: // simple star + case 0: /* Simple star. */ glareoperation = new GlareSimpleStarOperation(); break; } diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.cc b/source/blender/compositor/nodes/COM_KeyingScreenNode.cc index cbe4f165a45..43574d02d80 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cc +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cc @@ -38,7 +38,7 @@ void KeyingScreenNode::convertToOperations(NodeConverter &converter, NodeOutput *outputScreen = this->getOutputSocket(0); - // always connect the output image + /* Always connect the output image. */ KeyingScreenOperation *operation = new KeyingScreenOperation(); operation->setMovieClip(clip); operation->setTrackingObject(keyingscreen_data->tracking_object); diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cc b/source/blender/compositor/nodes/COM_ViewLevelsNode.cc index dc454b95080..5a03972c89d 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cc +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cc @@ -34,7 +34,7 @@ void ViewLevelsNode::convertToOperations(NodeConverter &converter, { NodeInput *input = this->getInputSocket(0); if (input->isLinked()) { - // add preview to inputSocket; + /* Add preview to input-socket. */ /* calculate mean operation */ { diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cc b/source/blender/compositor/nodes/COM_ZCombineNode.cc index a76049ff249..ddf66740578 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.cc +++ b/source/blender/compositor/nodes/COM_ZCombineNode.cc @@ -58,8 +58,9 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, } else { /* XXX custom1 is "use_alpha", what on earth is this supposed to do here?!? */ - // not full anti alias, use masking for Z combine. be aware it uses anti aliasing. - // step 1 create mask + /* not full anti alias, use masking for Z combine. be aware it uses anti aliasing. */ + + /* Step 1 create mask. */ NodeOperation *maskoperation; if (this->getbNode()->custom1) { maskoperation = new MathGreaterThanOperation(); @@ -76,13 +77,13 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1)); } - // step 2 anti alias mask bit of an expensive operation, but does the trick + /* Step 2 anti alias mask bit of an expensive operation, but does the trick. */ AntiAliasOperation *antialiasoperation = new AntiAliasOperation(); converter.addOperation(antialiasoperation); converter.addLink(maskoperation->getOutputSocket(), antialiasoperation->getInputSocket(0)); - // use mask to blend between the input colors. + /* use mask to blend between the input colors. */ ZCombineMaskOperation *zcombineoperation = this->getbNode()->custom1 ? new ZCombineMaskAlphaOperation() : new ZCombineMaskOperation(); diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc index 0c1bb688d4e..44680c3acd1 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc @@ -43,8 +43,8 @@ void BilateralBlurOperation::initExecution() void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *data) { - // read the determinator color at x, y, this will be used as the reference color for the - // determinator + /* Read the determinator color at x, y, + * this will be used as the reference color for the determinator. */ float determinatorReferenceColor[4]; float determinator[4]; float tempColor[4]; @@ -67,14 +67,14 @@ void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *d */ for (int yi = miny; yi < maxy; yi += QualityStepHelper::getStep()) { for (int xi = minx; xi < maxx; xi += QualityStepHelper::getStep()) { - // read determinator + /* Read determinator. */ this->m_inputDeterminatorProgram->read(determinator, xi, yi, data); deltaColor = (fabsf(determinatorReferenceColor[0] - determinator[0]) + fabsf(determinatorReferenceColor[1] - determinator[1]) + - fabsf(determinatorReferenceColor[2] - - determinator[2])); // do not take the alpha channel into account + /* Do not take the alpha channel into account. */ + fabsf(determinatorReferenceColor[2] - determinator[2])); if (deltaColor < sigmacolor) { - // add this to the blur + /* Add this to the blur. */ this->m_inputColorProgram->read(tempColor, xi, yi, data); add_v4_v4(blurColor, tempColor); blurDivider += 1.0f; diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc index b50145b106d..d3557e541c0 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc @@ -132,7 +132,7 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], g = color_correct_powf_safe(g * gain + lift, invgamma, g); b = color_correct_powf_safe(b * gain + lift, invgamma, b); - // mix with mask + /* Mix with mask. */ r = mvalue * inputImageColor[0] + value * r; g = mvalue * inputImageColor[1] + value * g; b = mvalue * inputImageColor[2] + value * b; diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc index 57027c11949..a9c58b55d73 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc @@ -58,7 +58,7 @@ void ConvertDepthToRadiusOperation::initExecution() this->m_inputOperation = this->getInputSocketReader(0); float focalDistance = determineFocalDistance(); if (focalDistance == 0.0f) { - focalDistance = 1e10f; /* if the dof is 0.0 then set it to be far away */ + focalDistance = 1e10f; /* If the DOF is 0.0 then set it to be far away. */ } this->m_inverseFocalDistance = 1.0f / focalDistance; this->m_aspect = (this->getWidth() > this->getHeight()) ? @@ -66,9 +66,9 @@ void ConvertDepthToRadiusOperation::initExecution() (this->getWidth() / (float)this->getHeight()); this->m_aperture = 0.5f * (this->m_cam_lens / (this->m_aspect * cam_sensor)) / this->m_fStop; const float minsz = MIN2(getWidth(), getHeight()); - this->m_dof_sp = minsz / - ((cam_sensor / 2.0f) / - this->m_cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov); + this->m_dof_sp = + minsz / ((cam_sensor / 2.0f) / + this->m_cam_lens); /* <- == `aspect * MIN2(img->x, img->y) / tan(0.5f * fov)` */ if (this->m_blurPostOperation) { m_blurPostOperation->setSigma(MIN2(m_aperture * 128.0f, this->m_maxRadius)); @@ -91,7 +91,7 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], /* bug T6656 part 2b, do not re-scale. */ #if 0 bcrad = 0.5f * fabs(aperture * (dof_sp * (cam_invfdist - iZ) - 1.0f)); - // scale crad back to original maximum and blend + /* Scale crad back to original maximum and blend. */ crad->rect[px] = bcrad + wts->rect[px] * (scf * crad->rect[px] - bcrad); #endif radius = 0.5f * fabsf(this->m_aperture * diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc index 0af4eb43624..5ca64b02586 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc @@ -47,15 +47,15 @@ void GlareStreaksOperation::generateGlare(float *data, const float p4 = pow(4.0, (double)n); const float vxp = vx * p4, vyp = vy * p4; const float wt = pow((double)settings->fade, (double)p4); - const float cmo = 1.0f - - (float)pow((double)settings->colmod, - (double)n + - 1); // colormodulation amount relative to current pass + + /* Color-modulation amount relative to current pass. */ + const float cmo = 1.0f - (float)pow((double)settings->colmod, (double)n + 1); + float *tdstcol = tdst.getBuffer(); for (y = 0; y < tsrc.getHeight() && (!breaked); y++) { for (x = 0; x < tsrc.getWidth(); x++, tdstcol += 4) { - // first pass no offset, always same for every pass, exact copy, - // otherwise results in uneven brightness, only need once + /* First pass no offset, always same for every pass, exact copy, + * otherwise results in uneven brightness, only need once. */ if (n == 0) { tsrc.read(c1, x, y); } @@ -65,7 +65,7 @@ void GlareStreaksOperation::generateGlare(float *data, tsrc.readBilinear(c2, x + vxp, y + vyp); tsrc.readBilinear(c3, x + vxp * 2.0f, y + vyp * 2.0f); tsrc.readBilinear(c4, x + vxp * 3.0f, y + vyp * 3.0f); - // modulate color to look vaguely similar to a color spectrum + /* Modulate color to look vaguely similar to a color spectrum. */ c2[1] *= cmo; c2[2] *= cmo; diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cc b/source/blender/compositor/operations/COM_ScaleOperation.cc index bbb6de2f39e..0161b837915 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cc +++ b/source/blender/compositor/operations/COM_ScaleOperation.cc @@ -213,12 +213,12 @@ void ScaleAbsoluteOperation::executePixelSampled(float output[4], this->m_inputXOperation->readSampled(scaleX, x, y, effective_sampler); this->m_inputYOperation->readSampled(scaleY, x, y, effective_sampler); - const float scx = scaleX[0]; // target absolute scale - const float scy = scaleY[0]; // target absolute scale + const float scx = scaleX[0]; /* Target absolute scale. */ + const float scy = scaleY[0]; /* Target absolute scale. */ const float width = this->getWidth(); const float height = this->getHeight(); - // div + /* Divide. */ float relativeXScale = scx / width; float relativeYScale = scy / height; @@ -244,7 +244,7 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, const float scy = scaleY[0]; const float width = this->getWidth(); const float height = this->getHeight(); - // div + /* Divide. */ float relateveXScale = scx / width; float relateveYScale = scy / height; diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc index 1f503051349..628da686a42 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc @@ -369,7 +369,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest( void ScreenLensDistortionOperation::updateVariables(float distortion, float dispersion) { m_k[1] = max_ff(min_ff(distortion, 1.0f), -0.999f); - // smaller dispersion range for somewhat more control + /* Smaller dispersion range for somewhat more control. */ float d = 0.25f * max_ff(min_ff(dispersion, 1.0f), 0.0f); m_k[0] = max_ff(min_ff((m_k[1] + d), 1.0f), -0.999f); m_k[2] = max_ff(min_ff((m_k[1] - d), 1.0f), -0.999f); diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc index 6af6f5a6244..b8274576cb5 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc @@ -28,11 +28,11 @@ namespace blender::compositor { VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() { this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color, ResizeMode::None); // do not resize the bokeh image. - this->addInputSocket(DataType::Value); // radius + this->addInputSocket(DataType::Color, ResizeMode::None); /* Do not resize the bokeh image. */ + this->addInputSocket(DataType::Value); /* Radius. */ #ifdef COM_DEFOCUS_SEARCH - this->addInputSocket(DataType::Color, - ResizeMode::None); // inverse search radius optimization structure. + /* Inverse search radius optimization structure. */ + this->addInputSocket(DataType::Color, ResizeMode::None); #endif this->addOutputSocket(DataType::Color); flags.complex = true; @@ -438,10 +438,10 @@ void VariableSizeBokehBlurOperation::update_memory_buffer_partial(MemoryBuffer * } #ifdef COM_DEFOCUS_SEARCH -// InverseSearchRadiusOperation +/* #InverseSearchRadiusOperation. */ InverseSearchRadiusOperation::InverseSearchRadiusOperation() { - this->addInputSocket(DataType::Value, ResizeMode::None); // radius + this->addInputSocket(DataType::Value, ResizeMode::None); /* Radius. */ this->addOutputSocket(DataType::Color); this->flags.complex = true; this->m_inputRadius = nullptr; @@ -472,37 +472,39 @@ void *InverseSearchRadiusOperation::initializeTileData(rcti *rect) offset += 4; } } - // for (x = rect->xmin; x < rect->xmax ; x++) { - // for (y = rect->ymin; y < rect->ymax ; y++) { - // int rx = x * DIVIDER; - // int ry = y * DIVIDER; - // float radius = 0.0f; - // float maxx = x; - // float maxy = y; - - // for (int x2 = 0 ; x2 < DIVIDER ; x2 ++) { - // for (int y2 = 0 ; y2 < DIVIDER ; y2 ++) { - // this->m_inputRadius->read(temp, rx+x2, ry+y2, PixelSampler::Nearest); - // if (radius < temp[0]) { - // radius = temp[0]; - // maxx = x2; - // maxy = y2; - // } - // } - // } - // int impactRadius = ceil(radius / DIVIDER); - // for (int x2 = x - impactRadius ; x2 < x + impactRadius ; x2 ++) { - // for (int y2 = y - impactRadius ; y2 < y + impactRadius ; y2 ++) { - // data->read(temp, x2, y2); - // temp[0] = MIN2(temp[0], maxx); - // temp[1] = MIN2(temp[1], maxy); - // temp[2] = MAX2(temp[2], maxx); - // temp[3] = MAX2(temp[3], maxy); - // data->writePixel(x2, y2, temp); - // } - // } - // } - // } +# if 0 + for (x = rect->xmin; x < rect->xmax; x++) { + for (y = rect->ymin; y < rect->ymax; y++) { + int rx = x * DIVIDER; + int ry = y * DIVIDER; + float radius = 0.0f; + float maxx = x; + float maxy = y; + + for (int x2 = 0; x2 < DIVIDER; x2++) { + for (int y2 = 0; y2 < DIVIDER; y2++) { + this->m_inputRadius->read(temp, rx + x2, ry + y2, PixelSampler::Nearest); + if (radius < temp[0]) { + radius = temp[0]; + maxx = x2; + maxy = y2; + } + } + } + int impactRadius = ceil(radius / DIVIDER); + for (int x2 = x - impactRadius; x2 < x + impactRadius; x2++) { + for (int y2 = y - impactRadius; y2 < y + impactRadius; y2++) { + data->read(temp, x2, y2); + temp[0] = MIN2(temp[0], maxx); + temp[1] = MIN2(temp[1], maxy); + temp[2] = MAX2(temp[2], maxx); + temp[3] = MAX2(temp[3], maxy); + data->writePixel(x2, y2, temp); + } + } + } + } +# endif return data; } |