Differential D12689 Diff 42665 source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc
| Show First 20 Lines • Show All 376 Lines • ▼ Show 20 Lines | void ScreenLensDistortionOperation::updateVariables(float distortion, float dispersion) | ||||
| m_sc = (m_fit && (m_maxk > 0.0f)) ? (1.0f / (1.0f + 2.0f * m_maxk)) : (1.0f / (1.0f + m_maxk)); | m_sc = (m_fit && (m_maxk > 0.0f)) ? (1.0f / (1.0f + 2.0f * m_maxk)) : (1.0f / (1.0f + m_maxk)); | ||||
| m_dk4[0] = 4.0f * (m_k[1] - m_k[0]); | m_dk4[0] = 4.0f * (m_k[1] - m_k[0]); | ||||
| m_dk4[1] = 4.0f * (m_k[2] - m_k[1]); | m_dk4[1] = 4.0f * (m_k[2] - m_k[1]); | ||||
| m_dk4[2] = 0.0f; /* unused */ | m_dk4[2] = 0.0f; /* unused */ | ||||
| mul_v3_v3fl(m_k4, m_k, 4.0f); | mul_v3_v3fl(m_k4, m_k, 4.0f); | ||||
| } | } | ||||
| void ScreenLensDistortionOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) | |||||
| { | |||||
| switch (execution_model_) { | |||||
| case eExecutionModel::FullFrame: { | |||||
| set_determined_canvas_modifier([=](rcti &canvas) { | |||||
| /* Ensure screen space. */ | |||||
| BLI_rcti_translate(&canvas, -canvas.xmin, -canvas.ymin); | |||||
| }); | |||||
| break; | |||||
| } | |||||
| default: | |||||
| break; | |||||
| } | |||||
| NodeOperation::determine_canvas(preferred_area, r_area); | |||||
| } | |||||
| void ScreenLensDistortionOperation::get_area_of_interest(const int input_idx, | void ScreenLensDistortionOperation::get_area_of_interest(const int input_idx, | ||||
| const rcti &UNUSED(output_area), | const rcti &UNUSED(output_area), | ||||
| rcti &r_input_area) | rcti &r_input_area) | ||||
| { | { | ||||
| if (input_idx != 0) { | if (input_idx != 0) { | ||||
| /* Dispersion and distortion inputs are used as constants only. */ | /* Dispersion and distortion inputs are used as constants only. */ | ||||
| r_input_area = COM_SINGLE_ELEM_AREA; | r_input_area = COM_CONSTANT_INPUT_AREA_OF_INTEREST; | ||||
| } | } | ||||
| /* XXX the original method of estimating the area-of-interest does not work | /* XXX the original method of estimating the area-of-interest does not work | ||||
| * it assumes a linear increase/decrease of mapped coordinates, which does not | * it assumes a linear increase/decrease of mapped coordinates, which does not | ||||
| * yield correct results for the area and leaves uninitialized buffer areas. | * yield correct results for the area and leaves uninitialized buffer areas. | ||||
| * So now just use the full image area, which may not be as efficient but works at least ... | * So now just use the full image area, which may not be as efficient but works at least ... | ||||
| */ | */ | ||||
| #if 1 | #if 1 | ||||
| NodeOperation *image = getInputOperation(0); | NodeOperation *image = getInputOperation(0); | ||||
| r_input_area.xmax = image->getWidth(); | r_input_area = image->get_canvas(); | ||||
| r_input_area.xmin = 0; | |||||
| r_input_area.ymax = image->getHeight(); | |||||
| r_input_area.ymin = 0; | |||||
| #else /* Original method in tiled implementation. */ | #else /* Original method in tiled implementation. */ | ||||
| rcti newInput; | rcti newInput; | ||||
| const float margin = 2; | const float margin = 2; | ||||
| BLI_rcti_init_minmax(&newInput); | BLI_rcti_init_minmax(&newInput); | ||||
| if (m_dispersion_const && m_distortion_const) { | if (m_dispersion_const && m_distortion_const) { | ||||
| ▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines | |||||