[Bf-blender-cvs] [32b861b14ac] master: Cleanup: fix deprecation warnings after OpenImageIO upgrade
Brecht Van Lommel
noreply at git.blender.org
Wed Jan 4 11:24:50 CET 2023
Commit: 32b861b14ac6e22ff93dec80ba6b4dd86d2c0611
Author: Brecht Van Lommel
Date: Tue Dec 20 02:57:02 2022 +0100
Branches: master
https://developer.blender.org/rB32b861b14ac6e22ff93dec80ba6b4dd86d2c0611
Cleanup: fix deprecation warnings after OpenImageIO upgrade
===================================================================
M intern/cycles/scene/image_oiio.cpp
M intern/cycles/session/denoising.cpp
M intern/cycles/session/merge.cpp
M intern/cycles/session/tile.cpp
M source/blender/imbuf/intern/oiio/openimageio_api.cpp
===================================================================
diff --git a/intern/cycles/scene/image_oiio.cpp b/intern/cycles/scene/image_oiio.cpp
index 5790c179d77..d0adef912be 100644
--- a/intern/cycles/scene/image_oiio.cpp
+++ b/intern/cycles/scene/image_oiio.cpp
@@ -113,14 +113,18 @@ static void oiio_load_pixels(const ImageMetaData &metadata,
if (depth <= 1) {
size_t scanlinesize = width * components * sizeof(StorageType);
- in->read_image(FileFormat,
+ in->read_image(0,
+ 0,
+ 0,
+ components,
+ FileFormat,
(uchar *)readpixels + (height - 1) * scanlinesize,
AutoStride,
-scanlinesize,
AutoStride);
}
else {
- in->read_image(FileFormat, (uchar *)readpixels);
+ in->read_image(0, 0, 0, components, FileFormat, (uchar *)readpixels);
}
if (components > 4) {
diff --git a/intern/cycles/session/denoising.cpp b/intern/cycles/session/denoising.cpp
index a9377d412e8..5086aa896d1 100644
--- a/intern/cycles/session/denoising.cpp
+++ b/intern/cycles/session/denoising.cpp
@@ -439,9 +439,12 @@ bool DenoiseImage::read_previous_pixels(const DenoiseImageLayer &layer,
{
/* Load pixels from neighboring frames, and copy them into device buffer
* with channels reshuffled. */
- size_t num_pixels = (size_t)width * (size_t)height;
+ const size_t num_pixels = (size_t)width * (size_t)height;
+ const int num_channels = in_previous->spec().nchannels;
+
array<float> neighbor_pixels(num_pixels * num_channels);
- if (!in_previous->read_image(TypeDesc::FLOAT, neighbor_pixels.data())) {
+
+ if (!in_previous->read_image(0, 0, 0, num_channels, TypeDesc::FLOAT, neighbor_pixels.data())) {
return false;
}
@@ -491,7 +494,7 @@ bool DenoiseImage::load(const string &in_filepath, string &error)
/* Read all channels into buffer. Reading all channels at once is faster
* than individually due to interleaved EXR channel storage. */
- if (!in->read_image(TypeDesc::FLOAT, pixels.data())) {
+ if (!in->read_image(0, 0, 0, num_channels, TypeDesc::FLOAT, pixels.data())) {
error = "Failed to read image: " + in_filepath;
return false;
}
diff --git a/intern/cycles/session/merge.cpp b/intern/cycles/session/merge.cpp
index 316f56630d6..e8e1dd62b4a 100644
--- a/intern/cycles/session/merge.cpp
+++ b/intern/cycles/session/merge.cpp
@@ -401,8 +401,8 @@ static bool merge_pixels(const vector<MergeImage> &images,
* faster than individually due to interleaved EXR channel storage. */
array<float> pixels;
alloc_pixels(image.in->spec(), pixels);
-
- if (!image.in->read_image(TypeDesc::FLOAT, pixels.data())) {
+ const int num_channels = image.in->spec().nchannels;
+ if (!image.in->read_image(0, 0, 0, num_channels, TypeDesc::FLOAT, pixels.data())) {
error = "Failed to read image: " + image.filepath;
return false;
}
@@ -538,6 +538,7 @@ static void read_layer_samples(vector<MergeImage> &images,
/* Load the "Debug Sample Count" pass and add the samples to the layer's sample count. */
array<float> sample_count_buffer;
sample_count_buffer.resize(in_spec.width * in_spec.height);
+
image.in->read_image(0,
0,
layer.sample_pass_offset,
diff --git a/intern/cycles/session/tile.cpp b/intern/cycles/session/tile.cpp
index 071c72a2c17..ab858e6f192 100644
--- a/intern/cycles/session/tile.cpp
+++ b/intern/cycles/session/tile.cpp
@@ -646,7 +646,8 @@ bool TileManager::read_full_buffer_from_disk(const string_view filename,
return false;
}
- if (!in->read_image(TypeDesc::FLOAT, buffers->buffer.data())) {
+ const int num_channels = in->spec().nchannels;
+ if (!in->read_image(0, 0, 0, num_channels, TypeDesc::FLOAT, buffers->buffer.data())) {
LOG(ERROR) << "Error reading pixels from the tile file " << in->geterror();
return false;
}
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index f8d00b5222f..7ed084b7144 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -73,7 +73,11 @@ static ImBuf *imb_oiio_load_image(
ibuf = IMB_allocImBuf(width, height, is_alpha ? 32 : 24, flags | IB_rect);
try {
- if (!in->read_image(TypeDesc::UINT8,
+ if (!in->read_image(0,
+ 0,
+ 0,
+ components,
+ TypeDesc::UINT8,
(uchar *)ibuf->rect + (height - 1) * scanlinesize,
AutoStride,
-scanlinesize,
@@ -113,7 +117,11 @@ static ImBuf *imb_oiio_load_image_float(
ibuf = IMB_allocImBuf(width, height, is_alpha ? 32 : 24, flags | IB_rectfloat);
try {
- if (!in->read_image(TypeDesc::FLOAT,
+ if (!in->read_image(0,
+ 0,
+ 0,
+ components,
+ TypeDesc::FLOAT,
(uchar *)ibuf->rect_float + (height - 1) * scanlinesize,
AutoStride,
-scanlinesize,
More information about the Bf-blender-cvs
mailing list