From 8bccc7d8611a7379adc8d981bca18938ab0a5c27 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 22 Mar 2022 00:54:42 +0100 Subject: Cleanup: add proper IMB_openexr.h instead of including file from intern/ --- source/blender/imbuf/CMakeLists.txt | 1 + source/blender/imbuf/IMB_openexr.h | 110 +++++++++++++++++++++ source/blender/imbuf/intern/openexr/CMakeLists.txt | 2 - .../blender/imbuf/intern/openexr/openexr_api.cpp | 3 +- .../blender/imbuf/intern/openexr/openexr_multi.h | 110 --------------------- .../blender/imbuf/intern/openexr/openexr_stub.cpp | 3 +- 6 files changed, 114 insertions(+), 115 deletions(-) create mode 100644 source/blender/imbuf/IMB_openexr.h delete mode 100644 source/blender/imbuf/intern/openexr/openexr_multi.h (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index 294aa8bbb9c..25961e6e1d5 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -57,6 +57,7 @@ set(SRC IMB_imbuf_types.h IMB_metadata.h IMB_moviecache.h + IMB_openexr.h IMB_thumbs.h intern/IMB_allocimbuf.h intern/IMB_anim.h diff --git a/source/blender/imbuf/IMB_openexr.h b/source/blender/imbuf/IMB_openexr.h new file mode 100644 index 00000000000..a41053b99bf --- /dev/null +++ b/source/blender/imbuf/IMB_openexr.h @@ -0,0 +1,110 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright 2006 Blender Foundation. All rights reserved. */ + +/** \file + * \ingroup imbuf + */ + +#pragma once + +/* API for reading and writing multilayer EXR files. */ + +/* XXX layer+pass name max 64? */ +/* This api also supports max 8 channels per pass now. easy to fix! */ +#define EXR_LAY_MAXNAME 64 +#define EXR_PASS_MAXNAME 64 +#define EXR_VIEW_MAXNAME 64 +#define EXR_TOT_MAXNAME 64 +#define EXR_PASS_MAXCHAN 24 + +#ifdef __cplusplus +extern "C" { +#endif + +struct StampData; + +void *IMB_exr_get_handle(void); +void *IMB_exr_get_handle_name(const char *name); + +/** + * Adds flattened #ExrChannel's + * `xstride`, `ystride` and `rect` can be done in set_channel too, for tile writing. + * \param passname: Does not include view. + */ +void IMB_exr_add_channel(void *handle, + const char *layname, + const char *passname, + const char *view, + int xstride, + int ystride, + float *rect, + bool use_half_float); + +/** + * Read from file. + */ +bool IMB_exr_begin_read( + void *handle, const char *filename, int *width, int *height, bool parse_channels); +/** + * Used for output files (from #RenderResult) (single and multi-layer, single and multi-view). + */ +bool IMB_exr_begin_write(void *handle, + const char *filename, + int width, + int height, + int compress, + const struct StampData *stamp); +/** + * Only used for writing temp. render results (not image files) + * (FSA and Save Buffers). + */ +void IMB_exrtile_begin_write( + void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley); + +/** + * Still clumsy name handling, layers/channels can be ordered as list in list later. + * + * \param passname: Here is the raw channel name without the layer. + */ +void IMB_exr_set_channel(void *handle, + const char *layname, + const char *passname, + int xstride, + int ystride, + float *rect); +float *IMB_exr_channel_rect(void *handle, + const char *layname, + const char *passname, + const char *view); + +void IMB_exr_read_channels(void *handle); +void IMB_exr_write_channels(void *handle); +/** + * Temporary function, used for FSA and Save Buffers. + * called once per `tile * view`. + */ +void IMB_exrtile_write_channels( + void *handle, int partx, int party, int level, const char *viewname, bool empty); +void IMB_exr_clear_channels(void *handle); + +void IMB_exr_multilayer_convert(void *handle, + void *base, + void *(*addview)(void *base, const char *str), + void *(*addlayer)(void *base, const char *str), + void (*addpass)(void *base, + void *lay, + const char *str, + float *rect, + int totchan, + const char *chan_id, + const char *view)); + +void IMB_exr_close(void *handle); + +void IMB_exr_add_view(void *handle, const char *name); + +bool IMB_exr_has_multilayer(void *handle); + +#ifdef __cplusplus +} /* extern "C" */ +#endif diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt index 08b17764d12..681176d8cc4 100644 --- a/source/blender/imbuf/intern/openexr/CMakeLists.txt +++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt @@ -18,8 +18,6 @@ set(INC_SYS set(SRC openexr_api.h - openexr_multi.h - openexr_api.cpp ) diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index d9b623cb765..aff9257d1f2 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -90,8 +90,7 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void) #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" #include "IMB_metadata.h" - -#include "openexr_multi.h" +#include "IMB_openexr.h" using namespace Imf; using namespace Imath; diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h deleted file mode 100644 index f5a2f983b18..00000000000 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ /dev/null @@ -1,110 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later - * Copyright 2006 Blender Foundation. All rights reserved. */ - -/** \file - * \ingroup openexr - */ - -#pragma once - -/* Experiment with more advanced EXR API. */ - -/* XXX layer+pass name max 64? */ -/* This api also supports max 8 channels per pass now. easy to fix! */ -#define EXR_LAY_MAXNAME 64 -#define EXR_PASS_MAXNAME 64 -#define EXR_VIEW_MAXNAME 64 -#define EXR_TOT_MAXNAME 64 -#define EXR_PASS_MAXCHAN 24 - -#ifdef __cplusplus -extern "C" { -#endif - -struct StampData; - -void *IMB_exr_get_handle(void); -void *IMB_exr_get_handle_name(const char *name); - -/** - * Adds flattened #ExrChannel's - * `xstride`, `ystride` and `rect` can be done in set_channel too, for tile writing. - * \param passname: Does not include view. - */ -void IMB_exr_add_channel(void *handle, - const char *layname, - const char *passname, - const char *view, - int xstride, - int ystride, - float *rect, - bool use_half_float); - -/** - * Read from file. - */ -bool IMB_exr_begin_read( - void *handle, const char *filename, int *width, int *height, bool parse_channels); -/** - * Used for output files (from #RenderResult) (single and multi-layer, single and multi-view). - */ -bool IMB_exr_begin_write(void *handle, - const char *filename, - int width, - int height, - int compress, - const struct StampData *stamp); -/** - * Only used for writing temp. render results (not image files) - * (FSA and Save Buffers). - */ -void IMB_exrtile_begin_write( - void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley); - -/** - * Still clumsy name handling, layers/channels can be ordered as list in list later. - * - * \param passname: Here is the raw channel name without the layer. - */ -void IMB_exr_set_channel(void *handle, - const char *layname, - const char *passname, - int xstride, - int ystride, - float *rect); -float *IMB_exr_channel_rect(void *handle, - const char *layname, - const char *passname, - const char *view); - -void IMB_exr_read_channels(void *handle); -void IMB_exr_write_channels(void *handle); -/** - * Temporary function, used for FSA and Save Buffers. - * called once per `tile * view`. - */ -void IMB_exrtile_write_channels( - void *handle, int partx, int party, int level, const char *viewname, bool empty); -void IMB_exr_clear_channels(void *handle); - -void IMB_exr_multilayer_convert(void *handle, - void *base, - void *(*addview)(void *base, const char *str), - void *(*addlayer)(void *base, const char *str), - void (*addpass)(void *base, - void *lay, - const char *str, - float *rect, - int totchan, - const char *chan_id, - const char *view)); - -void IMB_exr_close(void *handle); - -void IMB_exr_add_view(void *handle, const char *name); - -bool IMB_exr_has_multilayer(void *handle); - -#ifdef __cplusplus -} /* extern "C" */ -#endif diff --git a/source/blender/imbuf/intern/openexr/openexr_stub.cpp b/source/blender/imbuf/intern/openexr/openexr_stub.cpp index 4ca4a8313b1..2a655360aa5 100644 --- a/source/blender/imbuf/intern/openexr/openexr_stub.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_stub.cpp @@ -6,7 +6,8 @@ */ #include "openexr_api.h" -#include "openexr_multi.h" + +#include "IMB_openexr.h" void *IMB_exr_get_handle(void) { -- cgit v1.2.3