Blender  V3.3
Classes | Functions
imageprocess.c File Reference
#include <math.h>
#include <stdlib.h>
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"

Go to the source code of this file.

Classes

struct  ScanlineGlobalData
 

Functions

void IMB_convert_rgba_to_abgr (struct ImBuf *ibuf)
 
static void pixel_from_buffer (const struct ImBuf *ibuf, unsigned char **outI, float **outF, int x, int y)
 
Bi-Cubic Interpolation
void bicubic_interpolation_color (const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
 
void bicubic_interpolation (const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
 
Bi-Linear Interpolation
void bilinear_interpolation_color_fl (const struct ImBuf *in, unsigned char UNUSED(outI[4]), float outF[4], float u, float v)
 
void bilinear_interpolation_color_char (const struct ImBuf *in, unsigned char outI[4], float UNUSED(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_wrap (const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
 
void bilinear_interpolation (const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
 
Nearest Interpolation
void nearest_interpolation_color_char (const struct ImBuf *in, unsigned char outI[4], float UNUSED(outF[4]), float u, float v)
 
void nearest_interpolation_color_fl (const struct ImBuf *in, unsigned char UNUSED(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)
 
void nearest_interpolation_color_wrap (const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
 
void nearest_interpolation (const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
 
Alpha-under
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])
 
Sample Pixel
void IMB_sampleImageAtLocation (ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4])
 

Threaded Image Processing

typedef struct ScanlineGlobalData ScanlineGlobalData
 
static void processor_apply_func (TaskPool *__restrict pool, void *taskdata)
 
void IMB_processor_apply_threaded (int buffer_lines, int handle_size, void *init_customdata, void(init_handle)(void *handle, int start_line, int tot_line, void *customdata), void *(do_thread)(void *))
 
static void processor_apply_parallel (void *__restrict userdata, const int scanline, const TaskParallelTLS *__restrict UNUSED(tls))
 
void IMB_processor_apply_threaded_scanlines (int total_scanlines, ScanlineThreadFunc do_thread, void *custom_data)
 

Detailed Description

This file was moved here from the src/ directory. It is meant to deal with endianness. It resided in a general blending lib. The other functions were only used during rendering. This single function remained. It should probably move to imbuf/intern/util.c, but we'll keep it here for the time being.

Definition in file imageprocess.c.

Typedef Documentation

◆ ScanlineGlobalData

Function Documentation

◆ bicubic_interpolation()

void bicubic_interpolation ( const ImBuf in,
ImBuf out,
float  u,
float  v,
int  xout,
int  yout 
)

◆ bicubic_interpolation_color()

void bicubic_interpolation_color ( const struct ImBuf in,
unsigned char  outI[4],
float  outF[4],
float  u,
float  v 
)

◆ bilinear_interpolation()

void bilinear_interpolation ( const ImBuf in,
ImBuf out,
float  u,
float  v,
int  xout,
int  yout 
)

◆ bilinear_interpolation_color()

void bilinear_interpolation_color ( const struct ImBuf in,
unsigned char  outI[4],
float  outF[4],
float  u,
float  v 
)

◆ bilinear_interpolation_color_char()

void bilinear_interpolation_color_char ( const struct ImBuf in,
unsigned char  outI[4],
float   UNUSEDoutF[4],
float  u,
float  v 
)

◆ bilinear_interpolation_color_fl()

void bilinear_interpolation_color_fl ( const struct ImBuf in,
unsigned char   UNUSEDoutI[4],
float  outF[4],
float  u,
float  v 
)

◆ bilinear_interpolation_color_wrap()

void bilinear_interpolation_color_wrap ( const struct ImBuf in,
unsigned char  outI[4],
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. This the same as bilinear_interpolation_color except it wraps rather than using empty and emptyI.

Definition at line 142 of file imageprocess.c.

References Freestyle::a, usdtokens::b(), ceil(), clamp_v4(), blender::math::floor(), floorf, ImBuf::rect, ImBuf::rect_float, v, ImBuf::x, x2, ImBuf::y, and y1.

Referenced by paint_sample_color(), project_face_pixel(), and project_paint_PickColor().

◆ IMB_alpha_under_color_byte()

void IMB_alpha_under_color_byte ( unsigned char *  rect,
int  x,
int  y,
const float  backcol[3] 
)

Definition at line 449 of file imageprocess.c.

References Freestyle::a, mul(), x, and y.

Referenced by IMB_colormanagement_imbuf_for_write().

◆ IMB_alpha_under_color_float()

void IMB_alpha_under_color_float ( float rect_float,
int  x,
int  y,
float  backcol[3] 
)

Definition at line 435 of file imageprocess.c.

References Freestyle::a, madd_v3_v3fl(), mul(), x, and y.

Referenced by IMB_colormanagement_imbuf_for_write().

◆ IMB_convert_rgba_to_abgr()

void IMB_convert_rgba_to_abgr ( struct ImBuf ibuf)

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.c

Only this one is used liberally here, and in imbuf.

Definition at line 26 of file imageprocess.c.

References if(), ImBuf::rect, ImBuf::rect_float, size(), ImBuf::x, and ImBuf::y.

Referenced by IMB_anim_absolute(), imb_loadiris(), imb_loadtarga(), imb_read_tiff_pixels(), and imb_saveiris().

◆ IMB_processor_apply_threaded()

void IMB_processor_apply_threaded ( int  buffer_lines,
int  handle_size,
void init_customdata,
void(init_handle)(void *handle, int start_line, int tot_line, void *customdata)  ,
void do_thread)(void * 
)

◆ IMB_processor_apply_threaded_scanlines()

void IMB_processor_apply_threaded_scanlines ( int  total_scanlines,
ScanlineThreadFunc  do_thread,
void custom_data 
)

◆ IMB_sampleImageAtLocation()

void IMB_sampleImageAtLocation ( struct ImBuf ibuf,
float  x,
float  y,
bool  make_linear_rgb,
float  color[4] 
)

◆ nearest_interpolation()

void nearest_interpolation ( const ImBuf in,
ImBuf out,
float  u,
float  v,
int  xout,
int  yout 
)

◆ nearest_interpolation_color()

void nearest_interpolation_color ( const struct ImBuf in,
unsigned char  outI[4],
float  outF[4],
float  u,
float  v 
)

◆ nearest_interpolation_color_char()

void nearest_interpolation_color_char ( const struct ImBuf in,
unsigned char  outI[4],
float   UNUSEDoutF[4],
float  u,
float  v 
)

Definition at line 235 of file imageprocess.c.

References BLI_assert, offset, ImBuf::rect, v, ImBuf::x, ImBuf::y, and y1.

Referenced by nearest_interpolation_color().

◆ nearest_interpolation_color_fl()

void nearest_interpolation_color_fl ( const struct ImBuf in,
unsigned char   UNUSEDoutI[4],
float  outF[4],
float  u,
float  v 
)

Definition at line 258 of file imageprocess.c.

References BLI_assert, copy_v4_v4(), offset, ImBuf::rect_float, v, ImBuf::x, ImBuf::y, y1, and zero_v4().

Referenced by nearest_interpolation_color().

◆ nearest_interpolation_color_wrap()

void nearest_interpolation_color_wrap ( const struct ImBuf in,
unsigned char  outI[4],
float  outF[4],
float  u,
float  v 
)

◆ pixel_from_buffer()

static void pixel_from_buffer ( const struct ImBuf ibuf,
unsigned char **  outI,
float **  outF,
int  x,
int  y 
)
static

◆ processor_apply_func()

static void processor_apply_func ( TaskPool *__restrict  pool,
void taskdata 
)
static

Definition at line 349 of file imageprocess.c.

References BLI_task_pool_user_data(), blender::compositor::pool, and void.

Referenced by IMB_processor_apply_threaded().

◆ processor_apply_parallel()

static void processor_apply_parallel ( void *__restrict  userdata,
const int  scanline,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

Definition at line 407 of file imageprocess.c.

References data.

Referenced by IMB_processor_apply_threaded_scanlines().