Cleanup: reduce C-isms in imbuf headers

Pull Request: https://projects.blender.org/blender/blender/pulls/117327
This commit is contained in:
Aras Pranckevicius 2024-01-19 13:48:04 +02:00 committed by Gitea
parent a705259b4b
commit d2e4da0f5b
17 changed files with 445 additions and 706 deletions

View File

@ -6,9 +6,7 @@
#include "BKE_node.hh"
#include "COM_SMAAAreaTexture.h"
extern "C" {
#include "IMB_colormanagement.hh"
}
namespace blender::compositor {

View File

@ -56,6 +56,7 @@ set(SRC
IMB_colormanagement.hh
IMB_imbuf.hh
IMB_imbuf_enums.h
IMB_imbuf_types.hh
IMB_metadata.hh
IMB_moviecache.hh

View File

@ -1,4 +1,4 @@
/* SPDX-FileCopyrightText: 2012 Blender Authors
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
@ -11,10 +11,6 @@
#include "BLI_compiler_compat.h"
#include "BLI_sys_types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define BCM_CONFIG_FILE "config.ocio"
struct ColorManagedColorspaceSettings;
@ -34,24 +30,23 @@ struct ColorSpace;
/** \name Generic Functions
* \{ */
void IMB_colormanagement_check_file_config(struct Main *bmain);
void IMB_colormanagement_check_file_config(Main *bmain);
void IMB_colormanagement_validate_settings(
const struct ColorManagedDisplaySettings *display_settings,
struct ColorManagedViewSettings *view_settings);
void IMB_colormanagement_validate_settings(const ColorManagedDisplaySettings *display_settings,
ColorManagedViewSettings *view_settings);
const char *IMB_colormanagement_role_colorspace_name_get(int role);
void IMB_colormanagement_check_is_data(struct ImBuf *ibuf, const char *name);
void IMB_colormanagegent_copy_settings(struct ImBuf *ibuf_src, struct ImBuf *ibuf_dst);
void IMB_colormanagement_assign_float_colorspace(struct ImBuf *ibuf, const char *name);
void IMB_colormanagement_assign_byte_colorspace(struct ImBuf *ibuf, const char *name);
void IMB_colormanagement_check_is_data(ImBuf *ibuf, const char *name);
void IMB_colormanagegent_copy_settings(ImBuf *ibuf_src, ImBuf *ibuf_dst);
void IMB_colormanagement_assign_float_colorspace(ImBuf *ibuf, const char *name);
void IMB_colormanagement_assign_byte_colorspace(ImBuf *ibuf, const char *name);
const char *IMB_colormanagement_get_float_colorspace(struct ImBuf *ibuf);
const char *IMB_colormanagement_get_rect_colorspace(struct ImBuf *ibuf);
const char *IMB_colormanagement_get_float_colorspace(ImBuf *ibuf);
const char *IMB_colormanagement_get_rect_colorspace(ImBuf *ibuf);
bool IMB_colormanagement_space_is_data(struct ColorSpace *colorspace);
bool IMB_colormanagement_space_is_scene_linear(struct ColorSpace *colorspace);
bool IMB_colormanagement_space_is_srgb(struct ColorSpace *colorspace);
bool IMB_colormanagement_space_is_data(ColorSpace *colorspace);
bool IMB_colormanagement_space_is_scene_linear(ColorSpace *colorspace);
bool IMB_colormanagement_space_is_srgb(ColorSpace *colorspace);
bool IMB_colormanagement_space_name_is_data(const char *name);
bool IMB_colormanagement_space_name_is_scene_linear(const char *name);
bool IMB_colormanagement_space_name_is_srgb(const char *name);
@ -157,39 +152,33 @@ void IMB_colormanagement_transform_v4(float pixel[4],
* Convert pixel from specified by descriptor color space to scene linear
* used by performance-critical areas such as renderer and baker.
*/
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3],
struct ColorSpace *colorspace);
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], ColorSpace *colorspace);
void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4],
bool predivide,
struct ColorSpace *colorspace);
ColorSpace *colorspace);
/**
* Same as #IMB_colormanagement_colorspace_to_scene_linear_v4,
* but converts colors in opposite direction.
*/
void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3],
struct ColorSpace *colorspace);
void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], ColorSpace *colorspace);
void IMB_colormanagement_colorspace_to_scene_linear(float *buffer,
int width,
int height,
int channels,
struct ColorSpace *colorspace,
bool predivide);
void IMB_colormanagement_colorspace_to_scene_linear(
float *buffer, int width, int height, int channels, ColorSpace *colorspace, bool predivide);
void IMB_colormanagement_imbuf_to_byte_texture(unsigned char *out_buffer,
int x,
int y,
int width,
int height,
const struct ImBuf *ibuf,
const ImBuf *ibuf,
bool store_premultiplied);
void IMB_colormanagement_imbuf_to_float_texture(float *out_buffer,
int offset_x,
int offset_y,
int width,
int height,
const struct ImBuf *ibuf,
const ImBuf *ibuf,
bool store_premultiplied);
/**
@ -220,31 +209,29 @@ BLI_INLINE void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3
* used by performance-critical areas such as color-related widgets where we want to reduce
* amount of per-widget allocations.
*/
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3],
struct ColorManagedDisplay *display);
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], ColorManagedDisplay *display);
/**
* Same as #IMB_colormanagement_scene_linear_to_display_v3,
* but converts color in opposite direction.
*/
void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3],
struct ColorManagedDisplay *display);
void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3], ColorManagedDisplay *display);
void IMB_colormanagement_pixel_to_display_space_v4(
float result[4],
const float pixel[4],
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings);
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings);
void IMB_colormanagement_pixel_to_display_space_v3(
float result[3],
const float pixel[3],
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings);
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings);
void IMB_colormanagement_imbuf_make_display_space(
struct ImBuf *ibuf,
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings);
ImBuf *ibuf,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings);
/**
* Prepare image buffer to be saved on disk, applying color management if needed
@ -258,10 +245,10 @@ void IMB_colormanagement_imbuf_make_display_space(
* in image format write callback and if float_colorspace is not NULL, no color
* space transformation should be applied on this buffer.
*/
struct ImBuf *IMB_colormanagement_imbuf_for_write(struct ImBuf *ibuf,
bool save_as_render,
bool allocate_result,
const struct ImageFormatData *image_format);
ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
bool save_as_render,
bool allocate_result,
const ImageFormatData *image_format);
/** \} */
@ -270,42 +257,38 @@ struct ImBuf *IMB_colormanagement_imbuf_for_write(struct ImBuf *ibuf,
* \{ */
void IMB_colormanagement_display_settings_from_ctx(
const struct bContext *C,
struct ColorManagedViewSettings **r_view_settings,
struct ColorManagedDisplaySettings **r_display_settings);
const bContext *C,
ColorManagedViewSettings **r_view_settings,
ColorManagedDisplaySettings **r_display_settings);
/**
* Acquire display buffer for given image buffer using specified view and display settings.
*/
unsigned char *IMB_display_buffer_acquire(
struct ImBuf *ibuf,
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings,
void **cache_handle);
unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings,
void **cache_handle);
/**
* Same as #IMB_display_buffer_acquire but gets view and display settings from context.
*/
unsigned char *IMB_display_buffer_acquire_ctx(const struct bContext *C,
struct ImBuf *ibuf,
void **cache_handle);
unsigned char *IMB_display_buffer_acquire_ctx(const bContext *C, ImBuf *ibuf, void **cache_handle);
void IMB_display_buffer_transform_apply(unsigned char *display_buffer,
float *linear_buffer,
int width,
int height,
int channels,
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings,
bool predivide);
void IMB_display_buffer_transform_apply_float(
float *float_display_buffer,
float *linear_buffer,
int width,
int height,
int channels,
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings,
bool predivide);
void IMB_display_buffer_transform_apply_float(float *float_display_buffer,
float *linear_buffer,
int width,
int height,
int channels,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings,
bool predivide);
void IMB_display_buffer_release(void *cache_handle);
@ -321,10 +304,10 @@ const char *IMB_colormanagement_display_get_default_name(void);
/**
* Used by performance-critical pixel processing areas, such as color widgets.
*/
struct ColorManagedDisplay *IMB_colormanagement_display_get_named(const char *name);
ColorManagedDisplay *IMB_colormanagement_display_get_named(const char *name);
const char *IMB_colormanagement_display_get_none_name(void);
const char *IMB_colormanagement_display_get_default_view_transform_name(
struct ColorManagedDisplay *display);
ColorManagedDisplay *display);
/** \} */
@ -355,12 +338,12 @@ const char *IMB_colormanagement_look_validate_for_view(const char *view_name,
int IMB_colormanagement_colorspace_get_named_index(const char *name);
const char *IMB_colormanagement_colorspace_get_indexed_name(int index);
const char *IMB_colormanagement_colorspace_get_name(const struct ColorSpace *colorspace);
const char *IMB_colormanagement_colorspace_get_name(const ColorSpace *colorspace);
const char *IMB_colormanagement_view_get_default_name(const char *display_name);
const char *IMB_colormanagement_view_get_raw_or_default_name(const char *display_name);
void IMB_colormanagement_colorspace_from_ibuf_ftype(
struct ColorManagedColorspaceSettings *colorspace_settings, struct ImBuf *ibuf);
ColorManagedColorspaceSettings *colorspace_settings, ImBuf *ibuf);
/** \} */
@ -368,14 +351,14 @@ void IMB_colormanagement_colorspace_from_ibuf_ftype(
/** \name RNA Helper Functions
* \{ */
void IMB_colormanagement_display_items_add(struct EnumPropertyItem **items, int *totitem);
void IMB_colormanagement_view_items_add(struct EnumPropertyItem **items,
void IMB_colormanagement_display_items_add(EnumPropertyItem **items, int *totitem);
void IMB_colormanagement_view_items_add(EnumPropertyItem **items,
int *totitem,
const char *display_name);
void IMB_colormanagement_look_items_add(struct EnumPropertyItem **items,
void IMB_colormanagement_look_items_add(EnumPropertyItem **items,
int *totitem,
const char *view_name);
void IMB_colormanagement_colorspace_items_add(struct EnumPropertyItem **items, int *totitem);
void IMB_colormanagement_colorspace_items_add(EnumPropertyItem **items, int *totitem);
/** \} */
@ -383,35 +366,35 @@ void IMB_colormanagement_colorspace_items_add(struct EnumPropertyItem **items, i
/** \name Tile-based Buffer Management
* \{ */
void IMB_partial_display_buffer_update(struct ImBuf *ibuf,
void IMB_partial_display_buffer_update(ImBuf *ibuf,
const float *linear_buffer,
const unsigned char *byte_buffer,
int stride,
int offset_x,
int offset_y,
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings,
int xmin,
int ymin,
int xmax,
int ymax);
void IMB_partial_display_buffer_update_threaded(
struct ImBuf *ibuf,
ImBuf *ibuf,
const float *linear_buffer,
const unsigned char *byte_buffer,
int stride,
int offset_x,
int offset_y,
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings,
int xmin,
int ymin,
int xmax,
int ymax);
void IMB_partial_display_buffer_update_delayed(
struct ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax);
ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax);
/** \} */
@ -419,33 +402,31 @@ void IMB_partial_display_buffer_update_delayed(
/** \name Pixel Processor Functions
* \{ */
struct ColormanageProcessor *IMB_colormanagement_display_processor_new(
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings);
struct ColormanageProcessor *IMB_colormanagement_colorspace_processor_new(
const char *from_colorspace, const char *to_colorspace);
bool IMB_colormanagement_processor_is_noop(struct ColormanageProcessor *cm_processor);
void IMB_colormanagement_processor_apply_v4(struct ColormanageProcessor *cm_processor,
float pixel[4]);
void IMB_colormanagement_processor_apply_v4_predivide(struct ColormanageProcessor *cm_processor,
ColormanageProcessor *IMB_colormanagement_display_processor_new(
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings);
ColormanageProcessor *IMB_colormanagement_colorspace_processor_new(const char *from_colorspace,
const char *to_colorspace);
bool IMB_colormanagement_processor_is_noop(ColormanageProcessor *cm_processor);
void IMB_colormanagement_processor_apply_v4(ColormanageProcessor *cm_processor, float pixel[4]);
void IMB_colormanagement_processor_apply_v4_predivide(ColormanageProcessor *cm_processor,
float pixel[4]);
void IMB_colormanagement_processor_apply_v3(struct ColormanageProcessor *cm_processor,
float pixel[3]);
void IMB_colormanagement_processor_apply_pixel(struct ColormanageProcessor *cm_processor,
void IMB_colormanagement_processor_apply_v3(ColormanageProcessor *cm_processor, float pixel[3]);
void IMB_colormanagement_processor_apply_pixel(ColormanageProcessor *cm_processor,
float *pixel,
int channels);
void IMB_colormanagement_processor_apply(struct ColormanageProcessor *cm_processor,
void IMB_colormanagement_processor_apply(ColormanageProcessor *cm_processor,
float *buffer,
int width,
int height,
int channels,
bool predivide);
void IMB_colormanagement_processor_apply_byte(struct ColormanageProcessor *cm_processor,
void IMB_colormanagement_processor_apply_byte(ColormanageProcessor *cm_processor,
unsigned char *buffer,
int width,
int height,
int channels);
void IMB_colormanagement_processor_free(struct ColormanageProcessor *cm_processor);
void IMB_colormanagement_processor_free(ColormanageProcessor *cm_processor);
/** \} */
@ -456,15 +437,14 @@ void IMB_colormanagement_processor_free(struct ColormanageProcessor *cm_processo
/**
* Test if GLSL drawing is supported for combination of graphics card and this configuration.
*/
bool IMB_colormanagement_support_glsl_draw(const struct ColorManagedViewSettings *view_settings);
bool IMB_colormanagement_support_glsl_draw(const ColorManagedViewSettings *view_settings);
/**
* Configures GLSL shader for conversion from scene linear to display space.
*/
bool IMB_colormanagement_setup_glsl_draw(
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings,
float dither,
bool predivide);
bool IMB_colormanagement_setup_glsl_draw(const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings,
float dither,
bool predivide);
/**
* \note Same as IMB_colormanagement_setup_glsl_draw,
* but display space conversion happens from a specified space.
@ -482,24 +462,22 @@ bool IMB_colormanagement_setup_glsl_draw(
* only need to display given image buffer
*/
bool IMB_colormanagement_setup_glsl_draw_from_space(
const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings,
struct ColorSpace *colorspace,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings,
ColorSpace *colorspace,
float dither,
bool predivide,
bool do_overlay_merge);
/**
* Same as setup_glsl_draw, but color management settings are guessing from a given context.
*/
bool IMB_colormanagement_setup_glsl_draw_ctx(const struct bContext *C,
float dither,
bool predivide);
bool IMB_colormanagement_setup_glsl_draw_ctx(const bContext *C, float dither, bool predivide);
/**
* Same as `setup_glsl_draw_from_space`,
* but color management settings are guessing from a given context.
*/
bool IMB_colormanagement_setup_glsl_draw_from_space_ctx(const struct bContext *C,
struct ColorSpace *colorspace,
bool IMB_colormanagement_setup_glsl_draw_from_space_ctx(const bContext *C,
ColorSpace *colorspace,
float dither,
bool predivide);
/**
@ -514,8 +492,7 @@ void IMB_colormanagement_finish_glsl_draw(void);
* \{ */
void IMB_colormanagement_init_default_view_settings(
struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings);
ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings);
/* Roles */
enum {
@ -544,8 +521,4 @@ void IMB_colormanagement_wavelength_to_rgb_table(float *r_table, int width);
/** \} */
#ifdef __cplusplus
}
#endif
#include "intern/colormanagement_inline.h"

View File

@ -40,116 +40,73 @@
#pragma once
/* for bool */
#include "../blenlib/BLI_sys_types.h"
#include "../gpu/GPU_texture.h"
#include "BLI_utildefines.h"
#include "IMB_imbuf_types.hh"
#ifdef __cplusplus
extern "C" {
#endif
#define IM_MAX_SPACE 64
/**
* \attention defined in ???
*/
struct ImBuf;
struct rctf;
struct rcti;
/**
* \attention defined in ???
*/
struct anim;
struct ColorManagedDisplay;
struct GSet;
/**
* \attention defined in `DNA_scene_types.h`.
*/
struct ImageFormatData;
struct Stereo3dFormat;
/**
* \attention Defined in `allocimbuf.cc`.
*/
void IMB_init(void);
void IMB_exit(void);
/**
* \attention Defined in `readimage.cc`.
*/
struct ImBuf *IMB_ibImageFromMemory(const unsigned char *mem,
size_t size,
int flags,
char colorspace[IM_MAX_SPACE],
const char *descr);
ImBuf *IMB_ibImageFromMemory(const unsigned char *mem,
size_t size,
int flags,
char colorspace[IM_MAX_SPACE],
const char *descr);
/**
* \attention Defined in `readimage.cc`.
*/
struct ImBuf *IMB_testiffname(const char *filepath, int flags);
ImBuf *IMB_testiffname(const char *filepath, int flags);
/**
* \attention Defined in `readimage.cc`.
*/
struct ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]);
ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]);
/**
* \attention Defined in `readimage.cc`.
*/
struct ImBuf *IMB_thumb_load_image(const char *filepath,
const size_t max_thumb_size,
char colorspace[IM_MAX_SPACE]);
ImBuf *IMB_thumb_load_image(const char *filepath,
const size_t max_thumb_size,
char colorspace[IM_MAX_SPACE]);
/**
* \attention Defined in `allocimbuf.cc`.
*/
void IMB_freeImBuf(struct ImBuf *ibuf);
void IMB_freeImBuf(ImBuf *ibuf);
/**
* \attention Defined in `allocimbuf.cc`.
*/
struct ImBuf *IMB_allocImBuf(unsigned int x,
unsigned int y,
unsigned char planes,
unsigned int flags);
ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags);
/**
* Initialize given ImBuf.
*
* Use in cases when temporary image buffer is allocated on stack.
*
* \attention Defined in `allocimbuf.cc`.
*/
bool IMB_initImBuf(
struct ImBuf *ibuf, unsigned int x, unsigned int y, unsigned char planes, unsigned int flags);
ImBuf *ibuf, unsigned int x, unsigned int y, unsigned char planes, unsigned int flags);
/**
* Create a copy of a pixel buffer and wrap it to a new ImBuf
* (transferring ownership to the in imbuf).
* \attention Defined in `allocimbuf.cc`.
*/
struct ImBuf *IMB_allocFromBufferOwn(uint8_t *byte_buffer,
float *float_buffer,
unsigned int w,
unsigned int h,
unsigned int channels);
ImBuf *IMB_allocFromBufferOwn(uint8_t *byte_buffer,
float *float_buffer,
unsigned int w,
unsigned int h,
unsigned int channels);
/**
* Create a copy of a pixel buffer and wrap it to a new ImBuf
* \attention Defined in `allocimbuf.cc`.
*/
struct ImBuf *IMB_allocFromBuffer(const uint8_t *byte_buffer,
const float *float_buffer,
unsigned int w,
unsigned int h,
unsigned int channels);
ImBuf *IMB_allocFromBuffer(const uint8_t *byte_buffer,
const float *float_buffer,
unsigned int w,
unsigned int h,
unsigned int channels);
/**
* Assign the content of the corresponding buffer with the given data and ownership.
@ -158,47 +115,40 @@ struct ImBuf *IMB_allocFromBuffer(const uint8_t *byte_buffer,
* \note Does not modify the topology (width, height, number of channels)
* or the mipmaps in any way.
*/
void IMB_assign_byte_buffer(struct ImBuf *ibuf, uint8_t *buffer_data, ImBufOwnership ownership);
void IMB_assign_float_buffer(struct ImBuf *ibuf, float *buffer_data, ImBufOwnership ownership);
void IMB_assign_byte_buffer(ImBuf *ibuf, uint8_t *buffer_data, ImBufOwnership ownership);
void IMB_assign_float_buffer(ImBuf *ibuf, float *buffer_data, ImBufOwnership ownership);
/**
* Make corresponding buffers available for modification.
* Is achieved by ensuring that the given ImBuf is the only owner of the underlying buffer data.
*/
void IMB_make_writable_byte_buffer(struct ImBuf *ibuf);
void IMB_make_writable_float_buffer(struct ImBuf *ibuf);
void IMB_make_writable_byte_buffer(ImBuf *ibuf);
void IMB_make_writable_float_buffer(ImBuf *ibuf);
/**
* Steal the buffer data pointer: the ImBuf is no longer an owner of this data.
* \note If the ImBuf does not own the data the behavior is undefined.
* \note Stealing encoded buffer resets the encoded size.
*/
uint8_t *IMB_steal_byte_buffer(struct ImBuf *ibuf);
float *IMB_steal_float_buffer(struct ImBuf *ibuf);
uint8_t *IMB_steal_encoded_buffer(struct ImBuf *ibuf);
uint8_t *IMB_steal_byte_buffer(ImBuf *ibuf);
float *IMB_steal_float_buffer(ImBuf *ibuf);
uint8_t *IMB_steal_encoded_buffer(ImBuf *ibuf);
/**
* Increase reference count to imbuf
* (to delete an imbuf you have to call freeImBuf as many times as it
* is referenced)
*
* \attention Defined in `allocimbuf.cc`.
*/
void IMB_refImBuf(struct ImBuf *ibuf);
struct ImBuf *IMB_makeSingleUser(struct ImBuf *ibuf);
void IMB_refImBuf(ImBuf *ibuf);
ImBuf *IMB_makeSingleUser(ImBuf *ibuf);
/**
* \attention Defined in `allocimbuf.cc`.
*/
struct ImBuf *IMB_dupImBuf(const struct ImBuf *ibuf1);
ImBuf *IMB_dupImBuf(const ImBuf *ibuf1);
/**
* Approximate size of ImBuf in memory
*
* \attention Defined in `allocimbuf.cc`.
*/
size_t IMB_get_size_in_memory(struct ImBuf *ibuf);
size_t IMB_get_size_in_memory(ImBuf *ibuf);
/**
* \brief Get the length of the rect of the given image buffer in terms of pixels.
@ -206,16 +156,10 @@ size_t IMB_get_size_in_memory(struct ImBuf *ibuf);
* This is the width * the height of the image buffer.
* This function is preferred over `ibuf->x * ibuf->y` due to overflow issues when
* working with large resolution images (30kx30k).
*
* \attention Defined in `allocimbuf.cc`.
*/
size_t IMB_get_rect_len(const struct ImBuf *ibuf);
size_t IMB_get_rect_len(const ImBuf *ibuf);
/**
* \attention Defined in `rectop.cc`.
*/
typedef enum IMB_BlendMode {
enum IMB_BlendMode {
IMB_BLEND_MIX = 0,
IMB_BLEND_ADD = 1,
IMB_BLEND_SUB = 2,
@ -245,7 +189,7 @@ typedef enum IMB_BlendMode {
IMB_BLEND_COPY = 1000,
IMB_BLEND_COPY_RGB = 1001,
IMB_BLEND_COPY_ALPHA = 1002,
} IMB_BlendMode;
};
void IMB_blend_color_byte(unsigned char dst[4],
const unsigned char src1[4],
@ -259,32 +203,32 @@ void IMB_blend_color_float(float dst[4],
/**
* In-place image crop.
*/
void IMB_rect_crop(struct ImBuf *ibuf, const struct rcti *crop);
void IMB_rect_crop(ImBuf *ibuf, const rcti *crop);
/**
* In-place size setting (caller must fill in buffer contents).
*/
void IMB_rect_size_set(struct ImBuf *ibuf, const uint size[2]);
void IMB_rect_size_set(ImBuf *ibuf, const uint size[2]);
void IMB_rectclip(struct ImBuf *dbuf,
const struct ImBuf *sbuf,
void IMB_rectclip(ImBuf *dbuf,
const ImBuf *sbuf,
int *destx,
int *desty,
int *srcx,
int *srcy,
int *width,
int *height);
void IMB_rectcpy(struct ImBuf *dbuf,
const struct ImBuf *sbuf,
void IMB_rectcpy(ImBuf *dbuf,
const ImBuf *sbuf,
int destx,
int desty,
int srcx,
int srcy,
int width,
int height);
void IMB_rectblend(struct ImBuf *dbuf,
const struct ImBuf *obuf,
const struct ImBuf *sbuf,
void IMB_rectblend(ImBuf *dbuf,
const ImBuf *obuf,
const ImBuf *sbuf,
unsigned short *dmask,
const unsigned short *curvemask,
const unsigned short *texmask,
@ -299,9 +243,9 @@ void IMB_rectblend(struct ImBuf *dbuf,
int height,
IMB_BlendMode mode,
bool accumulate);
void IMB_rectblend_threaded(struct ImBuf *dbuf,
const struct ImBuf *obuf,
const struct ImBuf *sbuf,
void IMB_rectblend_threaded(ImBuf *dbuf,
const ImBuf *obuf,
const ImBuf *sbuf,
unsigned short *dmask,
const unsigned short *curvemask,
const unsigned short *texmask,
@ -317,77 +261,39 @@ void IMB_rectblend_threaded(struct ImBuf *dbuf,
IMB_BlendMode mode,
bool accumulate);
/**
* \attention Defined in `indexer.cc`.
*/
typedef enum IMB_Timecode_Type {
/** Don't use time-code files at all. */
IMB_TC_NONE = 0,
/**
* Use images in the order as they are recorded
* (currently, this is the only one implemented
* and is a sane default).
*/
IMB_TC_RECORD_RUN = 1,
/**
* Use global timestamp written by recording
* device (prosumer camcorders e.g. can do that).
*/
IMB_TC_FREE_RUN = 2,
/**
* Interpolate a global timestamp using the
* record date and time written by recording
* device (*every* consumer camcorder can do that).
*/
IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN = 4,
IMB_TC_RECORD_RUN_NO_GAPS = 8,
IMB_TC_MAX_SLOT = 4,
} IMB_Timecode_Type;
typedef enum IMB_Proxy_Size {
IMB_PROXY_NONE = 0,
IMB_PROXY_25 = 1,
IMB_PROXY_50 = 2,
IMB_PROXY_75 = 4,
IMB_PROXY_100 = 8,
IMB_PROXY_MAX_SLOT = 4,
} IMB_Proxy_Size;
ENUM_OPERATORS(IMB_Proxy_Size, IMB_PROXY_100);
typedef enum eIMBInterpolationFilterMode {
enum eIMBInterpolationFilterMode {
IMB_FILTER_NEAREST,
IMB_FILTER_BILINEAR,
IMB_FILTER_BICUBIC,
} eIMBInterpolationFilterMode;
};
/**
* Defaults to BL_proxy within the directory of the animation.
*/
void IMB_anim_set_index_dir(struct anim *anim, const char *dir);
void IMB_anim_get_filename(struct anim *anim, char *filename, int filename_maxncpy);
void IMB_anim_set_index_dir(anim *anim, const char *dir);
void IMB_anim_get_filename(anim *anim, char *filename, int filename_maxncpy);
int IMB_anim_index_get_frame_index(struct anim *anim, IMB_Timecode_Type tc, int position);
int IMB_anim_index_get_frame_index(anim *anim, IMB_Timecode_Type tc, int position);
int IMB_anim_proxy_get_existing(struct anim *anim);
int IMB_anim_proxy_get_existing(anim *anim);
struct IndexBuildContext;
/**
* Prepare context for proxies/time-codes builder
*/
struct IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim,
IMB_Timecode_Type tcs_in_use,
int proxy_sizes_in_use,
int quality,
const bool overwrite,
struct GSet *file_list,
bool build_only_on_bad_performance);
IndexBuildContext *IMB_anim_index_rebuild_context(anim *anim,
IMB_Timecode_Type tcs_in_use,
int proxy_sizes_in_use,
int quality,
const bool overwrite,
GSet *file_list,
bool build_only_on_bad_performance);
/**
* Will rebuild all used indices and proxies at once.
*/
void IMB_anim_index_rebuild(struct IndexBuildContext *context,
void IMB_anim_index_rebuild(IndexBuildContext *context,
bool *stop,
bool *do_update,
float *progress);
@ -395,167 +301,117 @@ void IMB_anim_index_rebuild(struct IndexBuildContext *context,
/**
* Finish rebuilding proxies/time-codes and free temporary contexts used.
*/
void IMB_anim_index_rebuild_finish(struct IndexBuildContext *context, bool stop);
void IMB_anim_index_rebuild_finish(IndexBuildContext *context, bool stop);
/**
* Return the length (in frames) of the given \a anim.
*/
int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc);
int IMB_anim_get_duration(anim *anim, IMB_Timecode_Type tc);
/**
* Return the encoded start offset (in seconds) of the given \a anim.
*/
double IMD_anim_get_offset(struct anim *anim);
double IMD_anim_get_offset(anim *anim);
/**
* Return the fps contained in movie files (function rval is false,
* and frs_sec and frs_sec_base untouched if none available!)
*/
bool IMB_anim_get_fps(const struct anim *anim,
bool no_av_base,
short *r_frs_sec,
float *r_frs_sec_base);
bool IMB_anim_get_fps(const anim *anim, bool no_av_base, short *r_frs_sec, float *r_frs_sec_base);
/**
* \attention Defined in `anim_movie.cc`.
*/
struct anim *IMB_open_anim(const char *filepath,
int ib_flags,
int streamindex,
char colorspace[IM_MAX_SPACE]);
void IMB_suffix_anim(struct anim *anim, const char *suffix);
void IMB_close_anim(struct anim *anim);
void IMB_close_anim_proxies(struct anim *anim);
bool IMB_anim_can_produce_frames(const struct anim *anim);
/**
* \attention Defined in `anim_movie.cc`.
*/
anim *IMB_open_anim(const char *filepath,
int ib_flags,
int streamindex,
char colorspace[IM_MAX_SPACE]);
void IMB_suffix_anim(anim *anim, const char *suffix);
void IMB_close_anim(anim *anim);
void IMB_close_anim_proxies(anim *anim);
bool IMB_anim_can_produce_frames(const anim *anim);
int ismovie(const char *filepath);
int IMB_anim_get_image_width(struct anim *anim);
int IMB_anim_get_image_height(struct anim *anim);
bool IMB_get_gop_decode_time(struct anim *anim);
int IMB_anim_get_image_width(anim *anim);
int IMB_anim_get_image_height(anim *anim);
bool IMB_get_gop_decode_time(anim *anim);
ImBuf *IMB_anim_absolute(anim *anim,
int position,
IMB_Timecode_Type tc /* = 1 = IMB_TC_RECORD_RUN */,
IMB_Proxy_Size preview_size /* = 0 = IMB_PROXY_NONE */);
/**
* \attention Defined in `anim_movie.cc`.
*/
struct ImBuf *IMB_anim_absolute(struct anim *anim,
int position,
IMB_Timecode_Type tc /* = 1 = IMB_TC_RECORD_RUN */,
IMB_Proxy_Size preview_size /* = 0 = IMB_PROXY_NONE */);
/**
* \attention Defined in `anim_movie.cc`.
* fetches a define preview-frame, usually half way into the movie.
*/
struct ImBuf *IMB_anim_previewframe(struct anim *anim);
ImBuf *IMB_anim_previewframe(anim *anim);
/**
* \attention Defined in `anim_movie.cc`.
*/
void IMB_free_anim(struct anim *anim);
/**
* \attention Defined in `filter.cc`.
*/
void IMB_free_anim(anim *anim);
#define FILTER_MASK_NULL 0
#define FILTER_MASK_MARGIN 1
#define FILTER_MASK_USED 2
void IMB_filter(struct ImBuf *ibuf);
void IMB_filter(ImBuf *ibuf);
void IMB_mask_filter_extend(char *mask, int width, int height);
void IMB_mask_clear(struct ImBuf *ibuf, const char *mask, int val);
void IMB_mask_clear(ImBuf *ibuf, const char *mask, int val);
/**
* If alpha is zero, it checks surrounding pixels and averages color. sets new alphas to 1.0
* When a mask is given, the mask will be used instead of the alpha channel, where only
* pixels with a mask value of 0 will be written to, and only pixels with a mask value of 1
* will be used for the average. The mask will be set to one for the pixels which were written.
*/
void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter);
void IMB_filter_extend(ImBuf *ibuf, char *mask, int filter);
/**
* Frees too (if there) and recreates new data.
*/
void IMB_makemipmap(struct ImBuf *ibuf, int use_filter);
void IMB_makemipmap(ImBuf *ibuf, int use_filter);
/**
* Thread-safe version, only recreates existing maps.
*/
void IMB_remakemipmap(struct ImBuf *ibuf, int use_filter);
struct ImBuf *IMB_getmipmap(struct ImBuf *ibuf, int level);
void IMB_remakemipmap(ImBuf *ibuf, int use_filter);
ImBuf *IMB_getmipmap(ImBuf *ibuf, int level);
/**
* \attention Defined in `filter.cc`.
*/
void IMB_filtery(struct ImBuf *ibuf);
void IMB_filtery(ImBuf *ibuf);
/**
* \attention Defined in `scaling.cc`.
*/
struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1);
ImBuf *IMB_onehalf(ImBuf *ibuf1);
/**
* \attention Defined in `scaling.cc`.
*
* Return true if \a ibuf is modified.
*/
bool IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy);
/**
* \attention Defined in `scaling.cc`.
*/
/**
* Return true if \a ibuf is modified.
*/
bool IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy);
bool IMB_scaleImBuf(ImBuf *ibuf, unsigned int newx, unsigned int newy);
/**
* \attention Defined in `scaling.cc`.
* Return true if \a ibuf is modified.
*/
void IMB_scaleImBuf_threaded(struct ImBuf *ibuf, unsigned int newx, unsigned int newy);
bool IMB_scalefastImBuf(ImBuf *ibuf, unsigned int newx, unsigned int newy);
/**
* \attention Defined in `writeimage.cc`.
*/
bool IMB_saveiff(struct ImBuf *ibuf, const char *filepath, int flags);
void IMB_scaleImBuf_threaded(ImBuf *ibuf, unsigned int newx, unsigned int newy);
bool IMB_saveiff(ImBuf *ibuf, const char *filepath, int flags);
/**
* \attention Defined in `util.cc`.
*/
bool IMB_ispic(const char *filepath);
bool IMB_ispic_type_matches(const char *filepath, int filetype);
int IMB_ispic_type_from_memory(const unsigned char *buf, size_t buf_size);
int IMB_ispic_type(const char *filepath);
/**
* \attention Defined in `util.cc`.
*/
bool IMB_isanim(const char *filepath);
/**
* \attention Defined in `util.cc`.
*/
int imb_get_anim_type(const char *filepath);
/**
* Test if color-space conversions of pixels in buffer need to take into account alpha.
*/
bool IMB_alpha_affects_rgb(const struct ImBuf *ibuf);
bool IMB_alpha_affects_rgb(const ImBuf *ibuf);
/**
* Create char buffer, color corrected if necessary, for ImBufs that lack one.
*/
void IMB_rect_from_float(struct ImBuf *ibuf);
void IMB_float_from_rect_ex(struct ImBuf *dst,
const struct ImBuf *src,
const struct rcti *region_to_update);
void IMB_float_from_rect(struct ImBuf *ibuf);
void IMB_rect_from_float(ImBuf *ibuf);
void IMB_float_from_rect_ex(ImBuf *dst, const ImBuf *src, const rcti *region_to_update);
void IMB_float_from_rect(ImBuf *ibuf);
/**
* No profile conversion.
*/
void IMB_color_to_bw(struct ImBuf *ibuf);
void IMB_saturation(struct ImBuf *ibuf, float sat);
void IMB_color_to_bw(ImBuf *ibuf);
void IMB_saturation(ImBuf *ibuf, float sat);
/* Converting pixel buffers. */
@ -649,45 +505,33 @@ void IMB_buffer_byte_from_byte(unsigned char *rect_to,
* Change the ordering of the color bytes pointed to by rect from
* RGBA to ABGR. size * 4 color bytes are reordered.
*
* \attention Defined in `imageprocess.cc`.
*
* Only this one is used liberally here, and in imbuf.
*/
void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf);
void IMB_convert_rgba_to_abgr(ImBuf *ibuf);
/**
* \attention defined in `imageprocess.cc`.
*/
void bicubic_interpolation(
const struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
void nearest_interpolation(
const struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
void bilinear_interpolation(
const struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
void bicubic_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout);
void nearest_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout);
void bilinear_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout);
typedef void (*InterpolationColorFunction)(
const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
const ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
void bicubic_interpolation_color(
const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
const ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
/* Functions assumes out to be zeroed, only does RGBA. */
void nearest_interpolation_color_char(
const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
const ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
void nearest_interpolation_color_fl(
const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
const ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
void nearest_interpolation_color(
const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
const ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
void nearest_interpolation_color_wrap(
const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
const ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
void bilinear_interpolation_color(
const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
void bilinear_interpolation_color_char(const struct ImBuf *in,
unsigned char outI[4],
float u,
float v);
void bilinear_interpolation_color_fl(const struct ImBuf *in, float outF[4], float u, float v);
const ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
void bilinear_interpolation_color_char(const ImBuf *in, unsigned char outI[4], float u, float v);
void bilinear_interpolation_color_fl(const ImBuf *in, float outF[4], float u, float v);
/**
* Note about wrapping, the u/v still needs to be within the image bounds,
* just the interpolation is wrapped.
@ -695,7 +539,7 @@ void bilinear_interpolation_color_fl(const struct ImBuf *in, float outF[4], floa
* rather than using empty and emptyI.
*/
void bilinear_interpolation_color_wrap(
const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
const ImBuf *in, unsigned char outI[4], float outF[4], float u, float v);
void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[3]);
void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3]);
@ -704,66 +548,31 @@ void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float b
* Sample pixel of image using NEAREST method.
*/
void IMB_sampleImageAtLocation(
struct ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4]);
ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4]);
/**
* \attention defined in `readimage.cc`.
*/
struct ImBuf *IMB_loadifffile(int file,
int flags,
char colorspace[IM_MAX_SPACE],
const char *descr);
ImBuf *IMB_loadifffile(int file, int flags, char colorspace[IM_MAX_SPACE], const char *descr);
/**
* \attention defined in `scaling.cc`.
*/
struct ImBuf *IMB_half_x(struct ImBuf *ibuf1);
ImBuf *IMB_half_x(ImBuf *ibuf1);
ImBuf *IMB_double_fast_x(ImBuf *ibuf1);
ImBuf *IMB_double_x(ImBuf *ibuf1);
ImBuf *IMB_half_y(ImBuf *ibuf1);
ImBuf *IMB_double_fast_y(ImBuf *ibuf1);
ImBuf *IMB_double_y(ImBuf *ibuf1);
/**
* \attention defined in `scaling.cc`.
*/
struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1);
/**
* \attention defined in `scaling.cc`.
*/
struct ImBuf *IMB_double_x(struct ImBuf *ibuf1);
/**
* \attention defined in `scaling.cc`.
*/
struct ImBuf *IMB_half_y(struct ImBuf *ibuf1);
/**
* \attention defined in `scaling.cc`.
*/
struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1);
/**
* \attention defined in `scaling.cc`.
*/
struct ImBuf *IMB_double_y(struct ImBuf *ibuf1);
/**
* \attention Defined in `rotate.cc`.
*/
void IMB_flipx(struct ImBuf *ibuf);
void IMB_flipy(struct ImBuf *ibuf);
void IMB_flipx(ImBuf *ibuf);
void IMB_flipy(ImBuf *ibuf);
/* Pre-multiply alpha. */
void IMB_premultiply_alpha(struct ImBuf *ibuf);
void IMB_unpremultiply_alpha(struct ImBuf *ibuf);
void IMB_premultiply_alpha(ImBuf *ibuf);
void IMB_unpremultiply_alpha(ImBuf *ibuf);
/**
* \attention Defined in `rectop.cc`.
*/
/**
* Replace pixels of entire image with solid color.
* \param drect: An image to be filled with color. It must be 4 channel image.
* \param col: RGBA color, which is assigned directly to both byte (via scaling) and float buffers.
*/
void IMB_rectfill(struct ImBuf *drect, const float col[4]);
void IMB_rectfill(ImBuf *drect, const float col[4]);
/**
* Blend pixels of image area with solid color.
*
@ -779,13 +588,8 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4]);
* order the area between x1 and x2, and y1 and y2 is filled.
* \param display: color-space reference for display space.
*/
void IMB_rectfill_area(struct ImBuf *ibuf,
const float col[4],
int x1,
int y1,
int x2,
int y2,
struct ColorManagedDisplay *display);
void IMB_rectfill_area(
ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2, ColorManagedDisplay *display);
/**
* Replace pixels of image area with solid color.
* \param ibuf: an image to be filled with color. It must be 4 channel image.
@ -796,8 +600,8 @@ void IMB_rectfill_area(struct ImBuf *ibuf,
* order the area between x1 and x2, and y1 and y2 is filled.
*/
void IMB_rectfill_area_replace(
const struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2);
void IMB_rectfill_alpha(struct ImBuf *ibuf, float value);
const ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2);
void IMB_rectfill_alpha(ImBuf *ibuf, float value);
/**
* This should not be here, really,
@ -808,7 +612,7 @@ void buf_rectfill_area(unsigned char *rect,
int width,
int height,
const float col[4],
struct ColorManagedDisplay *display,
ColorManagedDisplay *display,
int x1,
int y1,
int x2,
@ -823,25 +627,25 @@ void *imb_alloc_pixels(unsigned int x,
size_t typesize,
const char *alloc_name);
bool imb_addrectImBuf(struct ImBuf *ibuf);
bool imb_addrectImBuf(ImBuf *ibuf);
/**
* Any free `ibuf->rect` frees mipmaps to be sure, creation is in render on first request.
*/
void imb_freerectImBuf(struct ImBuf *ibuf);
void imb_freerectImBuf(ImBuf *ibuf);
bool imb_addrectfloatImBuf(struct ImBuf *ibuf, const unsigned int channels);
bool imb_addrectfloatImBuf(ImBuf *ibuf, const unsigned int channels);
/**
* Any free `ibuf->rect` frees mipmaps to be sure, creation is in render on first request.
*/
void imb_freerectfloatImBuf(struct ImBuf *ibuf);
void imb_freemipmapImBuf(struct ImBuf *ibuf);
void imb_freerectfloatImBuf(ImBuf *ibuf);
void imb_freemipmapImBuf(ImBuf *ibuf);
/** Free all CPU pixel data (associated with image size). */
void imb_freerectImbuf_all(struct ImBuf *ibuf);
void imb_freerectImbuf_all(ImBuf *ibuf);
/* Free the GPU textures of the given image buffer, leaving the CPU buffers unchanged.
* The ibuf can be nullptr, in which case the function does nothing. */
void IMB_free_gpu_textures(struct ImBuf *ibuf);
void IMB_free_gpu_textures(ImBuf *ibuf);
/**
* Threaded processors.
@ -863,14 +667,14 @@ void IMB_processor_apply_threaded_scanlines(int total_scanlines,
*
* These are not flags as the combination of cropping and repeat can lead to different expectation.
*/
typedef enum eIMBTransformMode {
enum eIMBTransformMode {
/** \brief Do not crop or repeat. */
IMB_TRANSFORM_MODE_REGULAR = 0,
/** \brief Crop the source buffer. */
IMB_TRANSFORM_MODE_CROP_SRC = 1,
/** \brief Wrap repeat the source buffer. Only supported in with nearest filtering. */
IMB_TRANSFORM_MODE_WRAP_REPEAT = 2,
} eIMBTransformMode;
};
/**
* \brief Transform source image buffer onto destination image buffer using a transform matrix.
@ -893,28 +697,25 @@ typedef enum eIMBTransformMode {
* When transforming between float images the number of channels of the source buffer may be
* between 1 and 4. When source buffer has one channel the data will be read as a gray scale value.
*/
void IMB_transform(const struct ImBuf *src,
struct ImBuf *dst,
void IMB_transform(const ImBuf *src,
ImBuf *dst,
eIMBTransformMode mode,
eIMBInterpolationFilterMode filter,
const int num_subsamples,
const float transform_matrix[4][4],
const struct rctf *src_crop);
const rctf *src_crop);
/* FFMPEG */
void IMB_ffmpeg_init(void);
const char *IMB_ffmpeg_last_error(void);
/**
* \attention defined in `util_gpu.cc`.
*/
GPUTexture *IMB_create_gpu_texture(const char *name,
struct ImBuf *ibuf,
ImBuf *ibuf,
bool use_high_bitdepth,
bool use_premult);
eGPUTextureFormat IMB_gpu_get_texture_format(const struct ImBuf *ibuf,
eGPUTextureFormat IMB_gpu_get_texture_format(const ImBuf *ibuf,
bool high_bitdepth,
bool use_grayscale);
@ -923,14 +724,14 @@ eGPUTextureFormat IMB_gpu_get_texture_format(const struct ImBuf *ibuf,
*
* Does nothing when given image_buffer doesn't contain a float rect.
*/
void IMB_gpu_clamp_half_float(struct ImBuf *image_buffer);
void IMB_gpu_clamp_half_float(ImBuf *image_buffer);
/**
* The `ibuf` is only here to detect the storage type. The produced texture will have undefined
* content. It will need to be populated by using #IMB_update_gpu_texture_sub().
*/
GPUTexture *IMB_touch_gpu_texture(const char *name,
struct ImBuf *ibuf,
ImBuf *ibuf,
int w,
int h,
int layers,
@ -943,7 +744,7 @@ GPUTexture *IMB_touch_gpu_texture(const char *name,
* Z is the layer to update. Unused if the texture is 2D.
*/
void IMB_update_gpu_texture_sub(GPUTexture *tex,
struct ImBuf *ibuf,
ImBuf *ibuf,
int x,
int y,
int z,
@ -953,20 +754,17 @@ void IMB_update_gpu_texture_sub(GPUTexture *tex,
bool use_grayscale,
bool use_premult);
/**
* \attention defined in `stereoimbuf.cc`.
*/
void IMB_stereo3d_write_dimensions(
char mode, bool is_squeezed, size_t width, size_t height, size_t *r_width, size_t *r_height);
void IMB_stereo3d_read_dimensions(
char mode, bool is_squeezed, size_t width, size_t height, size_t *r_width, size_t *r_height);
int *IMB_stereo3d_from_rect(const struct ImageFormatData *im_format,
int *IMB_stereo3d_from_rect(const ImageFormatData *im_format,
size_t x,
size_t y,
size_t channels,
int *rect_left,
int *rect_right);
float *IMB_stereo3d_from_rectf(const struct ImageFormatData *im_format,
float *IMB_stereo3d_from_rectf(const ImageFormatData *im_format,
size_t x,
size_t y,
size_t channels,
@ -975,17 +773,11 @@ float *IMB_stereo3d_from_rectf(const struct ImageFormatData *im_format,
/**
* Left/right are always float.
*/
struct ImBuf *IMB_stereo3d_ImBuf(const struct ImageFormatData *im_format,
struct ImBuf *ibuf_left,
struct ImBuf *ibuf_right);
ImBuf *IMB_stereo3d_ImBuf(const ImageFormatData *im_format, ImBuf *ibuf_left, ImBuf *ibuf_right);
/**
* Reading a stereo encoded ibuf (*left) and generating two ibufs from it (*left and *right).
*/
void IMB_ImBufFromStereo3d(const struct Stereo3dFormat *s3d,
struct ImBuf *ibuf_stereo,
struct ImBuf **r_ibuf_left,
struct ImBuf **r_ibuf_right);
#ifdef __cplusplus
}
#endif
void IMB_ImBufFromStereo3d(const Stereo3dFormat *s3d,
ImBuf *ibuf_stereo,
ImBuf **r_ibuf_left,
ImBuf **r_ibuf_right);

View File

@ -0,0 +1,84 @@
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "BLI_utildefines.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \file
* \ingroup imbuf
*/
/* WARNING: Keep explicit value assignments here,
* this file is included in areas where not all format defines are set
* (e.g. intern/dds only get WITH_DDS, even if TIFF, HDR etc are also defined).
* See #46524. */
/** #ImBuf.ftype flag, main image types. */
enum eImbFileType {
IMB_FTYPE_NONE = 0,
IMB_FTYPE_PNG = 1,
IMB_FTYPE_TGA = 2,
IMB_FTYPE_JPG = 3,
IMB_FTYPE_BMP = 4,
IMB_FTYPE_OPENEXR = 5,
IMB_FTYPE_IMAGIC = 6,
IMB_FTYPE_PSD = 7,
#ifdef WITH_OPENJPEG
IMB_FTYPE_JP2 = 8,
#endif
IMB_FTYPE_RADHDR = 9,
IMB_FTYPE_TIF = 10,
#ifdef WITH_CINEON
IMB_FTYPE_CINEON = 11,
IMB_FTYPE_DPX = 12,
#endif
IMB_FTYPE_DDS = 13,
#ifdef WITH_WEBP
IMB_FTYPE_WEBP = 14,
#endif
};
typedef enum IMB_Timecode_Type {
/** Don't use time-code files at all. */
IMB_TC_NONE = 0,
/**
* Use images in the order as they are recorded
* (currently, this is the only one implemented
* and is a sane default).
*/
IMB_TC_RECORD_RUN = 1,
/**
* Use global timestamp written by recording
* device (prosumer camcorders e.g. can do that).
*/
IMB_TC_FREE_RUN = 2,
/**
* Interpolate a global timestamp using the
* record date and time written by recording
* device (*every* consumer camcorder can do that).
*/
IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN = 4,
IMB_TC_RECORD_RUN_NO_GAPS = 8,
IMB_TC_MAX_SLOT = 4,
} IMB_Timecode_Type;
typedef enum IMB_Proxy_Size {
IMB_PROXY_NONE = 0,
IMB_PROXY_25 = 1,
IMB_PROXY_50 = 2,
IMB_PROXY_75 = 4,
IMB_PROXY_100 = 8,
IMB_PROXY_MAX_SLOT = 4,
} IMB_Proxy_Size;
ENUM_OPERATORS(IMB_Proxy_Size, IMB_PROXY_100);
#ifdef __cplusplus
}
#endif

View File

@ -8,11 +8,12 @@
#include "BLI_sys_types.h"
struct GPUTexture;
#include "IMB_imbuf_enums.h"
#ifdef __cplusplus
extern "C" {
#endif
struct ColormanageCache;
struct ColorSpace;
struct GPUTexture;
struct IDProperty;
/** \file
* \ingroup imbuf
@ -33,7 +34,7 @@ extern "C" {
#define IMB_MIPMAP_LEVELS 20
#define IMB_FILEPATH_SIZE 1024
typedef struct DDSData {
struct DDSData {
/** DDS fourcc info */
unsigned int fourcc;
/** The number of mipmaps in the dds file */
@ -42,7 +43,7 @@ typedef struct DDSData {
unsigned char *data;
/** The size of the compressed data */
unsigned int size;
} DDSData;
};
/**
* \ingroup imbuf
@ -51,39 +52,6 @@ typedef struct DDSData {
* Also; add new variables to the end to save pain!
*/
/* WARNING: Keep explicit value assignments here,
* this file is included in areas where not all format defines are set
* (e.g. intern/dds only get WITH_DDS, even if TIFF, HDR etc are also defined).
* See #46524. */
/** #ImBuf.ftype flag, main image types. */
enum eImbFileType {
IMB_FTYPE_PNG = 1,
IMB_FTYPE_TGA = 2,
IMB_FTYPE_JPG = 3,
IMB_FTYPE_BMP = 4,
IMB_FTYPE_OPENEXR = 5,
IMB_FTYPE_IMAGIC = 6,
IMB_FTYPE_PSD = 7,
#ifdef WITH_OPENJPEG
IMB_FTYPE_JP2 = 8,
#endif
IMB_FTYPE_RADHDR = 9,
IMB_FTYPE_TIF = 10,
#ifdef WITH_CINEON
IMB_FTYPE_CINEON = 11,
IMB_FTYPE_DPX = 12,
#endif
IMB_FTYPE_DDS = 13,
#ifdef WITH_WEBP
IMB_FTYPE_WEBP = 14,
#endif
};
/* Only for readability. */
#define IMB_FTYPE_NONE 0
/**
* #ImBuf::foptions.flag, type specific options.
* Some formats include compression rations on some bits.
@ -119,18 +87,18 @@ enum eImbFileType {
#define TIF_COMPRESS_LZW (1 << 5)
#define TIF_COMPRESS_PACKBITS (1 << 4)
typedef struct ImbFormatOptions {
struct ImbFormatOptions {
short flag;
/** Quality serves dual purpose as quality number for JPEG or compression amount for PNG. */
char quality;
} ImbFormatOptions;
};
/* -------------------------------------------------------------------- */
/** \name Imbuf Component flags
* \brief These flags determine the components of an ImBuf struct.
* \{ */
typedef enum eImBufFlags {
enum eImBufFlags {
IB_rect = 1 << 0,
IB_test = 1 << 1,
IB_mem = 1 << 4,
@ -150,7 +118,7 @@ typedef enum eImBufFlags {
IB_thumbnail = 1 << 16,
IB_multiview = 1 << 17,
IB_halffloat = 1 << 18,
} eImBufFlags;
};
/** \} */
@ -160,7 +128,7 @@ typedef enum eImBufFlags {
/* Specialization of an ownership whenever a bare pointer is provided to the ImBuf buffers
* assignment API. */
typedef enum ImBufOwnership {
enum ImBufOwnership {
/* The ImBuf simply shares pointer with data owned by someone else, and will not perform any
* memory management when the ImBuf frees the buffer. */
IB_DO_NOT_TAKE_OWNERSHIP = 0,
@ -168,7 +136,7 @@ typedef enum ImBufOwnership {
/* The ImBuf takes ownership of the buffer data, and will use MEM_freeN() to free this memory
* when the ImBuf needs to free the data. */
IB_TAKE_OWNERSHIP = 1,
} ImBufOwnership;
};
/* Different storage specialization.
*
@ -177,29 +145,29 @@ typedef enum ImBufOwnership {
*
* Accessing the data pointer directly is fine and is an expected way of accessing it. */
typedef struct ImBufByteBuffer {
struct ImBufByteBuffer {
uint8_t *data;
ImBufOwnership ownership;
struct ColorSpace *colorspace;
} ImBufByteBuffer;
ColorSpace *colorspace;
};
typedef struct ImBufFloatBuffer {
struct ImBufFloatBuffer {
float *data;
ImBufOwnership ownership;
struct ColorSpace *colorspace;
} ImBufFloatBuffer;
ColorSpace *colorspace;
};
typedef struct ImBufGPU {
struct ImBufGPU {
/* Texture which corresponds to the state of the ImBug on the GPU.
*
* Allocation is supposed to happen outside of the ImBug module from a proper GPU context.
* De-referencing the ImBuf or its GPU texture can happen from any state. */
/* TODO(sergey): This should become a list of textures, to support having high-res ImBuf on GPU
* without hitting hardware limitations. */
struct GPUTexture *texture;
} ImBufGPU;
GPUTexture *texture;
};
/** \} */
@ -207,7 +175,7 @@ typedef struct ImBufGPU {
/** \name Image Buffer
* \{ */
typedef struct ImBuf {
struct ImBuf {
/* dimensions */
/** Width and Height of our image buffer.
* Should be 'unsigned int' since most formats use this.
@ -254,7 +222,7 @@ typedef struct ImBuf {
/* mipmapping */
/** MipMap levels, a series of halved images */
struct ImBuf *mipmap[IMB_MIPMAP_LEVELS];
ImBuf *mipmap[IMB_MIPMAP_LEVELS];
int miptot, miplevel;
/* externally used data */
@ -263,7 +231,7 @@ typedef struct ImBuf {
/** used to set imbuf to dirty and other stuff */
int userflags;
/** image metadata */
struct IDProperty *metadata;
IDProperty *metadata;
/** temporary storage */
void *userdata;
@ -291,13 +259,13 @@ typedef struct ImBuf {
/** array of per-display display buffers dirty flags */
unsigned int *display_buffer_flags;
/** cache used by color management */
struct ColormanageCache *colormanage_cache;
ColormanageCache *colormanage_cache;
int colormanage_flag;
rcti invalid_rect;
/* information for compressed textures */
struct DDSData dds_data;
} ImBuf;
DDSData dds_data;
};
/**
* \brief userflags: Flags used internally by blender for image-buffers.
@ -365,7 +333,3 @@ enum {
};
/** \} */
#ifdef __cplusplus
}
#endif

View File

@ -8,10 +8,6 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct IDProperty;
struct ImBuf;
struct anim;
@ -31,8 +27,8 @@ struct anim;
* Ensure that the metadata property is a valid #IDProperty object.
* This is a no-op when *metadata != NULL.
*/
void IMB_metadata_ensure(struct IDProperty **metadata);
void IMB_metadata_free(struct IDProperty *metadata);
void IMB_metadata_ensure(IDProperty **metadata);
void IMB_metadata_free(IDProperty *metadata);
/**
* Read the field from the image info into the field.
@ -43,7 +39,7 @@ void IMB_metadata_free(struct IDProperty *metadata);
* \param len: length of value buffer allocated by user.
* \return 1 (true) if metadata is present and value for the key found, 0 (false) otherwise.
*/
bool IMB_metadata_get_field(struct IDProperty *metadata,
bool IMB_metadata_get_field(IDProperty *metadata,
const char *key,
char *value,
size_t value_maxncpy);
@ -56,15 +52,11 @@ bool IMB_metadata_get_field(struct IDProperty *metadata,
* \param key: the key of the field
* \param value: the data to be written to the field. zero terminated string
*/
void IMB_metadata_set_field(struct IDProperty *metadata, const char *key, const char *value);
void IMB_metadata_set_field(IDProperty *metadata, const char *key, const char *value);
void IMB_metadata_copy(struct ImBuf *dimb, struct ImBuf *simb);
struct IDProperty *IMB_anim_load_metadata(struct anim *anim);
void IMB_metadata_copy(ImBuf *dimb, ImBuf *simb);
IDProperty *IMB_anim_load_metadata(anim *anim);
/* Invoke callback for every value stored in the metadata. */
typedef void (*IMBMetadataForeachCb)(const char *field, const char *value, void *userdata);
void IMB_metadata_foreach(struct ImBuf *ibuf, IMBMetadataForeachCb callback, void *userdata);
#ifdef __cplusplus
}
#endif
void IMB_metadata_foreach(ImBuf *ibuf, IMBMetadataForeachCb callback, void *userdata);

View File

@ -15,10 +15,6 @@
* Supposed to provide unified cache system for movie clips, sequencer and
* other movie-related areas */
#ifdef __cplusplus
extern "C" {
#endif
struct ImBuf;
struct MovieCache;
@ -31,44 +27,37 @@ typedef void (*MovieCachePriorityDeleterFP)(void *priority_data);
void IMB_moviecache_init(void);
void IMB_moviecache_destruct(void);
struct MovieCache *IMB_moviecache_create(const char *name,
int keysize,
GHashHashFP hashfp,
GHashCmpFP cmpfp);
void IMB_moviecache_set_getdata_callback(struct MovieCache *cache,
MovieCacheGetKeyDataFP getdatafp);
void IMB_moviecache_set_priority_callback(struct MovieCache *cache,
MovieCache *IMB_moviecache_create(const char *name,
int keysize,
GHashHashFP hashfp,
GHashCmpFP cmpfp);
void IMB_moviecache_set_getdata_callback(MovieCache *cache, MovieCacheGetKeyDataFP getdatafp);
void IMB_moviecache_set_priority_callback(MovieCache *cache,
MovieCacheGetPriorityDataFP getprioritydatafp,
MovieCacheGetItemPriorityFP getitempriorityfp,
MovieCachePriorityDeleterFP prioritydeleterfp);
void IMB_moviecache_put(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
bool IMB_moviecache_put_if_possible(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
struct ImBuf *IMB_moviecache_get(struct MovieCache *cache, void *userkey, bool *r_is_cached_empty);
void IMB_moviecache_remove(struct MovieCache *cache, void *userkey);
bool IMB_moviecache_has_frame(struct MovieCache *cache, void *userkey);
void IMB_moviecache_free(struct MovieCache *cache);
void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf);
bool IMB_moviecache_put_if_possible(MovieCache *cache, void *userkey, ImBuf *ibuf);
ImBuf *IMB_moviecache_get(MovieCache *cache, void *userkey, bool *r_is_cached_empty);
void IMB_moviecache_remove(MovieCache *cache, void *userkey);
bool IMB_moviecache_has_frame(MovieCache *cache, void *userkey);
void IMB_moviecache_free(MovieCache *cache);
void IMB_moviecache_cleanup(struct MovieCache *cache,
bool(cleanup_check_cb)(struct ImBuf *ibuf,
void *userkey,
void *userdata),
void IMB_moviecache_cleanup(MovieCache *cache,
bool(cleanup_check_cb)(ImBuf *ibuf, void *userkey, void *userdata),
void *userdata);
/**
* Get segments of cached frames. Useful for debugging cache policies.
*/
void IMB_moviecache_get_cache_segments(
struct MovieCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points);
MovieCache *cache, int proxy, int render_flags, int *r_totseg, int **r_points);
struct MovieCacheIter;
struct MovieCacheIter *IMB_moviecacheIter_new(struct MovieCache *cache);
void IMB_moviecacheIter_free(struct MovieCacheIter *iter);
bool IMB_moviecacheIter_done(struct MovieCacheIter *iter);
void IMB_moviecacheIter_step(struct MovieCacheIter *iter);
struct ImBuf *IMB_moviecacheIter_getImBuf(struct MovieCacheIter *iter);
void *IMB_moviecacheIter_getUserKey(struct MovieCacheIter *iter);
#ifdef __cplusplus
}
#endif
MovieCacheIter *IMB_moviecacheIter_new(MovieCache *cache);
void IMB_moviecacheIter_free(MovieCacheIter *iter);
bool IMB_moviecacheIter_done(MovieCacheIter *iter);
void IMB_moviecacheIter_step(MovieCacheIter *iter);
ImBuf *IMB_moviecacheIter_getImBuf(MovieCacheIter *iter);
void *IMB_moviecacheIter_getUserKey(MovieCacheIter *iter);

View File

@ -18,10 +18,6 @@
#define EXR_TOT_MAXNAME 64
#define EXR_PASS_MAXCHAN 24
#ifdef __cplusplus
extern "C" {
#endif
struct StampData;
void *IMB_exr_get_handle(void);
@ -54,7 +50,7 @@ bool IMB_exr_begin_write(void *handle,
int width,
int height,
int compress,
const struct StampData *stamp);
const StampData *stamp);
/**
* Only used for writing temp. render results (not image files)
* (FSA and Save Buffers).
@ -105,7 +101,3 @@ 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

View File

@ -8,10 +8,6 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct ImBuf;
/**
@ -20,19 +16,19 @@ struct ImBuf;
* Reference: http://jens.triq.net/thumbnail-spec/index.html
*/
typedef enum ThumbSize {
enum ThumbSize {
THB_NORMAL,
THB_LARGE,
THB_FAIL,
} ThumbSize;
};
typedef enum ThumbSource {
enum ThumbSource {
THB_SOURCE_IMAGE,
THB_SOURCE_MOVIE,
THB_SOURCE_BLEND,
THB_SOURCE_FONT,
THB_SOURCE_OBJECT_IO,
} ThumbSource;
};
/**
* Don't generate thumbs for images bigger than this (100mb).
@ -53,17 +49,14 @@ typedef enum ThumbSource {
* Create thumbnail for file and returns new imbuf for thumbnail.
* \param filepath: File path (but not a library path!) to the thumbnail to be created.
*/
struct ImBuf *IMB_thumb_create(const char *filepath,
ThumbSize size,
ThumbSource source,
struct ImBuf *img);
ImBuf *IMB_thumb_create(const char *filepath, ThumbSize size, ThumbSource source, ImBuf *img);
/**
* Read thumbnail for file and returns new imbuf for thumbnail.
* \param file_or_lib_path: File path or library-ID path (e.g. `/a/b.blend/Material/MyMaterial`) to
* the thumbnail to be read.
*/
struct ImBuf *IMB_thumb_read(const char *file_or_lib_path, ThumbSize size);
ImBuf *IMB_thumb_read(const char *file_or_lib_path, ThumbSize size);
/**
* Delete all thumbs for the file.
@ -80,7 +73,7 @@ void IMB_thumb_delete(const char *file_or_lib_path, ThumbSize size);
* \param file_or_lib_path: File path or library-ID path (e.g. `/a/b.blend/Material/MyMaterial`) to
* the thumbnail to be created/managed.
*/
struct ImBuf *IMB_thumb_manage(const char *file_or_lib_path, ThumbSize size, ThumbSource source);
ImBuf *IMB_thumb_manage(const char *file_or_lib_path, ThumbSize size, ThumbSource source);
/**
* Create the necessary directories to store the thumbnails.
@ -90,14 +83,12 @@ void IMB_thumb_makedirs(void);
/**
* Special function for loading a thumbnail embedded into a blend file.
*/
struct ImBuf *IMB_thumb_load_blend(const char *blen_path,
const char *blen_group,
const char *blen_id);
ImBuf *IMB_thumb_load_blend(const char *blen_path, const char *blen_group, const char *blen_id);
/**
* Special function for previewing fonts.
*/
struct ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned int y);
ImBuf *IMB_thumb_load_font(const char *filename, unsigned int x, unsigned int y);
bool IMB_thumb_load_font_get_hash(char *r_hash);
/* Threading */
@ -106,7 +97,3 @@ void IMB_thumb_locks_acquire(void);
void IMB_thumb_locks_release(void);
void IMB_thumb_path_lock(const char *path);
void IMB_thumb_path_unlock(const char *path);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -4,14 +4,9 @@
/** \file
* \ingroup imbuf
* \brief Header file for `allocimbuf.cc`.
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct ImBuf;
void imb_refcounter_lock_init(void);
@ -29,9 +24,5 @@ void imb_mmap_unlock(void);
# define imb_mmap_unlock()
#endif
bool imb_addencodedbufferImBuf(struct ImBuf *ibuf);
bool imb_enlargeencodedbufferImBuf(struct ImBuf *ibuf);
#ifdef __cplusplus
}
#endif
bool imb_addencodedbufferImBuf(ImBuf *ibuf);
bool imb_enlargeencodedbufferImBuf(ImBuf *ibuf);

View File

@ -41,8 +41,6 @@
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "IMB_allocimbuf.hh"
#ifdef WITH_FFMPEG
extern "C" {
# include <libavcodec/avcodec.h>

View File

@ -1,4 +1,4 @@
/* SPDX-FileCopyrightText: 2012 Blender Authors
/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
@ -11,10 +11,6 @@
#include "BLI_sys_types.h"
#include "DNA_listBase.h"
#ifdef __cplusplus
extern "C" {
#endif
struct ImBuf;
struct OCIO_ConstCPUProcessorRc;
typedef struct OCIO_ConstCPUProcessorRc *OCIO_ConstCPUProcessorRcPtr;
@ -30,8 +26,8 @@ extern float imbuf_rec709_to_scene_linear[3][3];
#define MAX_COLORSPACE_NAME 64
#define MAX_COLORSPACE_DESCRIPTION 512
typedef struct ColorSpace {
struct ColorSpace *next, *prev;
struct ColorSpace {
ColorSpace *next, *prev;
int index;
char name[MAX_COLORSPACE_NAME];
char description[MAX_COLORSPACE_DESCRIPTION];
@ -51,74 +47,68 @@ typedef struct ColorSpace {
bool is_srgb;
bool is_scene_linear;
} info;
} ColorSpace;
};
typedef struct ColorManagedDisplay {
struct ColorManagedDisplay *next, *prev;
struct ColorManagedDisplay {
ColorManagedDisplay *next, *prev;
int index;
char name[MAX_COLORSPACE_NAME];
ListBase views; /* LinkData.data -> ColorManagedView */
OCIO_ConstCPUProcessorRcPtr *to_scene_linear;
OCIO_ConstCPUProcessorRcPtr *from_scene_linear;
} ColorManagedDisplay;
};
typedef struct ColorManagedView {
struct ColorManagedView *next, *prev;
struct ColorManagedView {
ColorManagedView *next, *prev;
int index;
char name[MAX_COLORSPACE_NAME];
} ColorManagedView;
};
typedef struct ColorManagedLook {
struct ColorManagedLook *next, *prev;
struct ColorManagedLook {
ColorManagedLook *next, *prev;
int index;
char name[MAX_COLORSPACE_NAME];
char ui_name[MAX_COLORSPACE_NAME];
char view[MAX_COLORSPACE_NAME];
char process_space[MAX_COLORSPACE_NAME];
bool is_noop;
} ColorManagedLook;
};
/* ** Initialization / De-initialization ** */
void colormanagement_init(void);
void colormanagement_exit(void);
void colormanage_cache_free(struct ImBuf *ibuf);
void colormanage_cache_free(ImBuf *ibuf);
const char *colormanage_display_get_default_name(void);
struct ColorManagedDisplay *colormanage_display_get_default(void);
struct ColorManagedDisplay *colormanage_display_add(const char *name);
struct ColorManagedDisplay *colormanage_display_get_named(const char *name);
struct ColorManagedDisplay *colormanage_display_get_indexed(int index);
ColorManagedDisplay *colormanage_display_get_default(void);
ColorManagedDisplay *colormanage_display_add(const char *name);
ColorManagedDisplay *colormanage_display_get_named(const char *name);
ColorManagedDisplay *colormanage_display_get_indexed(int index);
const char *colormanage_view_get_default_name(const ColorManagedDisplay *display);
struct ColorManagedView *colormanage_view_get_default(const ColorManagedDisplay *display);
struct ColorManagedView *colormanage_view_add(const char *name);
struct ColorManagedView *colormanage_view_get_indexed(int index);
struct ColorManagedView *colormanage_view_get_named(const char *name);
struct ColorManagedView *colormanage_view_get_named_for_display(const char *display_name,
const char *name);
ColorManagedView *colormanage_view_get_default(const ColorManagedDisplay *display);
ColorManagedView *colormanage_view_add(const char *name);
ColorManagedView *colormanage_view_get_indexed(int index);
ColorManagedView *colormanage_view_get_named(const char *name);
ColorManagedView *colormanage_view_get_named_for_display(const char *display_name,
const char *name);
struct ColorSpace *colormanage_colorspace_add(const char *name,
const char *description,
bool is_invertible,
bool is_data);
struct ColorSpace *colormanage_colorspace_get_named(const char *name);
struct ColorSpace *colormanage_colorspace_get_roled(int role);
struct ColorSpace *colormanage_colorspace_get_indexed(int index);
ColorSpace *colormanage_colorspace_add(const char *name,
const char *description,
bool is_invertible,
bool is_data);
ColorSpace *colormanage_colorspace_get_named(const char *name);
ColorSpace *colormanage_colorspace_get_roled(int role);
ColorSpace *colormanage_colorspace_get_indexed(int index);
struct ColorManagedLook *colormanage_look_add(const char *name,
const char *process_space,
bool is_noop);
struct ColorManagedLook *colormanage_look_get_named(const char *name);
struct ColorManagedLook *colormanage_look_get_indexed(int index);
ColorManagedLook *colormanage_look_add(const char *name, const char *process_space, bool is_noop);
ColorManagedLook *colormanage_look_get_named(const char *name);
ColorManagedLook *colormanage_look_get_indexed(int index);
void colorspace_set_default_role(char *colorspace, int size, int role);
void colormanage_imbuf_set_default_spaces(struct ImBuf *ibuf);
void colormanage_imbuf_make_linear(struct ImBuf *ibuf, const char *from_colorspace);
#ifdef __cplusplus
}
#endif
void colormanage_imbuf_set_default_spaces(ImBuf *ibuf);
void colormanage_imbuf_make_linear(ImBuf *ibuf, const char *from_colorspace);

View File

@ -95,7 +95,6 @@
using namespace Imf;
using namespace Imath;
extern "C" {
/* prototype */
static struct ExrPass *imb_exr_get_pass(ListBase *lb, char *passname);
static bool exr_has_multiview(MultiPartInputFile &file);
@ -107,7 +106,6 @@ static void imb_exr_type_by_channels(ChannelList &channels,
bool *r_singlelayer,
bool *r_multilayer,
bool *r_multiview);
}
/* Memory Input Stream */
@ -379,8 +377,6 @@ static half float_to_half_safe(const float value)
return half(clamp_f(value, -HALF_MAX, HALF_MAX));
}
extern "C" {
bool imb_is_a_openexr(const uchar *mem, const size_t size)
{
/* No define is exposed for this size. */
@ -743,9 +739,6 @@ void *IMB_exr_get_handle_name(const char *name)
}
/* multiview functions */
} /* extern "C" */
extern "C" {
void IMB_exr_add_view(void *handle, const char *name)
{
@ -2315,5 +2308,3 @@ void imb_exitopenexr()
/* Tells OpenEXR to free thread pool, also ensures there is no running tasks. */
Imf::setGlobalThreadCount(0);
}
} /* export "C" */

View File

@ -368,8 +368,6 @@ static void transform_scanlines_filter(const TransformContext &ctx, IndexRange y
} // namespace blender::imbuf::transform
extern "C" {
using namespace blender::imbuf::transform;
using namespace blender;
@ -408,4 +406,3 @@ void IMB_transform(const ImBuf *src,
}
});
}
}

View File

@ -68,7 +68,7 @@
#include "BLI_memarena.h"
#include "BLI_utildefines.h"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_enums.h"
#include "DNA_defaults.h"

View File

@ -17,9 +17,9 @@
#include "../generic/py_capi_utils.h"
/* #include "IMB_imbuf_types.hh" */
extern "C" const char *imb_ext_image[];
extern "C" const char *imb_ext_movie[];
extern "C" const char *imb_ext_audio[];
extern const char *imb_ext_image[];
extern const char *imb_ext_movie[];
extern const char *imb_ext_audio[];
/*----------------------------MODULE INIT-------------------------*/
static PyModuleDef _bpy_path_module_def = {