Blender
V3.3
|
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "IMB_filter.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "imbuf.h"
#include "IMB_colormanagement.h"
#include "IMB_colormanagement_intern.h"
#include "MEM_guardedalloc.h"
Go to the source code of this file.
Classes | |
struct | DitherContext |
struct | FloatToFloatThreadData |
Macros | |
#define | USHORTTOFLOAT(val) ((float)val / 65535.0f) |
Functions | |
ImBuf Conversion | |
void | IMB_rect_from_float (ImBuf *ibuf) |
void | IMB_float_from_rect_ex (struct ImBuf *dst, const struct ImBuf *src, const rcti *region_to_update) |
void | IMB_float_from_rect (ImBuf *ibuf) |
Color to Gray-Scale | |
void | IMB_color_to_bw (ImBuf *ibuf) |
void | IMB_buffer_float_unpremultiply (float *buf, int width, int height) |
void | IMB_buffer_float_premultiply (float *buf, int width, int height) |
Alter Saturation | |
void | IMB_saturation (ImBuf *ibuf, float sat) |
Floyd-Steinberg dithering | |
typedef struct DitherContext | DitherContext |
static DitherContext * | create_dither_context (float dither) |
static void | clear_dither_context (DitherContext *di) |
Generic Buffer Conversion | |
typedef struct FloatToFloatThreadData | FloatToFloatThreadData |
MINLINE void | ushort_to_byte_v4 (uchar b[4], const unsigned short us[4]) |
MINLINE unsigned char | ftochar (float value) |
MINLINE void | ushort_to_byte_dither_v4 (uchar b[4], const unsigned short us[4], DitherContext *di, float s, float t) |
MINLINE void | float_to_byte_dither_v4 (uchar b[4], const float f[4], DitherContext *di, float s, float t) |
bool | IMB_alpha_affects_rgb (const ImBuf *ibuf) |
void | IMB_buffer_byte_from_float (uchar *rect_to, const float *rect_from, int channels_from, float dither, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from) |
void | IMB_buffer_byte_from_float_mask (uchar *rect_to, const float *rect_from, int channels_from, float dither, bool predivide, int width, int height, int stride_to, int stride_from, char *mask) |
void | IMB_buffer_float_from_byte (float *rect_to, const uchar *rect_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from) |
void | IMB_buffer_float_from_float (float *rect_to, const float *rect_from, int channels_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from) |
static void | imb_buffer_float_from_float_thread_do (void *data_v, int scanline) |
void | IMB_buffer_float_from_float_threaded (float *rect_to, const float *rect_from, int channels_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from) |
void | IMB_buffer_float_from_float_mask (float *rect_to, const float *rect_from, int channels_from, int width, int height, int stride_to, int stride_from, char *mask) |
void | IMB_buffer_byte_from_byte (uchar *rect_to, const uchar *rect_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from) |
typedef struct DitherContext DitherContext |
typedef struct FloatToFloatThreadData FloatToFloatThreadData |
|
static |
Definition at line 40 of file divers.c.
References MEM_freeN.
Referenced by IMB_buffer_byte_from_float(), and IMB_buffer_byte_from_float_mask().
|
static |
Definition at line 30 of file divers.c.
References DitherContext::dither, and MEM_mallocN.
Referenced by IMB_buffer_byte_from_float(), and IMB_buffer_byte_from_float_mask().
MINLINE void float_to_byte_dither_v4 | ( | uchar | b[4], |
const float | f[4], | ||
DitherContext * | di, | ||
float | s, | ||
float | t | ||
) |
Definition at line 78 of file divers.c.
References usdtokens::b(), DitherContext::dither, dither_random_value(), ftochar(), t, and unit_float_to_uchar_clamp().
Referenced by IMB_buffer_byte_from_float(), and IMB_buffer_byte_from_float_mask().
Definition at line 59 of file divers.c.
References unit_float_to_uchar_clamp().
Referenced by float_to_byte_dither_v4(), and ushort_to_byte_dither_v4().
Definition at line 89 of file divers.c.
References ImBuf::flags, and IB_alphamode_channel_packed.
Referenced by IMB_float_from_rect_ex(), and IMB_rect_from_float().
void IMB_buffer_byte_from_byte | ( | unsigned char * | rect_to, |
const unsigned char * | rect_from, | ||
int | profile_to, | ||
int | profile_from, | ||
bool | predivide, | ||
int | width, | ||
int | height, | ||
int | stride_to, | ||
int | stride_from | ||
) |
Byte to byte pixels, input and output 4-channel RGBA.
Definition at line 627 of file divers.c.
References BLI_assert, from, height, IB_PROFILE_LINEAR_RGB, IB_PROFILE_NONE, IB_PROFILE_SRGB, linearrgb_to_srgb_predivide_v4(), linearrgb_to_srgb_v4(), rgba_float_to_uchar(), rgba_uchar_to_float(), srgb_to_linearrgb_predivide_v4(), srgb_to_linearrgb_v4(), width, x, and y.
Referenced by do_display_buffer_apply_thread(), and imb_stereo3d_squeeze_rect().
void IMB_buffer_byte_from_float | ( | unsigned char * | rect_to, |
const float * | rect_from, | ||
int | channels_from, | ||
float | dither, | ||
int | profile_to, | ||
int | profile_from, | ||
bool | predivide, | ||
int | width, | ||
int | height, | ||
int | stride_to, | ||
int | stride_from | ||
) |
Float to byte pixels, output 4-channel RGBA.
Definition at line 94 of file divers.c.
References BLI_assert, clear_dither_context(), create_dither_context(), float_to_byte_dither_v4(), from, height, IB_PROFILE_LINEAR_RGB, IB_PROFILE_NONE, IB_PROFILE_SRGB, linearrgb_to_srgb_ushort4(), linearrgb_to_srgb_v3_v3(), NULL, premul_to_straight_v4_v4(), rgb_float_to_uchar(), rgba_float_to_uchar(), srgb_to_linearrgb_predivide_v4(), srgb_to_linearrgb_v3_v3(), srgb_to_linearrgb_v4(), t, unit_float_to_uchar_clamp(), ushort_to_byte_dither_v4(), ushort_to_byte_v4(), width, x, and y.
Referenced by do_display_buffer_apply_thread(), do_glow_effect_byte(), IMB_display_buffer_transform_apply(), IMB_rect_from_float(), partial_buffer_update_rect(), write_external_bake_pixels(), and write_internal_bake_pixels().
void IMB_buffer_byte_from_float_mask | ( | unsigned char * | rect_to, |
const float * | rect_from, | ||
int | channels_from, | ||
float | dither, | ||
bool | predivide, | ||
int | width, | ||
int | height, | ||
int | stride_to, | ||
int | stride_from, | ||
char * | mask | ||
) |
Float to byte pixels, output 4-channel RGBA.
Definition at line 260 of file divers.c.
References clear_dither_context(), create_dither_context(), FILTER_MASK_USED, float_to_byte_dither_v4(), from, height, mask(), NULL, premul_to_straight_v4_v4(), rgb_float_to_uchar(), rgba_float_to_uchar(), t, unit_float_to_uchar_clamp(), width, x, and y.
Referenced by write_internal_bake_pixels().
void IMB_buffer_float_from_byte | ( | float * | rect_to, |
const unsigned char * | rect_from, | ||
int | profile_to, | ||
int | profile_from, | ||
bool | predivide, | ||
int | width, | ||
int | height, | ||
int | stride_to, | ||
int | stride_from | ||
) |
Byte to float pixels, input and output 4-channel RGBA.
Definition at line 350 of file divers.c.
References BLI_assert, from, height, IB_PROFILE_LINEAR_RGB, IB_PROFILE_NONE, IB_PROFILE_SRGB, linearrgb_to_srgb_predivide_v4(), linearrgb_to_srgb_v4(), rgba_uchar_to_float(), srgb_to_linearrgb_uchar4(), srgb_to_linearrgb_uchar4_predivide(), width, x, and y.
Referenced by do_display_buffer_apply_thread(), do_glow_effect_byte(), do_processor_transform_thread(), IMB_colormanagement_transform_from_byte(), IMB_colormanagement_transform_from_byte_threaded(), IMB_float_from_rect_ex(), and partial_buffer_update_rect().
void IMB_buffer_float_from_float | ( | float * | rect_to, |
const float * | rect_from, | ||
int | channels_from, | ||
int | profile_to, | ||
int | profile_from, | ||
bool | predivide, | ||
int | width, | ||
int | height, | ||
int | stride_to, | ||
int | stride_from | ||
) |
Float to float pixels, output 4-channel RGBA.
Definition at line 409 of file divers.c.
References BLI_assert, copy_v3_v3(), from, height, IB_PROFILE_LINEAR_RGB, IB_PROFILE_NONE, IB_PROFILE_SRGB, linearrgb_to_srgb_predivide_v4(), linearrgb_to_srgb_v3_v3(), linearrgb_to_srgb_v4(), srgb_to_linearrgb_predivide_v4(), srgb_to_linearrgb_v3_v3(), srgb_to_linearrgb_v4(), width, x, and y.
Referenced by blender::compositor::ConvertColorProfileOperation::execute_pixel_sampled(), imb_buffer_float_from_float_thread_do(), IMB_buffer_float_from_float_threaded(), imb_stereo3d_squeeze_rectf(), studiolight_multilayer_convert_pass(), write_external_bake_pixels(), and write_internal_bake_pixels().
void IMB_buffer_float_from_float_mask | ( | float * | rect_to, |
const float * | rect_from, | ||
int | channels_from, | ||
int | width, | ||
int | height, | ||
int | stride_to, | ||
int | stride_from, | ||
char * | mask | ||
) |
Float to float pixels, output 4-channel RGBA.
Definition at line 574 of file divers.c.
References copy_v3_v3(), copy_v4_v4(), FILTER_MASK_USED, from, height, mask(), width, x, and y.
Referenced by write_internal_bake_pixels().
Definition at line 518 of file divers.c.
References data, and IMB_buffer_float_from_float().
Referenced by IMB_buffer_float_from_float_threaded().
void IMB_buffer_float_from_float_threaded | ( | float * | rect_to, |
const float * | rect_from, | ||
int | channels_from, | ||
int | profile_to, | ||
int | profile_from, | ||
bool | predivide, | ||
int | width, | ||
int | height, | ||
int | stride_to, | ||
int | stride_from | ||
) |
Definition at line 536 of file divers.c.
References data, height, IMB_buffer_float_from_float(), imb_buffer_float_from_float_thread_do(), IMB_processor_apply_threaded_scanlines(), and width.
Referenced by BKE_image_buf_fill_checker_color().
Definition at line 873 of file divers.c.
References height, straight_to_premul_v4(), and width.
Referenced by do_glow_effect_byte().
Definition at line 863 of file divers.c.
References height, premul_to_straight_v4(), and width.
Referenced by do_glow_effect_byte().
No profile conversion.
Definition at line 844 of file divers.c.
References if(), IMB_colormanagement_get_luminance(), IMB_colormanagement_get_luminance_byte(), IMB_get_rect_len(), ImBuf::rect, and ImBuf::rect_float.
Referenced by RE_render_result_rect_to_ibuf(), and screenshot_exec().
Definition at line 805 of file divers.c.
References BLI_rcti_init(), ImBuf::channels, ImBuf::flags, IB_rectfloat, IMB_float_from_rect_ex(), IMB_get_rect_len(), ImBuf::mall, MEM_callocN, NULL, ImBuf::rect, ImBuf::rect_float, size(), ImBuf::x, and ImBuf::y.
Referenced by accessor_get_ibuf(), colorfn(), FloatBufferCache::ensure_float_buffer(), blender::nodes::node_geo_image_texture_cc::ImageFieldsFunction::ImageFieldsFunction(), IMB_colormanagement_imbuf_for_write(), blender::compositor::MovieClipBaseOperation::init_execution(), modifier_render_mask_input(), paint_2d_canvas_set(), project_paint_op(), RE_layer_load_from_file(), RE_render_result_rect_to_ibuf(), studiolight_load_equirect_image(), and studiolight_load_irradiance_equirect_image().
void IMB_float_from_rect_ex | ( | struct ImBuf * | dst, |
const struct ImBuf * | src, | ||
const rcti * | region_to_update | ||
) |
Definition at line 750 of file divers.c.
References BLI_assert_msg, BLI_rcti_size_x(), BLI_rcti_size_y(), ImBuf::channels, IB_PROFILE_SRGB, IMB_alpha_affects_rgb(), IMB_buffer_float_from_byte(), IMB_colormanagement_colorspace_to_scene_linear(), IMB_premultiply_rect_float(), NULL, ImBuf::rect_float, src, ImBuf::x, rcti::xmax, rcti::xmin, ImBuf::y, rcti::ymax, and rcti::ymin.
Referenced by IMB_float_from_rect().
Create char buffer, color corrected if necessary, for ImBufs that lack one.
Definition at line 696 of file divers.c.
References buffer, ImBuf::channels, COLOR_ROLE_DEFAULT_BYTE, COLOR_ROLE_SCENE_LINEAR, ImBuf::dither, ImBuf::float_colorspace, IB_PROFILE_SRGB, IB_RECT_INVALID, imb_addrectImBuf(), IMB_alpha_affects_rgb(), IMB_buffer_byte_from_float(), IMB_colormanagement_role_colorspace_name_get(), IMB_colormanagement_transform(), IMB_unpremultiply_rect_float(), MEM_dupallocN, MEM_freeN, ColorSpace::name, NULL, ImBuf::rect, ImBuf::rect_colorspace, ImBuf::rect_float, ImBuf::userflags, ImBuf::x, and ImBuf::y.
Referenced by BKE_main_thumbnail_from_imbuf(), ED_view3d_draw_offscreen_imbuf(), gpencil_render_offscreen(), icon_copy_rect(), image_flip_exec(), image_invert_exec(), IMB_colormanagement_imbuf_for_write(), imb_load_jp2_stream(), imb_load_openexr(), imb_loadhdr(), imb_loadiris(), imb_save_dpx_cineon(), IMB_saveiff(), IMB_thumb_manage(), modifier_render_mask_input(), paint_2d_canvas_set(), prepare_effect_imbufs(), project_paint_op(), blender::ed::space_node::sample_apply(), screen_opengl_render_doit(), sequencer_draw_display_buffer(), and thumb_create_ex().
Definition at line 889 of file divers.c.
References hsv_to_rgb(), if(), IMB_get_rect_len(), ImBuf::rect, ImBuf::rect_float, usdtokens::rgb(), rgb_float_to_uchar(), rgb_to_hsv_v(), and rgb_uchar_to_float().
Referenced by input_preprocess().
MINLINE void ushort_to_byte_dither_v4 | ( | uchar | b[4], |
const unsigned short | us[4], | ||
DitherContext * | di, | ||
float | s, | ||
float | t | ||
) |
Definition at line 64 of file divers.c.
References usdtokens::b(), DitherContext::dither, dither_random_value(), ftochar(), t, unit_ushort_to_uchar(), and USHORTTOFLOAT.
Referenced by IMB_buffer_byte_from_float().
Definition at line 51 of file divers.c.
References usdtokens::b(), and unit_ushort_to_uchar().
Referenced by IMB_buffer_byte_from_float().