28 #ifndef PROCESS_BP_OPTIMIZED_CPU_H_
29 #define PROCESS_BP_OPTIMIZED_CPU_H_
55 template<RunData_t T,
unsigned int DISP_VALS, run_environment::AccSetting ACCELERATION>
60 ProcessBp<T, DISP_VALS, ACCELERATION>(opt_cpu_params) {}
66 const std::array<float*, 2>& images_target_device,
74 unsigned int bp_settings_num_disp_vals)
const override;
79 unsigned int bp_settings_num_disp_vals)
const override;
86 T* allocated_memory)
const override;
93 unsigned int bp_settings_num_disp_vals)
const override;
95 float* RetrieveOutputDisparity(
99 unsigned int bp_settings_num_disp_vals)
const override;
105 template<RunData_t T,
unsigned int DISP_VALS, run_environment::AccSetting ACCELERATION>
111 T* allocated_memory)
const
114 for (
unsigned int iteration_num = 0; iteration_num < alg_settings.
num_iterations; iteration_num++)
117 ((iteration_num % 2) == 0) ?
122 beliefprop_cpu::RunBPIterationUsingCheckerboardUpdates<T, DISP_VALS, ACCELERATION>(
124 data_costs_device[0], data_costs_device[1],
142 template<RunData_t T,
unsigned int DISP_VALS, run_environment::AccSetting ACCELERATION>
148 unsigned int bp_settings_num_disp_vals)
const
156 beliefprop_cpu::CopyMsgDataToNextLevel<T, DISP_VALS, ACCELERATION>(
174 bp_settings_num_disp_vals, this->parallel_params_);
180 template<RunData_t T,
unsigned int DISP_VALS, run_environment::AccSetting ACCELERATION>
186 beliefprop_cpu::InitializeBottomLevelData<T, DISP_VALS, ACCELERATION>(
188 images_target_device[0], images_target_device[1],
189 data_costs_device[0], data_costs_device[1],
196 template<RunData_t T,
unsigned int DISP_VALS, run_environment::AccSetting ACCELERATION>
200 unsigned int bp_settings_num_disp_vals)
const
204 beliefprop_cpu::InitializeMessageValsToDefaultKernel<T, DISP_VALS, ACCELERATION>(
214 bp_settings_num_disp_vals, this->parallel_params_);
220 template<RunData_t T,
unsigned int DISP_VALS, run_environment::AccSetting ACCELERATION>
226 unsigned int bp_settings_num_disp_vals)
const
228 const size_t offset_num{0};
229 for (
const auto& [checkerboard_part, data_costs] : {
232 data_costs_device_write[0]),
235 data_costs_device_write[1])})
237 beliefprop_cpu::InitializeCurrentLevelData<T, DISP_VALS, ACCELERATION>(
240 data_costs_device[0], data_costs_device[1],
242 ((
int) offset_num /
sizeof(
float)),
243 bp_settings_num_disp_vals, this->parallel_params_);
248 template<RunData_t T,
unsigned int DISP_VALS, run_environment::AccSetting ACCELERATION>
253 unsigned int bp_settings_num_disp_vals)
const
255 float* result_disp_map_device =
259 beliefprop_cpu::RetrieveOutputDisparity<T, DISP_VALS, ACCELERATION>(
261 data_costs_device[0],
262 data_costs_device[1],
271 result_disp_map_device, bp_settings_num_disp_vals, this->parallel_params_);
273 return result_disp_map_device;
File with namespace for enums, constants, structures, and functions specific to belief propagation pr...
Header file that contains information about the stereo sets used for evaluation of the bp implementat...
This header declares the kernel functions to run optimized belief propagation on CPU.
Declares child class of ParallelParams to store and process parallelization parameters to use in each...
Declares abstract class to run belief propagation on target device. Some of the class functions need ...
Contains namespace with enums and constants for implementation run evaluation.
Declares and defines structure that stores settings for current implementation run as well as functio...
Define constraints for data type in processing.
Class to store and retrieve properties of a bp processing level including a data type specified as a ...
const beliefprop::BpLevelProperties & LevelProperties() const
Return level properties as const reference to avoid copying and not allow it to be modified.
Abstract class for holding and processing parallelization parameters. Child class(es) specific to im...
Abstract class to run belief propagation on target device. Some of the class functions need to be ove...
Child class of ProcessBp that defines functions used in processing bp in the optimized CPU implementa...
ProcessBpOptimizedCPU(const ParallelParams &opt_cpu_params)
Namespace for enums, constants, structures, and functions specific to belief propagation processing.
std::array< T, kNumCheckerboardParts > DataCostsCheckerboards
Define alias for two-element array with data costs for each bp processing checkerboard....
CheckerboardPart
Define the two checkerboard "parts" that the image is divided into.
std::array< std::array< T, kNumMessageArrays >, kNumCheckerboardParts > CheckerboardMessages
Define alias for array with message costs for each bp processing checkerboard. Each checkerboard mes...
Status
Enum for status to indicate if error or no error.
unsigned int height_level_
unsigned int width_level_
Structure to store the belief propagation settings including the number of levels and iterations.
unsigned int num_iterations
unsigned int num_disp_vals
Number of disparity values must be set for each stereo set.
float disc_k_bp
Discontinuity cost cap set to high value by default but is expected to be dependent on number of disp...