Blender  V3.3
Classes | Macros
divers.c File Reference
#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 DitherContextcreate_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)
 

Macro Definition Documentation

◆ USHORTTOFLOAT

#define USHORTTOFLOAT (   val)    ((float)val / 65535.0f)

Typedef Documentation

◆ DitherContext

typedef struct DitherContext DitherContext

◆ FloatToFloatThreadData

Function Documentation

◆ clear_dither_context()

static void clear_dither_context ( DitherContext di)
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().

◆ create_dither_context()

static DitherContext* create_dither_context ( float  dither)
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().

◆ float_to_byte_dither_v4()

MINLINE void float_to_byte_dither_v4 ( uchar  b[4],
const float  f[4],
DitherContext di,
float  s,
float  t 
)

◆ ftochar()

MINLINE unsigned char ftochar ( float  value)

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().

◆ IMB_alpha_affects_rgb()

bool IMB_alpha_affects_rgb ( const ImBuf ibuf)

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().

◆ IMB_buffer_byte_from_byte()

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 
)

◆ IMB_buffer_byte_from_float()

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 
)

◆ IMB_buffer_byte_from_float_mask()

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 
)

◆ IMB_buffer_float_from_byte()

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 
)

◆ IMB_buffer_float_from_float()

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 
)

◆ IMB_buffer_float_from_float_mask()

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().

◆ imb_buffer_float_from_float_thread_do()

static void imb_buffer_float_from_float_thread_do ( void data_v,
int  scanline 
)
static

Definition at line 518 of file divers.c.

References data, and IMB_buffer_float_from_float().

Referenced by IMB_buffer_float_from_float_threaded().

◆ 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 
)

◆ IMB_buffer_float_premultiply()

void IMB_buffer_float_premultiply ( float buf,
int  width,
int  height 
)

Definition at line 873 of file divers.c.

References height, straight_to_premul_v4(), and width.

Referenced by do_glow_effect_byte().

◆ IMB_buffer_float_unpremultiply()

void IMB_buffer_float_unpremultiply ( float buf,
int  width,
int  height 
)

Definition at line 863 of file divers.c.

References height, premul_to_straight_v4(), and width.

Referenced by do_glow_effect_byte().

◆ IMB_color_to_bw()

void IMB_color_to_bw ( struct ImBuf ibuf)

◆ IMB_float_from_rect()

void IMB_float_from_rect ( ImBuf ibuf)

◆ IMB_float_from_rect_ex()

void IMB_float_from_rect_ex ( struct ImBuf dst,
const struct ImBuf src,
const rcti region_to_update 
)

◆ IMB_rect_from_float()

void IMB_rect_from_float ( struct ImBuf ibuf)

◆ IMB_saturation()

void IMB_saturation ( ImBuf ibuf,
float  sat 
)

◆ ushort_to_byte_dither_v4()

MINLINE void ushort_to_byte_dither_v4 ( uchar  b[4],
const unsigned short  us[4],
DitherContext di,
float  s,
float  t 
)

◆ ushort_to_byte_v4()

MINLINE void ushort_to_byte_v4 ( uchar  b[4],
const unsigned short  us[4] 
)

Definition at line 51 of file divers.c.

References usdtokens::b(), and unit_ushort_to_uchar().

Referenced by IMB_buffer_byte_from_float().