Commit 2227a96
committed
api: add image_span, deprecate image_view
* `image_span<T,Rank>` is a 2D-to-4D bounded span with byte-measured
strides (describing data layout with dimensions for channel, x, y,
z) for us to have future APIs deal with bounded+strided regions
rather than YOLOing raw pointers. Among other advantages,
image_span will have robust bounds checking in debug builds. It also
simplifies interfaces to pass a single image_span that encapsulates
everything about an up-to-4D data layout, rather than needing to
pass a function a long list of individual pointers, sizes, and
strides.
* I've templated image_span on Rank, but default to Rank=4 and am
using that version. The templating allows future expansion to
describe one scanline (2D) or image plane (3D) if we want to do so
for certain API calls, but I'm not sure yet whether to bother with
that, so for now, the ability to template by Rank is just
flexibility for the future.
* Add image_span based versions of copy_image() and contiguize()
utilities. I added tests and benchmarks to verify their correctness
and that they have similar performance to the pointer based versions.
* Deprecate image_view, which we did not ever use internally to OIIO
or in its APIs. But since we published the headers, there's a chance
it's used downstream and would be unwise to change its behavior or
data layout. The new image_span is what we will use moving forward
so that we are free to modify it and start with a fresh
slate. Keeping the definition/header for now, but marking it with a
deprecation warning.
Signed-off-by: Larry Gritz <lg@larrygritz.com>1 parent 3b69478 commit 2227a96
9 files changed
Lines changed: 809 additions & 64 deletions
File tree
- src
- doc
- include
- OpenImageIO
- libOpenImageIO
- libutil
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
114 | 126 | | |
115 | 127 | | |
116 | 128 | | |
| |||
0 commit comments