Optimized Belief Propagation (CPU and GPU)
SharedBpUtilFuncts.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2024 Scott Grauer-Gray
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
28 #ifndef SHARED_BP_UTIL_FUNCTS_H_
29 #define SHARED_BP_UTIL_FUNCTS_H_
30 
33 #include "RunImp/UtilityFuncts.h"
38 #include "SharedBpUtilFuncts.h"
39 
40 namespace beliefprop {
41 
53  unsigned int x_val, unsigned int y_val,
54  unsigned int width, unsigned int height)
55 {
56  return ((x_val < width) && (y_val < height));
57 }
58 
73  unsigned int x_val, unsigned int y_val, unsigned int width, unsigned int height,
74  unsigned int current_disparity, unsigned int total_num_disp_vals,
75  unsigned int offset_data = 0u)
76 {
78  //indexing is performed in such a way so that the memory accesses as coalesced as much as possible
79  return (y_val * width * total_num_disp_vals + width * current_disparity + x_val) + offset_data;
80  }
81  else {
82  return ((y_val * width + x_val) * total_num_disp_vals + current_disparity);
83  }
84 }
85 
86 };
87 
88 #endif //SHARED_BP_UTIL_FUNCTS_H_
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...
Declares class to store and retrieve properties of a bp processing level.
File with namespace for enums, constants, structures, and functions specific to belief propagation pr...
Declares and defines structure that stores settings for current implementation run as well as functio...
Define constraints for data type in processing.
Utility functions for belief propagation processing that are used in both optimized CPU and CUDA impl...
Contains namespace with utility functions for implementation.
#define ARCHITECTURE_ADDITION
Definition: UtilityFuncts.h:37
Namespace for enums, constants, structures, and functions specific to belief propagation processing.
constexpr bool kOptimizedIndexingSetting
Definition: BpRunUtils.h:114
ARCHITECTURE_ADDITION bool WithinImageBounds(unsigned int x_val, unsigned int y_val, unsigned int width, unsigned int height)
Checks if the current point is within the image bounds Assumed that input x/y vals are above zero sin...
ARCHITECTURE_ADDITION unsigned int RetrieveIndexInDataAndMessage(unsigned int x_val, unsigned int y_val, unsigned int width, unsigned int height, unsigned int current_disparity, unsigned int total_num_disp_vals, unsigned int offset_data=0u)
Retrieve the current 1-D index value of the given point at the given disparity in the data cost and m...