diff options
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/IMB_colormanagement.h | 2 | ||||
-rw-r--r-- | source/blender/imbuf/IMB_imbuf.h | 65 | ||||
-rw-r--r-- | source/blender/imbuf/IMB_imbuf_types.h | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/colormanagement_inline.c | 5 | ||||
-rw-r--r-- | source/blender/imbuf/intern/transform.cc | 1 | ||||
-rw-r--r-- | source/blender/imbuf/intern/util_gpu.c | 10 |
6 files changed, 29 insertions, 58 deletions
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index 0818dd653a1..2fb1d814c83 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -56,6 +56,8 @@ bool IMB_colormanagement_space_name_is_data(const char *name); bool IMB_colormanagement_space_name_is_scene_linear(const char *name); bool IMB_colormanagement_space_name_is_srgb(const char *name); +BLI_INLINE void IMB_colormanagement_get_luminance_coefficients(float r_rgb[3]); + /** * Convert a float RGB triplet to the correct luminance weighted average. * diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 20c414bb1ad..3a770c9a2b7 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -41,6 +41,7 @@ /* for bool */ #include "../blenlib/BLI_sys_types.h" +#include "../gpu/GPU_texture.h" #ifdef __cplusplus extern "C" { @@ -49,7 +50,6 @@ extern "C" { #define IM_MAX_SPACE 64 /** - * * \attention defined in ??? */ struct ImBuf; @@ -57,7 +57,6 @@ struct rctf; struct rcti; /** - * * \attention defined in ??? */ struct anim; @@ -66,27 +65,18 @@ struct ColorManagedDisplay; struct GSet; /** - * * \attention defined in DNA_scene_types.h */ struct ImageFormatData; struct Stereo3dFormat; /** - * - * \attention defined in GPU_texture.h - */ -struct GPUTexture; - -/** - * * \attention Defined in allocimbuf.c */ void IMB_init(void); void IMB_exit(void); /** - * * \attention Defined in readimage.c */ struct ImBuf *IMB_ibImageFromMemory(const unsigned char *mem, @@ -96,19 +86,16 @@ struct ImBuf *IMB_ibImageFromMemory(const unsigned char *mem, const char *descr); /** - * * \attention Defined in readimage.c */ struct ImBuf *IMB_testiffname(const char *filepath, int flags); /** - * * \attention Defined in readimage.c */ struct ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]); /** - * * \attention Defined in readimage.c */ struct ImBuf *IMB_thumb_load_image(const char *filepath, @@ -116,13 +103,11 @@ struct ImBuf *IMB_thumb_load_image(const char *filepath, char colorspace[IM_MAX_SPACE]); /** - * * \attention Defined in allocimbuf.c */ void IMB_freeImBuf(struct ImBuf *ibuf); /** - * * \attention Defined in allocimbuf.c */ struct ImBuf *IMB_allocImBuf(unsigned int x, @@ -159,7 +144,6 @@ struct ImBuf *IMB_allocFromBuffer(const unsigned int *rect, unsigned int channels); /** - * * Increase reference count to imbuf * (to delete an imbuf you have to call freeImBuf as many times as it * is referenced) @@ -171,13 +155,11 @@ void IMB_refImBuf(struct ImBuf *ibuf); struct ImBuf *IMB_makeSingleUser(struct ImBuf *ibuf); /** - * * \attention Defined in allocimbuf.c */ struct ImBuf *IMB_dupImBuf(const struct ImBuf *ibuf1); /** - * * \attention Defined in allocimbuf.c */ bool addzbufImBuf(struct ImBuf *ibuf); @@ -202,7 +184,6 @@ size_t IMB_get_size_in_memory(struct ImBuf *ibuf); size_t IMB_get_rect_len(const struct ImBuf *ibuf); /** - * * \attention Defined in rectop.c */ @@ -309,7 +290,6 @@ void IMB_rectblend_threaded(struct ImBuf *dbuf, bool accumulate); /** - * * \attention Defined in indexer.c */ @@ -404,7 +384,6 @@ double IMD_anim_get_offset(struct anim *anim); bool IMB_anim_get_fps(struct anim *anim, short *frs_sec, float *frs_sec_base, bool no_av_base); /** - * * \attention Defined in anim_movie.c */ struct anim *IMB_open_anim(const char *name, @@ -417,7 +396,6 @@ void IMB_close_anim_proxies(struct anim *anim); bool IMB_anim_can_produce_frames(const struct anim *anim); /** - * * \attention Defined in anim_movie.c */ @@ -427,7 +405,6 @@ int IMB_anim_get_image_height(struct anim *anim); bool IMB_get_gop_decode_time(struct anim *anim); /** - * * \attention Defined in anim_movie.c */ @@ -437,20 +414,17 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim, IMB_Proxy_Size preview_size /* = 0 = IMB_PROXY_NONE */); /** - * * \attention Defined in anim_movie.c * fetches a define preview-frame, usually half way into the movie. */ struct ImBuf *IMB_anim_previewframe(struct anim *anim); /** - * * \attention Defined in anim_movie.c */ void IMB_free_anim(struct anim *anim); /** - * * \attention Defined in filter.c */ @@ -479,7 +453,6 @@ void IMB_remakemipmap(struct ImBuf *ibuf, int use_filter); struct ImBuf *IMB_getmipmap(struct ImBuf *ibuf, int level); /** - * * \attention Defined in cache.c */ @@ -491,19 +464,16 @@ unsigned int *IMB_gettile(struct ImBuf *ibuf, int tx, int ty, int thread); void IMB_tiles_to_rect(struct ImBuf *ibuf); /** - * * \attention Defined in filter.c */ void IMB_filtery(struct ImBuf *ibuf); /** - * * \attention Defined in scaling.c */ struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1); /** - * * \attention Defined in scaling.c * * Return true if \a ibuf is modified. @@ -511,7 +481,6 @@ struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1); bool IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy); /** - * * \attention Defined in scaling.c */ /** @@ -520,19 +489,16 @@ bool IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy); bool IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy); /** - * * \attention Defined in scaling.c */ void IMB_scaleImBuf_threaded(struct ImBuf *ibuf, unsigned int newx, unsigned int newy); /** - * * \attention Defined in writeimage.c */ bool IMB_saveiff(struct ImBuf *ibuf, const char *filepath, int flags); /** - * * \attention Defined in util.c */ bool IMB_ispic(const char *filepath); @@ -541,13 +507,11 @@ int IMB_ispic_type_from_memory(const unsigned char *buf, size_t buf_size); int IMB_ispic_type(const char *filepath); /** - * * \attention Defined in util.c */ bool IMB_isanim(const char *filepath); /** - * * \attention Defined in util.c */ int imb_get_anim_type(const char *filepath); @@ -672,7 +636,6 @@ void IMB_buffer_float_premultiply(float *buf, int width, int height); void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf); /** - * * \attention defined in imageprocess.c */ @@ -723,50 +686,42 @@ void IMB_sampleImageAtLocation( struct ImBuf *ibuf, float x, float y, bool make_linear_rgb, float color[4]); /** - * * \attention defined in readimage.c */ struct ImBuf *IMB_loadifffile( int file, const char *filepath, int flags, char colorspace[IM_MAX_SPACE], const char *descr); /** - * * \attention defined in scaling.c */ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1); /** - * * \attention defined in scaling.c */ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1); /** - * * \attention defined in scaling.c */ struct ImBuf *IMB_double_x(struct ImBuf *ibuf1); /** - * * \attention defined in scaling.c */ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1); /** - * * \attention defined in scaling.c */ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1); /** - * * \attention defined in scaling.c */ struct ImBuf *IMB_double_y(struct ImBuf *ibuf1); /** - * * \attention Defined in rotate.c */ void IMB_flipx(struct ImBuf *ibuf); @@ -778,14 +733,12 @@ void IMB_premultiply_alpha(struct ImBuf *ibuf); void IMB_unpremultiply_alpha(struct ImBuf *ibuf); /** - * * \attention Defined in allocimbuf.c */ void IMB_freezbufImBuf(struct ImBuf *ibuf); void IMB_freezbuffloatImBuf(struct ImBuf *ibuf); /** - * * \attention Defined in rectop.c */ /** @@ -930,25 +883,27 @@ void IMB_ffmpeg_init(void); const char *IMB_ffmpeg_last_error(void); /** - * * \attention defined in util_gpu.c */ -struct GPUTexture *IMB_create_gpu_texture(const char *name, - struct ImBuf *ibuf, - bool use_high_bitdepth, - bool use_premult); +GPUTexture *IMB_create_gpu_texture(const char *name, + struct ImBuf *ibuf, + bool use_high_bitdepth, + bool use_premult); + +eGPUTextureFormat IMB_gpu_get_texture_format(const struct ImBuf *ibuf, bool high_bitdepth); + /** * The `ibuf` is only here to detect the storage type. The produced texture will have undefined * content. It will need to be populated by using #IMB_update_gpu_texture_sub(). */ -struct GPUTexture *IMB_touch_gpu_texture( +GPUTexture *IMB_touch_gpu_texture( const char *name, struct ImBuf *ibuf, int w, int h, int layers, bool use_high_bitdepth); /** * Will update a #GPUTexture using the content of the #ImBuf. Only one layer will be updated. * Will resize the ibuf if needed. * Z is the layer to update. Unused if the texture is 2D. */ -void IMB_update_gpu_texture_sub(struct GPUTexture *tex, +void IMB_update_gpu_texture_sub(GPUTexture *tex, struct ImBuf *ibuf, int x, int y, diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h index c6a9ed35c4c..45d05e9b856 100644 --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@ -253,9 +253,9 @@ typedef struct ImBuf { /* some parameters to pass along for packing images */ /** Compressed image only used with PNG and EXR currently. */ unsigned char *encodedbuffer; - /** Size of data written to encodedbuffer */ + /** Size of data written to `encodedbuffer`. */ unsigned int encodedsize; - /** Size of encodedbuffer */ + /** Size of `encodedbuffer` */ unsigned int encodedbuffersize; /* color management */ diff --git a/source/blender/imbuf/intern/colormanagement_inline.c b/source/blender/imbuf/intern/colormanagement_inline.c index 668307ec802..3c6c0f5fd0a 100644 --- a/source/blender/imbuf/intern/colormanagement_inline.c +++ b/source/blender/imbuf/intern/colormanagement_inline.c @@ -11,6 +11,11 @@ #include "BLI_math_vector.h" #include "IMB_colormanagement_intern.h" +void IMB_colormanagement_get_luminance_coefficients(float r_rgb[3]) +{ + copy_v3_v3(r_rgb, imbuf_luma_coefficients); +} + float IMB_colormanagement_get_luminance(const float rgb[3]) { return dot_v3v3(imbuf_luma_coefficients, rgb); diff --git a/source/blender/imbuf/intern/transform.cc b/source/blender/imbuf/intern/transform.cc index 1499c1071e3..d64a48569ae 100644 --- a/source/blender/imbuf/intern/transform.cc +++ b/source/blender/imbuf/intern/transform.cc @@ -259,7 +259,6 @@ class WrapRepeatUV : public BaseUVWrapping { * \brief Read a sample from an image buffer. * * A sampler can read from an image buffer. - * */ template< /** \brief Interpolation mode to use when sampling. */ diff --git a/source/blender/imbuf/intern/util_gpu.c b/source/blender/imbuf/intern/util_gpu.c index 5feb0ceb515..727704e27e8 100644 --- a/source/blender/imbuf/intern/util_gpu.c +++ b/source/blender/imbuf/intern/util_gpu.c @@ -290,3 +290,13 @@ GPUTexture *IMB_create_gpu_texture(const char *name, return tex; } + +eGPUTextureFormat IMB_gpu_get_texture_format(const ImBuf *ibuf, bool high_bitdepth) +{ + eGPUTextureFormat gpu_texture_format; + eGPUDataFormat gpu_data_format; + + imb_gpu_get_format(ibuf, high_bitdepth, &gpu_data_format, &gpu_texture_format); + + return gpu_texture_format; +} |