Blender V5.3
openimageio_support.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10#include <OpenImageIO/image_span.h>
11#include <OpenImageIO/imagebuf.h>
12#include <OpenImageIO/imagebufalgo.h>
13
14#include <cmath>
15#include <cstddef>
16
18#include "BLI_string_utf8.hh"
19
20#include "BKE_idprop.hh"
21
22#include "DNA_ID.h"
23
25#include "IMB_filetype.hh"
26#include "IMB_metadata.hh"
27
28#include "CLG_log.h"
29
30namespace blender {
31
32static CLG_LogRef LOG_READ = {"image.read"};
33static CLG_LogRef LOG_WRITE = {"image.write"};
34
35OIIO_NAMESPACE_USING
36
37using std::string;
38using std::unique_ptr;
39
40namespace imbuf {
41
42/* An OIIO IOProxy to write into an in-memory buffer. */
43struct MemoryBufferWriter : public Filesystem::IOProxy {
44 MemoryBufferWriter() : IOProxy("", Write)
45 {
46 buffer.reserve(80 * 1024);
47 }
48
49 const char *proxytype() const override
50 {
51 return "MemoryBufferWriter";
52 }
53
54 size_t write(const void *buf, size_t size) override
55 {
56 size = pwrite(buf, size, m_pos);
57 m_pos += size;
58 return size;
59 }
60
61 size_t pwrite(const void *buf, size_t size, int64_t offset) override
62 {
63 /* If buffer is too small increase it. */
64 size_t end = offset + size;
65 if (end > buffer.size()) {
66 buffer.resize(end);
67 }
68 memcpy(buffer.data() + offset, buf, size);
69 return size;
70 }
71
72 size_t size() const override
73 {
74 return buffer.size();
75 }
76
78};
79
80/* Utility to in-place expand an n-component pixel buffer into a 4-component buffer. */
81template<typename T>
82static void fill_all_channels(T *pixels, int width, int height, int components, T alpha)
83{
84 const int64_t pixel_count = int64_t(width) * height;
85 if (components == 3) {
86 for (int64_t i = 0; i < pixel_count; i++) {
87 pixels[i * 4 + 3] = alpha;
88 }
89 }
90 else if (components == 1) {
91 for (int64_t i = 0; i < pixel_count; i++) {
92 pixels[i * 4 + 3] = alpha;
93 pixels[i * 4 + 2] = pixels[i * 4 + 0];
94 pixels[i * 4 + 1] = pixels[i * 4 + 0];
95 }
96 }
97 else if (components == 2) {
98 for (int64_t i = 0; i < pixel_count; i++) {
99 pixels[i * 4 + 3] = pixels[i * 4 + 1];
100 pixels[i * 4 + 2] = pixels[i * 4 + 0];
101 pixels[i * 4 + 1] = pixels[i * 4 + 0];
102 }
103 }
104}
105
106template<typename T>
108 ImageInput *in, int width, int height, int channels, ImBufFlags flags, bool use_all_planes)
109{
110 /* Allocate the ImBuf for the image. */
111 constexpr bool is_float = sizeof(T) > 1;
112 const ImBufFlags format_flag = (is_float ? ImBufFlags::FloatData : ImBufFlags::ByteData) |
114 const ImBufFlags ibuf_flags = flag_is_set(flags, ImBufFlags::Test) ? ImBufFlags::Zero :
115 format_flag;
116
117 ImColorMode color_mode = ImColorMode::RGBA;
118 if (channels == 2) {
119 color_mode = ImColorMode::BW_A;
120 }
121 else if (!use_all_planes) {
122 if (channels == 1) {
123 color_mode = ImColorMode::BW;
124 }
125 else if (channels == 3) {
126 color_mode = ImColorMode::RGB;
127 }
128 }
129 ImBuf *ibuf = IMB_allocImBuf(width, height, ibuf_flags);
130 if (!ibuf) {
131 return nullptr;
132 }
133 ibuf->color_mode = color_mode;
134
135 /* No need to load actual pixel data during the test phase. */
136 if (flag_is_set(flags, ImBufFlags::Test)) {
137 return ibuf;
138 }
139
140 /* Calculate an appropriate stride to read n-channels directly into
141 * the ImBuf 4-channel layout. */
142 const stride_t ibuf_xstride = sizeof(T) * 4;
143 const stride_t ibuf_ystride = ibuf_xstride * width;
144 const TypeDesc format = is_float ? TypeDesc::FLOAT : TypeDesc::UINT8;
145 uchar *rect = is_float ? reinterpret_cast<uchar *>(ibuf->float_data_for_write()) :
146 reinterpret_cast<uchar *>(ibuf->byte_data_for_write());
147 void *ibuf_data = rect + ((stride_t(height) - 1) * ibuf_ystride);
148
149 bool ok = in->read_image(
150 0, 0, 0, channels, format, ibuf_data, ibuf_xstride, -ibuf_ystride, AutoStride);
151 if (!ok) {
152 CLOG_ERROR(&LOG_READ, "OpenImageIO read failed: %s", in->geterror().c_str());
153
154 IMB_freeImBuf(ibuf);
155 return nullptr;
156 }
157
158 /* ImBuf always needs 4 channels */
159 const T alpha_fill = is_float ? 1.0f : 0xFF;
160 fill_all_channels<T>(reinterpret_cast<T *>(rect), width, height, channels, alpha_fill);
161
162 return ibuf;
163}
164
165static void set_file_colorspace(ImFileColorSpace &r_colorspace,
166 const ReadContext &ctx,
167 const ImageSpec &spec,
168 bool is_float)
169{
170 /* Guess float data types means HDR colors. File formats can override this later. */
171 r_colorspace.is_hdr_float = is_float;
172
173 /* Override if necessary. */
174 if (ctx.use_metadata_colorspace) {
175 string ics = spec.get_string_attribute("oiio:ColorSpace");
176 STRNCPY_UTF8(r_colorspace.metadata_colorspace, ics.c_str());
177 }
178
179 /* Get colorspace from CICP. */
180 int cicp[4] = {};
181 if (spec.getattribute("CICP", TypeDesc(TypeDesc::INT, 4), cicp, true)) {
184 if (colorspace) {
187 }
188 }
189}
190
194static ImBuf *get_oiio_ibuf(ImageInput *in, const ReadContext &ctx, ImFileColorSpace &r_colorspace)
195{
196 const ImageSpec &spec = in->spec();
197 const int width = spec.width;
198 const int height = spec.height;
199 const bool has_alpha = spec.alpha_channel != -1;
200 const bool is_float = spec.format.basesize() > 1;
201
202 /* Only a maximum of 4 channels are supported by ImBuf. */
203 const int channels = spec.nchannels <= 4 ? spec.nchannels : 4;
204 if (channels < 1) {
205 return nullptr;
206 }
207
208 if (spec.depth > 1) {
209 CLOG_ERROR(&LOG_READ, "Image has unsupported depth of %d", spec.depth);
210 return nullptr;
211 }
212
213 const bool use_all_planes = has_alpha || ctx.use_all_planes;
214
215 ImBuf *ibuf = nullptr;
216 if (is_float) {
217 ibuf = load_pixels<float>(in, width, height, channels, ctx.flags, use_all_planes);
218 }
219 else {
220 ibuf = load_pixels<uchar>(in, width, height, channels, ctx.flags, use_all_planes);
221 }
222
223 /* Fill in common ibuf properties. */
224 if (ibuf) {
225 ibuf->ftype = ctx.file_type;
226 ibuf->foptions.flag |= (spec.format == TypeDesc::HALF) ? OPENEXR_HALF : 0;
227
228 set_file_colorspace(r_colorspace, ctx, spec, is_float);
229
230 double x_res = spec.get_float_attribute("XResolution", 0.0f);
231 double y_res = spec.get_float_attribute("YResolution", 0.0f);
232 /* Some formats store the resolution as integers. */
233 if (!(x_res > 0.0f && y_res > 0.0f)) {
234 x_res = spec.get_int_attribute("XResolution", 0);
235 y_res = spec.get_int_attribute("YResolution", 0);
236 }
237
238 if (x_res > 0.0f && y_res > 0.0f) {
239 double scale = 1.0;
240 auto unit = spec.get_string_attribute("ResolutionUnit", "");
241 if (ELEM(unit, "in", "inch")) {
242 scale = 100.0 / 2.54;
243 }
244 else if (unit == "cm") {
245 scale = 100.0;
246 }
247 ibuf->ppm[0] = scale * x_res;
248 ibuf->ppm[1] = scale * y_res;
249 }
250
251 /* Transfer metadata to the ibuf if necessary. */
252 if (flag_is_set(ctx.flags, ImBufFlags::Metadata)) {
254 ibuf->flags |= spec.extra_attribs.empty() ? ImBufFlags::Zero : ImBufFlags::Metadata;
255
256 for (const auto &attrib : spec.extra_attribs) {
257 if (attrib.name().find("ICCProfile") != string::npos) {
258 continue;
259 }
260 IMB_metadata_set_field(metadata, attrib.name().c_str(), attrib.get_string().c_str());
261 }
262 }
263 }
264
265 return ibuf;
266}
267
273static unique_ptr<ImageInput> get_oiio_reader(const char *format,
274 const ImageSpec &config,
275 Filesystem::IOMemReader &mem_reader,
276 ImageSpec &r_newspec)
277{
278 /* Attempt to create a reader based on the passed in format. */
279 unique_ptr<ImageInput> in = ImageInput::create(format);
280 if (!(in && in->valid_file(&mem_reader))) {
281 return nullptr;
282 }
283
284 /* Open the reader using the ioproxy. */
285 in->set_ioproxy(&mem_reader);
286 bool ok = in->open("", r_newspec, config);
287 if (!ok) {
288 return nullptr;
289 }
290
291 return in;
292}
293
294bool imb_oiio_check(const uchar *mem, size_t mem_size, const char *file_format)
295{
296 ImageSpec config, spec;
297
298 /* This memory proxy must remain alive for the full duration of the read. */
299 Filesystem::IOMemReader mem_reader(cspan<uchar>(mem, mem_size));
300 unique_ptr<ImageInput> in = ImageInput::create(file_format);
301 return in && in->valid_file(&mem_reader);
302}
303
305 const ImageSpec &config,
306 ImFileColorSpace &r_colorspace,
307 ImageSpec &r_newspec)
308{
309 /* This memory proxy must remain alive for the full duration of the read. */
310 Filesystem::IOMemReader mem_reader(cspan<uchar>(ctx.mem_start, ctx.mem_size));
311 unique_ptr<ImageInput> in = get_oiio_reader(ctx.file_format, config, mem_reader, r_newspec);
312 if (!in) {
313 return nullptr;
314 }
315
316 return get_oiio_ibuf(in.get(), ctx, r_colorspace);
317}
318
319static void oiio_write_prepare(const ImageSpec &file_spec, ImageBuf &orig_buf, ImageBuf &final_buf)
320{
321#if OIIO_VERSION_MAJOR >= 3
322 const size_t original_channels_count = orig_buf.nchannels();
323#else
324 const int original_channels_count = orig_buf.nchannels();
325#endif
326
327 if (original_channels_count > 1 && file_spec.nchannels == 1) {
328 /* Convert to gray-scale image by computing the luminance. Make sure the weight of alpha
329 * channel is zero since it should not contribute to the luminance. */
330 float weights[4] = {0.0f, 0.0f, 0.0f, 0.0f};
332 ImageBufAlgo::channel_sum(final_buf, orig_buf, {weights, original_channels_count});
333 }
334 else if (original_channels_count == 1 && file_spec.nchannels > 1) {
335 /* Broadcast the gray-scale channel to as many channels as needed, filling the alpha channel
336 * with ones if needed. 0 channel order mean we will be copying from the first channel, while
337 * -1 means we will be filling based on the corresponding value from the defined channel
338 * values. */
339 const int channel_order[] = {0, 0, 0, -1};
340 const float channel_values[] = {0.0f, 0.0f, 0.0f, 1.0f};
341 const std::string channel_names[] = {"R", "G", "B", "A"};
342 ImageBufAlgo::channels(final_buf,
343 orig_buf,
344 file_spec.nchannels,
345 cspan<int>(channel_order, file_spec.nchannels),
346 cspan<float>(channel_values, file_spec.nchannels),
347 cspan<std::string>(channel_names, file_spec.nchannels));
348 }
349 else if (file_spec.nchannels == 2 && original_channels_count >= 2) {
350 /* Gray-scale + alpha output (#ImColorMode::BW_A). The #ImBuf source replicates gray into
351 * RGB and stores alpha at index 3, so extract {gray, alpha} = {0, 3}. */
352 const int channel_order[] = {0, 3};
353 const float channel_values[] = {0.0f, 1.0f};
354 const std::string channel_names[] = {"Y", "A"};
355 ImageBufAlgo::channels(final_buf, orig_buf, 2, channel_order, channel_values, channel_names);
356 }
357 else if (original_channels_count != file_spec.nchannels) {
358 /* Either trim or fill new channels based on the needed channels count. */
359 int channel_order[4];
360 for (int i = 0; i < 4; i++) {
361 /* If a channel exists in the original buffer, we copy it, if not, we fill it by supplying
362 * -1, which is a special value that means filling based on the value in the defined channels
363 * values. So alpha is filled with 1, and other channels are filled with zero. */
364 const bool channel_exists = i + 1 <= original_channels_count;
365 channel_order[i] = channel_exists ? i : -1;
366 }
367 const float channel_values[] = {0.0f, 0.0f, 0.0f, 1.0f};
368 const std::string channel_names[] = {"R", "G", "B", "A"};
369 ImageBufAlgo::channels(final_buf,
370 orig_buf,
371 file_spec.nchannels,
372 cspan<int>(channel_order, file_spec.nchannels),
373 cspan<float>(channel_values, file_spec.nchannels),
374 cspan<std::string>(channel_names, file_spec.nchannels));
375 }
376 else {
377 final_buf = std::move(orig_buf);
378 }
379}
380
381bool imb_oiio_write(const WriteContext &ctx, const char *filepath, const ImageSpec &file_spec)
382{
383 unique_ptr<ImageOutput> out = ImageOutput::create(ctx.file_format);
384 if (!out) {
385 return false;
386 }
387
388 ImageBuf orig_buf(ctx.mem_spec, ctx.mem_span);
389 ImageBuf final_buf{};
390
391 oiio_write_prepare(file_spec, orig_buf, final_buf);
392
393 bool write_ok = false;
394 bool close_ok = false;
395 if (out->open(filepath, file_spec)) {
396 write_ok = final_buf.write(out.get());
397 close_ok = out->close();
398 }
399
400 const bool all_ok = write_ok && close_ok;
401 if (!all_ok) {
402 CLOG_ERROR(&LOG_WRITE, "OpenImageIO write failed: %s", out->geterror().c_str());
403 errno = 0; /* Prevent higher level layers from calling `perror` unnecessarily. */
404 }
405
406 return all_ok;
407}
408
409Vector<uint8_t> imb_oiio_write_buffer(const WriteContext &ctx, const ImageSpec &file_spec)
410{
411 unique_ptr<ImageOutput> out = ImageOutput::create(ctx.file_format);
412 if (!out) {
413 return {};
414 }
415
416 ImageBuf orig_buf(ctx.mem_spec, ctx.mem_span);
417 ImageBuf final_buf{};
418
419 oiio_write_prepare(file_spec, orig_buf, final_buf);
420
421 MemoryBufferWriter writer;
422 out->set_ioproxy(&writer);
423
424 bool write_ok = false;
425 bool close_ok = false;
426 if (out->open("", file_spec)) {
427 write_ok = final_buf.write(out.get());
428 close_ok = out->close();
429 }
430 const bool all_ok = write_ok && close_ok;
431 if (!all_ok) {
432 CLOG_ERROR(&LOG_WRITE, "OpenImageIO write failed: %s", out->geterror().c_str());
433 errno = 0; /* Prevent higher level layers from calling `perror` unnecessarily. */
434 return {};
435 }
436
437 return std::move(writer.buffer);
438}
439
441 const ImBuf *ibuf,
442 ImBufFlags flags,
443 bool prefer_float)
444{
445 WriteContext ctx{};
446 ctx.file_format = file_format;
447 ctx.ibuf = ibuf;
448 ctx.flags = flags;
449
450 const int width = ibuf->x;
451 const int height = ibuf->y;
452 const bool use_float = prefer_float && (ibuf->float_data() != nullptr);
453
454 auto make_image_span =
455 [](const auto *buffer, int width, int height, int channels, size_t channel_size) {
456 const stride_t mem_xstride = channel_size * channels;
457 const stride_t mem_ystride = mem_xstride * width;
458 const std::byte *mem_start = reinterpret_cast<const std::byte *>(buffer);
459
460 /* We always write using a negative y-stride so ensure we start at the end. */
461 const stride_t y_flip_offset = (stride_t(height) - 1) * mem_ystride;
462 return image_span<const std::byte>(mem_start + y_flip_offset,
463 channels,
464 width,
465 height,
466 1,
467 AutoStride,
468 mem_xstride,
469 -mem_ystride,
470 AutoStride,
471 channel_size);
472 };
473
474 if (use_float) {
475 const int mem_channels = ibuf->channels ? ibuf->channels : 4;
476 ctx.mem_span = make_image_span(ibuf->float_data(), width, height, mem_channels, sizeof(float));
477 ctx.mem_spec = ImageSpec(width, height, mem_channels, TypeDesc::FLOAT);
478 }
479 else {
480 const int mem_channels = 4;
481 ctx.mem_span = make_image_span(ibuf->byte_data(), width, height, mem_channels, sizeof(uchar));
482 ctx.mem_spec = ImageSpec(width, height, mem_channels, TypeDesc::UINT8);
483 }
484
485 return ctx;
486}
487
488ImageSpec imb_create_write_spec(const WriteContext &ctx, int file_channels, TypeDesc data_format)
489{
490 const int width = ctx.ibuf->x;
491 const int height = ctx.ibuf->y;
492 ImageSpec file_spec(width, height, file_channels, data_format);
493
494 /* Populate the spec with all common attributes.
495 *
496 * Care must be taken with the metadata:
497 * - It should be processed first, before the "Resolution" metadata below, to
498 * ensure the proper values end up in the #ImageSpec
499 * - It needs to filter format-specific metadata that may no longer apply to
500 * the current format being written (e.g. metadata for tiff being written to a `PNG`)
501 */
502
503 if (ctx.ibuf->metadata()) {
504 for (IDProperty &prop : ctx.ibuf->metadata()->data.group) {
505 if (prop.type == IDP_STRING) {
506 /* If this property has a prefixed name (oiio:, tiff:, etc.) and it belongs to
507 * oiio or a different format, then skip. */
508 if (char *colon = strchr(prop.name, ':')) {
509 std::string prefix(prop.name, colon);
510 Strutil::to_lower(prefix);
511 if (prefix == "oiio" ||
512 (!STREQ(prefix.c_str(), ctx.file_format) && OIIO::is_imageio_format_name(prefix)))
513 {
514 /* Skip this attribute. */
515 continue;
516 }
517 }
518
519 file_spec.attribute(prop.name, IDP_string_get(&prop));
520 }
521 }
522 }
523
524 if (ctx.ibuf->ppm[0] > 0.0 && ctx.ibuf->ppm[1] > 0.0) {
525 if (STREQ(ctx.file_format, "bmp")) {
526 /* BMP only supports meters as integers. */
527 file_spec.attribute("ResolutionUnit", "m");
528 file_spec.attribute("XResolution", int(round(ctx.ibuf->ppm[0])));
529 file_spec.attribute("YResolution", int(round(ctx.ibuf->ppm[1])));
530 }
531 else {
532 /* More OIIO formats support inch than meter. */
533 file_spec.attribute("ResolutionUnit", "in");
534 file_spec.attribute("XResolution", float(ctx.ibuf->ppm[0] * 0.0254));
535 file_spec.attribute("YResolution", float(ctx.ibuf->ppm[1] * 0.0254));
536 }
537 }
538
539 /* Write ICC profile and/or CICP if there is one associated with the colorspace. */
540 const ColorSpace *colorspace = (ctx.mem_spec.format == TypeDesc::FLOAT) ?
543 if (colorspace) {
544 /* Our ICC profiles are only valid for RGB channels, using them for grayscale
545 * is considered invalid by some software. */
546 if (file_channels >= 3) {
548 if (!icc_profile.is_empty()) {
549 file_spec.attribute("ICCProfile",
550 OIIO::TypeDesc(OIIO::TypeDesc::UINT8, icc_profile.size()),
551 icc_profile.data());
552 }
553 }
554
555 /* PNG only supports RGB matrix. For AVIF and HEIF we want to use a YUV matrix
556 * as these are based on video codecs designed to use them. */
557 const bool rgb_matrix = STREQ(ctx.file_format, "png");
558 int cicp[4];
560 colorspace, ColorManagedFileOutput::Image, rgb_matrix, cicp))
561 {
562 file_spec.attribute("CICP", TypeDesc(TypeDesc::INT, 4), cicp);
563 }
564 }
565
566 return file_spec;
567}
568
569} // namespace imbuf
570} // namespace blender
#define IDP_string_get(prop)
#define STRNCPY_UTF8(dst, src)
#define CLOG_ERROR(clg_ref,...)
Definition CLG_log.h:188
ID and Library types, which are fundamental for SDNA.
#define ELEM(...)
#define STREQ(a, b)
int64_t size() const
bool is_empty() const
#define round
float3x3 scale(float3x3 mat, float2 scale)
#define OPENEXR_HALF
#define T
bool imb_oiio_write(const WriteContext &ctx, const char *filepath, const ImageSpec &file_spec)
static unique_ptr< ImageInput > get_oiio_reader(const char *format, const ImageSpec &config, Filesystem::IOMemReader &mem_reader, ImageSpec &r_newspec)
ImBuf * imb_oiio_read(const ReadContext &ctx, const ImageSpec &config, ImFileColorSpace &r_colorspace, ImageSpec &r_newspec)
bool imb_oiio_check(const uchar *mem, size_t mem_size, const char *file_format)
ImageSpec imb_create_write_spec(const WriteContext &ctx, int file_channels, TypeDesc data_format)
static ImBuf * load_pixels(ImageInput *in, int width, int height, int channels, ImBufFlags flags, bool use_all_planes)
WriteContext imb_create_write_context(const char *file_format, const ImBuf *ibuf, ImBufFlags flags, bool prefer_float)
static ImBuf * get_oiio_ibuf(ImageInput *in, const ReadContext &ctx, ImFileColorSpace &r_colorspace)
static void fill_all_channels(T *pixels, int width, int height, int components, T alpha)
static void oiio_write_prepare(const ImageSpec &file_spec, ImageBuf &orig_buf, ImageBuf &final_buf)
Vector< uint8_t > imb_oiio_write_buffer(const WriteContext &ctx, const ImageSpec &file_spec)
static void set_file_colorspace(ImFileColorSpace &r_colorspace, const ReadContext &ctx, const ImageSpec &spec, bool is_float)
BMesh Iterators.
__int64 int64_t
Definition BKE_text.h:90
const ColorSpace * IMB_colormanagement_space_from_cicp(const int cicp[4], ColorManagedFileOutput output)
Vector< char > IMB_colormanagement_space_to_icc_profile(const ColorSpace *colorspace)
BLI_INLINE void IMB_colormanagement_get_luminance_coefficients(float r_rgb[3])
static CLG_LogRef LOG_READ
bool IMB_colormanagement_space_to_cicp(const ColorSpace *colorspace, ColorManagedFileOutput output, bool rgb_matrix, int cicp[4])
void IMB_freeImBuf(ImBuf *ibuf)
unsigned char uchar
Definition BKE_text.h:58
const char * IMB_colormanagement_colorspace_get_name(const ColorSpace *colorspace)
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, ImBufFlags flags)
static CLG_LogRef LOG_WRITE
void IMB_metadata_set_field(IDProperty *metadata, const char *key, const char *value)
ocio::ColorSpace ColorSpace
Definition BLF_api.hh:42
ListBaseT< struct IDProperty > group
Definition DNA_ID.h:133
IDPropertyData data
Definition DNA_ID.h:157
const ColorSpace * colorspace
const ColorSpace * colorspace
ImbFormatOptions foptions
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
const uint8_t * byte_data() const
uint8_t * byte_data_for_write()
Definition allocimbuf.cc:60
IDProperty * metadata_for_write()
const IDProperty * metadata() const
const float * float_data() const
ImColorMode color_mode
eImbFileType ftype
float * float_data_for_write()
Definition allocimbuf.cc:79
char metadata_colorspace[IM_MAX_SPACE]
size_t write(const void *buf, size_t size) override
const char * proxytype() const override
size_t pwrite(const void *buf, size_t size, int64_t offset) override
OIIO::image_span< const std::byte > mem_span
int size() const
Definition vector.hh:130
void reserve(int new_size)
Definition vector.hh:78
void resize(int new_size)
Definition vector.hh:94