From e9a01c1d2f6edaf2902f82c73c98ff7d25627878 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 22 Apr 2019 01:18:55 +1000 Subject: Cleanup: comments (long lines) in imbuf --- source/blender/imbuf/IMB_colormanagement.h | 3 ++- source/blender/imbuf/IMB_imbuf.h | 6 ++++-- source/blender/imbuf/intern/allocimbuf.c | 8 ++++---- source/blender/imbuf/intern/anim_movie.c | 9 ++++++++- source/blender/imbuf/intern/bmp.c | 4 ++-- source/blender/imbuf/intern/cineon/logImageCore.h | 3 ++- source/blender/imbuf/intern/colormanagement.c | 20 +++++++++++++------- source/blender/imbuf/intern/dds/Color.h | 17 ++++++++++++++--- source/blender/imbuf/intern/divers.c | 5 ++++- source/blender/imbuf/intern/filter.c | 6 ++++-- source/blender/imbuf/intern/imageprocess.c | 3 ++- source/blender/imbuf/intern/jp2.c | 12 +++++++++--- source/blender/imbuf/intern/oiio/openimageio_api.cpp | 3 ++- source/blender/imbuf/intern/openexr/openexr_api.cpp | 17 +++++++++++------ source/blender/imbuf/intern/radiance_hdr.c | 3 ++- source/blender/imbuf/intern/scaling.c | 3 ++- source/blender/imbuf/intern/thumbs.c | 3 ++- source/blender/imbuf/intern/thumbs_blend.c | 5 +++-- 18 files changed, 90 insertions(+), 40 deletions(-) (limited to 'source/blender') diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index 5978066f4a8..620f8984d9f 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -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, diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 8445c0f8f3a..bdc1abf3132 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -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, diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index eaf3d58270a..ba92026f560 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -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; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 13813fb23b3..aa1d63394ff 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -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; } diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index f5c12c916f0..b43b13ff282 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -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 */ diff --git a/source/blender/imbuf/intern/cineon/logImageCore.h b/source/blender/imbuf/intern/cineon/logImageCore.h index e01c2e0f117..3f09effa839 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.h +++ b/source/blender/imbuf/intern/cineon/logImageCore.h @@ -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, diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 1370ea40137..46c08afe201 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -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, diff --git a/source/blender/imbuf/intern/dds/Color.h b/source/blender/imbuf/intern/dds/Color.h index 16432ffa715..36e2615759b 100644 --- a/source/blender/imbuf/intern/dds/Color.h +++ b/source/blender/imbuf/intern/dds/Color.h @@ -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) { } diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index fb8dcffe9d4..535d2e95122 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -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) { diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 32b1c6b280e..f41c831cf85 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -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) { diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 58253bde3e3..02a93d7fa5c 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -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) { diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index c36b09c5a90..bfbe4260f5f 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -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 diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index 7b14678ed62..5f6af67c60d 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -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; } diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 25e4ae6cf0d..fb38e1e01c8 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -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. // diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index e3ab460cce4..238f58b7834 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -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; diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index e57f3bb08f4..14b2ded73e0 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -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; diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 6341192c40c..afbc0f0a5c4 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -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) { diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index 20a419d1a16..283bd11dc7d 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -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); -- cgit v1.2.3