MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ calculate_output_region() [1/2]

Region MayaFlux::Kakshya::calculate_output_region ( const std::vector< uint64_t > &  current_pos,
const std::vector< uint64_t > &  output_shape 
)

Calculate output region bounds from current position and shape.

Parameters
current_posCurrent position coordinates.
output_shapeDesired output shape.
Returns
Region representing the output bounds.

Definition at line 183 of file RegionUtils.cpp.

185{
186 if (current_pos.size() != output_shape.size()) {
187 error<std::invalid_argument>(
188 Journal::Component::Kakshya, Journal::Context::Runtime,
189 std::source_location::current(),
190 "Position and shape vectors must have same size: current_pos size = "
191 + std::to_string(current_pos.size()) + ", output_shape size = "
192 + std::to_string(output_shape.size()));
193 }
194
195 std::vector<uint64_t> end_pos;
196 end_pos.reserve(current_pos.size());
197
198 for (size_t i = 0; i < current_pos.size(); ++i) {
199 if (output_shape[i] == 0) {
200 error<std::invalid_argument>(
201 Journal::Component::Kakshya, Journal::Context::Runtime,
202 std::source_location::current(),
203 "Output shape cannot have zero dimensions: dimension " + std::to_string(i) + " is zero");
204 }
205 end_pos.push_back(current_pos[i] + output_shape[i] - 1);
206 }
207
208 return { current_pos, end_pos };
209}

References calculate_output_region().

Referenced by calculate_output_region(), calculate_output_region(), and MayaFlux::Kakshya::ContiguousAccessProcessor::process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: