Blender
V3.3
|
#include <math.h>
#include "BLI_math_color.h"
#include "BLI_math_interp.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "imbuf.h"
#include "IMB_filter.h"
#include "BLI_sys_types.h"
Go to the source code of this file.
Classes | |
struct | scale_outpix_byte |
struct | scale_outpix_float |
struct | imbufRGBA |
struct | ScaleTreadInitData |
struct | ScaleThreadData |
Typedefs | |
typedef struct ScaleTreadInitData | ScaleTreadInitData |
typedef struct ScaleThreadData | ScaleThreadData |
Functions | |
static void | imb_half_x_no_alloc (struct ImBuf *ibuf2, struct ImBuf *ibuf1) |
struct ImBuf * | IMB_half_x (struct ImBuf *ibuf1) |
struct ImBuf * | IMB_double_fast_x (struct ImBuf *ibuf1) |
struct ImBuf * | IMB_double_x (struct ImBuf *ibuf1) |
static void | imb_half_y_no_alloc (struct ImBuf *ibuf2, struct ImBuf *ibuf1) |
struct ImBuf * | IMB_half_y (struct ImBuf *ibuf1) |
struct ImBuf * | IMB_double_fast_y (struct ImBuf *ibuf1) |
struct ImBuf * | IMB_double_y (struct ImBuf *ibuf1) |
MINLINE void | straight_uchar_to_premul_ushort (unsigned short result[4], const unsigned char color[4]) |
MINLINE void | premul_ushort_to_straight_uchar (unsigned char *result, const unsigned short color[4]) |
void | imb_onehalf_no_alloc (struct ImBuf *ibuf2, struct ImBuf *ibuf1) |
ImBuf * | IMB_onehalf (struct ImBuf *ibuf1) |
static void | enlarge_picture_byte (unsigned char *src, unsigned char *dst, int src_width, int src_height, int dst_width, int dst_height) |
static void | shrink_picture_byte (unsigned char *src, unsigned char *dst, int src_width, int src_height, int dst_width, int dst_height) |
static void | q_scale_byte (unsigned char *in, unsigned char *out, int in_width, int in_height, int dst_width, int dst_height) |
static void | enlarge_picture_float (float *src, float *dst, int src_width, int src_height, int dst_width, int dst_height) |
static void | shrink_picture_float (const float *src, float *dst, int src_width, int src_height, int dst_width, int dst_height) |
static void | q_scale_float (float *in, float *out, int in_width, int in_height, int dst_width, int dst_height) |
static bool | q_scale_linear_interpolation (struct ImBuf *ibuf, int newx, int newy) |
static ImBuf * | scaledownx (struct ImBuf *ibuf, int newx) |
static ImBuf * | scaledowny (struct ImBuf *ibuf, int newy) |
static ImBuf * | scaleupx (struct ImBuf *ibuf, int newx) |
static ImBuf * | scaleupy (struct ImBuf *ibuf, int newy) |
static void | scalefast_Z_ImBuf (ImBuf *ibuf, int newx, int newy) |
bool | IMB_scaleImBuf (struct ImBuf *ibuf, unsigned int newx, unsigned int newy) |
bool | IMB_scalefastImBuf (struct ImBuf *ibuf, unsigned int newx, unsigned int newy) |
static void | scale_thread_init (void *data_v, int start_line, int tot_line, void *init_data_v) |
static void * | do_scale_thread (void *data_v) |
void | IMB_scaleImBuf_threaded (ImBuf *ibuf, unsigned int newx, unsigned int newy) |
typedef struct ScaleThreadData ScaleThreadData |
typedef struct ScaleTreadInitData ScaleTreadInitData |
Definition at line 1829 of file scaling.c.
References BLI_bilinear_interpolation_char(), BLI_bilinear_interpolation_fl(), ImBuf::channels, data, float(), NULL, offset, ImBuf::rect, ImBuf::rect_float, v, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_scaleImBuf_threaded().
|
static |
Definition at line 107 of file scaling.c.
References col, dest, ImBuf::flags, IMB_allocImBuf(), NULL, ImBuf::planes, ImBuf::rect, ImBuf::rect_float, ImBuf::x, and ImBuf::y.
Referenced by IMB_double_x().
Definition at line 260 of file scaling.c.
References ImBuf::flags, IMB_allocImBuf(), NULL, ImBuf::planes, ImBuf::rect, ImBuf::rect_float, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_double_y().
Definition at line 152 of file scaling.c.
References IMB_double_fast_x(), imb_filterx(), NULL, ImBuf::rect, and ImBuf::rect_float.
Definition at line 307 of file scaling.c.
References IMB_double_fast_y(), IMB_filtery(), NULL, and ImBuf::rect.
Definition at line 82 of file scaling.c.
References ImBuf::flags, IMB_allocImBuf(), IMB_dupImBuf(), imb_half_x_no_alloc(), NULL, ImBuf::planes, ImBuf::rect, ImBuf::rect_float, ImBuf::x, and ImBuf::y.
Referenced by IMB_onehalf().
Definition at line 23 of file scaling.c.
References Freestyle::a, usdtokens::b(), dest, usdtokens::g(), NULL, r, ImBuf::rect, ImBuf::rect_float, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_half_x(), and imb_onehalf_no_alloc().
Definition at line 235 of file scaling.c.
References ImBuf::flags, IMB_allocImBuf(), IMB_dupImBuf(), imb_half_y_no_alloc(), NULL, ImBuf::planes, ImBuf::rect, ImBuf::rect_float, ImBuf::x, and ImBuf::y.
Referenced by IMB_onehalf().
Definition at line 169 of file scaling.c.
References Freestyle::a, usdtokens::b(), dest, usdtokens::g(), NULL, r, ImBuf::rect, ImBuf::rect_float, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_half_y(), and imb_onehalf_no_alloc().
Definition at line 433 of file scaling.c.
References ImBuf::flags, IMB_allocImBuf(), IMB_half_x(), IMB_half_y(), imb_onehalf_no_alloc(), NULL, ImBuf::planes, ImBuf::rect, ImBuf::rect_float, ImBuf::x, and ImBuf::y.
Referenced by IMB_makemipmap().
Result in ibuf2, scaling should be done correctly.
Definition at line 356 of file scaling.c.
References dest, imb_addrectImBuf(), imb_half_x_no_alloc(), imb_half_y_no_alloc(), NULL, premul_ushort_to_straight_uchar(), ImBuf::rect, ImBuf::rect_float, straight_uchar_to_premul_ushort(), x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_onehalf(), and IMB_remakemipmap().
Definition at line 1689 of file scaling.c.
References BLI_assert_msg, IB_rect, IB_rectfloat, imb_freerectfloatImBuf(), imb_freerectImBuf(), ImBuf::mall, MEM_freeN, MEM_mallocN, NULL, ImBuf::rect, ImBuf::rect_float, scalefast_Z_ImBuf(), x, ImBuf::x, y, and ImBuf::y.
Referenced by icon_copy_rect(), py_imbuf_resize(), and seq_proxy_build_frame().
Return true if ibuf is modified.
Definition at line 1644 of file scaling.c.
References BLI_assert_msg, NULL, q_scale_linear_interpolation(), ImBuf::rect, ImBuf::rect_float, scaledownx(), scaledowny(), scalefast_Z_ImBuf(), scaleupx(), scaleupy(), x, ImBuf::x, y, and ImBuf::y.
Referenced by accessor_get_ibuf(), BKE_image_scale(), BKE_previewimg_ensure(), blend_file_thumb_from_camera(), blend_file_thumb_from_screenshot(), get_undistorted_ibuf(), icon_verify_datatoc(), image_scale_exec(), imb_gpu_get_data(), Freestyle::Canvas::loadMap(), movieclip_build_proxy_ibuf(), py_imbuf_resize(), thumb_create_ex(), ui_draw_but_IMAGE(), update_do_scale(), wm_block_create_about(), and wm_block_splash_image().
Definition at line 1863 of file scaling.c.
References BLI_assert_msg, ImBuf::channels, do_scale_thread(), IB_rect, IB_rectfloat, imb_freerectfloatImBuf(), imb_freerectImBuf(), IMB_processor_apply_threaded(), init_data(), ImBuf::mall, MEM_mallocN, NULL, ImBuf::rect, ImBuf::rect_float, scale_thread_init(), ImBuf::x, and ImBuf::y.
Referenced by imb_stereo3d_squeeze_ImBuf(), imb_stereo3d_squeeze_rect(), imb_stereo3d_squeeze_rectf(), imb_stereo3d_unsqueeze_ImBuf(), and movieclip_build_proxy_ibuf().
MINLINE void premul_ushort_to_straight_uchar | ( | unsigned char * | result, |
const unsigned short | color[4] | ||
) |
Definition at line 338 of file scaling.c.
References color, result, and unit_ushort_to_uchar().
Referenced by imb_onehalf_no_alloc().
|
static |
Definition at line 646 of file scaling.c.
References enlarge_picture_byte(), usdtokens::out(), and shrink_picture_byte().
Referenced by q_scale_linear_interpolation().
|
static |
Definition at line 832 of file scaling.c.
References enlarge_picture_float(), usdtokens::out(), and shrink_picture_float().
Referenced by q_scale_linear_interpolation().
q_scale_linear_interpolation (derived from ppmqscale, http://libdv.sf.net)
q stands for quick and quality :)
only handles common cases when we either
scale both, x and y or shrink both, x and y
but that is pretty fast:
Should be comparable in speed to the ImBuf ..._fast functions at least for byte-buffers.
NOTE: disabled, due to unacceptable inaccuracy and quality loss, see bug T18609 (ton)
Definition at line 864 of file scaling.c.
References IB_rect, IB_rectfloat, imb_freerectfloatImBuf(), imb_freerectImBuf(), ImBuf::mall, MEM_mallocN, q_scale_byte(), q_scale_float(), ImBuf::rect, ImBuf::rect_float, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_scaleImBuf().
|
static |
Definition at line 1812 of file scaling.c.
References data, and init_data().
Referenced by IMB_scaleImBuf_threaded().
Definition at line 891 of file scaling.c.
References blender::bke::attribute_accessor_functions::add(), BLI_assert, IB_rect, IB_rectfloat, imb_freerectfloatImBuf(), imb_freerectImBuf(), IMB_get_rect_len(), ImBuf::mall, MEM_freeN, MEM_mallocN, NULL, ImBuf::rect, ImBuf::rect_float, rect_size(), sample, void, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_scaleImBuf().
Definition at line 1032 of file scaling.c.
References blender::bke::attribute_accessor_functions::add(), BLI_assert, IB_rect, IB_rectfloat, imb_freerectfloatImBuf(), imb_freerectImBuf(), IMB_get_rect_len(), ImBuf::mall, MEM_freeN, MEM_mallocN, NULL, ImBuf::rect, ImBuf::rect_float, rect_size(), sample, void, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_scaleImBuf().
Definition at line 1579 of file scaling.c.
References IB_zbuf, IB_zbuffloat, IMB_freezbuffloatImBuf(), IMB_freezbufImBuf(), ImBuf::mall, MEM_mallocN, NULL, x, ImBuf::x, y, ImBuf::y, ImBuf::zbuf, and ImBuf::zbuf_float.
Referenced by IMB_scalefastImBuf(), and IMB_scaleImBuf().
Definition at line 1174 of file scaling.c.
References blender::bke::attribute_accessor_functions::add(), IB_rect, IB_rectfloat, imb_freerectfloatImBuf(), imb_freerectImBuf(), ImBuf::mall, MEM_freeN, MEM_mallocN, NULL, ImBuf::rect, ImBuf::rect_float, sample, UNLIKELY, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_scaleImBuf().
Definition at line 1376 of file scaling.c.
References blender::bke::attribute_accessor_functions::add(), IB_rect, IB_rectfloat, imb_freerectfloatImBuf(), imb_freerectImBuf(), ImBuf::mall, MEM_freeN, MEM_mallocN, NULL, ImBuf::rect, ImBuf::rect_float, sample, UNLIKELY, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_scaleImBuf().
|
static |
Definition at line 531 of file scaling.c.
References scale_outpix_byte::a, scale_outpix_byte::b, double(), scale_outpix_byte::g, MEM_callocN, MEM_freeN, NULL, scale_outpix_byte::r, src, w(), scale_outpix_byte::weight, and x.
Referenced by q_scale_byte().
|
static |
Definition at line 723 of file scaling.c.
References scale_outpix_float::a, scale_outpix_float::b, double(), scale_outpix_float::g, MEM_callocN, MEM_freeN, scale_outpix_float::r, src, w(), scale_outpix_float::weight, and x.
Referenced by q_scale_float().