Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-13 09:29:06 +0300
committerCampbell Barton <campbell@blender.org>2022-09-13 09:29:06 +0300
commit4d69b6f525a4f02a24141e61f16e90455f3f0a30 (patch)
tree44cbbef93dc0ed5ea3d76827f2bb63c7f50d5620
parent75f9b691e209bc3d09383d733b11a08d2bcfdbc3 (diff)
Cleanup: use u-prefixed integer types (for brevity)
-rw-r--r--source/blender/imbuf/intern/allocimbuf.c31
-rw-r--r--source/blender/imbuf/intern/anim_movie.c11
-rw-r--r--source/blender/imbuf/intern/cache.c30
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c25
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c14
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.h30
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c10
-rw-r--r--source/blender/imbuf/intern/cineon/logImageCore.c119
-rw-r--r--source/blender/imbuf/intern/cineon/logmemfile.c30
-rw-r--r--source/blender/imbuf/intern/colormanagement.c125
-rw-r--r--source/blender/imbuf/intern/colormanagement_inline.c2
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.cpp4
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp6
-rw-r--r--source/blender/imbuf/intern/dds/FlipDXT.cpp44
-rw-r--r--source/blender/imbuf/intern/dds/Stream.cpp16
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.cpp23
-rw-r--r--source/blender/imbuf/intern/divers.c14
-rw-r--r--source/blender/imbuf/intern/filter.c34
-rw-r--r--source/blender/imbuf/intern/imageprocess.c59
-rw-r--r--source/blender/imbuf/intern/jp2.c46
-rw-r--r--source/blender/imbuf/intern/jpeg.c21
-rw-r--r--source/blender/imbuf/intern/moviecache.cc2
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.cpp6
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp47
-rw-r--r--source/blender/imbuf/intern/png.c58
-rw-r--r--source/blender/imbuf/intern/radiance_hdr.c53
-rw-r--r--source/blender/imbuf/intern/readimage.c15
-rw-r--r--source/blender/imbuf/intern/rectop.c86
-rw-r--r--source/blender/imbuf/intern/rotate.c4
-rw-r--r--source/blender/imbuf/intern/scaling.c100
-rw-r--r--source/blender/imbuf/intern/stereoimbuf.c6
-rw-r--r--source/blender/imbuf/intern/targa.c57
-rw-r--r--source/blender/imbuf/intern/thumbs.c8
-rw-r--r--source/blender/imbuf/intern/thumbs_font.c6
-rw-r--r--source/blender/imbuf/intern/tiff.c48
-rw-r--r--source/blender/imbuf/intern/transform.cc27
-rw-r--r--source/blender/imbuf/intern/util.c11
-rw-r--r--source/blender/imbuf/intern/webp.c17
38 files changed, 579 insertions, 666 deletions
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index 868040dc17a..42b587c3c81 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -258,7 +258,7 @@ bool addzbufImBuf(ImBuf *ibuf)
IMB_freezbufImBuf(ibuf);
- if ((ibuf->zbuf = imb_alloc_pixels(ibuf->x, ibuf->y, 1, sizeof(unsigned int), __func__))) {
+ if ((ibuf->zbuf = imb_alloc_pixels(ibuf->x, ibuf->y, 1, sizeof(uint), __func__))) {
ibuf->mall |= IB_zbuf;
ibuf->flags |= IB_zbuf;
return true;
@@ -309,7 +309,7 @@ bool imb_addencodedbufferImBuf(ImBuf *ibuf)
bool imb_enlargeencodedbufferImBuf(ImBuf *ibuf)
{
- unsigned int newsize, encodedsize;
+ uint newsize, encodedsize;
void *newbuffer;
if (ibuf == NULL) {
@@ -351,8 +351,7 @@ bool imb_enlargeencodedbufferImBuf(ImBuf *ibuf)
return true;
}
-void *imb_alloc_pixels(
- unsigned int x, unsigned int y, unsigned int channels, size_t typesize, const char *name)
+void *imb_alloc_pixels(uint x, uint y, uint channels, size_t typesize, const char *name)
{
/* Protect against buffer overflow vulnerabilities from files specifying
* a width and height that overflow and alloc too little memory. */
@@ -364,7 +363,7 @@ void *imb_alloc_pixels(
return MEM_callocN(size, name);
}
-bool imb_addrectfloatImBuf(ImBuf *ibuf, const unsigned int channels)
+bool imb_addrectfloatImBuf(ImBuf *ibuf, const uint channels)
{
if (ibuf == NULL) {
return false;
@@ -399,7 +398,7 @@ bool imb_addrectImBuf(ImBuf *ibuf)
}
ibuf->rect = NULL;
- if ((ibuf->rect = imb_alloc_pixels(ibuf->x, ibuf->y, 4, sizeof(unsigned char), __func__))) {
+ if ((ibuf->rect = imb_alloc_pixels(ibuf->x, ibuf->y, 4, sizeof(uchar), __func__))) {
ibuf->mall |= IB_rect;
ibuf->flags |= IB_rect;
if (ibuf->planes > 32) {
@@ -412,8 +411,7 @@ bool imb_addrectImBuf(ImBuf *ibuf)
return false;
}
-struct ImBuf *IMB_allocFromBufferOwn(
- unsigned int *rect, float *rectf, unsigned int w, unsigned int h, unsigned int channels)
+struct ImBuf *IMB_allocFromBufferOwn(uint *rect, float *rectf, uint w, uint h, uint channels)
{
ImBuf *ibuf = NULL;
@@ -444,11 +442,8 @@ struct ImBuf *IMB_allocFromBufferOwn(
return ibuf;
}
-struct ImBuf *IMB_allocFromBuffer(const unsigned int *rect,
- const float *rectf,
- unsigned int w,
- unsigned int h,
- unsigned int channels)
+struct ImBuf *IMB_allocFromBuffer(
+ const uint *rect, const float *rectf, uint w, uint h, uint channels)
{
ImBuf *ibuf = NULL;
@@ -488,8 +483,7 @@ bool imb_addtilesImBuf(ImBuf *ibuf)
}
if (!ibuf->tiles) {
- if ((ibuf->tiles = MEM_callocN(sizeof(unsigned int *) * ibuf->xtiles * ibuf->ytiles,
- "imb_tiles"))) {
+ if ((ibuf->tiles = MEM_callocN(sizeof(uint *) * ibuf->xtiles * ibuf->ytiles, "imb_tiles"))) {
ibuf->mall |= IB_tiles;
}
}
@@ -497,7 +491,7 @@ bool imb_addtilesImBuf(ImBuf *ibuf)
return (ibuf->tiles != NULL);
}
-ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int flags)
+ImBuf *IMB_allocImBuf(uint x, uint y, uchar planes, uint flags)
{
ImBuf *ibuf;
@@ -513,8 +507,7 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int
return ibuf;
}
-bool IMB_initImBuf(
- struct ImBuf *ibuf, unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
+bool IMB_initImBuf(struct ImBuf *ibuf, uint x, uint y, uchar planes, uint flags)
{
memset(ibuf, 0, sizeof(ImBuf));
@@ -678,7 +671,7 @@ size_t IMB_get_size_in_memory(ImBuf *ibuf)
}
if (ibuf->tiles) {
- size += sizeof(unsigned int) * ibuf->ytiles * ibuf->xtiles;
+ size += sizeof(uint) * ibuf->ytiles * ibuf->xtiles;
}
return size;
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index 52ed68a1ff3..4e6a52f8464 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -97,9 +97,9 @@ static void free_anim_movie(struct anim *UNUSED(anim))
# define PATHSEPARATOR '/'
#endif
-static int an_stringdec(const char *string, char *head, char *tail, unsigned short *numlen)
+static int an_stringdec(const char *string, char *head, char *tail, ushort *numlen)
{
- unsigned short len, nume, nums = 0;
+ ushort len, nume, nums = 0;
short i;
bool found = false;
@@ -139,8 +139,7 @@ static int an_stringdec(const char *string, char *head, char *tail, unsigned sho
return true;
}
-static void an_stringenc(
- char *string, const char *head, const char *tail, unsigned short numlen, int pic)
+static void an_stringenc(char *string, const char *head, const char *tail, ushort numlen, int pic)
{
BLI_path_sequence_encode(string, head, tail, numlen, pic);
}
@@ -454,7 +453,7 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position)
lpbi = AVIStreamGetFrame(anim->pgf, position + AVIStreamStart(anim->pavi[anim->firstvideo]));
if (lpbi) {
ibuf = IMB_ibImageFromMemory(
- (const unsigned char *)lpbi, 100, IB_rect, anim->colorspace, "<avi_fetchibuf>");
+ (const uchar *)lpbi, 100, IB_rect, anim->colorspace, "<avi_fetchibuf>");
/* Oh brother... */
}
}
@@ -1568,7 +1567,7 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim,
{
struct ImBuf *ibuf = NULL;
char head[256], tail[256];
- unsigned short digits;
+ ushort digits;
int pic;
int filter_y;
if (anim == NULL) {
diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c
index 51f7dbdf41a..4e1563c62ab 100644
--- a/source/blender/imbuf/intern/cache.c
+++ b/source/blender/imbuf/intern/cache.c
@@ -81,11 +81,11 @@ static ImGlobalTileCache GLOBAL_CACHE;
/** \name Hash Functions
* \{ */
-static unsigned int imb_global_tile_hash(const void *gtile_p)
+static uint imb_global_tile_hash(const void *gtile_p)
{
const ImGlobalTile *gtile = gtile_p;
- return ((unsigned int)(intptr_t)gtile->ibuf) * 769 + gtile->tx * 53 + gtile->ty * 97;
+ return ((uint)(intptr_t)gtile->ibuf) * 769 + gtile->tx * 53 + gtile->ty * 97;
}
static bool imb_global_tile_cmp(const void *a_p, const void *b_p)
@@ -96,11 +96,11 @@ static bool imb_global_tile_cmp(const void *a_p, const void *b_p)
return ((a->ibuf != b->ibuf) || (a->tx != b->tx) || (a->ty != b->ty));
}
-static unsigned int imb_thread_tile_hash(const void *ttile_p)
+static uint imb_thread_tile_hash(const void *ttile_p)
{
const ImThreadTile *ttile = ttile_p;
- return ((unsigned int)(intptr_t)ttile->ibuf) * 769 + ttile->tx * 53 + ttile->ty * 97;
+ return ((uint)(intptr_t)ttile->ibuf) * 769 + ttile->tx * 53 + ttile->ty * 97;
}
static bool imb_thread_tile_cmp(const void *a_p, const void *b_p)
@@ -121,9 +121,9 @@ static void imb_global_cache_tile_load(ImGlobalTile *gtile)
{
ImBuf *ibuf = gtile->ibuf;
int toffs = ibuf->xtiles * gtile->ty + gtile->tx;
- unsigned int *rect;
+ uint *rect;
- rect = MEM_callocN(sizeof(unsigned int) * ibuf->tilex * ibuf->tiley, "imb_tile");
+ rect = MEM_callocN(sizeof(uint) * ibuf->tilex * ibuf->tiley, "imb_tile");
imb_loadtile(ibuf, gtile->tx, gtile->ty, rect);
ibuf->tiles[toffs] = rect;
}
@@ -136,7 +136,7 @@ static void imb_global_cache_tile_unload(ImGlobalTile *gtile)
MEM_freeN(ibuf->tiles[toffs]);
ibuf->tiles[toffs] = NULL;
- GLOBAL_CACHE.totmem -= sizeof(unsigned int) * ibuf->tilex * ibuf->tiley;
+ GLOBAL_CACHE.totmem -= sizeof(uint) * ibuf->tilex * ibuf->tiley;
}
void imb_tile_cache_tile_free(ImBuf *ibuf, int tx, int ty)
@@ -343,7 +343,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf,
BLI_addhead(&GLOBAL_CACHE.tiles, gtile);
/* mark as being loaded and unlock to allow other threads to load too */
- GLOBAL_CACHE.totmem += sizeof(unsigned int) * ibuf->tilex * ibuf->tiley;
+ GLOBAL_CACHE.totmem += sizeof(uint) * ibuf->tilex * ibuf->tiley;
BLI_mutex_unlock(&GLOBAL_CACHE.mutex);
@@ -363,10 +363,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf,
/** \name Per-Thread Cache
* \{ */
-static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache,
- ImBuf *ibuf,
- int tx,
- int ty)
+static uint *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *ibuf, int tx, int ty)
{
ImThreadTile *ttile, lookuptile;
ImGlobalTile *gtile, *replacetile;
@@ -418,7 +415,7 @@ static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache,
return ibuf->tiles[toffs];
}
-unsigned int *IMB_gettile(ImBuf *ibuf, int tx, int ty, int thread)
+uint *IMB_gettile(ImBuf *ibuf, int tx, int ty, int thread)
{
return imb_thread_cache_get_tile(&GLOBAL_CACHE.thread_cache[thread + 1], ibuf, tx, ty);
}
@@ -427,7 +424,7 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
{
ImBuf *mipbuf;
ImGlobalTile *gtile;
- unsigned int *to, *from;
+ uint *to, *from;
int a, tx, ty, y, w, h;
for (a = 0; a < ibuf->miptot; a++) {
@@ -435,8 +432,7 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
/* don't call imb_addrectImBuf, it frees all mipmaps */
if (!mipbuf->rect) {
- if ((mipbuf->rect = MEM_callocN(ibuf->x * ibuf->y * sizeof(unsigned int),
- "imb_addrectImBuf"))) {
+ if ((mipbuf->rect = MEM_callocN(ibuf->x * ibuf->y * sizeof(uint), "imb_addrectImBuf"))) {
mipbuf->mall |= IB_rect;
mipbuf->flags |= IB_rect;
}
@@ -460,7 +456,7 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
h = (ty == mipbuf->ytiles - 1) ? mipbuf->y - ty * mipbuf->tiley : mipbuf->tiley;
for (y = 0; y < h; y++) {
- memcpy(to, from, sizeof(unsigned int) * w);
+ memcpy(to, from, sizeof(uint) * w);
from += mipbuf->tilex;
to += mipbuf->x;
}
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index 1a99d2a34d9..3bff8184b19 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -21,11 +21,8 @@
#include "MEM_guardedalloc.h"
-static struct ImBuf *imb_load_dpx_cineon(const unsigned char *mem,
- size_t size,
- int use_cineon,
- int flags,
- char colorspace[IM_MAX_SPACE])
+static struct ImBuf *imb_load_dpx_cineon(
+ const uchar *mem, size_t size, int use_cineon, int flags, char colorspace[IM_MAX_SPACE])
{
ImBuf *ibuf;
LogImageFile *image;
@@ -74,7 +71,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filepath, int use_cineon
LogImageFile *logImage;
float *fbuf;
float *fbuf_ptr;
- unsigned char *rect_ptr;
+ uchar *rect_ptr;
int x, y, depth, bitspersample, rvalue;
if (flags & IB_mem) {
@@ -153,7 +150,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filepath, int use_cineon
for (y = 0; y < ibuf->y; y++) {
for (x = 0; x < ibuf->x; x++) {
fbuf_ptr = fbuf + 4 * ((ibuf->y - y - 1) * ibuf->x + x);
- rect_ptr = (unsigned char *)ibuf->rect + 4 * (y * ibuf->x + x);
+ rect_ptr = (uchar *)ibuf->rect + 4 * (y * ibuf->x + x);
fbuf_ptr[0] = (float)rect_ptr[0] / 255.0f;
fbuf_ptr[1] = (float)rect_ptr[1] / 255.0f;
fbuf_ptr[2] = (float)rect_ptr[2] / 255.0f;
@@ -173,15 +170,12 @@ bool imb_save_cineon(struct ImBuf *buf, const char *filepath, int flags)
return imb_save_dpx_cineon(buf, filepath, 1, flags);
}
-bool imb_is_a_cineon(const unsigned char *buf, size_t size)
+bool imb_is_a_cineon(const uchar *buf, size_t size)
{
return logImageIsCineon(buf, size);
}
-ImBuf *imb_load_cineon(const unsigned char *mem,
- size_t size,
- int flags,
- char colorspace[IM_MAX_SPACE])
+ImBuf *imb_load_cineon(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
if (!imb_is_a_cineon(mem, size)) {
return NULL;
@@ -194,15 +188,12 @@ bool imb_save_dpx(struct ImBuf *buf, const char *filepath, int flags)
return imb_save_dpx_cineon(buf, filepath, 0, flags);
}
-bool imb_is_a_dpx(const unsigned char *buf, size_t size)
+bool imb_is_a_dpx(const uchar *buf, size_t size)
{
return logImageIsDpx(buf, size);
}
-ImBuf *imb_load_dpx(const unsigned char *mem,
- size_t size,
- int flags,
- char colorspace[IM_MAX_SPACE])
+ImBuf *imb_load_dpx(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
if (!imb_is_a_dpx(mem, size)) {
return NULL;
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index fa05f155b30..6417d92644f 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -121,13 +121,13 @@ static void fillCineonMainHeader(LogImageFile *cineon,
/* we leave it blank */
}
-LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize)
+LogImageFile *cineonOpen(const uchar *byteStuff, int fromMemory, size_t bufferSize)
{
CineonMainHeader header;
LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
const char *filepath = (const char *)byteStuff;
int i;
- unsigned int dataOffset;
+ uint dataOffset;
if (cineon == NULL) {
if (verbose) {
@@ -158,8 +158,8 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
cineon->memBufferSize = 0;
}
else {
- cineon->memBuffer = (unsigned char *)byteStuff;
- cineon->memCursor = (unsigned char *)byteStuff;
+ cineon->memBuffer = (uchar *)byteStuff;
+ cineon->memCursor = (uchar *)byteStuff;
cineon->memBufferSize = bufferSize;
}
@@ -187,7 +187,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
else {
if (verbose) {
printf("Cineon: Bad magic number %lu in \"%s\".\n",
- (unsigned long)header.fileHeader.magic_num,
+ (ulong)header.fileHeader.magic_num,
byteStuff);
}
logImageClose(cineon);
@@ -296,7 +296,7 @@ LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t
}
if (cineon->element[i].refHighData == CINEON_UNDEFINED_U32) {
- cineon->element[i].refHighData = (unsigned int)cineon->element[i].maxValue;
+ cineon->element[i].refHighData = (uint)cineon->element[i].maxValue;
}
if (cineon->element[i].refLowQuantity == CINEON_UNDEFINED_R32 ||
@@ -353,7 +353,7 @@ LogImageFile *cineonCreate(
{
CineonMainHeader header;
const char *shortFilename = NULL;
- /* unsigned char pad[6044]; */
+ /* uchar pad[6044]; */
LogImageFile *cineon = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
if (cineon == NULL) {
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.h b/source/blender/imbuf/intern/cineon/cineonlib.h
index 13d40461728..ac0cc15590d 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.h
+++ b/source/blender/imbuf/intern/cineon/cineonlib.h
@@ -38,10 +38,10 @@ typedef struct {
} CineonFileHeader;
typedef struct {
- unsigned char descriptor1;
- unsigned char descriptor2;
- unsigned char bits_per_sample;
- unsigned char filler;
+ uchar descriptor1;
+ uchar descriptor2;
+ uchar bits_per_sample;
+ uchar filler;
unsigned int pixels_per_line;
unsigned int lines_per_image;
unsigned int ref_low_data;
@@ -51,8 +51,8 @@ typedef struct {
} CineonElementHeader;
typedef struct {
- unsigned char orientation;
- unsigned char elements_per_image;
+ uchar orientation;
+ uchar elements_per_image;
unsigned short filler;
CineonElementHeader element[8];
float white_point_x;
@@ -65,10 +65,10 @@ typedef struct {
float blue_primary_y;
char label[200];
char reserved[28];
- unsigned char interleave;
- unsigned char packing;
- unsigned char data_sign;
- unsigned char sense;
+ uchar interleave;
+ uchar packing;
+ uchar data_sign;
+ uchar sense;
unsigned int line_padding;
unsigned int element_padding;
char reserved2[20];
@@ -90,10 +90,10 @@ typedef struct {
} CineonOriginationHeader;
typedef struct {
- unsigned char film_code;
- unsigned char film_type;
- unsigned char edge_code_perforation_offset;
- unsigned char filler;
+ uchar film_code;
+ uchar film_type;
+ uchar edge_code_perforation_offset;
+ uchar filler;
unsigned int prefix;
unsigned int count;
char format[32];
@@ -112,7 +112,7 @@ typedef struct {
} CineonMainHeader;
void cineonSetVerbose(int);
-LogImageFile *cineonOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize);
+LogImageFile *cineonOpen(const uchar *byteStuff, int fromMemory, size_t bufferSize);
LogImageFile *cineonCreate(
const char *filepath, int width, int height, int bitsPerSample, const char *creator);
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index 4c780032f0b..494bf37cfe7 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -119,7 +119,7 @@ static void fillDpxMainHeader(LogImageFile *dpx,
header->televisionHeader.integration_times = swap_float(DPX_UNDEFINED_R32, dpx->isMSB);
}
-LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t bufferSize)
+LogImageFile *dpxOpen(const uchar *byteStuff, int fromMemory, size_t bufferSize)
{
DpxMainHeader header;
LogImageFile *dpx = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
@@ -155,8 +155,8 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
dpx->memBufferSize = 0;
}
else {
- dpx->memBuffer = (unsigned char *)byteStuff;
- dpx->memCursor = (unsigned char *)byteStuff;
+ dpx->memBuffer = (uchar *)byteStuff;
+ dpx->memCursor = (uchar *)byteStuff;
dpx->memBufferSize = bufferSize;
}
@@ -320,7 +320,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
}
if (dpx->element[i].refHighData == DPX_UNDEFINED_U32) {
- dpx->element[i].refHighData = (unsigned int)dpx->element[i].maxValue;
+ dpx->element[i].refHighData = (uint)dpx->element[i].maxValue;
}
if (IS_DPX_UNDEFINED_R32(dpx->element[i].refLowQuantity)) {
@@ -418,7 +418,7 @@ LogImageFile *dpxCreate(const char *filepath,
{
DpxMainHeader header;
const char *shortFilename = NULL;
- unsigned char pad[6044];
+ uchar pad[6044];
LogImageFile *dpx = (LogImageFile *)MEM_mallocN(sizeof(LogImageFile), __func__);
if (dpx == NULL) {
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c
index e693aa6f891..69ec3c4bee8 100644
--- a/source/blender/imbuf/intern/cineon/logImageCore.c
+++ b/source/blender/imbuf/intern/cineon/logImageCore.c
@@ -81,29 +81,29 @@ void logImageSetVerbose(int verbosity)
* IO stuff
*/
-int logImageIsDpx(const void *buffer, const unsigned int size)
+int logImageIsDpx(const void *buffer, const uint size)
{
- unsigned int magicNum;
+ uint magicNum;
if (size < sizeof(magicNum)) {
return 0;
}
- magicNum = *(unsigned int *)buffer;
+ magicNum = *(uint *)buffer;
return (magicNum == DPX_FILE_MAGIC || magicNum == swap_uint(DPX_FILE_MAGIC, 1));
}
-int logImageIsCineon(const void *buffer, const unsigned int size)
+int logImageIsCineon(const void *buffer, const uint size)
{
- unsigned int magicNum;
+ uint magicNum;
if (size < sizeof(magicNum)) {
return 0;
}
- magicNum = *(unsigned int *)buffer;
+ magicNum = *(uint *)buffer;
return (magicNum == CINEON_FILE_MAGIC || magicNum == swap_uint(CINEON_FILE_MAGIC, 1));
}
LogImageFile *logImageOpenFromFile(const char *filepath, int cineon)
{
- unsigned int magicNum;
+ uint magicNum;
FILE *f = BLI_fopen(filepath, "rb");
(void)cineon;
@@ -120,16 +120,16 @@ LogImageFile *logImageOpenFromFile(const char *filepath, int cineon)
fclose(f);
if (logImageIsDpx(&magicNum, sizeof(magicNum))) {
- return dpxOpen((const unsigned char *)filepath, 0, 0);
+ return dpxOpen((const uchar *)filepath, 0, 0);
}
if (logImageIsCineon(&magicNum, sizeof(magicNum))) {
- return cineonOpen((const unsigned char *)filepath, 0, 0);
+ return cineonOpen((const uchar *)filepath, 0, 0);
}
return NULL;
}
-LogImageFile *logImageOpenFromMemory(const unsigned char *buffer, unsigned int size)
+LogImageFile *logImageOpenFromMemory(const uchar *buffer, uint size)
{
if (logImageIsDpx(buffer, size)) {
return dpxOpen(buffer, 1, size);
@@ -276,9 +276,9 @@ int logImageSetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB
static int logImageSetData8(LogImageFile *logImage, LogImageElement logElement, float *data)
{
size_t rowLength = getRowLength(logImage->width, logElement);
- unsigned char *row;
+ uchar *row;
- row = (unsigned char *)MEM_mallocN(rowLength, __func__);
+ row = (uchar *)MEM_mallocN(rowLength, __func__);
if (row == NULL) {
if (verbose) {
printf("DPX/Cineon: Cannot allocate row.\n");
@@ -289,7 +289,7 @@ static int logImageSetData8(LogImageFile *logImage, LogImageElement logElement,
for (size_t y = 0; y < logImage->height; y++) {
for (size_t x = 0; x < logImage->width * logImage->depth; x++) {
- row[x] = (unsigned char)float_uint(data[y * logImage->width * logImage->depth + x], 255);
+ row[x] = (uchar)float_uint(data[y * logImage->width * logImage->depth + x], 255);
}
if (logimage_fwrite(row, rowLength, 1, logImage) == 0) {
@@ -307,10 +307,10 @@ static int logImageSetData8(LogImageFile *logImage, LogImageElement logElement,
static int logImageSetData10(LogImageFile *logImage, LogImageElement logElement, float *data)
{
size_t rowLength = getRowLength(logImage->width, logElement);
- unsigned int pixel, index;
- unsigned int *row;
+ uint pixel, index;
+ uint *row;
- row = (unsigned int *)MEM_mallocN(rowLength, __func__);
+ row = (uint *)MEM_mallocN(rowLength, __func__);
if (row == NULL) {
if (verbose) {
printf("DPX/Cineon: Cannot allocate row.\n");
@@ -324,8 +324,7 @@ static int logImageSetData10(LogImageFile *logImage, LogImageElement logElement,
pixel = 0;
for (size_t x = 0; x < logImage->width * logImage->depth; x++) {
- pixel |= (unsigned int)float_uint(data[y * logImage->width * logImage->depth + x], 1023)
- << offset;
+ pixel |= (uint)float_uint(data[y * logImage->width * logImage->depth + x], 1023) << offset;
offset -= 10;
if (offset < 0) {
row[index] = swap_uint(pixel, logImage->isMSB);
@@ -353,9 +352,9 @@ static int logImageSetData10(LogImageFile *logImage, LogImageElement logElement,
static int logImageSetData12(LogImageFile *logImage, LogImageElement logElement, float *data)
{
size_t rowLength = getRowLength(logImage->width, logElement);
- unsigned short *row;
+ ushort *row;
- row = (unsigned short *)MEM_mallocN(rowLength, __func__);
+ row = (ushort *)MEM_mallocN(rowLength, __func__);
if (row == NULL) {
if (verbose) {
printf("DPX/Cineon: Cannot allocate row.\n");
@@ -366,7 +365,7 @@ static int logImageSetData12(LogImageFile *logImage, LogImageElement logElement,
for (size_t y = 0; y < logImage->height; y++) {
for (size_t x = 0; x < logImage->width * logImage->depth; x++) {
row[x] = swap_ushort(
- ((unsigned short)float_uint(data[y * logImage->width * logImage->depth + x], 4095)) << 4,
+ ((ushort)float_uint(data[y * logImage->width * logImage->depth + x], 4095)) << 4,
logImage->isMSB);
}
@@ -385,9 +384,9 @@ static int logImageSetData12(LogImageFile *logImage, LogImageElement logElement,
static int logImageSetData16(LogImageFile *logImage, LogImageElement logElement, float *data)
{
size_t rowLength = getRowLength(logImage->width, logElement);
- unsigned short *row;
+ ushort *row;
- row = (unsigned short *)MEM_mallocN(rowLength, __func__);
+ row = (ushort *)MEM_mallocN(rowLength, __func__);
if (row == NULL) {
if (verbose) {
printf("DPX/Cineon: Cannot allocate row.\n");
@@ -398,7 +397,7 @@ static int logImageSetData16(LogImageFile *logImage, LogImageElement logElement,
for (size_t y = 0; y < logImage->height; y++) {
for (size_t x = 0; x < logImage->width * logImage->depth; x++) {
row[x] = swap_ushort(
- (unsigned short)float_uint(data[y * logImage->width * logImage->depth + x], 65535),
+ (ushort)float_uint(data[y * logImage->width * logImage->depth + x], 65535),
logImage->isMSB);
}
@@ -425,11 +424,11 @@ int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB
float *elementData[8];
float *elementData_ptr[8];
float *mergedData;
- unsigned int sampleIndex;
+ uint sampleIndex;
LogImageElement mergedElement;
/* Determine the depth of the picture and if there's a separate alpha element.
- * If the element is supported, load it into an unsigned ints array. */
+ * If the element is supported, load it into an uints array. */
memset(&elementData, 0, 8 * sizeof(float *));
hasAlpha = 0;
@@ -695,7 +694,7 @@ static int logImageElementGetData(LogImageFile *logImage, LogImageElement logEle
static int logImageElementGetData1(LogImageFile *logImage, LogImageElement logElement, float *data)
{
- unsigned int pixel;
+ uint pixel;
/* seek at the right place */
if (logimage_fseek(logImage, logElement.dataOffset, SEEK_SET) != 0) {
@@ -727,7 +726,7 @@ static int logImageElementGetData1(LogImageFile *logImage, LogImageElement logEl
static int logImageElementGetData8(LogImageFile *logImage, LogImageElement logElement, float *data)
{
size_t rowLength = getRowLength(logImage->width, logElement);
- unsigned char pixel;
+ uchar pixel;
/* extract required pixels */
for (size_t y = 0; y < logImage->height; y++) {
@@ -756,7 +755,7 @@ static int logImageElementGetData10(LogImageFile *logImage,
LogImageElement logElement,
float *data)
{
- unsigned int pixel;
+ uint pixel;
/* seek to data */
if (logimage_fseek(logImage, logElement.dataOffset, SEEK_SET) != 0) {
@@ -829,15 +828,14 @@ static int logImageElementGetData10Packed(LogImageFile *logImage,
float *data)
{
size_t rowLength = getRowLength(logImage->width, logElement);
- unsigned int pixel, oldPixel;
+ uint pixel, oldPixel;
/* converting bytes to pixels */
for (size_t y = 0; y < logImage->height; y++) {
/* seek to data */
if (logimage_fseek(logImage, y * rowLength + logElement.dataOffset, SEEK_SET) != 0) {
if (verbose) {
- printf("DPX/Cineon: Couldn't seek at %u\n",
- (unsigned int)(y * rowLength + logElement.dataOffset));
+ printf("DPX/Cineon: Couldn't seek at %u\n", (uint)(y * rowLength + logElement.dataOffset));
}
return 1;
}
@@ -884,9 +882,9 @@ static int logImageElementGetData12(LogImageFile *logImage,
LogImageElement logElement,
float *data)
{
- unsigned int sampleIndex;
- unsigned int numSamples = logImage->width * logImage->height * logElement.depth;
- unsigned short pixel;
+ uint sampleIndex;
+ uint numSamples = logImage->width * logImage->height * logElement.depth;
+ ushort pixel;
/* seek to data */
if (logimage_fseek(logImage, logElement.dataOffset, SEEK_SET) != 0) {
@@ -923,15 +921,14 @@ static int logImageElementGetData12Packed(LogImageFile *logImage,
float *data)
{
size_t rowLength = getRowLength(logImage->width, logElement);
- unsigned int pixel, oldPixel;
+ uint pixel, oldPixel;
/* converting bytes to pixels */
for (size_t y = 0; y < logImage->height; y++) {
/* seek to data */
if (logimage_fseek(logImage, y * rowLength + logElement.dataOffset, SEEK_SET) != 0) {
if (verbose) {
- printf("DPX/Cineon: Couldn't seek at %u\n",
- (unsigned int)(y * rowLength + logElement.dataOffset));
+ printf("DPX/Cineon: Couldn't seek at %u\n", (uint)(y * rowLength + logElement.dataOffset));
}
return 1;
}
@@ -978,9 +975,9 @@ static int logImageElementGetData16(LogImageFile *logImage,
LogImageElement logElement,
float *data)
{
- unsigned int numSamples = logImage->width * logImage->height * logElement.depth;
- unsigned int sampleIndex;
- unsigned short pixel;
+ uint numSamples = logImage->width * logImage->height * logElement.depth;
+ uint sampleIndex;
+ ushort pixel;
/* seek to data */
if (logimage_fseek(logImage, logElement.dataOffset, SEEK_SET) != 0) {
@@ -1076,8 +1073,8 @@ static float *getLinToLogLut(LogImageFile *logImage, LogImageElement logElement)
{
float *lut;
float gain, negativeFilmGamma, offset, step;
- unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
- unsigned int i;
+ uint lutsize = (uint)(logElement.maxValue + 1);
+ uint i;
lut = MEM_mallocN(sizeof(float) * lutsize, "getLinToLogLut");
@@ -1104,8 +1101,8 @@ static float *getLogToLinLut(LogImageFile *logImage, LogImageElement logElement)
float *lut;
float breakPoint, gain, kneeGain, kneeOffset, negativeFilmGamma, offset, step, softClip;
/* float filmGamma; unused */
- unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
- unsigned int i;
+ uint lutsize = (uint)(logElement.maxValue + 1);
+ uint i;
lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut");
@@ -1154,8 +1151,8 @@ static float *getLogToLinLut(LogImageFile *logImage, LogImageElement logElement)
static float *getLinToSrgbLut(LogImageElement logElement)
{
float col, *lut;
- unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
- unsigned int i;
+ uint lutsize = (uint)(logElement.maxValue + 1);
+ uint i;
lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut");
@@ -1175,8 +1172,8 @@ static float *getLinToSrgbLut(LogImageElement logElement)
static float *getSrgbToLinLut(LogImageElement logElement)
{
float col, *lut;
- unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
- unsigned int i;
+ uint lutsize = (uint)(logElement.maxValue + 1);
+ uint i;
lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut");
@@ -1199,7 +1196,7 @@ static int convertRGBA_RGB(float *src,
LogImageElement logElement,
int elementIsSource)
{
- unsigned int i;
+ uint i;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1254,7 +1251,7 @@ static int convertRGB_RGBA(float *src,
LogImageElement logElement,
int elementIsSource)
{
- unsigned int i;
+ uint i;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1309,7 +1306,7 @@ static int convertRGBA_RGBA(float *src,
LogImageElement logElement,
int elementIsSource)
{
- unsigned int i;
+ uint i;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1354,7 +1351,7 @@ static int convertABGR_RGBA(float *src,
LogImageElement logElement,
int elementIsSource)
{
- unsigned int i;
+ uint i;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1407,7 +1404,7 @@ static int convertCbYCr_RGBA(float *src,
LogImageFile *logImage,
LogImageElement logElement)
{
- unsigned int i;
+ uint i;
float conversionMatrix[9], refLowData, y, cb, cr;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1439,7 +1436,7 @@ static int convertCbYCrA_RGBA(float *src,
LogImageFile *logImage,
LogImageElement logElement)
{
- unsigned int i;
+ uint i;
float conversionMatrix[9], refLowData, y, cb, cr, a;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1472,7 +1469,7 @@ static int convertCbYCrY_RGBA(float *src,
LogImageFile *logImage,
LogImageElement logElement)
{
- unsigned int i;
+ uint i;
float conversionMatrix[9], refLowData, y1, y2, cb, cr;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1524,7 +1521,7 @@ static int convertCbYACrYA_RGBA(float *src,
LogImageFile *logImage,
LogImageElement logElement)
{
- unsigned int i;
+ uint i;
float conversionMatrix[9], refLowData, y1, y2, cb, cr, a1, a2;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1578,7 +1575,7 @@ static int convertLuminance_RGBA(float *src,
LogImageFile *logImage,
LogImageElement logElement)
{
- unsigned int i;
+ uint i;
float conversionMatrix[9], value, refLowData;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1604,7 +1601,7 @@ static int convertYA_RGBA(float *src,
LogImageFile *logImage,
LogImageElement logElement)
{
- unsigned int i;
+ uint i;
float conversionMatrix[9], value, refLowData;
float *src_ptr = src;
float *dst_ptr = dst;
@@ -1629,7 +1626,7 @@ static int convertLogElementToRGBA(
float *src, float *dst, LogImageFile *logImage, LogImageElement logElement, int dstIsLinearRGB)
{
int rvalue;
- unsigned int i;
+ uint i;
float *src_ptr;
float *dst_ptr;
@@ -1698,7 +1695,7 @@ static int convertLogElementToRGBA(
static int convertRGBAToLogElement(
float *src, float *dst, LogImageFile *logImage, LogImageElement logElement, int srcIsLinearRGB)
{
- unsigned int i;
+ uint i;
int rvalue;
float *srgbSrc;
float *srgbSrc_ptr;
diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c
index f5bd87f96d1..6c24d67b33f 100644
--- a/source/blender/imbuf/intern/cineon/logmemfile.c
+++ b/source/blender/imbuf/intern/cineon/logmemfile.c
@@ -44,7 +44,7 @@ int logimage_fseek(LogImageFile *logFile, intptr_t offset, int origin)
return 0;
}
-int logimage_fwrite(void *buffer, size_t size, unsigned int count, LogImageFile *logFile)
+int logimage_fwrite(void *buffer, size_t size, uint count, LogImageFile *logFile)
{
if (logFile->file) {
return fwrite(buffer, size, count, logFile->file);
@@ -54,13 +54,13 @@ int logimage_fwrite(void *buffer, size_t size, unsigned int count, LogImageFile
return count;
}
-int logimage_fread(void *buffer, size_t size, unsigned int count, LogImageFile *logFile)
+int logimage_fread(void *buffer, size_t size, uint count, LogImageFile *logFile)
{
if (logFile->file) {
return fread(buffer, size, count, logFile->file);
}
/* we're reading from memory */
- unsigned char *buf = (unsigned char *)buffer;
+ uchar *buf = (uchar *)buffer;
uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
size_t total_size = size * count;
if (pos + total_size > logFile->memBufferSize) {
@@ -77,38 +77,38 @@ int logimage_fread(void *buffer, size_t size, unsigned int count, LogImageFile *
return count;
}
-int logimage_read_uchar(unsigned char *x, LogImageFile *logFile)
+int logimage_read_uchar(uchar *x, LogImageFile *logFile)
{
uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
- if (pos + sizeof(unsigned char) > logFile->memBufferSize) {
+ if (pos + sizeof(uchar) > logFile->memBufferSize) {
return 1;
}
- *x = *(unsigned char *)logFile->memCursor;
- logFile->memCursor += sizeof(unsigned char);
+ *x = *(uchar *)logFile->memCursor;
+ logFile->memCursor += sizeof(uchar);
return 0;
}
-int logimage_read_ushort(unsigned short *x, LogImageFile *logFile)
+int logimage_read_ushort(ushort *x, LogImageFile *logFile)
{
uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
- if (pos + sizeof(unsigned short) > logFile->memBufferSize) {
+ if (pos + sizeof(ushort) > logFile->memBufferSize) {
return 1;
}
- *x = *(unsigned short *)logFile->memCursor;
- logFile->memCursor += sizeof(unsigned short);
+ *x = *(ushort *)logFile->memCursor;
+ logFile->memCursor += sizeof(ushort);
return 0;
}
-int logimage_read_uint(unsigned int *x, LogImageFile *logFile)
+int logimage_read_uint(uint *x, LogImageFile *logFile)
{
uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer;
- if (pos + sizeof(unsigned int) > logFile->memBufferSize) {
+ if (pos + sizeof(uint) > logFile->memBufferSize) {
return 1;
}
- *x = *(unsigned int *)logFile->memCursor;
- logFile->memCursor += sizeof(unsigned int);
+ *x = *(uint *)logFile->memCursor;
+ logFile->memCursor += sizeof(uint);
return 0;
}
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index b62bdd5521d..ea5f4ec275d 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -235,11 +235,11 @@ static ColormanageCacheData *colormanage_cachedata_get(const ImBuf *ibuf)
return ibuf->colormanage_cache->data;
}
-static unsigned int colormanage_hashhash(const void *key_v)
+static uint colormanage_hashhash(const void *key_v)
{
const ColormanageCacheKey *key = key_v;
- unsigned int rval = (key->display << 16) | (key->view % 0xffff);
+ uint rval = (key->display << 16) | (key->view % 0xffff);
return rval;
}
@@ -336,11 +336,10 @@ static ImBuf *colormanage_cache_get_ibuf(ImBuf *ibuf,
return cache_ibuf;
}
-static unsigned char *colormanage_cache_get(
- ImBuf *ibuf,
- const ColormanageCacheViewSettings *view_settings,
- const ColormanageCacheDisplaySettings *display_settings,
- void **cache_handle)
+static uchar *colormanage_cache_get(ImBuf *ibuf,
+ const ColormanageCacheViewSettings *view_settings,
+ const ColormanageCacheDisplaySettings *display_settings,
+ void **cache_handle)
{
ColormanageCacheKey key;
ImBuf *cache_ibuf;
@@ -383,7 +382,7 @@ static unsigned char *colormanage_cache_get(
return NULL;
}
- return (unsigned char *)cache_ibuf->rect;
+ return (uchar *)cache_ibuf->rect;
}
return NULL;
@@ -392,7 +391,7 @@ static unsigned char *colormanage_cache_get(
static void colormanage_cache_put(ImBuf *ibuf,
const ColormanageCacheViewSettings *view_settings,
const ColormanageCacheDisplaySettings *display_settings,
- unsigned char *display_buffer,
+ uchar *display_buffer,
void **cache_handle)
{
ColormanageCacheKey key;
@@ -410,7 +409,7 @@ static void colormanage_cache_put(ImBuf *ibuf,
/* buffer itself */
cache_ibuf = IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->planes, 0);
- cache_ibuf->rect = (unsigned int *)display_buffer;
+ cache_ibuf->rect = (uint *)display_buffer;
cache_ibuf->mall |= IB_rect;
cache_ibuf->flags |= IB_rect;
@@ -1441,10 +1440,10 @@ typedef struct DisplayBufferThread {
ColormanageProcessor *cm_processor;
const float *buffer;
- unsigned char *byte_buffer;
+ uchar *byte_buffer;
float *display_buffer;
- unsigned char *display_buffer_byte;
+ uchar *display_buffer_byte;
int width;
int start_line;
@@ -1463,10 +1462,10 @@ typedef struct DisplayBufferInitData {
ImBuf *ibuf;
ColormanageProcessor *cm_processor;
const float *buffer;
- unsigned char *byte_buffer;
+ uchar *byte_buffer;
float *display_buffer;
- unsigned char *display_buffer_byte;
+ uchar *display_buffer_byte;
int width;
@@ -1539,13 +1538,13 @@ static void display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle,
bool predivide = handle->predivide;
if (!handle->buffer) {
- unsigned char *byte_buffer = handle->byte_buffer;
+ uchar *byte_buffer = handle->byte_buffer;
const char *from_colorspace = handle->byte_colorspace;
const char *to_colorspace = global_role_scene_linear;
float *fp;
- unsigned char *cp;
+ uchar *cp;
const size_t i_last = ((size_t)width) * height;
size_t i;
@@ -1608,7 +1607,7 @@ static void *do_display_buffer_apply_thread(void *handle_v)
DisplayBufferThread *handle = (DisplayBufferThread *)handle_v;
ColormanageProcessor *cm_processor = handle->cm_processor;
float *display_buffer = handle->display_buffer;
- unsigned char *display_buffer_byte = handle->display_buffer_byte;
+ uchar *display_buffer_byte = handle->display_buffer_byte;
int channels = handle->channels;
int width = handle->width;
int height = handle->tot_line;
@@ -1698,9 +1697,9 @@ static void *do_display_buffer_apply_thread(void *handle_v)
static void display_buffer_apply_threaded(ImBuf *ibuf,
const float *buffer,
- unsigned char *byte_buffer,
+ uchar *byte_buffer,
float *display_buffer,
- unsigned char *display_buffer_byte,
+ uchar *display_buffer_byte,
ColormanageProcessor *cm_processor)
{
DisplayBufferInitData init_data;
@@ -1761,7 +1760,7 @@ static bool is_ibuf_rect_in_display_space(ImBuf *ibuf,
static void colormanage_display_buffer_process_ex(
ImBuf *ibuf,
float *display_buffer,
- unsigned char *display_buffer_byte,
+ uchar *display_buffer_byte,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings)
{
@@ -1783,7 +1782,7 @@ static void colormanage_display_buffer_process_ex(
display_buffer_apply_threaded(ibuf,
ibuf->rect_float,
- (unsigned char *)ibuf->rect,
+ (uchar *)ibuf->rect,
display_buffer,
display_buffer_byte,
cm_processor);
@@ -1794,7 +1793,7 @@ static void colormanage_display_buffer_process_ex(
}
static void colormanage_display_buffer_process(ImBuf *ibuf,
- unsigned char *display_buffer,
+ uchar *display_buffer,
const ColorManagedViewSettings *view_settings,
const ColorManagedDisplaySettings *display_settings)
{
@@ -1810,7 +1809,7 @@ static void colormanage_display_buffer_process(ImBuf *ibuf,
typedef struct ProcessorTransformThread {
ColormanageProcessor *cm_processor;
- unsigned char *byte_buffer;
+ uchar *byte_buffer;
float *float_buffer;
int width;
int start_line;
@@ -1822,7 +1821,7 @@ typedef struct ProcessorTransformThread {
typedef struct ProcessorTransformInit {
ColormanageProcessor *cm_processor;
- unsigned char *byte_buffer;
+ uchar *byte_buffer;
float *float_buffer;
int width;
int height;
@@ -1871,7 +1870,7 @@ static void processor_transform_init_handle(void *handle_v,
static void *do_processor_transform_thread(void *handle_v)
{
ProcessorTransformThread *handle = (ProcessorTransformThread *)handle_v;
- unsigned char *byte_buffer = handle->byte_buffer;
+ uchar *byte_buffer = handle->byte_buffer;
float *float_buffer = handle->float_buffer;
const int channels = handle->channels;
const int width = handle->width;
@@ -1907,7 +1906,7 @@ static void *do_processor_transform_thread(void *handle_v)
return NULL;
}
-static void processor_transform_apply_threaded(unsigned char *byte_buffer,
+static void processor_transform_apply_threaded(uchar *byte_buffer,
float *float_buffer,
const int width,
const int height,
@@ -1942,7 +1941,7 @@ static void processor_transform_apply_threaded(unsigned char *byte_buffer,
/* Convert the whole buffer from specified by name color space to another -
* internal implementation. */
-static void colormanagement_transform_ex(unsigned char *byte_buffer,
+static void colormanagement_transform_ex(uchar *byte_buffer,
float *float_buffer,
int width,
int height,
@@ -2008,7 +2007,7 @@ void IMB_colormanagement_transform_threaded(float *buffer,
NULL, buffer, width, height, channels, from_colorspace, to_colorspace, predivide, true);
}
-void IMB_colormanagement_transform_byte(unsigned char *buffer,
+void IMB_colormanagement_transform_byte(uchar *buffer,
int width,
int height,
int channels,
@@ -2018,7 +2017,7 @@ void IMB_colormanagement_transform_byte(unsigned char *buffer,
colormanagement_transform_ex(
buffer, NULL, width, height, channels, from_colorspace, to_colorspace, false, false);
}
-void IMB_colormanagement_transform_byte_threaded(unsigned char *buffer,
+void IMB_colormanagement_transform_byte_threaded(uchar *buffer,
int width,
int height,
int channels,
@@ -2030,7 +2029,7 @@ void IMB_colormanagement_transform_byte_threaded(unsigned char *buffer,
}
void IMB_colormanagement_transform_from_byte(float *float_buffer,
- unsigned char *byte_buffer,
+ uchar *byte_buffer,
int width,
int height,
int channels,
@@ -2050,7 +2049,7 @@ void IMB_colormanagement_transform_from_byte(float *float_buffer,
float_buffer, width, height, channels, from_colorspace, to_colorspace, true);
}
void IMB_colormanagement_transform_from_byte_threaded(float *float_buffer,
- unsigned char *byte_buffer,
+ uchar *byte_buffer,
int width,
int height,
int channels,
@@ -2205,7 +2204,7 @@ void IMB_colormanagement_colorspace_to_scene_linear(float *buffer,
}
}
-void IMB_colormanagement_imbuf_to_byte_texture(unsigned char *out_buffer,
+void IMB_colormanagement_imbuf_to_byte_texture(uchar *out_buffer,
const int offset_x,
const int offset_y,
const int width,
@@ -2220,14 +2219,14 @@ void IMB_colormanagement_imbuf_to_byte_texture(unsigned char *out_buffer,
IMB_colormanagement_space_is_scene_linear(ibuf->rect_colorspace) ||
IMB_colormanagement_space_is_data(ibuf->rect_colorspace));
- const unsigned char *in_buffer = (unsigned char *)ibuf->rect;
+ const uchar *in_buffer = (uchar *)ibuf->rect;
const bool use_premultiply = IMB_alpha_affects_rgb(ibuf) && store_premultiplied;
for (int y = 0; y < height; y++) {
const size_t in_offset = (offset_y + y) * ibuf->x + offset_x;
const size_t out_offset = y * width;
- const unsigned char *in = in_buffer + in_offset * 4;
- unsigned char *out = out_buffer + out_offset * 4;
+ const uchar *in = in_buffer + in_offset * 4;
+ uchar *out = out_buffer + out_offset * 4;
if (use_premultiply) {
/* Premultiply only. */
@@ -2305,7 +2304,7 @@ void IMB_colormanagement_imbuf_to_float_texture(float *out_buffer,
}
else {
/* Byte source buffer. */
- const unsigned char *in_buffer = (unsigned char *)ibuf->rect;
+ const uchar *in_buffer = (uchar *)ibuf->rect;
const bool use_premultiply = IMB_alpha_affects_rgb(ibuf) && store_premultiplied;
/* TODO(brecht): make this multi-threaded, or at least process in batches. */
@@ -2317,7 +2316,7 @@ void IMB_colormanagement_imbuf_to_float_texture(float *out_buffer,
for (int y = 0; y < height; y++) {
const size_t in_offset = (offset_y + y) * ibuf->x + offset_x;
const size_t out_offset = y * width;
- const unsigned char *in = in_buffer + in_offset * 4;
+ const uchar *in = in_buffer + in_offset * 4;
float *out = out_buffer + out_offset * 4;
/* Convert to scene linear, to sRGB and premultiply. */
@@ -2458,7 +2457,7 @@ static void colormanagement_imbuf_make_display_space(
}
colormanage_display_buffer_process_ex(
- ibuf, ibuf->rect_float, (unsigned char *)ibuf->rect, view_settings, display_settings);
+ ibuf, ibuf->rect_float, (uchar *)ibuf->rect, view_settings, display_settings);
}
void IMB_colormanagement_imbuf_make_display_space(
@@ -2545,10 +2544,8 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
}
if (colormanaged_ibuf->rect) {
- IMB_alpha_under_color_byte((unsigned char *)colormanaged_ibuf->rect,
- colormanaged_ibuf->x,
- colormanaged_ibuf->y,
- color);
+ IMB_alpha_under_color_byte(
+ (uchar *)colormanaged_ibuf->rect, colormanaged_ibuf->x, colormanaged_ibuf->y, color);
}
}
@@ -2603,7 +2600,7 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
if (colormanaged_ibuf->rect) {
/* Byte to byte. */
- IMB_colormanagement_transform_byte_threaded((unsigned char *)colormanaged_ibuf->rect,
+ IMB_colormanagement_transform_byte_threaded((uchar *)colormanaged_ibuf->rect,
colormanaged_ibuf->x,
colormanaged_ibuf->y,
colormanaged_ibuf->channels,
@@ -2650,12 +2647,12 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
/** \name Public Display Buffers Interfaces
* \{ */
-unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf,
- const ColorManagedViewSettings *view_settings,
- const ColorManagedDisplaySettings *display_settings,
- void **cache_handle)
+uchar *IMB_display_buffer_acquire(ImBuf *ibuf,
+ const ColorManagedViewSettings *view_settings,
+ const ColorManagedDisplaySettings *display_settings,
+ void **cache_handle)
{
- unsigned char *display_buffer;
+ uchar *display_buffer;
size_t buffer_size;
ColormanageCacheViewSettings cache_view_settings;
ColormanageCacheDisplaySettings cache_display_settings;
@@ -2683,7 +2680,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf,
*/
if (ibuf->rect_float == NULL && ibuf->rect_colorspace && ibuf->channels == 4) {
if (is_ibuf_rect_in_display_space(ibuf, applied_view_settings, display_settings)) {
- return (unsigned char *)ibuf->rect;
+ return (uchar *)ibuf->rect;
}
}
@@ -2694,7 +2691,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf,
if ((ibuf->userflags & IB_DISPLAY_BUFFER_INVALID) == 0) {
IMB_partial_display_buffer_update_threaded(ibuf,
ibuf->rect_float,
- (unsigned char *)ibuf->rect,
+ (uchar *)ibuf->rect,
ibuf->x,
0,
0,
@@ -2713,14 +2710,14 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf,
/* ensure color management bit fields exists */
if (!ibuf->display_buffer_flags) {
- ibuf->display_buffer_flags = MEM_callocN(sizeof(unsigned int) * global_tot_display,
+ ibuf->display_buffer_flags = MEM_callocN(sizeof(uint) * global_tot_display,
"imbuf display_buffer_flags");
}
else if (ibuf->userflags & IB_DISPLAY_BUFFER_INVALID) {
/* all display buffers were marked as invalid from other areas,
* now propagate this flag to internal color management routines
*/
- memset(ibuf->display_buffer_flags, 0, global_tot_display * sizeof(unsigned int));
+ memset(ibuf->display_buffer_flags, 0, global_tot_display * sizeof(uint));
ibuf->userflags &= ~IB_DISPLAY_BUFFER_INVALID;
}
@@ -2747,7 +2744,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf,
return display_buffer;
}
-unsigned char *IMB_display_buffer_acquire_ctx(const bContext *C, ImBuf *ibuf, void **cache_handle)
+uchar *IMB_display_buffer_acquire_ctx(const bContext *C, ImBuf *ibuf, void **cache_handle)
{
ColorManagedViewSettings *view_settings;
ColorManagedDisplaySettings *display_settings;
@@ -2757,7 +2754,7 @@ unsigned char *IMB_display_buffer_acquire_ctx(const bContext *C, ImBuf *ibuf, vo
return IMB_display_buffer_acquire(ibuf, view_settings, display_settings, cache_handle);
}
-void IMB_display_buffer_transform_apply(unsigned char *display_buffer,
+void IMB_display_buffer_transform_apply(uchar *display_buffer,
float *linear_buffer,
int width,
int height,
@@ -3396,9 +3393,9 @@ void IMB_colormanagement_colorspace_items_add(EnumPropertyItem **items, int *tot
*/
static void partial_buffer_update_rect(ImBuf *ibuf,
- unsigned char *display_buffer,
+ uchar *display_buffer,
const float *linear_buffer,
- const unsigned char *byte_buffer,
+ const uchar *byte_buffer,
int display_stride,
int linear_stride,
int linear_offset_x,
@@ -3547,9 +3544,9 @@ static void partial_buffer_update_rect(ImBuf *ibuf,
typedef struct PartialThreadData {
ImBuf *ibuf;
- unsigned char *display_buffer;
+ uchar *display_buffer;
const float *linear_buffer;
- const unsigned char *byte_buffer;
+ const uchar *byte_buffer;
int display_stride;
int linear_stride;
int linear_offset_x, linear_offset_y;
@@ -3580,7 +3577,7 @@ static void partial_buffer_update_rect_thread_do(void *data_v, int scanline)
static void imb_partial_display_buffer_update_ex(
ImBuf *ibuf,
const float *linear_buffer,
- const unsigned char *byte_buffer,
+ const uchar *byte_buffer,
int stride,
int offset_x,
int offset_y,
@@ -3595,7 +3592,7 @@ static void imb_partial_display_buffer_update_ex(
ColormanageCacheViewSettings cache_view_settings;
ColormanageCacheDisplaySettings cache_display_settings;
void *cache_handle = NULL;
- unsigned char *display_buffer = NULL;
+ uchar *display_buffer = NULL;
int buffer_width = ibuf->x;
if (ibuf->display_buffer_flags) {
@@ -3621,7 +3618,7 @@ static void imb_partial_display_buffer_update_ex(
buffer_width = ibuf->x;
/* Mark all other buffers as invalid. */
- memset(ibuf->display_buffer_flags, 0, global_tot_display * sizeof(unsigned int));
+ memset(ibuf->display_buffer_flags, 0, global_tot_display * sizeof(uint));
ibuf->display_buffer_flags[display_index] |= view_flag;
BLI_thread_unlock(LOCK_COLORMANAGE);
@@ -3689,7 +3686,7 @@ static void imb_partial_display_buffer_update_ex(
void IMB_partial_display_buffer_update(ImBuf *ibuf,
const float *linear_buffer,
- const unsigned char *byte_buffer,
+ const uchar *byte_buffer,
int stride,
int offset_x,
int offset_y,
@@ -3718,7 +3715,7 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf,
void IMB_partial_display_buffer_update_threaded(
struct ImBuf *ibuf,
const float *linear_buffer,
- const unsigned char *byte_buffer,
+ const uchar *byte_buffer,
int stride,
int offset_x,
int offset_y,
@@ -3925,7 +3922,7 @@ void IMB_colormanagement_processor_apply(ColormanageProcessor *cm_processor,
}
void IMB_colormanagement_processor_apply_byte(
- ColormanageProcessor *cm_processor, unsigned char *buffer, int width, int height, int channels)
+ ColormanageProcessor *cm_processor, uchar *buffer, int width, int height, int channels)
{
/* TODO(sergey): Would be nice to support arbitrary channels configurations,
* but for now it's not so important.
diff --git a/source/blender/imbuf/intern/colormanagement_inline.c b/source/blender/imbuf/intern/colormanagement_inline.c
index 3c6c0f5fd0a..df513a7330c 100644
--- a/source/blender/imbuf/intern/colormanagement_inline.c
+++ b/source/blender/imbuf/intern/colormanagement_inline.c
@@ -21,7 +21,7 @@ float IMB_colormanagement_get_luminance(const float rgb[3])
return dot_v3v3(imbuf_luma_coefficients, rgb);
}
-unsigned char IMB_colormanagement_get_luminance_byte(const unsigned char rgb[3])
+uchar IMB_colormanagement_get_luminance_byte(const uchar rgb[3])
{
float rgbf[3];
float val;
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 4048a78e5cf..2d198135a66 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -34,6 +34,8 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE. */
+#include <BLI_sys_types.h> /* For `uint`. */
+
#include <BlockDXT.h>
#include <ColorBlock.h>
#include <Common.h>
@@ -576,7 +578,7 @@ void mem_read(Stream &mem, BlockDXT1 &block)
void mem_read(Stream &mem, AlphaBlockDXT3 &block)
{
- for (unsigned short &alpha : block.row) {
+ for (ushort &alpha : block.row) {
mem_read(mem, alpha);
}
}
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index ce5dd4927be..4e5dc9ce560 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -867,7 +867,7 @@ uint DDSHeader::d3d9Format() const
return findD3D9Format(pf.bitcount, pf.rmask, pf.gmask, pf.bmask, pf.amask);
}
-DirectDrawSurface::DirectDrawSurface(unsigned char *mem, uint size) : stream(mem, size), header()
+DirectDrawSurface::DirectDrawSurface(uchar *mem, uint size) : stream(mem, size), header()
{
mem_read(stream, header);
@@ -1112,7 +1112,7 @@ void *DirectDrawSurface::readData(uint &rsize)
uint size = stream.size - header_size;
rsize = size;
- unsigned char *data = (unsigned char *)malloc(sizeof(*data) * size);
+ uchar *data = (uchar *)malloc(sizeof(*data) * size);
stream.seek(header_size);
mem_read(stream, data, size);
@@ -1158,7 +1158,7 @@ void DirectDrawSurface::readLinearImage(Image *img)
for (uint y = 0; y < h; y++) {
for (uint x = 0; x < w; x++) {
uint c = 0;
- mem_read(stream, (unsigned char *)(&c), byteCount);
+ mem_read(stream, (uchar *)(&c), byteCount);
Color32 pixel(0, 0, 0, 0xFF);
pixel.r = PixelFormat::convert((c & header.pf.rmask) >> rshift, rsize, 8);
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp
index fc978bff788..682cf394d08 100644
--- a/source/blender/imbuf/intern/dds/FlipDXT.cpp
+++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp
@@ -104,19 +104,19 @@ static void FlipDXT5BlockFull(uint8_t *block)
* bits = bits_0 + 256 * (bits_1 + 256 * (bits_2 + 256 * (bits_3 +
* 256 * (bits_4 + 256 * bits_5))))
*
- * bits is a 48-bit unsigned integer, from which a three-bit control code
+ * bits is a 48-bit uinteger, from which a three-bit control code
* is extracted for a texel at location (x,y) in the block using:
*
* code(x,y) = bits[3*(4*y+x)+1..3*(4*y+x)+0]
*
* where bit 47 is the most significant and bit 0 is the least
* significant bit. */
- unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
- unsigned int line_2_3 = block[5] + 256 * (block[6] + 256 * block[7]);
+ uint line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
+ uint line_2_3 = block[5] + 256 * (block[6] + 256 * block[7]);
/* swap lines 0 and 1 in line_0_1. */
- unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
+ uint line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
/* swap lines 2 and 3 in line_2_3. */
- unsigned int line_3_2 = ((line_2_3 & 0x000fff) << 12) | ((line_2_3 & 0xfff000) >> 12);
+ uint line_3_2 = ((line_2_3 & 0x000fff) << 12) | ((line_2_3 & 0xfff000) >> 12);
block[2] = line_3_2 & 0xff;
block[3] = (line_3_2 & 0xff00) >> 8;
@@ -133,21 +133,21 @@ static void FlipDXT5BlockFull(uint8_t *block)
static void FlipDXT5BlockHalf(uint8_t *block)
{
/* See layout above. */
- unsigned int line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
- unsigned int line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
+ uint line_0_1 = block[2] + 256 * (block[3] + 256 * block[4]);
+ uint line_1_0 = ((line_0_1 & 0x000fff) << 12) | ((line_0_1 & 0xfff000) >> 12);
block[2] = line_1_0 & 0xff;
block[3] = (line_1_0 & 0xff00) >> 8;
block[4] = (line_1_0 & 0xff0000) >> 16;
FlipDXT1BlockHalf(block + 8);
}
-int FlipDXTCImage(unsigned int width,
- unsigned int height,
- unsigned int levels,
+int FlipDXTCImage(uint width,
+ uint height,
+ uint levels,
int fourcc,
uint8_t *data,
int data_size,
- unsigned int *r_num_valid_levels)
+ uint *r_num_valid_levels)
{
*r_num_valid_levels = 0;
@@ -162,7 +162,7 @@ int FlipDXTCImage(unsigned int width,
FlipBlockFunction full_block_function;
FlipBlockFunction half_block_function;
- unsigned int block_bytes = 0;
+ uint block_bytes = 0;
switch (fourcc) {
case FOURCC_DXT1:
@@ -186,15 +186,15 @@ int FlipDXTCImage(unsigned int width,
*r_num_valid_levels = levels;
- unsigned int mip_width = width;
- unsigned int mip_height = height;
+ uint mip_width = width;
+ uint mip_height = height;
const uint8_t *data_end = data + data_size;
- for (unsigned int i = 0; i < levels; i++) {
- unsigned int blocks_per_row = (mip_width + 3) / 4;
- unsigned int blocks_per_col = (mip_height + 3) / 4;
- unsigned int blocks = blocks_per_row * blocks_per_col;
+ for (uint i = 0; i < levels; i++) {
+ uint blocks_per_row = (mip_width + 3) / 4;
+ uint blocks_per_col = (mip_height + 3) / 4;
+ uint blocks = blocks_per_row * blocks_per_col;
if (data + block_bytes * blocks > data_end) {
/* Stop flipping when running out of data to be modified, avoiding possible buffer overrun
@@ -209,23 +209,23 @@ int FlipDXTCImage(unsigned int width,
}
if (mip_height == 2) {
/* flip the first 2 lines in each block. */
- for (unsigned int i = 0; i < blocks_per_row; i++) {
+ for (uint i = 0; i < blocks_per_row; i++) {
half_block_function(data + i * block_bytes);
}
}
else {
/* flip each block. */
- for (unsigned int i = 0; i < blocks; i++) {
+ for (uint i = 0; i < blocks; i++) {
full_block_function(data + i * block_bytes);
}
/* Swap each block line in the first half of the image with the
* corresponding one in the second half.
* note that this is a no-op if mip_height is 4. */
- unsigned int row_bytes = block_bytes * blocks_per_row;
+ uint row_bytes = block_bytes * blocks_per_row;
uint8_t *temp_line = new uint8_t[row_bytes];
- for (unsigned int y = 0; y < blocks_per_col / 2; y++) {
+ for (uint y = 0; y < blocks_per_col / 2; y++) {
uint8_t *line1 = data + y * row_bytes;
uint8_t *line2 = data + (blocks_per_col - y - 1) * row_bytes;
diff --git a/source/blender/imbuf/intern/dds/Stream.cpp b/source/blender/imbuf/intern/dds/Stream.cpp
index 566891dac8b..44b7e6d8f42 100644
--- a/source/blender/imbuf/intern/dds/Stream.cpp
+++ b/source/blender/imbuf/intern/dds/Stream.cpp
@@ -4,6 +4,8 @@
* \ingroup imbdds
*/
+#include "BLI_sys_types.h" /* For `uint`. */
+
#include <Stream.h>
#include <cstdio> /* printf */
@@ -12,7 +14,7 @@
static const char *msg_error_seek = "DDS: trying to seek beyond end of stream (corrupt file?)";
static const char *msg_error_read = "DDS: trying to read beyond end of stream (corrupt file?)";
-inline bool is_read_within_bounds(const Stream &mem, unsigned int count)
+inline bool is_read_within_bounds(const Stream &mem, uint count)
{
if (mem.pos >= mem.size) {
/* No more data remained in the memory buffer. */
@@ -27,7 +29,7 @@ inline bool is_read_within_bounds(const Stream &mem, unsigned int count)
return true;
}
-unsigned int Stream::seek(unsigned int p)
+uint Stream::seek(uint p)
{
if (p > size) {
set_failed(msg_error_seek);
@@ -39,7 +41,7 @@ unsigned int Stream::seek(unsigned int p)
return pos;
}
-unsigned int mem_read(Stream &mem, unsigned long long &i)
+uint mem_read(Stream &mem, unsigned long long &i)
{
if (!is_read_within_bounds(mem, 8)) {
mem.set_failed(msg_error_seek);
@@ -50,7 +52,7 @@ unsigned int mem_read(Stream &mem, unsigned long long &i)
return 8;
}
-unsigned int mem_read(Stream &mem, unsigned int &i)
+uint mem_read(Stream &mem, uint &i)
{
if (!is_read_within_bounds(mem, 4)) {
mem.set_failed(msg_error_read);
@@ -61,7 +63,7 @@ unsigned int mem_read(Stream &mem, unsigned int &i)
return 4;
}
-unsigned int mem_read(Stream &mem, unsigned short &i)
+uint mem_read(Stream &mem, ushort &i)
{
if (!is_read_within_bounds(mem, 2)) {
mem.set_failed(msg_error_read);
@@ -72,7 +74,7 @@ unsigned int mem_read(Stream &mem, unsigned short &i)
return 2;
}
-unsigned int mem_read(Stream &mem, unsigned char &i)
+uint mem_read(Stream &mem, uchar &i)
{
if (!is_read_within_bounds(mem, 1)) {
mem.set_failed(msg_error_read);
@@ -83,7 +85,7 @@ unsigned int mem_read(Stream &mem, unsigned char &i)
return 1;
}
-unsigned int mem_read(Stream &mem, unsigned char *i, unsigned int count)
+uint mem_read(Stream &mem, uchar *i, uint count)
{
if (!is_read_within_bounds(mem, count)) {
mem.set_failed(msg_error_read);
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index e9a13573116..213e10cf744 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -58,7 +58,7 @@ bool imb_save_dds(struct ImBuf *ibuf, const char *name, int /*flags*/)
return true;
}
-bool imb_is_a_dds(const unsigned char *mem, const size_t size)
+bool imb_is_a_dds(const uchar *mem, const size_t size)
{
if (size < 8) {
return false;
@@ -75,19 +75,16 @@ bool imb_is_a_dds(const unsigned char *mem, const size_t size)
return true;
}
-struct ImBuf *imb_load_dds(const unsigned char *mem,
- size_t size,
- int flags,
- char colorspace[IM_MAX_SPACE])
+struct ImBuf *imb_load_dds(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
struct ImBuf *ibuf = nullptr;
- DirectDrawSurface dds((unsigned char *)mem, size); /* reads header */
- unsigned char bits_per_pixel;
- unsigned int *rect;
+ DirectDrawSurface dds((uchar *)mem, size); /* reads header */
+ uchar bits_per_pixel;
+ uint *rect;
Image img;
- unsigned int numpixels = 0;
+ uint numpixels = 0;
int col;
- unsigned char *cp = (unsigned char *)&col;
+ uchar *cp = (uchar *)&col;
Color32 pixel;
Color32 *pixels = nullptr;
@@ -128,7 +125,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem,
bits_per_pixel = 24;
if (img.format() == Image::Format_ARGB) {
/* check that there is effectively an alpha channel */
- for (unsigned int i = 0; i < numpixels; i++) {
+ for (uint i = 0; i < numpixels; i++) {
pixel = pixels[i];
if (pixel.a != 255) {
bits_per_pixel = 32;
@@ -156,7 +153,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem,
rect = ibuf->rect;
cp[3] = 0xff; /* default alpha if alpha channel is not present */
- for (unsigned int i = 0; i < numpixels; i++) {
+ for (uint i = 0; i < numpixels; i++) {
pixel = pixels[i];
cp[0] = pixel.r; /* set R component of col */
cp[1] = pixel.g; /* set G component of col */
@@ -168,7 +165,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem,
}
if (ibuf->dds_data.fourcc != FOURCC_DDS) {
- ibuf->dds_data.data = (unsigned char *)dds.readData(ibuf->dds_data.size);
+ ibuf->dds_data.data = (uchar *)dds.readData(ibuf->dds_data.size);
/* flip compressed texture */
if (ibuf->dds_data.data) {
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index 13c8f0887b3..61ef9c111d7 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -48,7 +48,7 @@ static void clear_dither_context(DitherContext *di)
/** \name Generic Buffer Conversion
* \{ */
-MINLINE void ushort_to_byte_v4(uchar b[4], const unsigned short us[4])
+MINLINE void ushort_to_byte_v4(uchar b[4], const ushort us[4])
{
b[0] = unit_ushort_to_uchar(us[0]);
b[1] = unit_ushort_to_uchar(us[1]);
@@ -56,13 +56,13 @@ MINLINE void ushort_to_byte_v4(uchar b[4], const unsigned short us[4])
b[3] = unit_ushort_to_uchar(us[3]);
}
-MINLINE unsigned char ftochar(float value)
+MINLINE uchar ftochar(float value)
{
return unit_float_to_uchar_clamp(value);
}
MINLINE void ushort_to_byte_dither_v4(
- uchar b[4], const unsigned short us[4], DitherContext *di, float s, float t)
+ uchar b[4], const ushort us[4], DitherContext *di, float s, float t)
{
#define USHORTTOFLOAT(val) ((float)val / 65535.0f)
float dither_value = dither_random_value(s, t) * 0.0033f * di->dither;
@@ -192,7 +192,7 @@ void IMB_buffer_byte_from_float(uchar *rect_to,
}
else if (profile_to == IB_PROFILE_SRGB) {
/* convert from linear to sRGB */
- unsigned short us[4];
+ ushort us[4];
float straight[4];
if (dither && predivide) {
@@ -729,7 +729,7 @@ void IMB_rect_from_float(ImBuf *ibuf)
}
/* convert float to byte */
- IMB_buffer_byte_from_float((unsigned char *)ibuf->rect,
+ IMB_buffer_byte_from_float((uchar *)ibuf->rect,
buffer,
ibuf->channels,
ibuf->dither,
@@ -768,7 +768,7 @@ void IMB_float_from_rect_ex(struct ImBuf *dst,
float *rect_float = dst->rect_float;
rect_float += (region_to_update->xmin + region_to_update->ymin * dst->x) * 4;
- unsigned char *rect = (unsigned char *)src->rect;
+ uchar *rect = (uchar *)src->rect;
rect += (region_to_update->xmin + region_to_update->ymin * dst->x) * 4;
const int region_width = BLI_rcti_size_x(region_to_update);
const int region_height = BLI_rcti_size_y(region_to_update);
@@ -889,7 +889,7 @@ void IMB_buffer_float_premultiply(float *buf, int width, int height)
void IMB_saturation(ImBuf *ibuf, float sat)
{
size_t i;
- unsigned char *rct = (unsigned char *)ibuf->rect;
+ uchar *rct = (uchar *)ibuf->rect;
float *rct_fl = ibuf->rect_float;
float hsv[3];
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 91c69d3abc8..67de467bd93 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -18,9 +18,9 @@
#include "imbuf.h"
-static void filtrow(unsigned char *point, int x)
+static void filtrow(uchar *point, int x)
{
- unsigned int c1, c2, c3, error;
+ uint c1, c2, c3, error;
if (x > 1) {
c1 = c2 = *point;
@@ -56,10 +56,10 @@ static void filtrowf(float *point, int x)
}
}
-static void filtcolum(unsigned char *point, int y, int skip)
+static void filtcolum(uchar *point, int y, int skip)
{
- unsigned int c1, c2, c3, error;
- unsigned char *point2;
+ uint c1, c2, c3, error;
+ uchar *point2;
if (y > 1) {
c1 = c2 = *point;
@@ -101,11 +101,11 @@ static void filtcolumf(float *point, int y, int skip)
void IMB_filtery(struct ImBuf *ibuf)
{
- unsigned char *point;
+ uchar *point;
float *pointf;
int x, y, skip;
- point = (unsigned char *)ibuf->rect;
+ point = (uchar *)ibuf->rect;
pointf = ibuf->rect_float;
x = ibuf->x;
@@ -142,11 +142,11 @@ void IMB_filtery(struct ImBuf *ibuf)
void imb_filterx(struct ImBuf *ibuf)
{
- unsigned char *point;
+ uchar *point;
float *pointf;
int x, y, skip;
- point = (unsigned char *)ibuf->rect;
+ point = (uchar *)ibuf->rect;
pointf = ibuf->rect_float;
x = ibuf->x;
@@ -395,7 +395,7 @@ static int check_pixel_assigned(
res = mask[index] != 0 ? 1 : 0;
}
else if ((is_float && ((const float *)buffer)[alpha_index] != 0.0f) ||
- (!is_float && ((const unsigned char *)buffer)[alpha_index] != 0)) {
+ (!is_float && ((const uchar *)buffer)[alpha_index] != 0)) {
res = 1;
}
}
@@ -408,7 +408,7 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
const int width = ibuf->x;
const int height = ibuf->y;
const int depth = 4; /* always 4 channels */
- const int chsize = ibuf->rect_float ? sizeof(float) : sizeof(unsigned char);
+ const int chsize = ibuf->rect_float ? sizeof(float) : sizeof(uchar);
const size_t bsize = ((size_t)width) * height * depth * chsize;
const bool is_float = (ibuf->rect_float != NULL);
void *dstbuf = (void *)MEM_dupallocN(ibuf->rect_float ? (void *)ibuf->rect_float :
@@ -478,7 +478,7 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
}
else {
for (c = 0; c < depth; c++) {
- tmp[c] = (float)((const unsigned char *)srcbuf)[depth * tmpindex + c];
+ tmp[c] = (float)((const uchar *)srcbuf)[depth * tmpindex + c];
}
}
@@ -505,8 +505,10 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
}
else {
for (c = 0; c < depth; c++) {
- ((unsigned char *)dstbuf)[depth * index + c] =
- acc[c] > 255 ? 255 : (acc[c] < 0 ? 0 : (unsigned char)roundf(acc[c]));
+ ((uchar *)dstbuf)[depth * index + c] = acc[c] > 255 ?
+ 255 :
+ (acc[c] < 0 ? 0 :
+ (uchar)roundf(acc[c]));
}
}
@@ -613,7 +615,7 @@ ImBuf *IMB_getmipmap(ImBuf *ibuf, int level)
return (level == 0) ? ibuf : ibuf->mipmap[level - 1];
}
-void IMB_premultiply_rect(unsigned int *rect, char planes, int w, int h)
+void IMB_premultiply_rect(uint *rect, char planes, int w, int h)
{
char *cp;
int x, y, val;
@@ -674,7 +676,7 @@ void IMB_premultiply_alpha(ImBuf *ibuf)
}
}
-void IMB_unpremultiply_rect(unsigned int *rect, char planes, int w, int h)
+void IMB_unpremultiply_rect(uint *rect, char planes, int w, int h)
{
char *cp;
int x, y;
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index 13bf3697946..4530959e5ac 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -26,7 +26,7 @@
void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
{
size_t size;
- unsigned char rt, *cp = (unsigned char *)ibuf->rect;
+ uchar rt, *cp = (uchar *)ibuf->rect;
float rtf, *cpf = ibuf->rect_float;
if (ibuf->rect) {
@@ -58,14 +58,13 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
}
}
-static void pixel_from_buffer(
- const struct ImBuf *ibuf, unsigned char **outI, float **outF, int x, int y)
+static void pixel_from_buffer(const struct ImBuf *ibuf, uchar **outI, float **outF, int x, int y)
{
size_t offset = ((size_t)ibuf->x) * y * 4 + 4 * x;
if (ibuf->rect) {
- *outI = (unsigned char *)ibuf->rect + offset;
+ *outI = (uchar *)ibuf->rect + offset;
}
if (ibuf->rect_float) {
@@ -78,19 +77,19 @@ static void pixel_from_buffer(
* \{ */
void bicubic_interpolation_color(
- const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
+ const struct ImBuf *in, uchar outI[4], float outF[4], float u, float v)
{
if (outF) {
BLI_bicubic_interpolation_fl(in->rect_float, outF, in->x, in->y, 4, u, v);
}
else {
- BLI_bicubic_interpolation_char((unsigned char *)in->rect, outI, in->x, in->y, 4, u, v);
+ BLI_bicubic_interpolation_char((uchar *)in->rect, outI, in->x, in->y, 4, u, v);
}
}
void bicubic_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
{
- unsigned char *outI = NULL;
+ uchar *outI = NULL;
float *outF = NULL;
if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
@@ -110,7 +109,7 @@ void bicubic_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xo
* \{ */
void bilinear_interpolation_color_fl(
- const struct ImBuf *in, unsigned char UNUSED(outI[4]), float outF[4], float u, float v)
+ const struct ImBuf *in, uchar UNUSED(outI[4]), float outF[4], float u, float v)
{
BLI_assert(outF);
BLI_assert(in->rect_float);
@@ -118,21 +117,21 @@ void bilinear_interpolation_color_fl(
}
void bilinear_interpolation_color_char(
- const struct ImBuf *in, unsigned char outI[4], float UNUSED(outF[4]), float u, float v)
+ const struct ImBuf *in, uchar outI[4], float UNUSED(outF[4]), float u, float v)
{
BLI_assert(outI);
BLI_assert(in->rect);
- BLI_bilinear_interpolation_char((unsigned char *)in->rect, outI, in->x, in->y, 4, u, v);
+ BLI_bilinear_interpolation_char((uchar *)in->rect, outI, in->x, in->y, 4, u, v);
}
void bilinear_interpolation_color(
- const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
+ const struct ImBuf *in, uchar outI[4], float outF[4], float u, float v)
{
if (outF) {
BLI_bilinear_interpolation_fl(in->rect_float, outF, in->x, in->y, 4, u, v);
}
else {
- BLI_bilinear_interpolation_char((unsigned char *)in->rect, outI, in->x, in->y, 4, u, v);
+ BLI_bilinear_interpolation_char((uchar *)in->rect, outI, in->x, in->y, 4, u, v);
}
}
@@ -140,10 +139,10 @@ void bilinear_interpolation_color(
/* BILINEAR INTERPOLATION */
void bilinear_interpolation_color_wrap(
- const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
+ const struct ImBuf *in, uchar outI[4], float outF[4], float u, float v)
{
float *row1, *row2, *row3, *row4, a, b;
- unsigned char *row1I, *row2I, *row3I, *row4I;
+ uchar *row1I, *row2I, *row3I, *row4I;
float a_b, ma_b, a_mb, ma_mb;
int y1, y2, x1, x2;
@@ -198,10 +197,10 @@ void bilinear_interpolation_color_wrap(
}
if (outI) {
/* sample including outside of edges of image */
- row1I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x1;
- row2I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x1;
- row3I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x2;
- row4I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x2;
+ row1I = (uchar *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x1;
+ row2I = (uchar *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x1;
+ row3I = (uchar *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x2;
+ row4I = (uchar *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x2;
/* Tested with white images and this should not wrap back to zero. */
outI[0] = roundf(ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]);
@@ -213,7 +212,7 @@ void bilinear_interpolation_color_wrap(
void bilinear_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
{
- unsigned char *outI = NULL;
+ uchar *outI = NULL;
float *outF = NULL;
if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
@@ -233,7 +232,7 @@ void bilinear_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int x
* \{ */
void nearest_interpolation_color_char(
- const struct ImBuf *in, unsigned char outI[4], float UNUSED(outF[4]), float u, float v)
+ const struct ImBuf *in, uchar outI[4], float UNUSED(outF[4]), float u, float v)
{
BLI_assert(outI);
BLI_assert(in->rect);
@@ -248,7 +247,7 @@ void nearest_interpolation_color_char(
}
const size_t offset = ((size_t)in->x * y1 + x1) * 4;
- const unsigned char *dataI = (unsigned char *)in->rect + offset;
+ const uchar *dataI = (uchar *)in->rect + offset;
outI[0] = dataI[0];
outI[1] = dataI[1];
outI[2] = dataI[2];
@@ -256,7 +255,7 @@ void nearest_interpolation_color_char(
}
void nearest_interpolation_color_fl(
- const struct ImBuf *in, unsigned char UNUSED(outI[4]), float outF[4], float u, float v)
+ const struct ImBuf *in, uchar UNUSED(outI[4]), float outF[4], float u, float v)
{
BLI_assert(outF);
BLI_assert(in->rect_float);
@@ -276,7 +275,7 @@ void nearest_interpolation_color_fl(
}
void nearest_interpolation_color(
- const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
+ const struct ImBuf *in, uchar outI[4], float outF[4], float u, float v)
{
if (outF) {
nearest_interpolation_color_fl(in, outI, outF, u, v);
@@ -287,10 +286,10 @@ void nearest_interpolation_color(
}
void nearest_interpolation_color_wrap(
- const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
+ const struct ImBuf *in, uchar outI[4], float outF[4], float u, float v)
{
const float *dataF;
- unsigned char *dataI;
+ uchar *dataI;
int y, x;
/* ImBuf in must have a valid rect or rect_float, assume this is already checked */
@@ -309,7 +308,7 @@ void nearest_interpolation_color_wrap(
y += in->y;
}
- dataI = (unsigned char *)in->rect + ((size_t)in->x) * y * 4 + 4 * x;
+ dataI = (uchar *)in->rect + ((size_t)in->x) * y * 4 + 4 * x;
if (outI) {
outI[0] = dataI[0];
outI[1] = dataI[1];
@@ -327,7 +326,7 @@ void nearest_interpolation_color_wrap(
void nearest_interpolation(const ImBuf *in, ImBuf *out, float u, float v, int xout, int yout)
{
- unsigned char *outI = NULL;
+ uchar *outI = NULL;
float *outF = NULL;
if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) {
@@ -446,10 +445,10 @@ void IMB_alpha_under_color_float(float *rect_float, int x, int y, float backcol[
}
}
-void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, const float backcol[3])
+void IMB_alpha_under_color_byte(uchar *rect, int x, int y, const float backcol[3])
{
size_t a = ((size_t)x) * y;
- unsigned char *cp = rect;
+ uchar *cp = rect;
while (a--) {
if (cp[3] == 255) {
@@ -487,7 +486,7 @@ void IMB_sampleImageAtLocation(ImBuf *ibuf, float x, float y, bool make_linear_r
nearest_interpolation_color(ibuf, NULL, color, x, y);
}
else {
- unsigned char byte_color[4];
+ uchar byte_color[4];
nearest_interpolation_color(ibuf, byte_color, NULL, x, y);
rgba_uchar_to_float(color, byte_color);
if (make_linear_rgb) {
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index a14c94d5d62..f57d4382672 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -39,7 +39,7 @@ typedef struct img_folder {
float *rates;
} img_fol_t;
-static bool check_jp2(const unsigned char *mem, const size_t size) /* J2K_CFMT */
+static bool check_jp2(const uchar *mem, const size_t size) /* J2K_CFMT */
{
if (size < sizeof(JP2_HEAD)) {
return false;
@@ -47,7 +47,7 @@ static bool check_jp2(const unsigned char *mem, const size_t size) /* J2K_CFMT *
return memcmp(JP2_HEAD, mem, sizeof(JP2_HEAD)) ? 0 : 1;
}
-static bool check_j2k(const unsigned char *mem, const size_t size) /* J2K_CFMT */
+static bool check_j2k(const uchar *mem, const size_t size) /* J2K_CFMT */
{
if (size < sizeof(J2K_HEAD)) {
return false;
@@ -55,8 +55,7 @@ static bool check_j2k(const unsigned char *mem, const size_t size) /* J2K_CFMT *
return memcmp(J2K_HEAD, mem, sizeof(J2K_HEAD)) ? 0 : 1;
}
-static OPJ_CODEC_FORMAT format_from_header(const unsigned char mem[JP2_FILEHEADER_SIZE],
- const size_t size)
+static OPJ_CODEC_FORMAT format_from_header(const uchar mem[JP2_FILEHEADER_SIZE], const size_t size)
{
if (check_jp2(mem, size)) {
return OPJ_CODEC_JP2;
@@ -68,7 +67,7 @@ static OPJ_CODEC_FORMAT format_from_header(const unsigned char mem[JP2_FILEHEADE
return OPJ_CODEC_UNKNOWN;
}
-bool imb_is_a_jp2(const unsigned char *buf, size_t size)
+bool imb_is_a_jp2(const uchar *buf, size_t size)
{
return (check_jp2(buf, size) || check_j2k(buf, size));
}
@@ -102,11 +101,11 @@ static void info_callback(const char *msg, void *client_data)
#endif
#define PIXEL_LOOPER_BEGIN(_rect) \
- for (y = h - 1; y != (unsigned int)(-1); y--) { \
+ for (y = h - 1; y != (uint)(-1); y--) { \
for (i = y * w, i_next = (y + 1) * w; i < i_next; i++, _rect += 4) {
#define PIXEL_LOOPER_BEGIN_CHANNELS(_rect, _channels) \
- for (y = h - 1; y != (unsigned int)(-1); y--) { \
+ for (y = h - 1; y != (uint)(-1); y--) { \
for (i = y * w, i_next = (y + 1) * w; i < i_next; i++, _rect += _channels) {
#define PIXEL_LOOPER_END \
@@ -119,8 +118,8 @@ static void info_callback(const char *msg, void *client_data)
* \{ */
struct BufInfo {
- const unsigned char *buf;
- const unsigned char *cur;
+ const uchar *buf;
+ const uchar *cur;
OPJ_OFF_T len;
};
@@ -300,10 +299,7 @@ static ImBuf *imb_load_jp2_stream(opj_stream_t *stream,
int flags,
char colorspace[IM_MAX_SPACE]);
-ImBuf *imb_load_jp2(const unsigned char *mem,
- size_t size,
- int flags,
- char colorspace[IM_MAX_SPACE])
+ImBuf *imb_load_jp2(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
const OPJ_CODEC_FORMAT format = (size > JP2_FILEHEADER_SIZE) ? format_from_header(mem, size) :
OPJ_CODEC_UNKNOWN;
@@ -322,7 +318,7 @@ ImBuf *imb_load_jp2(const unsigned char *mem,
ImBuf *imb_load_jp2_filepath(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
{
FILE *p_file = NULL;
- unsigned char mem[JP2_FILEHEADER_SIZE];
+ uchar mem[JP2_FILEHEADER_SIZE];
opj_stream_t *stream = opj_stream_create_from_file(
filepath, OPJ_J2K_STREAM_CHUNK_SIZE, true, &p_file);
if (stream) {
@@ -358,8 +354,8 @@ static ImBuf *imb_load_jp2_stream(opj_stream_t *stream,
long signed_offsets[4] = {0, 0, 0, 0};
int float_divs[4] = {1, 1, 1, 1};
- unsigned int i, i_next, w, h, planes;
- unsigned int y;
+ uint i, i_next, w, h, planes;
+ uint y;
int *r, *g, *b, *a; /* matching 'opj_image_comp.data' type */
opj_dparameters_t parameters; /* decompression parameters */
@@ -509,7 +505,7 @@ static ImBuf *imb_load_jp2_stream(opj_stream_t *stream,
}
}
else {
- unsigned char *rect_uchar = (unsigned char *)ibuf->rect;
+ uchar *rect_uchar = (uchar *)ibuf->rect;
if (image->numcomps < 3) {
r = image->comps[0].data;
@@ -599,11 +595,11 @@ static opj_image_t *rawtoimage(const char *filename,
(_val) <= 0.0f ? 0 : ((_val) >= 1.0f ? 65535 : (int)(65535.0f * (_val)))
#else
-BLI_INLINE int UPSAMPLE_8_TO_12(const unsigned char _val)
+BLI_INLINE int UPSAMPLE_8_TO_12(const uchar _val)
{
return (_val << 4) | (_val & ((1 << 4) - 1));
}
-BLI_INLINE int UPSAMPLE_8_TO_16(const unsigned char _val)
+BLI_INLINE int UPSAMPLE_8_TO_16(const uchar _val)
{
return (_val << 8) + _val;
}
@@ -811,14 +807,14 @@ static float channel_colormanage_noop(float value)
static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
{
- unsigned char *rect_uchar;
+ uchar *rect_uchar;
float *rect_float, from_straight[4];
- unsigned int subsampling_dx = parameters->subsampling_dx;
- unsigned int subsampling_dy = parameters->subsampling_dy;
+ uint subsampling_dx = parameters->subsampling_dx;
+ uint subsampling_dy = parameters->subsampling_dy;
- unsigned int i, i_next, numcomps, w, h, prec;
- unsigned int y;
+ uint i, i_next, numcomps, w, h, prec;
+ uint y;
int *r, *g, *b, *a; /* matching 'opj_image_comp.data' type */
OPJ_COLOR_SPACE color_space;
opj_image_cmptparm_t cmptparm[4]; /* maximum of 4 components */
@@ -910,7 +906,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
image->y1 = image->y0 + (h - 1) * subsampling_dy + 1 + image->y0;
/* set image data */
- rect_uchar = (unsigned char *)ibuf->rect;
+ rect_uchar = (uchar *)ibuf->rect;
rect_float = ibuf->rect_float;
/* set the destination channels */
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index 06f9202a1c6..e03765fea92 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -37,7 +37,7 @@ static void init_source(j_decompress_ptr cinfo);
static boolean fill_input_buffer(j_decompress_ptr cinfo);
static void skip_input_data(j_decompress_ptr cinfo, long num_bytes);
static void term_source(j_decompress_ptr cinfo);
-static void memory_source(j_decompress_ptr cinfo, const unsigned char *buffer, size_t size);
+static void memory_source(j_decompress_ptr cinfo, const uchar *buffer, size_t size);
static boolean handle_app1(j_decompress_ptr cinfo);
static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo,
int flags,
@@ -48,7 +48,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo,
static const uchar jpeg_default_quality = 75;
static uchar ibuf_quality;
-bool imb_is_a_jpeg(const unsigned char *mem, const size_t size)
+bool imb_is_a_jpeg(const uchar *mem, const size_t size)
{
const char magic[2] = {0xFF, 0xD8};
if (size < sizeof(magic)) {
@@ -89,7 +89,7 @@ static void jpeg_error(j_common_ptr cinfo)
#if 0
typedef struct {
- unsigned char *buffer;
+ uchar *buffer;
int filled;
} buffer_struct;
#endif
@@ -97,7 +97,7 @@ typedef struct {
typedef struct {
struct jpeg_source_mgr pub; /* public fields */
- const unsigned char *buffer;
+ const uchar *buffer;
int size;
JOCTET terminal[2];
} my_source_mgr;
@@ -144,7 +144,7 @@ static void term_source(j_decompress_ptr cinfo)
(void)cinfo; /* unused */
}
-static void memory_source(j_decompress_ptr cinfo, const unsigned char *buffer, size_t size)
+static void memory_source(j_decompress_ptr cinfo, const uchar *buffer, size_t size)
{
my_src_ptr src;
@@ -205,11 +205,11 @@ static void memory_source(j_decompress_ptr cinfo, const unsigned char *buffer, s
MAKESTMT(MAKE_BYTE_AVAIL(cinfo, action); bytes_in_buffer--; V = GETJOCTET(*next_input_byte++);)
/* As above, but read two bytes interpreted as an unsigned 16-bit integer.
- * V should be declared unsigned int or perhaps INT32.
+ * V should be declared `uint` or perhaps INT32.
*/
#define INPUT_2BYTES(cinfo, V, action) \
MAKESTMT(MAKE_BYTE_AVAIL(cinfo, action); bytes_in_buffer--; \
- V = ((unsigned int)GETJOCTET(*next_input_byte++)) << 8; \
+ V = ((uint)GETJOCTET(*next_input_byte++)) << 8; \
MAKE_BYTE_AVAIL(cinfo, action); \
bytes_in_buffer--; \
V += GETJOCTET(*next_input_byte++);)
@@ -445,10 +445,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo,
return ibuf;
}
-ImBuf *imb_load_jpeg(const unsigned char *buffer,
- size_t size,
- int flags,
- char colorspace[IM_MAX_SPACE])
+ImBuf *imb_load_jpeg(const uchar *buffer, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
struct jpeg_decompress_struct _cinfo, *cinfo = &_cinfo;
struct my_error_mgr jerr;
@@ -521,7 +518,7 @@ struct ImBuf *imb_thumbnail_jpeg(const char *filepath,
if ((fgetc(infile) == JPEG_MARKER_MSB) && (fgetc(infile) == JPEG_MARKER_SOI) &&
(fgetc(infile) == JPEG_MARKER_MSB) && (fgetc(infile) == JPEG_MARKER_APP1)) {
/* This is a JPEG in EXIF format (SOI + APP1), not JFIF (SOI + APP0). */
- unsigned int i = JPEG_APP1_MAX;
+ uint i = JPEG_APP1_MAX;
/* All EXIF data is within this 64K header segment. Skip ahead until next SOI for thumbnail. */
while (!((fgetc(infile) == JPEG_MARKER_MSB) && (fgetc(infile) == JPEG_MARKER_SOI)) &&
!feof(infile) && i--) {
diff --git a/source/blender/imbuf/intern/moviecache.cc b/source/blender/imbuf/intern/moviecache.cc
index 91a7dfdfae2..54d95578120 100644
--- a/source/blender/imbuf/intern/moviecache.cc
+++ b/source/blender/imbuf/intern/moviecache.cc
@@ -81,7 +81,7 @@ struct MovieCacheItem {
bool added_empty;
};
-static unsigned int moviecache_hashhash(const void *keyv)
+static uint moviecache_hashhash(const void *keyv)
{
const MovieCacheKey *key = (const MovieCacheKey *)keyv;
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index e887424d7b2..5c7b7d9fae4 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -32,7 +32,7 @@ OIIO_NAMESPACE_USING
using std::string;
using std::unique_ptr;
-using uchar = unsigned char;
+using uchar = uchar;
template<class T, class Q>
static void fill_all_channels(T *pixels, int width, int height, int components, Q alpha)
@@ -147,9 +147,9 @@ static ImBuf *imb_oiio_load_image_float(
extern "C" {
-bool imb_is_a_photoshop(const unsigned char *mem, size_t size)
+bool imb_is_a_photoshop(const uchar *mem, size_t size)
{
- const unsigned char magic[4] = {'8', 'B', 'P', 'S'};
+ const uchar magic[4] = {'8', 'B', 'P', 'S'};
if (size < sizeof(magic)) {
return false;
}
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index aaeb407abc4..b4ccdfab9a5 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -122,8 +122,7 @@ static void imb_exr_type_by_channels(ChannelList &channels,
class IMemStream : public Imf::IStream {
public:
- IMemStream(unsigned char *exrbuf, size_t exrsize)
- : IStream("<memory>"), _exrpos(0), _exrsize(exrsize)
+ IMemStream(uchar *exrbuf, size_t exrsize) : IStream("<memory>"), _exrpos(0), _exrsize(exrsize)
{
_exrbuf = exrbuf;
}
@@ -156,7 +155,7 @@ class IMemStream : public Imf::IStream {
private:
exr_file_offset_t _exrpos;
exr_file_offset_t _exrsize;
- unsigned char *_exrbuf;
+ uchar *_exrbuf;
};
/* Memory-Mapped Input Stream */
@@ -178,7 +177,7 @@ class IMMapStream : public Imf::IStream {
throw IEX_NAMESPACE::InputExc("BLI_mmap_open failed");
}
close(file);
- _exrbuf = (unsigned char *)BLI_mmap_get_pointer(_mmap_file);
+ _exrbuf = (uchar *)BLI_mmap_get_pointer(_mmap_file);
}
~IMMapStream() override
@@ -216,7 +215,7 @@ class IMMapStream : public Imf::IStream {
BLI_mmap_file *_mmap_file;
exr_file_offset_t _exrpos;
exr_file_offset_t _exrsize;
- unsigned char *_exrbuf;
+ uchar *_exrbuf;
};
/* File Input Stream */
@@ -395,7 +394,7 @@ static half float_to_half_safe(const float value)
extern "C" {
-bool imb_is_a_openexr(const unsigned char *mem, const size_t size)
+bool imb_is_a_openexr(const uchar *mem, const size_t size)
{
/* No define is exposed for this size. */
if (size < 4) {
@@ -547,10 +546,10 @@ static bool imb_save_openexr_half(ImBuf *ibuf, const char *name, const int flags
}
}
else {
- unsigned char *from;
+ uchar *from;
for (int i = ibuf->y - 1; i >= 0; i--) {
- from = (unsigned char *)ibuf->rect + 4 * i * width;
+ from = (uchar *)ibuf->rect + 4 * i * width;
for (int j = ibuf->x; j > 0; j--) {
to->r = srgb_to_linearrgb((float)from[0] / 255.0f);
@@ -1670,29 +1669,29 @@ static bool imb_exr_multilayer_parse_channels_from_file(ExrHandle *data)
if (ELEM(pass->totchan, 3, 4)) {
if (pass->chan[0]->chan_id == 'B' || pass->chan[1]->chan_id == 'B' ||
pass->chan[2]->chan_id == 'B') {
- lookup[(unsigned int)'R'] = 0;
- lookup[(unsigned int)'G'] = 1;
- lookup[(unsigned int)'B'] = 2;
- lookup[(unsigned int)'A'] = 3;
+ lookup[(uint)'R'] = 0;
+ lookup[(uint)'G'] = 1;
+ lookup[(uint)'B'] = 2;
+ lookup[(uint)'A'] = 3;
}
else if (pass->chan[0]->chan_id == 'Y' || pass->chan[1]->chan_id == 'Y' ||
pass->chan[2]->chan_id == 'Y') {
- lookup[(unsigned int)'X'] = 0;
- lookup[(unsigned int)'Y'] = 1;
- lookup[(unsigned int)'Z'] = 2;
- lookup[(unsigned int)'W'] = 3;
+ lookup[(uint)'X'] = 0;
+ lookup[(uint)'Y'] = 1;
+ lookup[(uint)'Z'] = 2;
+ lookup[(uint)'W'] = 3;
}
else {
- lookup[(unsigned int)'U'] = 0;
- lookup[(unsigned int)'V'] = 1;
- lookup[(unsigned int)'A'] = 2;
+ lookup[(uint)'U'] = 0;
+ lookup[(uint)'V'] = 1;
+ lookup[(uint)'A'] = 2;
}
for (int a = 0; a < pass->totchan; a++) {
echan = pass->chan[a];
- echan->rect = pass->rect + lookup[(unsigned int)echan->chan_id];
+ echan->rect = pass->rect + lookup[(uint)echan->chan_id];
echan->xstride = pass->totchan;
echan->ystride = data->width * pass->totchan;
- pass->chan_id[(unsigned int)lookup[(unsigned int)echan->chan_id]] = echan->chan_id;
+ pass->chan_id[(uint)lookup[(uint)echan->chan_id]] = echan->chan_id;
}
}
else { /* unknown */
@@ -1969,7 +1968,7 @@ bool IMB_exr_has_multilayer(void *handle)
return imb_exr_is_multi(*data->ifile);
}
-struct ImBuf *imb_load_openexr(const unsigned char *mem,
+struct ImBuf *imb_load_openexr(const uchar *mem,
size_t size,
int flags,
char colorspace[IM_MAX_SPACE])
@@ -1987,7 +1986,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem,
try {
bool is_multi;
- membuf = new IMemStream((unsigned char *)mem, size);
+ membuf = new IMemStream((uchar *)mem, size);
file = new MultiPartInputFile(*membuf);
Box2i dw = file->header(0).dataWindow();
@@ -2209,7 +2208,7 @@ struct ImBuf *imb_load_filepath_thumbnail_openexr(const char *filepath,
if (file->header().hasPreviewImage()) {
const Imf::PreviewImage &preview = file->header().previewImage();
ImBuf *ibuf = IMB_allocFromBuffer(
- (unsigned int *)preview.pixels(), nullptr, preview.width(), preview.height(), 4);
+ (uint *)preview.pixels(), nullptr, preview.width(), preview.height(), 4);
delete file;
delete stream;
IMB_flipy(ibuf);
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index e27d649ccbe..df6959ca90b 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -31,21 +31,21 @@
#include "IMB_colormanagement_intern.h"
typedef struct PNGReadStruct {
- const unsigned char *data;
- unsigned int size;
- unsigned int seek;
+ const uchar *data;
+ uint size;
+ uint seek;
} PNGReadStruct;
static void ReadData(png_structp png_ptr, png_bytep data, png_size_t length);
static void WriteData(png_structp png_ptr, png_bytep data, png_size_t length);
static void Flush(png_structp png_ptr);
-BLI_INLINE unsigned short UPSAMPLE_8_TO_16(const unsigned char _val)
+BLI_INLINE ushort UPSAMPLE_8_TO_16(const uchar _val)
{
return (_val << 8) + _val;
}
-bool imb_is_a_png(const unsigned char *mem, size_t size)
+bool imb_is_a_png(const uchar *mem, size_t size)
{
const int num_to_check = 8;
if (size < num_to_check) {
@@ -102,7 +102,7 @@ static float channel_colormanage_noop(float value)
}
/* wrap to avoid macro calling functions multiple times */
-BLI_INLINE unsigned short ftoshort(float val)
+BLI_INLINE ushort ftoshort(float val)
{
return unit_float_to_ushort_clamp(val);
}
@@ -112,9 +112,9 @@ bool imb_savepng(struct ImBuf *ibuf, const char *filepath, int flags)
png_structp png_ptr;
png_infop info_ptr;
- unsigned char *pixels = NULL;
- unsigned char *from, *to;
- unsigned short *pixels16 = NULL, *to16;
+ uchar *pixels = NULL;
+ uchar *from, *to;
+ ushort *pixels16 = NULL, *to16;
float *from_float, from_straight[4];
png_bytepp row_pointers = NULL;
int i, bytesperpixel, color_type = PNG_COLOR_TYPE_GRAY;
@@ -169,10 +169,10 @@ bool imb_savepng(struct ImBuf *ibuf, const char *filepath, int flags)
/* copy image data */
num_bytes = ((size_t)ibuf->x) * ibuf->y * bytesperpixel;
if (is_16bit) {
- pixels16 = MEM_mallocN(num_bytes * sizeof(unsigned short), "png 16bit pixels");
+ pixels16 = MEM_mallocN(num_bytes * sizeof(ushort), "png 16bit pixels");
}
else {
- pixels = MEM_mallocN(num_bytes * sizeof(unsigned char), "png 8bit pixels");
+ pixels = MEM_mallocN(num_bytes * sizeof(uchar), "png 8bit pixels");
}
if (pixels == NULL && pixels16 == NULL) {
printf(
@@ -210,7 +210,7 @@ bool imb_savepng(struct ImBuf *ibuf, const char *filepath, int flags)
return 0;
}
- from = (unsigned char *)ibuf->rect;
+ from = (uchar *)ibuf->rect;
to = pixels;
from_float = ibuf->rect_float;
to16 = pixels16;
@@ -453,8 +453,8 @@ bool imb_savepng(struct ImBuf *ibuf, const char *filepath, int flags)
if (ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) {
png_set_pHYs(png_ptr,
info_ptr,
- (unsigned int)(ibuf->ppm[0] + 0.5),
- (unsigned int)(ibuf->ppm[1] + 0.5),
+ (uint)(ibuf->ppm[0] + 0.5),
+ (uint)(ibuf->ppm[1] + 0.5),
PNG_RESOLUTION_METER);
}
@@ -468,15 +468,15 @@ bool imb_savepng(struct ImBuf *ibuf, const char *filepath, int flags)
/* set the individual row-pointers to point at the correct offsets */
if (is_16bit) {
for (i = 0; i < ibuf->y; i++) {
- row_pointers[ibuf->y - 1 - i] = (png_bytep)((unsigned short *)pixels16 +
+ row_pointers[ibuf->y - 1 - i] = (png_bytep)((ushort *)pixels16 +
(((size_t)i) * ibuf->x) * bytesperpixel);
}
}
else {
for (i = 0; i < ibuf->y; i++) {
- row_pointers[ibuf->y - 1 - i] = (png_bytep)((unsigned char *)pixels +
- (((size_t)i) * ibuf->x) * bytesperpixel *
- sizeof(unsigned char));
+ row_pointers[ibuf->y - 1 - i] = (png_bytep)((uchar *)pixels + (((size_t)i) * ibuf->x) *
+ bytesperpixel *
+ sizeof(uchar));
}
}
@@ -521,22 +521,22 @@ static void imb_png_error(png_structp UNUSED(png_ptr), png_const_charp message)
fprintf(stderr, "libpng error: %s\n", message);
}
-ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
+ImBuf *imb_loadpng(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
struct ImBuf *ibuf = NULL;
png_structp png_ptr;
png_infop info_ptr;
- unsigned char *pixels = NULL;
- unsigned short *pixels16 = NULL;
+ uchar *pixels = NULL;
+ ushort *pixels16 = NULL;
png_bytepp row_pointers = NULL;
png_uint_32 width, height;
int bit_depth, color_type;
PNGReadStruct ps;
- unsigned char *from, *to;
- unsigned short *from16;
+ uchar *from, *to;
+ ushort *from16;
float *to_float;
- unsigned int channels;
+ uint channels;
if (imb_is_a_png(mem, size) == 0) {
return NULL;
@@ -718,7 +718,7 @@ ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colors
else {
imb_addrectImBuf(ibuf);
- pixels = imb_alloc_pixels(ibuf->x, ibuf->y, channels, sizeof(unsigned char), "pixels");
+ pixels = imb_alloc_pixels(ibuf->x, ibuf->y, channels, sizeof(uchar), "pixels");
if (pixels == NULL || ibuf->rect == NULL) {
printf("Cannot allocate pixels array\n");
longjmp(png_jmpbuf(png_ptr), 1);
@@ -733,16 +733,16 @@ ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colors
/* set the individual row-pointers to point at the correct offsets */
for (int i = 0; i < ibuf->y; i++) {
- row_pointers[ibuf->y - 1 - i] = (png_bytep)((unsigned char *)pixels +
- (((size_t)i) * ibuf->x) * channels *
- sizeof(unsigned char));
+ row_pointers[ibuf->y - 1 - i] = (png_bytep)((uchar *)pixels + (((size_t)i) * ibuf->x) *
+ channels *
+ sizeof(uchar));
}
png_read_image(png_ptr, row_pointers);
/* copy image data */
- to = (unsigned char *)ibuf->rect;
+ to = (uchar *)ibuf->rect;
from = pixels;
switch (channels) {
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c
index aa07edf5c3a..00ef12a54f8 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -33,7 +33,7 @@
#define BLU 2
#define EXP 3
#define COLXS 128
-typedef unsigned char RGBE[4];
+typedef uchar RGBE[4];
typedef float fCOLOR[3];
/* copy source -> dest */
@@ -41,10 +41,7 @@ typedef float fCOLOR[3];
(c2[RED] = c1[RED], c2[GRN] = c1[GRN], c2[BLU] = c1[BLU], c2[EXP] = c1[EXP])
/* read routines */
-static const unsigned char *oldreadcolrs(RGBE *scan,
- const unsigned char *mem,
- int xmax,
- const unsigned char *mem_eof)
+static const uchar *oldreadcolrs(RGBE *scan, const uchar *mem, int xmax, const uchar *mem_eof)
{
size_t i, rshift = 0, len = xmax;
while (len > 0) {
@@ -72,10 +69,7 @@ static const unsigned char *oldreadcolrs(RGBE *scan,
return mem;
}
-static const unsigned char *freadcolrs(RGBE *scan,
- const unsigned char *mem,
- int xmax,
- const unsigned char *mem_eof)
+static const uchar *freadcolrs(RGBE *scan, const uchar *mem, int xmax, const uchar *mem_eof)
{
if (UNLIKELY(mem_eof - mem < 4)) {
return NULL;
@@ -118,7 +112,7 @@ static const unsigned char *freadcolrs(RGBE *scan,
}
val = *mem++;
while (code--) {
- scan[j++][i] = (unsigned char)val;
+ scan[j++][i] = (uchar)val;
}
}
else {
@@ -167,16 +161,16 @@ static void FLOAT2RGBE(const fCOLOR fcol, RGBE rgbe)
}
else {
d = (float)frexp(d, &e) * 256.0f / d;
- rgbe[RED] = (unsigned char)(fcol[RED] * d);
- rgbe[GRN] = (unsigned char)(fcol[GRN] * d);
- rgbe[BLU] = (unsigned char)(fcol[BLU] * d);
- rgbe[EXP] = (unsigned char)(e + COLXS);
+ rgbe[RED] = (uchar)(fcol[RED] * d);
+ rgbe[GRN] = (uchar)(fcol[GRN] * d);
+ rgbe[BLU] = (uchar)(fcol[BLU] * d);
+ rgbe[EXP] = (uchar)(e + COLXS);
}
}
/* ImBuf read */
-bool imb_is_a_hdr(const unsigned char *buf, const size_t size)
+bool imb_is_a_hdr(const uchar *buf, const size_t size)
{
/* NOTE: `#?RADIANCE` is used by other programs such as `ImageMagik`,
* Although there are some files in the wild that only use `#?` (from looking online).
@@ -187,17 +181,14 @@ bool imb_is_a_hdr(const unsigned char *buf, const size_t size)
*
* See: http://paulbourke.net/dataformats/pic/
*/
- const unsigned char magic[2] = {'#', '?'};
+ const uchar magic[2] = {'#', '?'};
if (size < sizeof(magic)) {
return false;
}
return memcmp(buf, magic, sizeof(magic)) == 0;
}
-struct ImBuf *imb_loadhdr(const unsigned char *mem,
- size_t size,
- int flags,
- char colorspace[IM_MAX_SPACE])
+struct ImBuf *imb_loadhdr(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
struct ImBuf *ibuf;
RGBE *sline;
@@ -205,7 +196,7 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem,
float *rect_float;
int found = 0;
int width = 0, height = 0;
- const unsigned char *ptr, *mem_eof = mem + size;
+ const uchar *ptr, *mem_eof = mem + size;
char oriY[3], oriX[3];
if (!imb_is_a_hdr(mem, size)) {
@@ -246,7 +237,7 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem,
* since the format uses RLE compression. Can cause excessive memory allocation to occur. */
/* find end of this line, data right behind it */
- ptr = (const unsigned char *)strchr((const char *)&mem[x], '\n');
+ ptr = (const uchar *)strchr((const char *)&mem[x], '\n');
if (ptr == NULL || ptr >= mem_eof) {
return NULL;
}
@@ -306,7 +297,7 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem,
/* ImBuf write */
static int fwritecolrs(
- FILE *file, int width, int channels, const unsigned char *ibufscan, const float *fpscan)
+ FILE *file, int width, int channels, const uchar *ibufscan, const float *fpscan)
{
int beg, c2, count = 0;
fCOLOR fcol;
@@ -343,8 +334,8 @@ static int fwritecolrs(
/* put magic header */
putc(2, file);
putc(2, file);
- putc((unsigned char)(width >> 8), file);
- putc((unsigned char)(width & 255), file);
+ putc((uchar)(width >> 8), file);
+ putc((uchar)(width & 255), file);
/* put components separately */
for (size_t i = 0; i < 4; i++) {
for (size_t j = 0; j < width; j += count) { /* find next run */
@@ -362,8 +353,8 @@ static int fwritecolrs(
c2 = j + 1;
while (rgbe_scan[c2++][i] == rgbe_scan[j][i]) {
if (c2 == beg) { /* short run */
- putc((unsigned char)(128 + beg - j), file);
- putc((unsigned char)(rgbe_scan[j][i]), file);
+ putc((uchar)(128 + beg - j), file);
+ putc((uchar)(rgbe_scan[j][i]), file);
j = beg;
break;
}
@@ -373,13 +364,13 @@ static int fwritecolrs(
if ((c2 = beg - j) > 128) {
c2 = 128;
}
- putc((unsigned char)(c2), file);
+ putc((uchar)(c2), file);
while (c2--) {
putc(rgbe_scan[j++][i], file);
}
}
if (count >= MINRUN) { /* write out run */
- putc((unsigned char)(128 + count), file);
+ putc((uchar)(128 + count), file);
putc(rgbe_scan[beg][i], file);
}
else {
@@ -411,7 +402,7 @@ bool imb_savehdr(struct ImBuf *ibuf, const char *filepath, int flags)
FILE *file = BLI_fopen(filepath, "wb");
float *fp = NULL;
size_t width = ibuf->x, height = ibuf->y;
- unsigned char *cp = NULL;
+ uchar *cp = NULL;
(void)flags; /* unused */
@@ -422,7 +413,7 @@ bool imb_savehdr(struct ImBuf *ibuf, const char *filepath, int flags)
writeHeader(file, width, height);
if (ibuf->rect) {
- cp = (unsigned char *)ibuf->rect + ibuf->channels * (height - 1) * width;
+ cp = (uchar *)ibuf->rect + ibuf->channels * (height - 1) * width;
}
if (ibuf->rect_float) {
fp = ibuf->rect_float + ibuf->channels * (height - 1) * width;
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index b33e9dc4e0e..a9b79ad6d19 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -81,11 +81,8 @@ static void imb_handle_alpha(ImBuf *ibuf,
colormanage_imbuf_make_linear(ibuf, effective_colorspace);
}
-ImBuf *IMB_ibImageFromMemory(const unsigned char *mem,
- size_t size,
- int flags,
- char colorspace[IM_MAX_SPACE],
- const char *descr)
+ImBuf *IMB_ibImageFromMemory(
+ const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE], const char *descr)
{
ImBuf *ibuf;
const ImFileType *type;
@@ -157,7 +154,7 @@ ImBuf *IMB_loadifffile(
int file, const char *filepath, int flags, char colorspace[IM_MAX_SPACE], const char *descr)
{
ImBuf *ibuf;
- unsigned char *mem;
+ uchar *mem;
size_t size;
if (file == -1) {
@@ -319,9 +316,9 @@ ImBuf *IMB_testiffname(const char *filepath, int flags)
return ibuf;
}
-static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int *rect)
+static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, uint *rect)
{
- unsigned char *mem;
+ uchar *mem;
size_t size;
if (file == -1) {
@@ -352,7 +349,7 @@ static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int
imb_mmap_unlock();
}
-void imb_loadtile(ImBuf *ibuf, int tx, int ty, unsigned int *rect)
+void imb_loadtile(ImBuf *ibuf, int tx, int ty, uint *rect)
{
int file;
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index 2f864534d61..4159aa851c4 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -21,9 +21,9 @@
#include "MEM_guardedalloc.h"
-void IMB_blend_color_byte(unsigned char dst[4],
- const unsigned char src1[4],
- const unsigned char src2[4],
+void IMB_blend_color_byte(uchar dst[4],
+ const uchar src1[4],
+ const uchar src2[4],
IMB_BlendMode mode)
{
switch (mode) {
@@ -487,17 +487,15 @@ void IMB_rectcpy(ImBuf *dbuf,
false);
}
-typedef void (*IMB_blend_func)(unsigned char *dst,
- const unsigned char *src1,
- const unsigned char *src2);
+typedef void (*IMB_blend_func)(uchar *dst, const uchar *src1, const uchar *src2);
typedef void (*IMB_blend_func_float)(float *dst, const float *src1, const float *src2);
void IMB_rectblend(ImBuf *dbuf,
const ImBuf *obuf,
const ImBuf *sbuf,
- unsigned short *dmask,
- const unsigned short *curvemask,
- const unsigned short *texmask,
+ ushort *dmask,
+ const ushort *curvemask,
+ const ushort *texmask,
float mask_max,
int destx,
int desty,
@@ -510,11 +508,11 @@ void IMB_rectblend(ImBuf *dbuf,
IMB_BlendMode mode,
bool accumulate)
{
- unsigned int *drect = NULL, *orect = NULL, *srect = NULL, *dr, * or, *sr;
+ uint *drect = NULL, *orect = NULL, *srect = NULL, *dr, * or, *sr;
float *drectf = NULL, *orectf = NULL, *srectf = NULL, *drf, *orf, *srf;
- const unsigned short *cmaskrect = curvemask, *cmr;
- unsigned short *dmaskrect = dmask, *dmr;
- const unsigned short *texmaskrect = texmask, *tmr;
+ const ushort *cmaskrect = curvemask, *cmr;
+ ushort *dmaskrect = dmask, *dmr;
+ const ushort *texmaskrect = texmask, *tmr;
int srcskip, destskip, origskip, x;
IMB_blend_func func = NULL;
IMB_blend_func_float func_float = NULL;
@@ -766,7 +764,7 @@ void IMB_rectblend(ImBuf *dbuf,
if (dmaskrect) {
dmr = dmaskrect;
for (x = width; x > 0; x--, dr++, or ++, sr++, dmr++, cmr++) {
- unsigned char *src = (unsigned char *)sr;
+ uchar *src = (uchar *)sr;
float mask_lim = mask_max * (*cmr);
if (texmaskrect) {
@@ -786,7 +784,7 @@ void IMB_rectblend(ImBuf *dbuf,
mask = min_ff(mask, 65535.0);
if (mask > *dmr) {
- unsigned char mask_src[4];
+ uchar mask_src[4];
*dmr = mask;
@@ -797,11 +795,11 @@ void IMB_rectblend(ImBuf *dbuf,
if (mode == IMB_BLEND_INTERPOLATE) {
mask_src[3] = src[3];
blend_color_interpolate_byte(
- (unsigned char *)dr, (unsigned char *) or, mask_src, mask / 65535.0f);
+ (uchar *)dr, (uchar *) or, mask_src, mask / 65535.0f);
}
else {
mask_src[3] = divide_round_i(src[3] * mask, 65535);
- func((unsigned char *)dr, (unsigned char *) or, mask_src);
+ func((uchar *)dr, (uchar *) or, mask_src);
}
}
}
@@ -811,7 +809,7 @@ void IMB_rectblend(ImBuf *dbuf,
/* no destination mask buffer, do regular blend with masktexture if present */
else {
for (x = width; x > 0; x--, dr++, or ++, sr++, cmr++) {
- unsigned char *src = (unsigned char *)sr;
+ uchar *src = (uchar *)sr;
float mask = (float)mask_max * ((float)(*cmr));
if (texmaskrect) {
@@ -821,7 +819,7 @@ void IMB_rectblend(ImBuf *dbuf,
mask = min_ff(mask, 65535.0);
if (src[3] && (mask > 0.0f)) {
- unsigned char mask_src[4];
+ uchar mask_src[4];
mask_src[0] = src[0];
mask_src[1] = src[1];
@@ -830,11 +828,11 @@ void IMB_rectblend(ImBuf *dbuf,
if (mode == IMB_BLEND_INTERPOLATE) {
mask_src[3] = src[3];
blend_color_interpolate_byte(
- (unsigned char *)dr, (unsigned char *) or, mask_src, mask / 65535.0f);
+ (uchar *)dr, (uchar *) or, mask_src, mask / 65535.0f);
}
else {
mask_src[3] = divide_round_i(src[3] * mask, 65535);
- func((unsigned char *)dr, (unsigned char *) or, mask_src);
+ func((uchar *)dr, (uchar *) or, mask_src);
}
}
}
@@ -848,8 +846,8 @@ void IMB_rectblend(ImBuf *dbuf,
else {
/* regular blending */
for (x = width; x > 0; x--, dr++, or ++, sr++) {
- if (((unsigned char *)sr)[3]) {
- func((unsigned char *)dr, (unsigned char *) or, (unsigned char *)sr);
+ if (((uchar *)sr)[3]) {
+ func((uchar *)dr, (uchar *) or, (uchar *)sr);
}
}
}
@@ -956,8 +954,8 @@ void IMB_rectblend(ImBuf *dbuf,
typedef struct RectBlendThreadData {
ImBuf *dbuf;
const ImBuf *obuf, *sbuf;
- unsigned short *dmask;
- const unsigned short *curvemask, *texmask;
+ ushort *dmask;
+ const ushort *curvemask, *texmask;
float mask_max;
int destx, desty, origx, origy;
int srcx, srcy, width;
@@ -991,9 +989,9 @@ static void rectblend_thread_do(void *data_v, int scanline)
void IMB_rectblend_threaded(ImBuf *dbuf,
const ImBuf *obuf,
const ImBuf *sbuf,
- unsigned short *dmask,
- const unsigned short *curvemask,
- const unsigned short *texmask,
+ ushort *dmask,
+ const ushort *curvemask,
+ const ushort *texmask,
float mask_max,
int destx,
int desty,
@@ -1052,7 +1050,7 @@ void IMB_rectfill(ImBuf *drect, const float col[4])
int num;
if (drect->rect) {
- unsigned int *rrect = drect->rect;
+ uint *rrect = drect->rect;
char ccol[4];
ccol[0] = (int)(col[0] * 255);
@@ -1062,7 +1060,7 @@ void IMB_rectfill(ImBuf *drect, const float col[4])
num = drect->x * drect->y;
for (; num > 0; num--) {
- *rrect++ = *((unsigned int *)ccol);
+ *rrect++ = *((uint *)ccol);
}
}
@@ -1106,15 +1104,15 @@ void IMB_rectfill_area_replace(
return;
}
- unsigned char col_char[4] = {col[0] * 255, col[1] * 255, col[2] * 255, col[3] * 255};
+ uchar col_char[4] = {col[0] * 255, col[1] * 255, col[2] * 255, col[3] * 255};
for (int y = y1; y < y2; y++) {
for (int x = x1; x < x2; x++) {
size_t offset = ((size_t)ibuf->x) * y * 4 + 4 * x;
if (ibuf->rect) {
- unsigned char *rrect = (unsigned char *)ibuf->rect + offset;
- memcpy(rrect, &col_char, sizeof(unsigned char) * 4);
+ uchar *rrect = (uchar *)ibuf->rect + offset;
+ memcpy(rrect, &col_char, sizeof(uchar) * 4);
}
if (ibuf->rect_float) {
@@ -1125,7 +1123,7 @@ void IMB_rectfill_area_replace(
}
}
-void buf_rectfill_area(unsigned char *rect,
+void buf_rectfill_area(uchar *rect,
float *rectf,
int width,
int height,
@@ -1165,8 +1163,8 @@ void buf_rectfill_area(unsigned char *rect,
aich = ai / 255.0f;
if (rect) {
- unsigned char *pixel;
- unsigned char chr = 0, chg = 0, chb = 0;
+ uchar *pixel;
+ uchar chr = 0, chg = 0, chb = 0;
float fr = 0, fg = 0, fb = 0;
const int alphaint = unit_float_to_uchar_clamp(a);
@@ -1247,16 +1245,8 @@ void IMB_rectfill_area(ImBuf *ibuf,
if (!ibuf) {
return;
}
- buf_rectfill_area((unsigned char *)ibuf->rect,
- ibuf->rect_float,
- ibuf->x,
- ibuf->y,
- col,
- display,
- x1,
- y1,
- x2,
- y2);
+ buf_rectfill_area(
+ (uchar *)ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y, col, display, x1, y1, x2, y2);
}
void IMB_rectfill_alpha(ImBuf *ibuf, const float value)
@@ -1271,8 +1261,8 @@ void IMB_rectfill_alpha(ImBuf *ibuf, const float value)
}
if (ibuf->rect) {
- const unsigned char cvalue = value * 255;
- unsigned char *cbuf = ((unsigned char *)ibuf->rect) + 3;
+ const uchar cvalue = value * 255;
+ uchar *cbuf = ((uchar *)ibuf->rect) + 3;
for (i = ibuf->x * ibuf->y; i > 0; i--, cbuf += 4) {
*cbuf = cvalue;
}
diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c
index ac07ce85526..7081bf2ad26 100644
--- a/source/blender/imbuf/intern/rotate.c
+++ b/source/blender/imbuf/intern/rotate.c
@@ -22,7 +22,7 @@ void IMB_flipy(struct ImBuf *ibuf)
}
if (ibuf->rect) {
- unsigned int *top, *bottom, *line;
+ uint *top, *bottom, *line;
x_size = ibuf->x;
y_size = ibuf->y;
@@ -88,7 +88,7 @@ void IMB_flipx(struct ImBuf *ibuf)
for (yi = y - 1; yi >= 0; yi--) {
const size_t x_offset = (size_t)x * yi;
for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) {
- SWAP(unsigned int, ibuf->rect[x_offset + xr], ibuf->rect[x_offset + xl]);
+ SWAP(uint, ibuf->rect[x_offset + xr], ibuf->rect[x_offset + xl]);
}
}
}
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index f4abc668402..05bee77a6cb 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -324,10 +324,9 @@ struct ImBuf *IMB_double_y(struct ImBuf *ibuf1)
/* pretty much specific functions which converts uchar <-> ushort but assumes
* ushort range of 255*255 which is more convenient here
*/
-MINLINE void straight_uchar_to_premul_ushort(unsigned short result[4],
- const unsigned char color[4])
+MINLINE void straight_uchar_to_premul_ushort(ushort result[4], const uchar color[4])
{
- unsigned short alpha = color[3];
+ ushort alpha = color[3];
result[0] = color[0] * alpha;
result[1] = color[1] * alpha;
@@ -335,7 +334,7 @@ MINLINE void straight_uchar_to_premul_ushort(unsigned short result[4],
result[3] = alpha * 256;
}
-MINLINE void premul_ushort_to_straight_uchar(unsigned char *result, const unsigned short color[4])
+MINLINE void premul_ushort_to_straight_uchar(uchar *result, const ushort color[4])
{
if (color[3] <= 255) {
result[0] = unit_ushort_to_uchar(color[0]);
@@ -344,7 +343,7 @@ MINLINE void premul_ushort_to_straight_uchar(unsigned char *result, const unsign
result[3] = unit_ushort_to_uchar(color[3]);
}
else {
- unsigned short alpha = color[3] / 256;
+ ushort alpha = color[3] / 256;
result[0] = unit_ushort_to_uchar((ushort)(color[0] / alpha * 256));
result[1] = unit_ushort_to_uchar((ushort)(color[1] / alpha * 256));
@@ -373,25 +372,25 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
}
if (do_rect) {
- unsigned char *cp1, *cp2, *dest;
+ uchar *cp1, *cp2, *dest;
- cp1 = (unsigned char *)ibuf1->rect;
- dest = (unsigned char *)ibuf2->rect;
+ cp1 = (uchar *)ibuf1->rect;
+ dest = (uchar *)ibuf2->rect;
for (y = ibuf2->y; y > 0; y--) {
cp2 = cp1 + (ibuf1->x << 2);
for (x = ibuf2->x; x > 0; x--) {
- unsigned short p1i[8], p2i[8], desti[4];
+ ushort p1i[8], p2i[8], desti[4];
straight_uchar_to_premul_ushort(p1i, cp1);
straight_uchar_to_premul_ushort(p2i, cp2);
straight_uchar_to_premul_ushort(p1i + 4, cp1 + 4);
straight_uchar_to_premul_ushort(p2i + 4, cp2 + 4);
- desti[0] = ((unsigned int)p1i[0] + p2i[0] + p1i[4] + p2i[4]) >> 2;
- desti[1] = ((unsigned int)p1i[1] + p2i[1] + p1i[5] + p2i[5]) >> 2;
- desti[2] = ((unsigned int)p1i[2] + p2i[2] + p1i[6] + p2i[6]) >> 2;
- desti[3] = ((unsigned int)p1i[3] + p2i[3] + p1i[7] + p2i[7]) >> 2;
+ desti[0] = ((uint)p1i[0] + p2i[0] + p1i[4] + p2i[4]) >> 2;
+ desti[1] = ((uint)p1i[1] + p2i[1] + p1i[5] + p2i[5]) >> 2;
+ desti[2] = ((uint)p1i[2] + p2i[2] + p1i[6] + p2i[6]) >> 2;
+ desti[3] = ((uint)p1i[3] + p2i[3] + p1i[7] + p2i[7]) >> 2;
premul_ushort_to_straight_uchar(dest, desti);
@@ -460,12 +459,8 @@ ImBuf *IMB_onehalf(struct ImBuf *ibuf1)
/* q_scale_linear_interpolation helper functions */
-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 enlarge_picture_byte(
+ uchar *src, uchar *dst, int src_width, int src_height, int dst_width, int dst_height)
{
double ratiox = (double)(dst_width - 1.0) / (double)(src_width - 1.001);
double ratioy = (double)(dst_height - 1.0) / (double)(src_height - 1.001);
@@ -477,8 +472,8 @@ static void enlarge_picture_byte(unsigned char *src,
y_src = 0;
for (y_dst = 0; y_dst < dst_height; y_dst++) {
- unsigned char *line1 = src + (y_src >> 16) * 4 * src_width;
- unsigned char *line2 = line1 + 4 * src_width;
+ uchar *line1 = src + (y_src >> 16) * 4 * src_width;
+ uchar *line2 = line1 + 4 * src_width;
uintptr_t weight1y = 65536 - (y_src & 0xffff);
uintptr_t weight2y = 65536 - weight1y;
@@ -491,7 +486,7 @@ static void enlarge_picture_byte(unsigned char *src,
uintptr_t weight1x = 65536 - (x_src & 0xffff);
uintptr_t weight2x = 65536 - weight1x;
- unsigned long x = (x_src >> 16) * 4;
+ ulong x = (x_src >> 16) * 4;
*dst++ = ((((line1[x] * weight1y) >> 16) * weight1x) >> 16) +
((((line2[x] * weight2y) >> 16) * weight1x) >> 16) +
@@ -528,19 +523,15 @@ struct scale_outpix_byte {
uintptr_t weight;
};
-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 shrink_picture_byte(
+ uchar *src, uchar *dst, int src_width, int src_height, int dst_width, int dst_height)
{
double ratiox = (double)(dst_width) / (double)(src_width);
double ratioy = (double)(dst_height) / (double)(src_height);
uintptr_t x_src, dx_dst, x_dst;
uintptr_t y_src, dy_dst, y_dst;
intptr_t y_counter;
- unsigned char *dst_begin = dst;
+ uchar *dst_begin = dst;
struct scale_outpix_byte *dst_line1 = NULL;
struct scale_outpix_byte *dst_line2 = NULL;
@@ -556,7 +547,7 @@ static void shrink_picture_byte(unsigned char *src,
y_dst = 0;
y_counter = 65536;
for (y_src = 0; y_src < src_height; y_src++) {
- unsigned char *line = src + y_src * 4 * src_width;
+ uchar *line = src + y_src * 4 * src_width;
uintptr_t weight1y = 65535 - (y_dst & 0xffff);
uintptr_t weight2y = 65535 - weight1y;
x_dst = 0;
@@ -643,12 +634,8 @@ static void shrink_picture_byte(unsigned char *src,
MEM_freeN(dst_line2);
}
-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 q_scale_byte(
+ uchar *in, uchar *out, int in_width, int in_height, int dst_width, int dst_height)
{
if (dst_width > in_width && dst_height > in_height) {
enlarge_picture_byte(in, out, in_width, in_height, dst_width, dst_height);
@@ -868,12 +855,12 @@ static bool q_scale_linear_interpolation(struct ImBuf *ibuf, int newx, int newy)
}
if (ibuf->rect) {
- unsigned char *newrect = MEM_mallocN(sizeof(int) * newx * newy, "q_scale rect");
- q_scale_byte((unsigned char *)ibuf->rect, newrect, ibuf->x, ibuf->y, newx, newy);
+ uchar *newrect = MEM_mallocN(sizeof(int) * newx * newy, "q_scale rect");
+ q_scale_byte((uchar *)ibuf->rect, newrect, ibuf->x, ibuf->y, newx, newy);
imb_freerectImBuf(ibuf);
ibuf->mall |= IB_rect;
- ibuf->rect = (unsigned int *)newrect;
+ ibuf->rect = (uint *)newrect;
}
if (ibuf->rect_float) {
float *newrect = MEM_mallocN(sizeof(float[4]) * newx * newy, "q_scale rectfloat");
@@ -1014,7 +1001,7 @@ static ImBuf *scaledownx(struct ImBuf *ibuf, int newx)
BLI_assert((uchar *)rect - ((uchar *)ibuf->rect) == rect_size); /* see bug T26502. */
imb_freerectImBuf(ibuf);
ibuf->mall |= IB_rect;
- ibuf->rect = (unsigned int *)_newrect;
+ ibuf->rect = (uint *)_newrect;
}
if (do_float) {
// printf("%ld %ld\n", rectf - ibuf->rect_float, rect_size);
@@ -1156,7 +1143,7 @@ static ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
BLI_assert((uchar *)rect - ((uchar *)ibuf->rect) == rect_size); /* see bug T26502. */
imb_freerectImBuf(ibuf);
ibuf->mall |= IB_rect;
- ibuf->rect = (unsigned int *)_newrect;
+ ibuf->rect = (uint *)_newrect;
}
if (do_float) {
// printf("%ld %ld\n", rectf - ibuf->rect_float, rect_size);
@@ -1361,7 +1348,7 @@ static ImBuf *scaleupx(struct ImBuf *ibuf, int newx)
if (do_rect) {
imb_freerectImBuf(ibuf);
ibuf->mall |= IB_rect;
- ibuf->rect = (unsigned int *)_newrect;
+ ibuf->rect = (uint *)_newrect;
}
if (do_float) {
imb_freerectfloatImBuf(ibuf);
@@ -1564,7 +1551,7 @@ static ImBuf *scaleupy(struct ImBuf *ibuf, int newy)
if (do_rect) {
imb_freerectImBuf(ibuf);
ibuf->mall |= IB_rect;
- ibuf->rect = (unsigned int *)_newrect;
+ ibuf->rect = (uint *)_newrect;
}
if (do_float) {
imb_freerectfloatImBuf(ibuf);
@@ -1641,7 +1628,7 @@ 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_scaleImBuf(struct ImBuf *ibuf, uint newx, uint newy)
{
BLI_assert_msg(newx > 0 && newy > 0, "Images must be at least 1 on both dimensions!");
@@ -1686,11 +1673,11 @@ struct imbufRGBA {
float r, g, b, a;
};
-bool IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy)
+bool IMB_scalefastImBuf(struct ImBuf *ibuf, uint newx, uint newy)
{
BLI_assert_msg(newx > 0 && newy > 0, "Images must be at least 1 on both dimensions!");
- unsigned int *rect, *_newrect, *newrect;
+ uint *rect, *_newrect, *newrect;
struct imbufRGBA *rectf, *_newrectf, *newrectf;
int x, y;
bool do_float = false, do_rect = false;
@@ -1789,23 +1776,23 @@ bool IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy
typedef struct ScaleTreadInitData {
ImBuf *ibuf;
- unsigned int newx;
- unsigned int newy;
+ uint newx;
+ uint newy;
- unsigned char *byte_buffer;
+ uchar *byte_buffer;
float *float_buffer;
} ScaleTreadInitData;
typedef struct ScaleThreadData {
ImBuf *ibuf;
- unsigned int newx;
- unsigned int newy;
+ uint newx;
+ uint newy;
int start_line;
int tot_line;
- unsigned char *byte_buffer;
+ uchar *byte_buffer;
float *float_buffer;
} ScaleThreadData;
@@ -1844,9 +1831,8 @@ static void *do_scale_thread(void *data_v)
int offset = y * data->newx + x;
if (data->byte_buffer) {
- unsigned char *pixel = data->byte_buffer + 4 * offset;
- BLI_bilinear_interpolation_char(
- (unsigned char *)ibuf->rect, pixel, ibuf->x, ibuf->y, 4, u, v);
+ uchar *pixel = data->byte_buffer + 4 * offset;
+ BLI_bilinear_interpolation_char((uchar *)ibuf->rect, pixel, ibuf->x, ibuf->y, 4, u, v);
}
if (data->float_buffer) {
@@ -1860,7 +1846,7 @@ static void *do_scale_thread(void *data_v)
return NULL;
}
-void IMB_scaleImBuf_threaded(ImBuf *ibuf, unsigned int newx, unsigned int newy)
+void IMB_scaleImBuf_threaded(ImBuf *ibuf, uint newx, uint newy)
{
BLI_assert_msg(newx > 0 && newy > 0, "Images must be at least 1 on both dimensions!");
@@ -1893,7 +1879,7 @@ void IMB_scaleImBuf_threaded(ImBuf *ibuf, unsigned int newx, unsigned int newy)
if (ibuf->rect) {
imb_freerectImBuf(ibuf);
ibuf->mall |= IB_rect;
- ibuf->rect = (unsigned int *)init_data.byte_buffer;
+ ibuf->rect = (uint *)init_data.byte_buffer;
}
if (ibuf->rect_float) {
diff --git a/source/blender/imbuf/intern/stereoimbuf.c b/source/blender/imbuf/intern/stereoimbuf.c
index ba1840a5fcd..eb2701b5b9c 100644
--- a/source/blender/imbuf/intern/stereoimbuf.c
+++ b/source/blender/imbuf/intern/stereoimbuf.c
@@ -650,8 +650,8 @@ static void imb_stereo3d_squeeze_rect(
IMB_stereo3d_write_dimensions(s3d->display_mode, false, x, y, &width, &height);
ibuf = IMB_allocImBuf(width, height, channels, IB_rect);
- IMB_buffer_byte_from_byte((unsigned char *)ibuf->rect,
- (unsigned char *)rect,
+ IMB_buffer_byte_from_byte((uchar *)ibuf->rect,
+ (uchar *)rect,
IB_PROFILE_SRGB,
IB_PROFILE_SRGB,
false,
@@ -661,7 +661,7 @@ static void imb_stereo3d_squeeze_rect(
width);
IMB_scaleImBuf_threaded(ibuf, x, y);
- memcpy(rect, ibuf->rect, x * y * sizeof(unsigned int));
+ memcpy(rect, ibuf->rect, x * y * sizeof(uint));
IMB_freeImBuf(ibuf);
}
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 7cf90cd12e2..ed6e6e9866d 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -30,18 +30,18 @@
/***/
typedef struct TARGA {
- unsigned char numid;
- unsigned char maptyp;
- unsigned char imgtyp;
+ uchar numid;
+ uchar maptyp;
+ uchar imgtyp;
short maporig;
short mapsize;
- unsigned char mapbits;
+ uchar mapbits;
short xorig;
short yorig;
short xsize;
short ysize;
- unsigned char pixsize;
- unsigned char imgdes;
+ uchar pixsize;
+ uchar imgdes;
} TARGA;
/**
@@ -54,7 +54,7 @@ typedef struct TARGA {
/***/
-static int tga_out1(unsigned int data, FILE *file)
+static int tga_out1(uint data, FILE *file)
{
uchar *p;
@@ -65,7 +65,7 @@ static int tga_out1(unsigned int data, FILE *file)
return ~EOF;
}
-static int tga_out2(unsigned int data, FILE *file)
+static int tga_out2(uint data, FILE *file)
{
uchar *p;
@@ -79,7 +79,7 @@ static int tga_out2(unsigned int data, FILE *file)
return ~EOF;
}
-static int tga_out3(unsigned int data, FILE *file)
+static int tga_out3(uint data, FILE *file)
{
uchar *p;
@@ -96,7 +96,7 @@ static int tga_out3(unsigned int data, FILE *file)
return ~EOF;
}
-static int tga_out4(unsigned int data, FILE *file)
+static int tga_out4(uint data, FILE *file)
{
uchar *p;
@@ -117,11 +117,11 @@ static int tga_out4(unsigned int data, FILE *file)
return ~EOF;
}
-static bool makebody_tga(ImBuf *ibuf, FILE *file, int (*out)(unsigned int, FILE *))
+static bool makebody_tga(ImBuf *ibuf, FILE *file, int (*out)(uint, FILE *))
{
int last, this;
int copy, bytes;
- unsigned int *rect, *rectstart, *temp;
+ uint *rect, *rectstart, *temp;
int y;
for (y = 0; y < ibuf->y; y++) {
@@ -345,7 +345,7 @@ bool imb_savetarga(struct ImBuf *ibuf, const char *filepath, int UNUSED(flags))
return ok;
}
-static bool checktarga(TARGA *tga, const unsigned char *mem, const size_t size)
+static bool checktarga(TARGA *tga, const uchar *mem, const size_t size)
{
if (size < TARGA_HEADER_SIZE) {
return false;
@@ -397,14 +397,14 @@ static bool checktarga(TARGA *tga, const unsigned char *mem, const size_t size)
return true;
}
-bool imb_is_a_targa(const unsigned char *buf, size_t size)
+bool imb_is_a_targa(const uchar *buf, size_t size)
{
TARGA tga;
return checktarga(&tga, buf, size);
}
-static void complete_partial_load(struct ImBuf *ibuf, unsigned int *rect)
+static void complete_partial_load(struct ImBuf *ibuf, uint *rect)
{
int size = (ibuf->x * ibuf->y) - (rect - ibuf->rect);
if (size) {
@@ -420,11 +420,11 @@ static void complete_partial_load(struct ImBuf *ibuf, unsigned int *rect)
}
}
-static void decodetarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem_size, int psize)
+static void decodetarga(struct ImBuf *ibuf, const uchar *mem, size_t mem_size, int psize)
{
- const unsigned char *mem_end = mem + mem_size;
+ const uchar *mem_end = mem + mem_size;
int count, col, size;
- unsigned int *rect;
+ uint *rect;
uchar *cp = (uchar *)&col;
if (ibuf == NULL) {
@@ -545,11 +545,11 @@ partial_load:
complete_partial_load(ibuf, rect);
}
-static void ldtarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem_size, int psize)
+static void ldtarga(struct ImBuf *ibuf, const uchar *mem, size_t mem_size, int psize)
{
- const unsigned char *mem_end = mem + mem_size;
+ const uchar *mem_end = mem + mem_size;
int col, size;
- unsigned int *rect;
+ uint *rect;
uchar *cp = (uchar *)&col;
if (ibuf == NULL) {
@@ -609,15 +609,12 @@ partial_load:
complete_partial_load(ibuf, rect);
}
-ImBuf *imb_loadtarga(const unsigned char *mem,
- size_t mem_size,
- int flags,
- char colorspace[IM_MAX_SPACE])
+ImBuf *imb_loadtarga(const uchar *mem, size_t mem_size, int flags, char colorspace[IM_MAX_SPACE])
{
TARGA tga;
struct ImBuf *ibuf;
int count, size;
- unsigned int *rect, *cmap = NULL /*, mincol = 0*/, cmap_max = 0;
+ uint *rect, *cmap = NULL /*, mincol = 0*/, cmap_max = 0;
int32_t cp_data;
uchar *cp = (uchar *)&cp_data;
@@ -650,7 +647,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem,
/* Load color map. */
// mincol = tga.maporig; /* UNUSED */
cmap_max = tga.mapsize;
- cmap = MEM_callocN(sizeof(unsigned int) * cmap_max, "targa cmap");
+ cmap = MEM_callocN(sizeof(uint) * cmap_max, "targa cmap");
for (count = 0; count < cmap_max; count++) {
switch (tga.mapbits >> 3) {
@@ -753,7 +750,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem,
}
if (tga.pixsize == 16) {
- unsigned int col;
+ uint col;
rect = ibuf->rect;
for (size = ibuf->x * ibuf->y; size > 0; size--, rect++) {
col = *rect;
@@ -773,10 +770,10 @@ ImBuf *imb_loadtarga(const unsigned char *mem,
if (ELEM(tga.imgtyp, 3, 11)) {
uchar *crect;
- unsigned int *lrect, col;
+ uint *lrect, col;
crect = (uchar *)ibuf->rect;
- lrect = (unsigned int *)ibuf->rect;
+ lrect = (uint *)ibuf->rect;
for (size = ibuf->x * ibuf->y; size > 0; size--) {
col = *lrect++;
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 6f39009d38d..d535bd00501 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -136,7 +136,7 @@ typedef enum {
/* Don't lose comment alignment. */
/* clang-format off */
-static const unsigned char acceptable[96] = {
+static const uchar acceptable[96] = {
/* A table of the ASCII chars from space (32) to DEL (127) */
/* ! " # $ % & ' ( ) * + , - . / */
0x00,0x3F,0x20,0x20,0x28,0x00,0x2C,0x3F,0x3F,0x3F,0x3F,0x2A,0x28,0x3F,0x3F,0x1C,
@@ -176,7 +176,7 @@ static void escape_uri_string(const char *string,
escaped_string_size -= 1;
for (q = escaped_string, p = string; (*p != '\0') && escaped_string_size; p++) {
- c = (unsigned char)*p;
+ c = (uchar)*p;
if (!ACCEPTABLE(c)) {
if (escaped_string_size < 3) {
@@ -227,7 +227,7 @@ static bool uri_from_filename(const char *path, char *uri)
return 0;
}
/* on windows, using always uppercase drive/volume letter in uri */
- vol[0] = (unsigned char)toupper(path[0]);
+ vol[0] = (uchar)toupper(path[0]);
vol[1] = ':';
vol[2] = '\0';
strcat(orig_uri, vol);
@@ -256,7 +256,7 @@ static bool thumbpathname_from_uri(
if (r_name) {
char hexdigest[33];
- unsigned char digest[16];
+ uchar digest[16];
BLI_hash_md5_buffer(uri, strlen(uri), digest);
hexdigest[0] = '\0';
BLI_snprintf(r_name, name_len, "%s.png", BLI_hash_md5_to_hexdigest(digest, hexdigest));
diff --git a/source/blender/imbuf/intern/thumbs_font.c b/source/blender/imbuf/intern/thumbs_font.c
index c0a33f608a5..65848bfb55e 100644
--- a/source/blender/imbuf/intern/thumbs_font.c
+++ b/source/blender/imbuf/intern/thumbs_font.c
@@ -41,7 +41,7 @@ void IMB_thumb_ensure_translations(void)
}
}
-struct ImBuf *IMB_thumb_load_font(const char *filepath, unsigned int x, unsigned int y)
+struct ImBuf *IMB_thumb_load_font(const char *filepath, uint x, uint y)
{
const int font_size = y / 4;
@@ -66,7 +66,7 @@ struct ImBuf *IMB_thumb_load_font(const char *filepath, unsigned int x, unsigned
ARRAY_SIZE(thumb_str),
font_color,
font_size,
- (unsigned char *)ibuf->rect,
+ (uchar *)ibuf->rect,
ibuf->x,
ibuf->y,
ibuf->channels);
@@ -83,7 +83,7 @@ bool IMB_thumb_load_font_get_hash(char *r_hash)
int draw_str_lines = ARRAY_SIZE(thumb_str);
int i;
- unsigned char digest[16];
+ uchar digest[16];
len += BLI_strncpy_rlen(str + len, THUMB_DEFAULT_HASH, sizeof(buf) - len);
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 1989566fc32..f4829386aac 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -60,7 +60,7 @@ static void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size);
/** Structure for in-memory TIFF file. */
typedef struct ImbTIFFMemFile {
/** Location of first byte of TIFF file. */
- const unsigned char *mem;
+ const uchar *mem;
/** Current offset within the file. */
toff_t offset;
/** Size of the TIFF file. */
@@ -262,7 +262,7 @@ static toff_t imb_tiff_SizeProc(thandle_t handle)
return (toff_t)(mfile->size);
}
-static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, const unsigned char *mem, size_t size)
+static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, const uchar *mem, size_t size)
{
/* open the TIFF client layer interface to the in-memory file */
memFile->mem = mem;
@@ -303,7 +303,7 @@ static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, const unsigned char *
* hence my manual comparison. - Jonathan Merritt (lancelet) 4th Sept 2005.
*/
#define IMB_TIFF_NCB 4 /* number of comparison bytes used */
-bool imb_is_a_tiff(const unsigned char *buf, size_t size)
+bool imb_is_a_tiff(const uchar *buf, size_t size)
{
const char big_endian[IMB_TIFF_NCB] = {0x4d, 0x4d, 0x00, 0x2a};
const char lil_endian[IMB_TIFF_NCB] = {0x49, 0x49, 0x2a, 0x00};
@@ -315,10 +315,7 @@ bool imb_is_a_tiff(const unsigned char *buf, size_t size)
(memcmp(lil_endian, buf, IMB_TIFF_NCB) == 0));
}
-static void scanline_contig_16bit(float *rectf,
- const unsigned short *sbuf,
- int scanline_w,
- int spp)
+static void scanline_contig_16bit(float *rectf, const ushort *sbuf, int scanline_w, int spp)
{
int i;
for (i = 0; i < scanline_w; i++) {
@@ -340,10 +337,7 @@ static void scanline_contig_32bit(float *rectf, const float *fbuf, int scanline_
}
}
-static void scanline_separate_16bit(float *rectf,
- const unsigned short *sbuf,
- int scanline_w,
- int chan)
+static void scanline_separate_16bit(float *rectf, const ushort *sbuf, int scanline_w, int chan)
{
int i;
for (i = 0; i < scanline_w; i++) {
@@ -392,7 +386,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
size_t scanline;
int ib_flag = 0, row, chan;
float *fbuf = NULL;
- unsigned short *sbuf = NULL;
+ ushort *sbuf = NULL;
TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitspersample);
TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); /* number of 'channels' */
@@ -410,7 +404,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
* So let's keep this thing here for until proper solution is found (sergey)
*/
- unsigned short extraSampleTypes[1];
+ ushort extraSampleTypes[1];
extraSampleTypes[0] = EXTRASAMPLE_ASSOCALPHA;
TIFFSetField(image, TIFFTAG_EXTRASAMPLES, 1, extraSampleTypes);
}
@@ -428,7 +422,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image)
}
else if (bitspersample == 16) {
ib_flag = IB_rectfloat;
- sbuf = (unsigned short *)_TIFFmalloc(scanline);
+ sbuf = (ushort *)_TIFFmalloc(scanline);
if (!sbuf) {
goto cleanup;
}
@@ -539,10 +533,7 @@ void imb_inittiff(void)
}
}
-ImBuf *imb_loadtiff(const unsigned char *mem,
- size_t size,
- int flags,
- char colorspace[IM_MAX_SPACE])
+ImBuf *imb_loadtiff(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
TIFF *image = NULL;
ImBuf *ibuf = NULL, *hbuf;
@@ -589,7 +580,7 @@ ImBuf *imb_loadtiff(const unsigned char *mem,
/* get alpha mode from file header */
if (flags & IB_alphamode_detect) {
if (spp == 4) {
- unsigned short extra, *extraSampleTypes;
+ ushort extra, *extraSampleTypes;
const int found = TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extra, &extraSampleTypes);
if (found && (extraSampleTypes[0] == EXTRASAMPLE_ASSOCALPHA)) {
@@ -661,8 +652,7 @@ ImBuf *imb_loadtiff(const unsigned char *mem,
return ibuf;
}
-void imb_loadtiletiff(
- ImBuf *ibuf, const unsigned char *mem, size_t size, int tx, int ty, unsigned int *rect)
+void imb_loadtiletiff(ImBuf *ibuf, const uchar *mem, size_t size, int tx, int ty, uint *rect)
{
TIFF *image = NULL;
uint32_t width, height;
@@ -723,9 +713,9 @@ bool imb_savetiff(ImBuf *ibuf, const char *filepath, int flags)
TIFF *image = NULL;
uint16_t samplesperpixel, bitspersample;
size_t npixels;
- unsigned char *pixels = NULL;
- unsigned char *from = NULL, *to = NULL;
- unsigned short *pixels16 = NULL, *to16 = NULL;
+ uchar *pixels = NULL;
+ uchar *from = NULL, *to = NULL;
+ ushort *pixels16 = NULL, *to16 = NULL;
float *fromf = NULL;
float xres, yres;
int x, y, from_i, to_i, i;
@@ -786,10 +776,10 @@ bool imb_savetiff(ImBuf *ibuf, const char *filepath, int flags)
/* allocate array for pixel data */
npixels = ibuf->x * ibuf->y;
if (bitspersample == 16) {
- pixels16 = (unsigned short *)_TIFFmalloc(npixels * samplesperpixel * sizeof(unsigned short));
+ pixels16 = (ushort *)_TIFFmalloc(npixels * samplesperpixel * sizeof(ushort));
}
else {
- pixels = (unsigned char *)_TIFFmalloc(npixels * samplesperpixel * sizeof(unsigned char));
+ pixels = (uchar *)_TIFFmalloc(npixels * samplesperpixel * sizeof(uchar));
}
if (pixels == NULL && pixels16 == NULL) {
@@ -804,7 +794,7 @@ bool imb_savetiff(ImBuf *ibuf, const char *filepath, int flags)
to16 = pixels16;
}
else {
- from = (unsigned char *)ibuf->rect;
+ from = (uchar *)ibuf->rect;
to = pixels;
}
@@ -813,7 +803,7 @@ bool imb_savetiff(ImBuf *ibuf, const char *filepath, int flags)
TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
if (samplesperpixel == 4) {
- unsigned short extraSampleTypes[1];
+ ushort extraSampleTypes[1];
if (bitspersample == 16) {
extraSampleTypes[0] = EXTRASAMPLE_ASSOCALPHA;
@@ -908,7 +898,7 @@ bool imb_savetiff(ImBuf *ibuf, const char *filepath, int flags)
TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
if (TIFFWriteEncodedStrip(image,
0,
- (bitspersample == 16) ? (unsigned char *)pixels16 : pixels,
+ (bitspersample == 16) ? (uchar *)pixels16 : pixels,
(size_t)ibuf->x * ibuf->y * samplesperpixel * bitspersample / 8) ==
-1) {
fprintf(stderr, "imb_savetiff: Could not write encoded TIFF.\n");
diff --git a/source/blender/imbuf/intern/transform.cc b/source/blender/imbuf/intern/transform.cc
index d64a48569ae..276d31c0557 100644
--- a/source/blender/imbuf/intern/transform.cc
+++ b/source/blender/imbuf/intern/transform.cc
@@ -147,7 +147,7 @@ class NoDiscard : public BaseDiscard {
template<
/**
* \brief Kind of buffer.
- * Possible options: float, unsigned char.
+ * Possible options: float, uchar.
*/
typename StorageType = float,
@@ -170,10 +170,9 @@ class PixelPointer {
if constexpr (std::is_same_v<StorageType, float>) {
pointer = image_buffer->rect_float + offset;
}
- else if constexpr (std::is_same_v<StorageType, unsigned char>) {
- pointer = const_cast<unsigned char *>(
- static_cast<const unsigned char *>(static_cast<const void *>(image_buffer->rect)) +
- offset);
+ else if constexpr (std::is_same_v<StorageType, uchar>) {
+ pointer = const_cast<uchar *>(
+ static_cast<const uchar *>(static_cast<const void *>(image_buffer->rect)) + offset);
}
else {
pointer = nullptr;
@@ -264,7 +263,7 @@ template<
/** \brief Interpolation mode to use when sampling. */
eIMBInterpolationFilterMode Filter,
- /** \brief storage type of a single pixel channel (unsigned char or float). */
+ /** \brief storage type of a single pixel channel (uchar or float). */
typename StorageType,
/**
* \brief number of channels if the image to read.
@@ -294,14 +293,14 @@ class Sampler {
const float wrapped_v = uv_wrapper.modify_v(source, v);
bilinear_interpolation_color_fl(source, nullptr, r_sample.data(), wrapped_u, wrapped_v);
}
- else if constexpr (Filter == IMB_FILTER_NEAREST &&
- std::is_same_v<StorageType, unsigned char> && NumChannels == 4) {
+ else if constexpr (Filter == IMB_FILTER_NEAREST && std::is_same_v<StorageType, uchar> &&
+ NumChannels == 4) {
const float wrapped_u = uv_wrapper.modify_u(source, u);
const float wrapped_v = uv_wrapper.modify_v(source, v);
nearest_interpolation_color_char(source, r_sample.data(), nullptr, wrapped_u, wrapped_v);
}
- else if constexpr (Filter == IMB_FILTER_BILINEAR &&
- std::is_same_v<StorageType, unsigned char> && NumChannels == 4) {
+ else if constexpr (Filter == IMB_FILTER_BILINEAR && std::is_same_v<StorageType, uchar> &&
+ NumChannels == 4) {
const float wrapped_u = uv_wrapper.modify_u(source, u);
const float wrapped_v = uv_wrapper.modify_v(source, v);
bilinear_interpolation_color_char(source, r_sample.data(), nullptr, wrapped_u, wrapped_v);
@@ -374,7 +373,7 @@ class Sampler {
*
* Template class to convert and store a sample in a PixelPointer.
* It supports:
- * - 4 channel unsigned char -> 4 channel unsigned char.
+ * - 4 channel uchar -> 4 channel uchar.
* - 4 channel float -> 4 channel float.
* - 3 channel float -> 4 channel float.
* - 2 channel float -> 4 channel float.
@@ -392,7 +391,7 @@ class ChannelConverter {
*/
void convert_and_store(const SampleType &sample, PixelType &pixel_pointer)
{
- if constexpr (std::is_same_v<StorageType, unsigned char>) {
+ if constexpr (std::is_same_v<StorageType, uchar>) {
BLI_STATIC_ASSERT(SourceNumChannels == 4, "Unsigned chars always have 4 channels.");
BLI_STATIC_ASSERT(DestinationNumChannels == 4, "Unsigned chars always have 4 channels.");
@@ -550,8 +549,8 @@ static void transform_threaded(TransformUserData *user_data, const eIMBTransform
scanline_func = get_scanline_function<Filter>(user_data, mode);
}
else if (user_data->dst->rect && user_data->src->rect) {
- /* Number of channels is always 4 when using unsigned char buffers (sRGB + straight alpha). */
- scanline_func = get_scanline_function<Filter, unsigned char, 4, 4>(mode);
+ /* Number of channels is always 4 when using uchar buffers (sRGB + straight alpha). */
+ scanline_func = get_scanline_function<Filter, uchar, 4, 4>(mode);
}
if (scanline_func != nullptr) {
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index ffa989a29b4..2870ff56c0a 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -106,8 +106,7 @@ const char *imb_ext_audio[] = {
/* Increased from 32 to 64 because of the bitmaps header size. */
#define HEADER_SIZE 64
-static ssize_t imb_ispic_read_header_from_filepath(const char *filepath,
- unsigned char buf[HEADER_SIZE])
+static ssize_t imb_ispic_read_header_from_filepath(const char *filepath, uchar buf[HEADER_SIZE])
{
BLI_stat_t st;
int fp;
@@ -135,7 +134,7 @@ static ssize_t imb_ispic_read_header_from_filepath(const char *filepath,
return size;
}
-int IMB_ispic_type_from_memory(const unsigned char *buf, const size_t buf_size)
+int IMB_ispic_type_from_memory(const uchar *buf, const size_t buf_size)
{
for (const ImFileType *type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
if (type->is_a != NULL) {
@@ -150,7 +149,7 @@ int IMB_ispic_type_from_memory(const unsigned char *buf, const size_t buf_size)
int IMB_ispic_type(const char *filepath)
{
- unsigned char buf[HEADER_SIZE];
+ uchar buf[HEADER_SIZE];
const ssize_t buf_size = imb_ispic_read_header_from_filepath(filepath, buf);
if (buf_size <= 0) {
return IMB_FTYPE_NONE;
@@ -160,7 +159,7 @@ int IMB_ispic_type(const char *filepath)
bool IMB_ispic_type_matches(const char *filepath, int filetype)
{
- unsigned char buf[HEADER_SIZE];
+ uchar buf[HEADER_SIZE];
const ssize_t buf_size = imb_ispic_read_header_from_filepath(filepath, buf);
if (buf_size <= 0) {
return false;
@@ -251,7 +250,7 @@ const char *IMB_ffmpeg_last_error(void)
static int isffmpeg(const char *filepath)
{
AVFormatContext *pFormatCtx = NULL;
- unsigned int i;
+ uint i;
int videoStream;
const AVCodec *pCodec;
diff --git a/source/blender/imbuf/intern/webp.c b/source/blender/imbuf/intern/webp.c
index 94c8e3fb61d..27c26fb19c1 100644
--- a/source/blender/imbuf/intern/webp.c
+++ b/source/blender/imbuf/intern/webp.c
@@ -29,7 +29,7 @@
#include "MEM_guardedalloc.h"
-bool imb_is_a_webp(const unsigned char *buf, size_t size)
+bool imb_is_a_webp(const uchar *buf, size_t size)
{
if (WebPGetInfo(buf, size, NULL, NULL)) {
return true;
@@ -37,10 +37,7 @@ bool imb_is_a_webp(const unsigned char *buf, size_t size)
return false;
}
-ImBuf *imb_loadwebp(const unsigned char *mem,
- size_t size,
- int flags,
- char colorspace[IM_MAX_SPACE])
+ImBuf *imb_loadwebp(const uchar *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE])
{
if (!imb_is_a_webp(mem, size)) {
return NULL;
@@ -66,7 +63,7 @@ ImBuf *imb_loadwebp(const unsigned char *mem,
ibuf->ftype = IMB_FTYPE_WEBP;
imb_addrectImBuf(ibuf);
/* Flip the image during decoding to match Blender. */
- unsigned char *last_row = (unsigned char *)(ibuf->rect + (ibuf->y - 1) * ibuf->x);
+ uchar *last_row = (uchar *)(ibuf->rect + (ibuf->y - 1) * ibuf->x);
if (WebPDecodeRGBAInto(mem, size, last_row, (size_t)(ibuf->x) * ibuf->y * 4, -4 * ibuf->x) ==
NULL) {
fprintf(stderr, "WebP: Failed to decode image\n");
@@ -98,7 +95,7 @@ struct ImBuf *imb_load_filepath_thumbnail_webp(const char *filepath,
return NULL;
}
- const unsigned char *data = BLI_mmap_get_pointer(mmap_file);
+ const uchar *data = BLI_mmap_get_pointer(mmap_file);
WebPDecoderConfig config;
if (!data || !WebPInitDecoderConfig(&config) ||
@@ -162,7 +159,7 @@ struct ImBuf *imb_load_filepath_thumbnail_webp(const char *filepath,
bool imb_savewebp(struct ImBuf *ibuf, const char *name, int UNUSED(flags))
{
const int bytesperpixel = (ibuf->planes + 7) >> 3;
- unsigned char *encoded_data, *last_row;
+ uchar *encoded_data, *last_row;
size_t encoded_data_size;
if (bytesperpixel == 3) {
@@ -176,7 +173,7 @@ bool imb_savewebp(struct ImBuf *ibuf, const char *name, int UNUSED(flags))
rgb_rect[i * 3 + 2] = rgba_rect[i * 4 + 2];
}
- last_row = (unsigned char *)(rgb_rect + (ibuf->y - 1) * ibuf->x * 3);
+ last_row = (uchar *)(rgb_rect + (ibuf->y - 1) * ibuf->x * 3);
if (ibuf->foptions.quality == 100.0f) {
encoded_data_size = WebPEncodeLosslessRGB(
@@ -189,7 +186,7 @@ bool imb_savewebp(struct ImBuf *ibuf, const char *name, int UNUSED(flags))
MEM_freeN(rgb_rect);
}
else if (bytesperpixel == 4) {
- last_row = (unsigned char *)(ibuf->rect + (ibuf->y - 1) * ibuf->x);
+ last_row = (uchar *)(ibuf->rect + (ibuf->y - 1) * ibuf->x);
if (ibuf->foptions.quality == 100.0f) {
encoded_data_size = WebPEncodeLosslessRGBA(