Cleanup: comments (long lines) in imbuf
This commit is contained in:
@@ -318,7 +318,8 @@ bool IMB_colormanagement_setup_glsl_draw_from_space(
|
||||
bool IMB_colormanagement_setup_glsl_draw_ctx(const struct bContext *C,
|
||||
float dither,
|
||||
bool predivide);
|
||||
/* Same as setup_glsl_draw_from_space, but color management settings are guessing from a given context */
|
||||
/* Same as setup_glsl_draw_from_space,
|
||||
* but color management settings are guessing from a given context. */
|
||||
bool IMB_colormanagement_setup_glsl_draw_from_space_ctx(const struct bContext *C,
|
||||
struct ColorSpace *colorspace,
|
||||
float dither,
|
||||
|
||||
@@ -472,7 +472,8 @@ bool IMB_isfloat(struct ImBuf *ibuf);
|
||||
/* create char buffer, color corrected if necessary, for ImBufs that lack one */
|
||||
void IMB_rect_from_float(struct ImBuf *ibuf);
|
||||
/* Create char buffer for part of the image, color corrected if necessary,
|
||||
* Changed part will be stored in buffer. This is expected to be used for texture painting updates */
|
||||
* Changed part will be stored in buffer.
|
||||
* This is expected to be used for texture painting updates */
|
||||
void IMB_partial_rect_from_float(
|
||||
struct ImBuf *ibuf, float *buffer, int x, int y, int w, int h, bool is_data);
|
||||
void IMB_float_from_rect(struct ImBuf *ibuf);
|
||||
@@ -660,7 +661,8 @@ void IMB_rectfill_area(struct ImBuf *ibuf,
|
||||
struct ColorManagedDisplay *display);
|
||||
void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value);
|
||||
|
||||
/* this should not be here, really, we needed it for operating on render data, IMB_rectfill_area calls it */
|
||||
/* This should not be here, really,
|
||||
* we needed it for operating on render data, IMB_rectfill_area calls it. */
|
||||
void buf_rectfill_area(unsigned char *rect,
|
||||
float *rectf,
|
||||
int width,
|
||||
|
||||
@@ -212,9 +212,8 @@ void IMB_freeImBuf(ImBuf *ibuf)
|
||||
colormanage_cache_free(ibuf);
|
||||
|
||||
if (ibuf->dds_data.data != NULL) {
|
||||
free(
|
||||
ibuf->dds_data
|
||||
.data); /* dds_data.data is allocated by DirectDrawSurface::readData(), so don't use MEM_freeN! */
|
||||
/* dds_data.data is allocated by DirectDrawSurface::readData(), so don't use MEM_freeN! */
|
||||
free(ibuf->dds_data.data);
|
||||
}
|
||||
MEM_freeN(ibuf);
|
||||
}
|
||||
@@ -385,7 +384,8 @@ bool imb_addrectImBuf(ImBuf *ibuf)
|
||||
if (ibuf == NULL)
|
||||
return false;
|
||||
|
||||
/* don't call imb_freerectImBuf, it frees mipmaps, this call is used only too give float buffers display */
|
||||
/* Don't call imb_freerectImBuf, it frees mipmaps,
|
||||
* this call is used only too give float buffers display. */
|
||||
if (ibuf->rect && (ibuf->mall & IB_rect))
|
||||
MEM_freeN(ibuf->rect);
|
||||
ibuf->rect = NULL;
|
||||
|
||||
@@ -413,7 +413,14 @@ static int startavi(struct anim *anim)
|
||||
anim->curposition = 0;
|
||||
anim->preseek = 0;
|
||||
|
||||
/* printf("x:%d y:%d size:%d interl:%d dur:%d\n", anim->x, anim->y, anim->framesize, anim->interlacing, anim->duration);*/
|
||||
# if 0
|
||||
printf("x:%d y:%d size:%d interl:%d dur:%d\n",
|
||||
anim->x,
|
||||
anim->y,
|
||||
anim->framesize,
|
||||
anim->interlacing,
|
||||
anim->duration);
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#include "IMB_colormanagement.h"
|
||||
#include "IMB_colormanagement_intern.h"
|
||||
|
||||
/* some code copied from article on microsoft.com, copied
|
||||
* here for enhanced BMP support in the future
|
||||
/* Some code copied from article on microsoft.com,
|
||||
* copied here for enhanced BMP support in the future:
|
||||
* http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0197/mfcp1/mfcp1.htm&nav=/msj/0197/newnav.htm
|
||||
*/
|
||||
|
||||
|
||||
@@ -43,7 +43,8 @@ extern "C" {
|
||||
* Image structure
|
||||
*/
|
||||
|
||||
/* There are some differences between DPX and Cineon so we need to know from what type of file the datas come from */
|
||||
/* There are some differences between DPX and Cineon
|
||||
* so we need to know from what type of file the datas come from. */
|
||||
enum format {
|
||||
format_DPX,
|
||||
format_Cineon,
|
||||
|
||||
@@ -332,8 +332,8 @@ static ImBuf *colormanage_cache_get_ibuf(ImBuf *ibuf,
|
||||
struct MovieCache *moviecache = colormanage_moviecache_get(ibuf);
|
||||
|
||||
if (!moviecache) {
|
||||
/* if there's no moviecache it means no color management was applied on given image buffer before */
|
||||
|
||||
/* If there's no moviecache it means no color management was applied
|
||||
* on given image buffer before. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -425,7 +425,8 @@ static void colormanage_cache_put(ImBuf *ibuf,
|
||||
cache_ibuf->mall |= IB_rect;
|
||||
cache_ibuf->flags |= IB_rect;
|
||||
|
||||
/* store data which is needed to check whether cached buffer could be used for color managed display settings */
|
||||
/* Store data which is needed to check whether cached buffer
|
||||
* could be used for color managed display settings. */
|
||||
cache_data = MEM_callocN(sizeof(ColormanageCacheData), "color manage cache imbuf data");
|
||||
cache_data->look = view_settings->look;
|
||||
cache_data->exposure = view_settings->exposure;
|
||||
@@ -1798,7 +1799,8 @@ static void processor_transform_apply_threaded(unsigned char *byte_buffer,
|
||||
|
||||
/*********************** Color space transformation functions *************************/
|
||||
|
||||
/* convert the whole buffer from specified by name color space to another - internal implementation */
|
||||
/* Convert the whole buffer from specified by name color space to another -
|
||||
* internal implementation. */
|
||||
static void colormanagement_transform_ex(unsigned char *byte_buffer,
|
||||
float *float_buffer,
|
||||
int width,
|
||||
@@ -2249,8 +2251,9 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
|
||||
colormanaged_ibuf = IMB_dupImBuf(ibuf);
|
||||
}
|
||||
else {
|
||||
/* render pipeline is constructing image buffer itself, but it's re-using byte and float buffers from render result
|
||||
* make copy of this buffers here sine this buffers would be transformed to other color space here
|
||||
/* Render pipeline is constructing image buffer itself,
|
||||
* but it's re-using byte and float buffers from render result make copy of this buffers
|
||||
* here sine this buffers would be transformed to other color space here.
|
||||
*/
|
||||
|
||||
if (ibuf->rect && (ibuf->mall & IB_rect) == 0) {
|
||||
@@ -3843,7 +3846,10 @@ bool IMB_colormanagement_setup_glsl_draw(const ColorManagedViewSettings *view_se
|
||||
view_settings, display_settings, NULL, dither, predivide);
|
||||
}
|
||||
|
||||
/* Same as setup_glsl_draw_from_space, but color management settings are guessing from a given context */
|
||||
/**
|
||||
* Same as setup_glsl_draw_from_space,
|
||||
* but color management settings are guessing from a given context.
|
||||
*/
|
||||
bool IMB_colormanagement_setup_glsl_draw_from_space_ctx(const bContext *C,
|
||||
struct ColorSpace *from_colorspace,
|
||||
float dither,
|
||||
|
||||
@@ -47,9 +47,20 @@ class Color32 {
|
||||
{
|
||||
setRGBA(R, G, B, A);
|
||||
}
|
||||
//Color32(unsigned char c[4]) { setRGBA(c[0], c[1], c[2], c[3]); }
|
||||
//Color32(float R, float G, float B) { setRGBA(uint(R*255), uint(G*255), uint(B*255), 0xFF); }
|
||||
//Color32(float R, float G, float B, float A) { setRGBA(uint(R*255), uint(G*255), uint(B*255), uint(A*255)); }
|
||||
#if 0
|
||||
Color32(unsigned char c[4])
|
||||
{
|
||||
setRGBA(c[0], c[1], c[2], c[3]);
|
||||
}
|
||||
Color32(float R, float G, float B)
|
||||
{
|
||||
setRGBA(uint(R * 255), uint(G * 255), uint(B * 255), 0xFF);
|
||||
}
|
||||
Color32(float R, float G, float B, float A)
|
||||
{
|
||||
setRGBA(uint(R * 255), uint(G * 255), uint(B * 255), uint(A * 255));
|
||||
}
|
||||
#endif
|
||||
Color32(unsigned int U) : u(U)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -801,7 +801,10 @@ static void partial_rect_from_float_thread_do(void *data_v, int start_scanline,
|
||||
data->is_data);
|
||||
}
|
||||
|
||||
/* converts from linear float to sRGB byte for part of the texture, buffer will hold the changed part */
|
||||
/**
|
||||
* Converts from linear float to sRGB byte for part of the texture,
|
||||
* buffer will hold the changed part.
|
||||
*/
|
||||
void IMB_partial_rect_from_float(
|
||||
ImBuf *ibuf, float *buffer, int x, int y, int w, int h, bool is_data)
|
||||
{
|
||||
|
||||
@@ -411,9 +411,11 @@ static int check_pixel_assigned(
|
||||
return res;
|
||||
}
|
||||
|
||||
/* if alpha is zero, it checks surrounding pixels and averages color. sets new alphas to 1.0
|
||||
/**
|
||||
* if alpha is zero, it checks surrounding pixels and averages color. sets new alphas to 1.0
|
||||
*
|
||||
* When a mask is given, only effect pixels with a mask value of 1, defined as BAKE_MASK_MARGIN in rendercore.c
|
||||
* When a mask is given, only effect pixels with a mask value of 1,
|
||||
* defined as #BAKE_MASK_MARGIN in rendercore.c
|
||||
* */
|
||||
void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
|
||||
{
|
||||
|
||||
@@ -131,7 +131,8 @@ void bilinear_interpolation_color(
|
||||
|
||||
/* 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 */
|
||||
* This the same as bilinear_interpolation_color except it wraps
|
||||
* rather than using empty and emptyI. */
|
||||
void bilinear_interpolation_color_wrap(
|
||||
struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
|
||||
{
|
||||
|
||||
@@ -588,10 +588,15 @@ finally:
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
//static opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp)
|
||||
#if 0
|
||||
static opj_image_t *rawtoimage(const char *filename,
|
||||
opj_cparameters_t *parameters,
|
||||
raw_cparameters_t *raw_cp)
|
||||
#endif
|
||||
/* prec can be 8, 12, 16 */
|
||||
|
||||
/* use inline because the float passed can be a function call that would end up being called many times */
|
||||
/* Use inline because the float passed can be a function call
|
||||
* that would end up being called many times. */
|
||||
#if 0
|
||||
# define UPSAMPLE_8_TO_12(_val) ((_val << 4) | (_val & ((1 << 4) - 1)))
|
||||
# define UPSAMPLE_8_TO_16(_val) ((_val << 8) + _val)
|
||||
@@ -628,7 +633,8 @@ BLI_INLINE int DOWNSAMPLE_FLOAT_TO_16BIT(const float _val)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 2048x1080 (2K) at 24 fps or 48 fps, or 4096x2160 (4K) at 24 fps; 3x12 bits per pixel, XYZ color space
|
||||
* 2048x1080 (2K) at 24 fps or 48 fps, or 4096x2160 (4K) at 24 fps;
|
||||
* 3x12 bits per pixel, XYZ color space
|
||||
*
|
||||
* - In 2K, for Scope (2.39:1) presentation 2048x858 pixels of the image is used
|
||||
* - In 2K, for Flat (1.85:1) presentation 1998x1080 pixels of the image is used
|
||||
|
||||
@@ -153,7 +153,8 @@ static ImBuf *imb_oiio_load_image_float(
|
||||
/* ImBuf always needs 4 channels */
|
||||
fill_all_channels((float *)ibuf->rect_float, width, height, components, 1.0f);
|
||||
|
||||
/* note: Photoshop 16 bit files never has alpha with it, so no need to handle associated/unassociated alpha */
|
||||
/* Note: Photoshop 16 bit files never has alpha with it,
|
||||
* so no need to handle associated/unassociated alpha. */
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
|
||||
@@ -592,7 +592,7 @@ int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
|
||||
}
|
||||
}
|
||||
|
||||
/* ********************* Nicer API, MultiLayer and with Tile file support ************************************ */
|
||||
/* ******* Nicer API, MultiLayer and with Tile file support ************************************ */
|
||||
|
||||
/* naming rules:
|
||||
* - parse name from right to left
|
||||
@@ -618,8 +618,10 @@ typedef struct ExrHandle {
|
||||
int width, height;
|
||||
int mipmap;
|
||||
|
||||
StringVector *
|
||||
multiView; /* it needs to be a pointer due to Windows release builds of EXR2.0 segfault when opening EXR bug */
|
||||
/** It needs to be a pointer due to Windows release builds of EXR2.0
|
||||
* segfault when opening EXR bug. */
|
||||
StringVector *multiView;
|
||||
|
||||
int parts;
|
||||
|
||||
ListBase channels; /* flattened out, ExrChannel */
|
||||
@@ -1817,7 +1819,8 @@ static bool exr_has_multipart_file(MultiPartInputFile &file)
|
||||
/* it returns true if the file is multilayer or multiview */
|
||||
static bool imb_exr_is_multi(MultiPartInputFile &file)
|
||||
{
|
||||
/* multipart files are treated as multilayer in blender - even if they are single layer openexr with multiview */
|
||||
/* Multipart files are treated as multilayer in blender -
|
||||
* even if they are single layer openexr with multiview. */
|
||||
if (exr_has_multipart_file(file))
|
||||
return true;
|
||||
|
||||
@@ -1922,7 +1925,8 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
|
||||
|
||||
imb_addrectfloatImBuf(ibuf);
|
||||
|
||||
/* inverse correct first pixel for datawindow coordinates (- dw.min.y because of y flip) */
|
||||
/* Inverse correct first pixel for datawindow
|
||||
* coordinates (- dw.min.y because of y flip). */
|
||||
first = ibuf->rect_float - 4 * (dw.min.x - dw.min.y * width);
|
||||
/* but, since we read y-flipped (negative y stride) we move to last scanline */
|
||||
first += 4 * (height - 1) * width;
|
||||
@@ -1967,7 +1971,8 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
|
||||
// XXX, ImBuf has no nice way to deal with this.
|
||||
// ideally IM_rect would be used when the caller wants a rect BUT
|
||||
// at the moment all functions use IM_rect.
|
||||
// Disabling this is ok because all functions should check if a rect exists and create one on demand.
|
||||
// Disabling this is ok because all functions should check
|
||||
// if a rect exists and create one on demand.
|
||||
//
|
||||
// Disabling this because the sequencer frees immediate.
|
||||
//
|
||||
|
||||
@@ -198,7 +198,8 @@ static void FLOAT2RGBE(fCOLOR fcol, RGBE rgbe)
|
||||
int imb_is_a_hdr(const unsigned char *buf)
|
||||
{
|
||||
/* For recognition, Blender only loads first 32 bytes, so use #?RADIANCE id instead */
|
||||
/* update: actually, the 'RADIANCE' part is just an optional program name, the magic word is really only the '#?' part */
|
||||
/* update: actually, the 'RADIANCE' part is just an optional program name,
|
||||
* the magic word is really only the '#?' part */
|
||||
//if (strstr((char *)buf, "#?RADIANCE")) return 1;
|
||||
if (strstr((char *)buf, "#?"))
|
||||
return 1;
|
||||
|
||||
@@ -557,7 +557,8 @@ static void shrink_picture_byte(unsigned char *src,
|
||||
|
||||
w = (weight1y * weight1x) >> 16;
|
||||
|
||||
/* ensure correct rounding, without this you get ugly banding, or too low color values (ton) */
|
||||
/* Ensure correct rounding, without this you get ugly banding,
|
||||
* or too low color values (ton). */
|
||||
dst_line1[x].r += (line[0] * w + 32767) >> 16;
|
||||
dst_line1[x].g += (line[1] * w + 32767) >> 16;
|
||||
dst_line1[x].b += (line[2] * w + 32767) >> 16;
|
||||
|
||||
@@ -734,7 +734,8 @@ ImBuf *IMB_thumb_manage(const char *org_path, ThumbSize size, ThumbSource source
|
||||
}
|
||||
}
|
||||
|
||||
/* Our imbuf **must** have a valid rect (i.e. 8-bits/channels) data, we rely on this in draw code.
|
||||
/* Our imbuf **must** have a valid rect (i.e. 8-bits/channels)
|
||||
* data, we rely on this in draw code.
|
||||
* However, in some cases we may end loading 16bits PNGs, which generated float buffers.
|
||||
* This should be taken care of in generation step, but add also a safeguard here! */
|
||||
if (img) {
|
||||
|
||||
@@ -54,8 +54,9 @@ ImBuf *IMB_thumb_load_blend(const char *blen_path, const char *blen_group, const
|
||||
return ima;
|
||||
}
|
||||
|
||||
/* Note: we should handle all previews for a same group at once, would avoid reopening .blend file
|
||||
* for each and every ID. However, this adds some complexity, so keep it for later. */
|
||||
/* Note: we should handle all previews for a same group at once, would avoid reopening
|
||||
* `.blend` file for each and every ID. However, this adds some complexity,
|
||||
* so keep it for later. */
|
||||
names = BLO_blendhandle_get_datablock_names(libfiledata, idcode, &nnames);
|
||||
previews = BLO_blendhandle_get_previews(libfiledata, idcode, &nprevs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user