Blender V5.3
image_metadata.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2026 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include <cassert>
6#include <csetjmp>
7#include <cstdio>
8
9#include <OpenImageIO/filesystem.h>
10#include <OpenImageIO/typedesc.h>
11
12#include "util/color.h"
13#include "util/colorspace.h"
14#include "util/debug.h"
15#include "util/image.h"
16#include "util/image_maketx.h"
17#include "util/image_metadata.h"
18#include "util/log.h"
19#include "util/param.h"
20#include "util/path.h"
21#include "util/types_image.h"
22
24
26
28{
29 return channels == other.channels && width == other.width && height == other.height &&
31 (!use_transform_3d || transform_3d == other.transform_3d) && type == other.type &&
32 colorspace == other.colorspace &&
34}
35
41
46
52
54{
55 switch (type) {
58 return OIIO::TypeUInt8;
61 return OIIO::TypeUInt16;
64 return OIIO::TypeHalf;
67 return OIIO::TypeFloat;
75 assert(!"Unknown data type");
76 break;
77 }
78 return TypeUnknown;
79}
80
82{
83 switch (type) {
85 return sizeof(uint8_t);
87 return sizeof(uint8_t) * 4;
89 return sizeof(uint16_t);
91 return sizeof(uint16_t) * 4;
94 return sizeof(half);
96 return sizeof(half) * 4;
99 return sizeof(float);
101 return sizeof(float) * 3;
104 return sizeof(float) * 4;
108 break;
109 }
110
111 return 0;
112}
113
115{
116 /* For NanoVDB, the byte size is stored directly. */
117 if (is_nanovdb_type(type)) {
118 return nanovdb_byte_size;
119 }
120
121 return width * height * pixel_memory_size();
122}
123
125{
126 /* Convert used specified color spaces to one we know how to handle. */
129
131 /* Nothing to do. */
132 }
134 /* Keep sRGB colorspace stored as sRGB, to save memory and/or loading time
135 * for the common case of 8bit sRGB images like PNG. */
137 }
138 else {
139 /* If colorspace conversion needed, use half instead of short so we can
140 * represent HDR values that might result from conversion. */
143 }
146 }
147 }
148
149 /* For Blender tx files, match colorspace used by maketx to generate the file.
150 * THis is needed because TIFF files can not store arbitrary colorspace metadata. */
151 if (!tile_need_conform) {
153 }
154
155 ignore_alpha = alpha_type == IMAGE_ALPHA_IGNORE;
157
158 /* No alpha conversion needed for data, associated, no alpha or channel packed. */
160 alpha_type == IMAGE_ALPHA_IGNORE || alpha_type == IMAGE_ALPHA_CHANNEL_PACKED)
161 {
162 is_unassociated_alpha = false;
163 }
164 /* Always convert if explicitly specified as unassociated. */
165 else if (alpha_type == IMAGE_ALPHA_UNASSOCIATED) {
167 }
168 else {
169 /* Leave automatically detected is_unassociated_alpha unchanged. */
170 }
171
172 /* Convert average color to scene linear colorspace. */
175 {
178 }
179 else {
181 colorspace, &average_color.x, 1, 1, 0, true, false, ignore_alpha || is_channel_packed);
182 }
183 }
184}
185
211
212static bool load_metadata_color(const ImageSpec &spec, const char *name, float4 &r_color)
213{
214 string_view metadata_color = spec.get_string_attribute(name);
215 if (metadata_color.size() == 0) {
216 return false;
217 }
218
219 vector<float> color;
220 while (metadata_color.size()) {
221 float val;
222 if (!OIIO::Strutil::parse_float(metadata_color, val)) {
223 break;
224 }
225 color.push_back(val);
226 if (!OIIO::Strutil::parse_char(metadata_color, ',')) {
227 break;
228 }
229 }
230
231 if (color.size() != size_t(spec.nchannels)) {
232 return false;
233 }
234
235 switch (spec.nchannels) {
236 case 1:
237 r_color = make_float4(color[0], color[0], color[0], 1.0f);
238 return true;
239 case 2:
240 r_color = make_float4(color[0], color[0], color[0], color[1]);
241 return true;
242 case 3:
243 r_color = make_float4(color[0], color[1], color[2], 1.0f);
244 return true;
245 case 4:
246 r_color = make_float4(color[0], color[1], color[2], color[3]);
247 return true;
248 default:
249 return false;
250 }
251}
252
253void ImageMetaData::detect_tiles(ImageInput &input,
254 const ImageSpec &spec,
255 OIIO::string_view filepath)
256{
257 /* 1x1 file can be used as tx file regardless of how it was generated,
258 * could be a constant color tx or just regular file. */
259 is_tx_file = (width == 1 && height == 1);
260
261 if (spec.tile_width == 0) {
262 return;
263 }
264
265 const std::string software = spec.get_string_attribute("Software");
266 int tx_file_format_version = INT_MAX;
267 sscanf(software.c_str(), "Blender maketx v%d", &tx_file_format_version);
268
269 if (tx_file_format_version != INT_MAX &&
270 (tx_file_format_version < 0 || tx_file_format_version > TX_FILE_FORMAT_VERSION))
271 {
272 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath)
273 << " has tiles, but file format version " << tx_file_format_version
274 << " is not supported by this version of Cycles";
275 return;
276 }
277
278 if (tx_file_format_version == INT_MAX) {
279 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath)
280 << " has tiles, but is missing blender:TxFileFormatVersion";
281 tile_need_conform = true;
282 }
283 else if (!(channels == 1 || channels == 4)) {
284 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath)
285 << " has tiles, but expected 1 or 4 channels, found " << channels;
286 tile_need_conform = true;
287 }
288 else {
289 tile_need_conform = false;
290 }
291
292 bool has_tiles = false;
293 bool is_small_image = false;
294
295 /* Load multiple small tiles together if min_tile_size is specified. */
296 uint32_t load_tile_size = spec.tile_width;
297 uint32_t min_tile_size = DebugFlags().texture_cache.min_tile_size;
298 if (min_tile_size > 0) {
299 min_tile_size = is_power_of_two(min_tile_size) ? min_tile_size :
300 next_power_of_two(min_tile_size);
301 load_tile_size = std::max(load_tile_size, min_tile_size);
302 }
303
304 if (!is_power_of_two(spec.tile_width)) {
305 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath)
306 << " has tiles, but tile size not power of two (" << spec.tile_width << ")";
307 }
308 else if (spec.tile_width != spec.tile_height) {
309 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath)
310 << " has tiles, but tile size is not square (" << spec.tile_width << "x"
311 << spec.tile_height << ")";
312 }
313 else if (spec.tile_depth != 1) {
314 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath)
315 << " has tiles, but depth is not 1";
316 }
317 else if (spec.tile_width < KERNEL_IMAGE_TEX_PADDING * 4) {
318 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath)
319 << " has tiles, but tile size too small (found " << spec.tile_width << ", minimum "
320 << KERNEL_IMAGE_TEX_PADDING * 4 << ")";
321 }
322 else if (width < load_tile_size && height < load_tile_size) {
323 /* We don't currently supporting using tiles for images smaller than the tile
324 * size, and it's also unnecessary. To enable this, we'd need to solve the
325 * problem where interpolation at tile pixel centers does not match full image
326 * sampling due to padding offset. */
327 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath)
328 << " has tiles, but image resolution is smaller than tile size";
329 has_tiles = true;
330 is_small_image = true;
331 }
332 else {
333 tile_size = load_tile_size;
334 has_tiles = true;
335 }
336
337 /* Check if mip levels are complete. */
338 has_tiles_and_mipmaps = has_tiles && tile_size;
339
341 for (int miplevel = 0;; miplevel++) {
342 if (!input.seek_subimage(0, miplevel)) {
343 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath)
344 << " has tiles, but missing mip levels";
345 has_tiles_and_mipmaps = false;
346 break;
347 }
348
349 const int mip_width = width >> miplevel;
350 const int mip_height = height >> miplevel;
351 if (mip_width <= tile_size && mip_height <= tile_size) {
352 break;
353 }
354 }
355
356 input.seek_subimage(0, 0);
357 }
358
359 /* Tiled tx files need to either have mipmaps, or be small enough not to need mipmaps. */
360 if (has_tiles && (is_small_image || has_tiles_and_mipmaps)) {
361 is_tx_file = true;
362 }
363}
364
365bool ImageMetaData::oiio_load_metadata(OIIO::string_view filepath, OIIO::ImageSpec *r_spec)
366{
367 /* Perform preliminary checks, with meaningful logging. */
368 if (!OIIO::Filesystem::exists(filepath)) {
369 LOG_WARNING << "Image file " << filepath << " does not exist.";
370 return false;
371 }
372 if (OIIO::Filesystem::is_directory(filepath)) {
373 LOG_WARNING << "Image file " << filepath << " is a directory, cannot use as image.";
374 return false;
375 }
376
377 std::unique_ptr<ImageInput> in(ImageInput::create(filepath));
378 if (!in) {
379 LOG_WARNING << "Image file " << filepath << " failed to load.";
380 return false;
381 }
382
383 ImageSpec spec;
384 ImageSpec config;
385
386 /* Load without automatic OIIO alpha conversion. */
387 config.attribute("oiio:UnassociatedAlpha", 1);
388
389 if (!in->open(filepath, spec, config)) {
390 LOG_WARNING << "Image file " << filepath << " failed to open.";
391 return false;
392 }
393
394 if (spec.depth > 1) {
395 LOG_WARNING << "Image file " << filepath << " has unsupported depth of " << spec.depth;
396 return false;
397 }
398
399 width = spec.width;
400 height = spec.height;
402
403 /* Check the main format, and channel formats. */
404 size_t channel_size = spec.format.basesize();
405
406 bool is_float = false;
407 bool is_half = false;
408
409 if (spec.format.is_floating_point()) {
410 is_float = true;
411 }
412
413 for (size_t channel = 0; channel < spec.channelformats.size(); channel++) {
414 channel_size = max(channel_size, spec.channelformats[channel].basesize());
415 if (spec.channelformats[channel].is_floating_point()) {
416 is_float = true;
417 }
418 }
419
420 /* check if it's half float */
421 if (spec.format == TypeDesc::HALF) {
422 is_half = true;
423 }
424
425 /* set type and channels */
426 channels = spec.nchannels;
427
428 if (is_half) {
430 }
431 else if (is_float) {
433 }
434 else if (spec.format == TypeDesc::USHORT) {
436 }
437 else {
439 }
440
441 colorspace_file_format = in->format_name();
442 colorspace_file_hint = spec.get_string_attribute("oiio:ColorSpace");
443
444 is_unassociated_alpha = spec.get_int_attribute("oiio:UnassociatedAlpha", 0);
445
446 if (!is_unassociated_alpha && spec.alpha_channel != -1) {
447 /* Workaround OIIO not detecting TGA file alpha the same as Blender (since #3019).
448 * We want anything not marked as premultiplied alpha to get associated. */
449 if (strcmp(in->format_name(), "targa") == 0) {
450 is_unassociated_alpha = spec.get_int_attribute("targa:alpha_type", -1) != 4;
451 }
452 /* OIIO DDS reader never sets UnassociatedAlpha attribute. */
453 if (strcmp(in->format_name(), "dds") == 0) {
455 }
456 /* Workaround OIIO bug that sets oiio:UnassociatedAlpha on the last layer
457 * but not composite image that we read. */
458 if (strcmp(in->format_name(), "psd") == 0) {
460 }
461 }
462
463 /* Load constant or average color. */
464 if (load_metadata_color(spec, "oiio:ConstantColor", average_color)) {
465 /* Could avoid loading tiles entirely for a bit more memory saving, or even
466 * constant folding in the shader nodes. */
467 }
468 else {
469 load_metadata_color(spec, "oiio:AverageColor", average_color);
470 }
471
472 detect_tiles(*in, spec, filepath);
473
474 LOG_DEBUG << "Image " << OIIO::Filesystem::filename(filepath) << ", " << width << "x" << height
475 << ", " << (tile_size ? "tiled" : "untiled");
476
477 if (r_spec) {
478 *r_spec = spec;
479 }
480
481 return true;
482}
483
484template<typename StorageType>
486 StorageType *pixels,
487 const int64_t width,
488 const int64_t height,
489 const int64_t x_stride,
490 const int64_t in_y_stride,
491 const int64_t out_y_stride)
492{
493 /* The kernel can handle 1 and 4 channel images. Anything that is not a single
494 * channel image is converted to RGBA format. */
495 const int channels = metadata.channels;
496 const bool is_rgba = metadata.is_rgba();
497
498 if (is_rgba) {
499 const StorageType one = util_image_cast_from_float<StorageType>(1.0f);
500
501 if (channels == 2) {
502 /* Grayscale + alpha to RGBA. */
503 for (int64_t j = height - 1; j >= 0; j--) {
504 StorageType *out_pixels = pixels + j * out_y_stride;
505 StorageType *in_pixels = pixels + j * in_y_stride;
506 for (int64_t i = width - 1; i >= 0; i--) {
507 out_pixels[i * 4 + 3] = in_pixels[i * x_stride + 1];
508 out_pixels[i * 4 + 2] = in_pixels[i * x_stride + 0];
509 out_pixels[i * 4 + 1] = in_pixels[i * x_stride + 0];
510 out_pixels[i * 4 + 0] = in_pixels[i * x_stride + 0];
511 }
512 }
513 }
514 else if (channels == 3) {
515 /* RGB to RGBA. */
516 for (int64_t j = height - 1; j >= 0; j--) {
517 StorageType *out_pixels = pixels + j * out_y_stride;
518 StorageType *in_pixels = pixels + j * in_y_stride;
519 for (int64_t i = width - 1; i >= 0; i--) {
520 out_pixels[i * 4 + 3] = one;
521 out_pixels[i * 4 + 2] = in_pixels[i * x_stride + 2];
522 out_pixels[i * 4 + 1] = in_pixels[i * x_stride + 1];
523 out_pixels[i * 4 + 0] = in_pixels[i * x_stride + 0];
524 }
525 }
526 }
527 else if (channels == 1) {
528 /* Grayscale to RGBA. */
529 for (int64_t j = height - 1; j >= 0; j--) {
530 StorageType *out_pixels = pixels + j * out_y_stride;
531 StorageType *in_pixels = pixels + j * in_y_stride;
532 for (int64_t i = width - 1; i >= 0; i--) {
533 out_pixels[i * 4 + 3] = one;
534 out_pixels[i * 4 + 2] = in_pixels[i * x_stride];
535 out_pixels[i * 4 + 1] = in_pixels[i * x_stride];
536 out_pixels[i * 4 + 0] = in_pixels[i * x_stride];
537 }
538 }
539 }
540
541 /* Associate alpha, after conversion to RGBA so it works for
542 * grayscale + alpha too. */
543 if (metadata.is_unassociated_alpha && channels != 3) {
544 for (int64_t j = 0; j < height; j++) {
545 StorageType *pixel = pixels + j * out_y_stride;
546 for (int64_t i = 0; i < width; i++, pixel += 4) {
547 const StorageType alpha = pixel[3];
548 pixel[0] = util_image_multiply_native(pixel[0], alpha);
549 pixel[1] = util_image_multiply_native(pixel[1], alpha);
550 pixel[2] = util_image_multiply_native(pixel[2], alpha);
551 }
552 }
553 }
554
555 /* Disable alpha if requested by the user. */
556 if (metadata.ignore_alpha) {
557 for (int64_t j = 0; j < height; j++) {
558 StorageType *out_pixels = pixels + j * out_y_stride;
559 for (int64_t i = 0; i < width; i++) {
560 out_pixels[i * 4 + 3] = one;
561 }
562 }
563 }
564 }
565
566 if (metadata.colorspace != u_colorspace_scene_linear &&
568 metadata.colorspace != u_colorspace_data)
569 {
570 /* Convert to scene linear. */
572 pixels,
573 width,
574 height,
575 out_y_stride,
576 is_rgba,
578 metadata.ignore_alpha || metadata.is_channel_packed);
579 }
580
581 /* Make sure we don't have buggy values. */
582 if constexpr (std::is_same_v<float, StorageType> || std::is_same_v<half, StorageType>) {
583 /* For RGBA buffers we put all channels to 0 if either of them is not
584 * finite. This way we avoid possible artifacts caused by fully changed
585 * hue. */
586 if (is_rgba) {
587 for (int64_t j = 0; j < height; j++) {
588 StorageType *pixel = pixels + j * out_y_stride;
589 for (int64_t i = 0; i < width; i++, pixel += 4) {
590 if (!util_image_is_finite(pixel[0]) || !util_image_is_finite(pixel[1]) ||
591 !util_image_is_finite(pixel[2]) || !util_image_is_finite(pixel[3]))
592 {
593 pixel[0] = 0;
594 pixel[1] = 0;
595 pixel[2] = 0;
596 pixel[3] = 0;
597 }
598 }
599 }
600 }
601 else {
602 for (int64_t j = 0; j < height; j++) {
603 StorageType *pixel = pixels + j * out_y_stride;
604 for (int64_t i = 0; i < width; i++, pixel++) {
605 if (!util_image_is_finite(pixel[0])) {
606 pixel[0] = 0;
607 }
608 }
609 }
610 }
611 }
612}
613
615 const int64_t width,
616 const int64_t height,
617 const int64_t x_stride,
618 const int64_t in_y_stride,
619 const int64_t out_y_stride) const
620{
621 switch (type) {
625 *this, static_cast<uchar *>(pixels), width, height, x_stride, in_y_stride, out_y_stride);
626 break;
630 static_cast<uint16_t *>(pixels),
631 width,
632 height,
633 x_stride,
634 in_y_stride,
635 out_y_stride);
636 break;
640 *this, static_cast<half *>(pixels), width, height, x_stride, in_y_stride, out_y_stride);
641 break;
645 *this, static_cast<float *>(pixels), width, height, x_stride, in_y_stride, out_y_stride);
646 break;
654 break;
655 }
656}
657
658void ImageMetaData::conform_pixels(void *pixels) const
659{
660 conform_pixels(pixels, width, height, channels, width * channels, width * (is_rgba() ? 4 : 1));
661}
662
663template<TypeDesc::BASETYPE FileFormat, typename StorageType>
664static bool load_pixels_oiio(const ImageMetaData &metadata,
665 const std::unique_ptr<ImageInput> &in,
666 StorageType *pixels,
667 const bool flip_y)
668{
669 const int64_t width = metadata.width;
670 const int64_t height = metadata.height;
671 const int channels = metadata.channels;
672 const int64_t num_pixels = width * height;
673 int64_t read_y_stride = width * channels * sizeof(StorageType);
674
675 /* Read pixels through OpenImageIO. */
676 StorageType *readpixels = pixels;
677 vector<StorageType> tmppixels;
678 if (channels > 4) {
679 tmppixels.resize(num_pixels * channels);
680 readpixels = &tmppixels[0];
681 }
682
683 if (!in->read_image(0,
684 0,
685 0,
686 channels,
687 FileFormat,
688 (flip_y) ? (uchar *)readpixels + (height - 1) * read_y_stride :
689 (uchar *)readpixels,
690 AutoStride,
691 (flip_y) ? -read_y_stride : read_y_stride,
692 AutoStride))
693 {
694 return false;
695 }
696
697 if (channels > 4) {
698 for (int64_t j = 0; j < height; j++) {
699 const StorageType *in_pixels = tmppixels.data() + j * width * channels;
700 StorageType *out_pixels = pixels + j * width * 4;
701 for (int64_t i = 0; i < width; i++) {
702 out_pixels[i * 4 + 3] = in_pixels[i * channels + 3];
703 out_pixels[i * 4 + 2] = in_pixels[i * channels + 2];
704 out_pixels[i * 4 + 1] = in_pixels[i * channels + 1];
705 out_pixels[i * 4 + 0] = in_pixels[i * channels + 0];
706 }
707 }
708 tmppixels.clear();
709 }
710
711 return true;
712}
713
714bool ImageMetaData::oiio_load_pixels(OIIO::string_view filepath,
715 void *pixels,
716 const bool flip_y) const
717{
718 /* load image from file through OIIO */
719 std::unique_ptr<ImageInput> in = ImageInput::create(filepath);
720 if (!in) {
721 return false;
722 }
723
724 ImageSpec spec = ImageSpec();
725 ImageSpec config = ImageSpec();
726
727 /* Load without automatic OIIO alpha conversion, we do it ourselves. OIIO
728 * will associate alpha in the 8bit buffer for PNGs, which leads to too
729 * much precision loss when we load it as half float to do a color-space transform. */
730 config.attribute("oiio:UnassociatedAlpha", 1);
731
732 if (!in->open(filepath, spec, config)) {
733 return false;
734 }
735
736 if (spec.depth > 1) {
737 LOG_WARNING << "Image file " << filepath << " has unsupported depth " << spec.depth;
738 return false;
739 }
740
741 switch (type) {
744 return load_pixels_oiio<TypeDesc::UINT8, uchar>(*this, in, (uchar *)pixels, flip_y);
747 return load_pixels_oiio<TypeDesc::USHORT, uint16_t>(*this, in, (uint16_t *)pixels, flip_y);
750 return load_pixels_oiio<TypeDesc::HALF, half>(*this, in, (half *)pixels, flip_y);
753 return load_pixels_oiio<TypeDesc::FLOAT, float>(*this, in, (float *)pixels, flip_y);
761 break;
762 }
763
764 return false;
765}
766
long long int int64_t
btScalar max
static bool colorspace_is_data(ustring colorspace)
static ustring detect_known_colorspace(ustring colorspace, const char *file_colorspace, const char *file_format, bool is_float)
static void to_scene_linear(ustring colorspace, T *pixels, const int64_t width, const int64_t height, const int64_t y_stride, bool is_rgba, bool compress_as_srgb, bool ignore_alpha)
TextureCache texture_cache
Definition debug.h:158
ImageDataType type
string colorspace_file_hint
void finalize(const ImageAlphaType alpha_type=IMAGE_ALPHA_AUTO)
bool oiio_load_metadata(OIIO::string_view filepath, OIIO::ImageSpec *r_spec=nullptr)
bool is_half() const
bool has_tiles_and_mipmaps
bool oiio_load_pixels(OIIO::string_view filepath, void *pixels, const bool flip_y=true) const
bool is_float() const
TypeDesc typedesc() const
Transform transform_3d
bool is_rgba() const
int64_t nanovdb_byte_size
size_t memory_size() const
size_t pixel_memory_size() const
bool is_compressible_as_srgb
uint32_t tile_size
void conform_pixels(void *pixels) const
bool is_unassociated_alpha
void detect_tiles(OIIO::ImageInput &input, const OIIO::ImageSpec &spec, OIIO::string_view filepath)
bool operator==(const ImageMetaData &other) const
const char * colorspace_file_format
Definition half.h:29
ccl_device float4 color_srgb_to_linear_v4(const float4 c)
Definition color.h:335
T util_image_is_finite(T a)
T util_image_cast_from_float(const float value)
T util_image_multiply_native(T a, T b)
#define CCL_NAMESPACE_END
#define assert(assertion)
#define INT_MAX
unsigned int uchar
bool is_zero(float3x3 a)
ustring make_tx_get_file_colorspace(const ImageMetaData &metadata)
#define TX_FILE_FORMAT_VERSION
static bool load_metadata_color(const ImageSpec &spec, const char *name, float4 &r_color)
static bool load_pixels_oiio(const ImageMetaData &metadata, const std::unique_ptr< ImageInput > &in, StorageType *pixels, const bool flip_y)
static void conform_pixels_to_metadata_type(const ImageMetaData &metadata, StorageType *pixels, const int64_t width, const int64_t height, const int64_t x_stride, const int64_t in_y_stride, const int64_t out_y_stride)
#define LOG_DEBUG
Definition log.h:107
#define LOG_WARNING
Definition log.h:103
ccl_device_inline uint next_power_of_two(const uint x)
Definition math_base.h:832
#define KERNEL_IMAGE_TEX_PADDING
#define make_float4
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
float x
Definition sky_math.h:225
ccl_device_inline bool is_power_of_two(const size_t x)
Definition types_base.h:78
@ IMAGE_DATA_NUM_TYPES
Definition types_image.h:51
@ IMAGE_DATA_TYPE_BYTE
Definition types_image.h:40
@ IMAGE_DATA_TYPE_FLOAT
Definition types_image.h:39
@ IMAGE_DATA_TYPE_NANOVDB_FP16
Definition types_image.h:48
@ IMAGE_DATA_TYPE_FLOAT4
Definition types_image.h:36
@ IMAGE_DATA_TYPE_USHORT4
Definition types_image.h:42
@ IMAGE_DATA_TYPE_USHORT
Definition types_image.h:43
@ IMAGE_DATA_TYPE_NANOVDB_EMPTY
Definition types_image.h:49
@ IMAGE_DATA_TYPE_NANOVDB_FLOAT
Definition types_image.h:44
@ IMAGE_DATA_TYPE_NANOVDB_FLOAT3
Definition types_image.h:45
@ IMAGE_DATA_TYPE_HALF
Definition types_image.h:41
@ IMAGE_DATA_TYPE_BYTE4
Definition types_image.h:37
@ IMAGE_DATA_TYPE_HALF4
Definition types_image.h:38
@ IMAGE_DATA_TYPE_NANOVDB_FLOAT4
Definition types_image.h:46
@ IMAGE_DATA_TYPE_NANOVDB_FPN
Definition types_image.h:47
ImageAlphaType
Definition types_image.h:61
@ IMAGE_ALPHA_ASSOCIATED
Definition types_image.h:63
@ IMAGE_ALPHA_CHANNEL_PACKED
Definition types_image.h:64
@ IMAGE_ALPHA_IGNORE
Definition types_image.h:65
@ IMAGE_ALPHA_UNASSOCIATED
Definition types_image.h:62
ccl_device_inline bool is_nanovdb_type(int type)
Definition types_image.h:54
ustring u_colorspace_scene_linear_srgb
ustring u_colorspace_scene_linear
ustring u_colorspace_data