|
libpsynth 0.2.1
|
Image range-equivalents of STL algorithms. More...
|
Classes | |
| struct | psynth::sound::binary_operation_obj< Derived, Result > |
| A generic binary operation on rangesUse this class as a convenience superclass when defining an operation for any image ranges. More... | |
Modules | |
| copy_frames | |
std::copy for image ranges | |
| ImageRangeSTLAlgorithmsCopyAndConvertFrames | |
copy_and_convert_frames | |
| fill_frames | |
std::fill for image ranges | |
| ImageRangeSTLAlgorithmsUninitializedFillFrames | |
uninitialized_fill_frames | |
| ImageRangeSTLAlgorithmsDefaultConstructFrames | |
default_construct_frames | |
| for_each_frame | |
std::for_each for image ranges | |
| ImageRangeSTLAlgorithmsForEachFramePosition | |
for_each_frame_position | |
| generate_frames | |
std::generate for image ranges | |
| equal_frames | |
std::equal for image ranges | |
| transform_frames | |
std::transform for image ranges | |
| ImageRangeSTLAlgorithmsTransformFramePositions | |
transform_frame_positions | |
Image range-equivalents of STL algorithms.
Image ranges provide 1D iteration of their frames via begin() and end() methods, which makes it possible to use STL algorithms with them. However, using nested loops over X and Y is in many cases more efficient. The algorithms in this section resemble STL algorithms, but they abstract away the nested loops and take ranges (as opposed to ranges) as input.
Most algorithms check whether the image ranges are 1D-traversable. A 1D-traversable image range has no gaps at the end of the rows. In other words, if an x_iterator of that range is advanced past the last frame in a row it will move to the first frame of the next row. When image ranges are 1D-traversable, the algorithms use a single loop and run more efficiently. If one or more of the input ranges are not 1D-traversable, the algorithms fall-back to an X-loop nested inside a Y-loop.
The algorithms typically delegate the work to their corresponding STL algorithms. For example, copy_frames calls std::copy either for each row, or, when the images are 1D-traversable, once for all frames.
In addition, overloads are sometimes provided for the STL algorithms. For example, std::copy for planar iterators is overloaded to perform std::copy for each of the planes. std::copy over bitwise-copiable frames results in std::copy over unsigned char, which STL typically implements via memmove.
As a result copy_frames may result in a single call to memmove for interleaved 1D-traversable ranges, or one per each plane of planar 1D-traversable ranges, or one per each row of interleaved non-1D-traversable images, etc.
1.7.4