Blender
V3.3
|
#include <stddef.h>
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_allocimbuf.h"
#include "IMB_colormanagement_intern.h"
#include "IMB_filetype.h"
#include "IMB_metadata.h"
#include "imbuf.h"
#include "MEM_guardedalloc.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
Go to the source code of this file.
Variables | |
static SpinLock | refcounter_spin |
static SpinLock | mmap_spin |
Definition at line 270 of file allocimbuf.c.
References ImBuf::flags, IB_zbuffloat, imb_alloc_pixels(), IMB_freezbuffloatImBuf(), ImBuf::mall, NULL, ImBuf::x, ImBuf::y, and ImBuf::zbuf_float.
Referenced by IMB_ImBufFromStereo3d(), IMB_initImBuf(), imb_load_openexr(), and seq_render_scene_strip().
Definition at line 253 of file allocimbuf.c.
References ImBuf::flags, IB_zbuf, imb_alloc_pixels(), IMB_freezbufImBuf(), ImBuf::mall, NULL, ImBuf::x, ImBuf::y, and ImBuf::zbuf.
Referenced by imb_addrectImBuf(), IMB_ImBufFromStereo3d(), and IMB_initImBuf().
Definition at line 138 of file allocimbuf.c.
References ImBuf::encodedbuffer, ImBuf::encodedbuffersize, ImBuf::encodedsize, IB_mem, ImBuf::mall, MEM_freeN, and NULL.
Referenced by imb_addencodedbufferImBuf(), imb_enlargeencodedbufferImBuf(), and imb_freerectImbuf_all().
Definition at line 287 of file allocimbuf.c.
References ImBuf::encodedbuffer, ImBuf::encodedbuffersize, ImBuf::encodedsize, ImBuf::flags, freeencodedbufferImBuf(), IB_mem, ImBuf::mall, MEM_mallocN, and NULL.
Referenced by IMB_dupImBuf(), imb_save_openexr(), imb_save_photoshop(), and imb_savepng().
Definition at line 367 of file allocimbuf.c.
References ImBuf::channels, channels(), ImBuf::flags, IB_rectfloat, imb_alloc_pixels(), imb_freerectfloatImBuf(), ImBuf::mall, NULL, ImBuf::rect_float, ImBuf::x, and ImBuf::y.
Referenced by IMB_ImBufFromStereo3d(), IMB_initImBuf(), imb_load_openexr(), imb_loadpng(), IMB_stereo3d_ImBuf(), modifier_color_balance_apply(), seq_imbuf_to_sequencer_space(), and ubuf_ensure_compat_ibuf().
Definition at line 387 of file allocimbuf.c.
References addzbufImBuf(), ImBuf::flags, IB_rect, imb_alloc_pixels(), ImBuf::mall, MEM_freeN, NULL, ImBuf::planes, ImBuf::rect, ImBuf::x, and ImBuf::y.
Referenced by colormanagement_imbuf_make_display_space(), IMB_ImBufFromStereo3d(), IMB_initImBuf(), imb_load_dds(), imb_loadpng(), imb_loadwebp(), imb_onehalf_no_alloc(), IMB_rect_from_float(), IMB_stereo3d_ImBuf(), and ubuf_ensure_compat_ibuf().
Definition at line 484 of file allocimbuf.c.
References IB_tiles, ImBuf::mall, MEM_callocN, NULL, ImBuf::tiles, ImBuf::xtiles, and ImBuf::ytiles.
Referenced by imb_loadtiff().
void* imb_alloc_pixels | ( | unsigned int | x, |
unsigned int | y, | ||
unsigned int | channels, | ||
size_t | typesize, | ||
const char * | name | ||
) |
Exported for image tools in blender, to quickly allocate 32 bits rect.
Definition at line 354 of file allocimbuf.c.
References channels(), MEM_callocN, NULL, size(), SIZE_MAX, x, and y.
Referenced by addzbuffloatImBuf(), addzbufImBuf(), avi_converter_from_avi_rgb(), avi_converter_from_mjpeg(), avi_converter_from_rgb32(), avi_converter_to_mjpeg(), avi_converter_to_rgb32(), convertRGBAToLogElement(), imb_addrectfloatImBuf(), imb_addrectImBuf(), imb_loadpng(), logImageGetDataRGBA(), and logImageSetDataRGBA().
struct ImBuf* IMB_allocFromBuffer | ( | const unsigned int * | rect, |
const float * | rectf, | ||
unsigned int | w, | ||
unsigned int | h, | ||
unsigned int | channels | ||
) |
Create a copy of a pixel buffer and wrap it to a new ImBuf
Definition at line 447 of file allocimbuf.c.
References ImBuf::channels, channels(), ImBuf::flags, IB_rect, IB_rectfloat, IMB_allocImBuf(), ImBuf::mall, MEM_mallocN, NULL, ImBuf::rect, ImBuf::rect_float, size(), and w().
Referenced by BKE_main_thumbnail_to_imbuf(), imb_gpu_get_data(), imb_load_filepath_thumbnail_openexr(), studiolight_calculate_radiance_cubemap_buffers(), studiolight_load_equirect_image(), and update_do_scale().
struct ImBuf* IMB_allocFromBufferOwn | ( | unsigned int * | rect, |
float * | rectf, | ||
unsigned int | w, | ||
unsigned int | h, | ||
unsigned int | channels | ||
) |
Create a copy of a pixel buffer and wrap it to a new ImBuf (transferring ownership to the in imbuf).
Definition at line 415 of file allocimbuf.c.
References BLI_assert, ImBuf::channels, channels(), ImBuf::flags, IB_rect, IB_rectfloat, IMB_allocImBuf(), ImBuf::mall, MEM_allocN_len, NULL, ImBuf::rect, ImBuf::rect_float, and w().
Referenced by blend_file_thumb_from_screenshot(), studiolight_calculate_irradiance_equirect_image(), and studiolight_load_equirect_image().
ImBuf* IMB_allocImBuf | ( | unsigned int | x, |
unsigned int | y, | ||
unsigned char | planes, | ||
unsigned int | flags | ||
) |
Definition at line 500 of file allocimbuf.c.
References ImBuf::flags, IMB_freeImBuf(), IMB_initImBuf(), MEM_mallocN, NULL, ImBuf::planes, x, and y.
Referenced by accessor_get_ibuf(), add_ibuf_size(), BKE_previewimg_to_imbuf(), BKE_tracking_get_plane_imbuf(), BKE_tracking_get_search_imbuf(), BKE_tracking_sample_pattern(), BKE_tracking_stabilize_frame(), brush_painter_imbuf_new(), brush_painter_imbuf_partial_update(), colormanage_cache_put(), blender::compositor::OutputStereoOperation::deinit_execution(), blender::compositor::OutputSingleLayerOperation::deinit_execution(), dynamicPaint_outputSurfaceImage(), ED_view3d_draw_offscreen_imbuf(), FloatBufferCache::ensure_float_buffer(), blender::compositor::DebugInfo::export_operation(), filelist_init_icons(), float_image_to_ibuf(), gpencil_render_offscreen(), GHOST_SystemCocoa::handleDraggingEvent(), ibJpegImageFromCinfo(), image_acquire_ibuf(), image_get_ibuf_multilayer(), image_get_render_result(), image_load_sequence_multilayer(), IMB_allocFromBuffer(), IMB_allocFromBufferOwn(), imb_bmp_decode(), IMB_double_fast_x(), IMB_double_fast_y(), IMB_dupImBuf(), IMB_half_x(), IMB_half_y(), IMB_ImBufFromStereo3d(), imb_load_dds(), imb_load_dpx_cineon(), imb_load_filepath_thumbnail_openexr(), imb_load_jp2_stream(), imb_load_openexr(), imb_loadhdr(), imb_loadiris(), imb_loadpng(), imb_loadtarga(), imb_loadtiff(), imb_loadwebp(), IMB_makemipmap(), imb_oiio_load_image(), imb_oiio_load_image_float(), IMB_onehalf(), imb_read_tiff_pixels(), IMB_remakemipmap(), IMB_stereo3d_ImBuf(), imb_stereo3d_squeeze_rect(), imb_stereo3d_squeeze_rectf(), IMB_thumb_load_font(), imbuf_alloc_temp_tile(), input_preprocess(), Freestyle::Canvas::loadMap(), M_imbuf_new(), make_grayscale_ibuf_copy(), make_histogram_view_from_ibuf_byte(), make_histogram_view_from_ibuf_float(), make_sep_waveform_view_from_ibuf_byte(), make_sep_waveform_view_from_ibuf_float(), make_vectorscope_view_from_ibuf_byte(), make_vectorscope_view_from_ibuf_float(), make_waveform_view_from_ibuf_byte(), make_waveform_view_from_ibuf_float(), make_zebra_view_from_ibuf(), paint_2d_lift_clone(), prepare_effect_imbufs(), RE_layer_load_from_file(), RE_render_result_rect_to_ibuf(), Freestyle::SteerableViewMap::saveSteerableViewMap(), screen_opengl_render_doit(), screenshot_exec(), seq_disk_cache_read_file(), seq_get_uncached_thumbnail(), seq_render_effect_strip_impl(), seq_render_mask(), seq_render_scene_strip(), seq_render_strip(), seq_render_strip_stack(), thumb_create_ex(), and write_external_bake_pixels().
Definition at line 562 of file allocimbuf.c.
References Freestyle::a, ImBuf::c_handle, ImBuf::channels, ImBuf::colormanage_cache, DDSData::data, ImBuf::dds_data, ImBuf::display_buffer_flags, ImBuf::encodedbuffer, ImBuf::encodedbuffersize, ImBuf::encodedsize, ImBuf::flags, IB_rect, IB_rectfloat, IB_zbuf, IB_zbuffloat, imb_addencodedbufferImBuf(), IMB_allocImBuf(), IMB_freeImBuf(), IMB_MIPMAP_LEVELS, ImBuf::mall, ImBuf::metadata, ImBuf::mipmap, NULL, ImBuf::planes, ImBuf::rect, ImBuf::rect_float, ImBuf::refcounter, x, ImBuf::x, y, ImBuf::y, ImBuf::zbuf, and ImBuf::zbuf_float.
Referenced by IMB_makeSingleUser().
Definition at line 310 of file allocimbuf.c.
References ImBuf::encodedbuffer, ImBuf::encodedbuffersize, ImBuf::encodedsize, ImBuf::flags, freeencodedbufferImBuf(), IB_mem, ImBuf::mall, MEM_mallocN, and NULL.
Referenced by WriteData().
Definition at line 192 of file allocimbuf.c.
References BLI_spin_lock(), BLI_spin_unlock(), colormanage_cache_free(), DDSData::data, ImBuf::dds_data, free(), imb_freerectImbuf_all(), IMB_metadata_free(), MEM_freeN, ImBuf::metadata, NULL, ImBuf::refcounter, and refcounter_spin.
Referenced by IMB_allocImBuf(), IMB_dupImBuf(), imb_freemipmapImBuf(), and IMB_makeSingleUser().
Definition at line 64 of file allocimbuf.c.
References Freestyle::a, IMB_freeImBuf(), IMB_MIPMAP_LEVELS, ImBuf::mipmap, ImBuf::miptot, and NULL.
Referenced by finish_images(), imb_freerectfloatImBuf(), imb_freerectImBuf(), IMB_makemipmap(), and write_internal_bake_pixels().
Any free ibuf->rect
frees mipmaps to be sure, creation is in render on first request.
Definition at line 80 of file allocimbuf.c.
References IB_rectfloat, imb_freemipmapImBuf(), ImBuf::mall, MEM_freeN, NULL, and ImBuf::rect_float.
Referenced by image_save_post(), imb_addrectfloatImBuf(), imb_freerectImbuf_all(), IMB_scalefastImBuf(), IMB_scaleImBuf_threaded(), IMB_thumb_manage(), project_paint_end(), q_scale_linear_interpolation(), scaledownx(), scaledowny(), scaleupx(), scaleupy(), screen_opengl_render_doit(), thumb_create_ex(), and ubuf_ensure_compat_ibuf().
Any free ibuf->rect
frees mipmaps to be sure, creation is in render on first request.
Definition at line 97 of file allocimbuf.c.
References IB_rect, imb_freemipmapImBuf(), ImBuf::mall, MEM_freeN, NULL, and ImBuf::rect.
Referenced by BKE_tracking_distortion_exec(), colormanage_imbuf_make_linear(), image_get_render_result(), image_save_post(), IMB_colormanagement_imbuf_for_write(), imb_freerectImbuf_all(), IMB_scalefastImBuf(), IMB_scaleImBuf_threaded(), input_preprocess(), modifier_color_balance_apply(), project_paint_end(), q_scale_linear_interpolation(), scaledownx(), scaledowny(), scaleupx(), scaleupy(), seq_imbuf_to_sequencer_space(), seq_render_image_strip_view(), and seq_render_movie_strip_view().
Free all pixel data (associated with image size).
Definition at line 182 of file allocimbuf.c.
References freeencodedbufferImBuf(), imb_freerectfloatImBuf(), imb_freerectImBuf(), imb_freetilesImBuf(), IMB_freezbuffloatImBuf(), and IMB_freezbufImBuf().
Referenced by IMB_freeImBuf(), and ubuf_ensure_compat_ibuf().
Definition at line 113 of file allocimbuf.c.
References IB_tiles, imb_tile_cache_tile_free(), ImBuf::mall, MEM_freeN, NULL, ImBuf::tiles, ImBuf::xtiles, and ImBuf::ytiles.
Referenced by imb_freerectImbuf_all().
Definition at line 168 of file allocimbuf.c.
References IB_zbuffloat, ImBuf::mall, MEM_freeN, NULL, and ImBuf::zbuf_float.
Referenced by addzbuffloatImBuf(), BKE_image_format_to_imbuf(), image_save_post(), imb_freerectImbuf_all(), and scalefast_Z_ImBuf().
Definition at line 154 of file allocimbuf.c.
References IB_zbuf, ImBuf::mall, MEM_freeN, NULL, and ImBuf::zbuf.
Referenced by addzbufImBuf(), image_save_post(), imb_freerectImbuf_all(), and scalefast_Z_ImBuf().
size_t IMB_get_rect_len | ( | const ImBuf * | ibuf | ) |
Definition at line 650 of file allocimbuf.c.
size_t IMB_get_size_in_memory | ( | struct ImBuf * | ibuf | ) |
Approximate size of ImBuf in memory
Definition at line 655 of file allocimbuf.c.
References Freestyle::a, ImBuf::channels, float(), IMB_get_size_in_memory(), ImBuf::mipmap, ImBuf::miptot, ImBuf::rect, ImBuf::rect_float, size(), ImBuf::tiles, ImBuf::x, ImBuf::xtiles, ImBuf::y, and ImBuf::ytiles.
Referenced by frame_cache_add(), get_size_in_memory(), and IMB_get_size_in_memory().
bool IMB_initImBuf | ( | struct ImBuf * | ibuf, |
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.
Definition at line 516 of file allocimbuf.c.
References addzbuffloatImBuf(), addzbufImBuf(), ImBuf::channels, colormanage_imbuf_set_default_spaces(), ImBuf::flags, ImBuf::foptions, ImBuf::ftype, IB_rect, IB_rectfloat, IB_zbuf, IB_zbuffloat, imb_addrectfloatImBuf(), imb_addrectImBuf(), IMB_DPI_DEFAULT, IMB_FTYPE_PNG, ImBuf::planes, ImBuf::ppm, ImbFormatOptions::quality, x, ImBuf::x, y, and ImBuf::y.
Referenced by IMB_allocImBuf(), and paint_2d_do_making_brush().
Definition at line 227 of file allocimbuf.c.
References BLI_spin_lock(), BLI_spin_unlock(), IMB_dupImBuf(), IMB_freeImBuf(), IMB_metadata_copy(), NULL, ImBuf::refcounter, and refcounter_spin.
Referenced by input_preprocess(), and load_movie_single().
Definition at line 53 of file allocimbuf.c.
References BLI_spin_lock(), and mmap_spin.
Referenced by IMB_loadifffile(), imb_loadtilefile(), IMMapStream::IMMapStream(), and IMMapStream::~IMMapStream().
Definition at line 48 of file allocimbuf.c.
References BLI_spin_end(), and mmap_spin.
Referenced by IMB_exit().
Definition at line 43 of file allocimbuf.c.
References BLI_spin_init(), and mmap_spin.
Referenced by IMB_init().
Definition at line 58 of file allocimbuf.c.
References BLI_spin_unlock(), and mmap_spin.
Referenced by IMB_loadifffile(), imb_loadtilefile(), IMMapStream::IMMapStream(), and IMMapStream::~IMMapStream().
Definition at line 35 of file allocimbuf.c.
References BLI_spin_end(), and refcounter_spin.
Referenced by IMB_exit().
Definition at line 30 of file allocimbuf.c.
References BLI_spin_init(), and refcounter_spin.
Referenced by IMB_init().
Increase reference count to imbuf (to delete an imbuf you have to call freeImBuf as many times as it is referenced)
Definition at line 220 of file allocimbuf.c.
References BLI_spin_lock(), BLI_spin_unlock(), ImBuf::refcounter, and refcounter_spin.
Referenced by BKE_image_get_first_ibuf(), BKE_image_get_ibuf_with_name(), do_moviecache_put(), get_postprocessed_cached_frame(), get_stable_cached_frame(), IMB_moviecache_get(), put_postprocessed_frame_to_cache(), put_stabilized_frame_to_cache(), seq_cache_get_ex(), and seq_cache_put_ex().
|
static |
Definition at line 41 of file allocimbuf.c.
Referenced by imb_mmap_lock(), imb_mmap_lock_exit(), imb_mmap_lock_init(), and imb_mmap_unlock().
|
static |
Definition at line 28 of file allocimbuf.c.
Referenced by IMB_freeImBuf(), IMB_makeSingleUser(), imb_refcounter_lock_exit(), imb_refcounter_lock_init(), and IMB_refImBuf().