MayaFlux 0.4.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 189 of file RegionUtils.cpp.

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

References MayaFlux::Journal::Kakshya, and MayaFlux::Journal::Runtime.

Referenced by MayaFlux::Kakshya::ContiguousAccessProcessor::process().

+ Here is the caller graph for this function: