Lines Matching refs:stbi_uc

385 typedef unsigned char stbi_uc;
421 STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels);
422 STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk , void *user, int *x, int *y, int *channels_in_file, int desired_channels);
425 STBIDEF stbi_uc *stbi_load (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels);
426 STBIDEF stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels);
431 STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp);
443 STBIDEF stbi_us *stbi_load_16_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels);
456 STBIDEF float *stbi_loadf_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels);
477 STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
492 STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
494 STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len);
813 stbi_uc buffer_start[128];
816 stbi_uc *img_buffer, *img_buffer_end;
817 stbi_uc *img_buffer_original, *img_buffer_original_end;
824 static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len)
829 s->img_buffer = s->img_buffer_original = (stbi_uc *) buffer;
830 s->img_buffer_end = s->img_buffer_original_end = (stbi_uc *) buffer+len;
1105 static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp);
1109 static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp);
1188 static stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, int channels)
1192 stbi_uc *reduced;
1194 reduced = (stbi_uc *) stbi__malloc(img_len);
1198 reduced[i] = (stbi_uc)((orig[i] >> 8) & 0xFF); // top half of each byte is sufficient approx of 16->8 bit scaling
1204 static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int channels)
1224 stbi_uc temp[2048];
1225 stbi_uc *bytes = (stbi_uc *)image;
1228 stbi_uc *row0 = bytes + row*bytes_per_row;
1229 stbi_uc *row1 = bytes + (h - row - 1)*bytes_per_row;
1250 stbi_uc *bytes = (stbi_uc *)image;
1278 stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi_uc));
1296 result = stbi__convert_8_to_16((stbi_uc *) result, *x, *y, req_comp == 0 ? *comp : req_comp);
1364 STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)
1374 STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
1413 STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels)
1427 STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
1434 STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp)
1442 STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp)
1476 STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
1515 STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
1612 stbi_inline static stbi_uc stbi__get8(stbi__context *s)
1664 static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)
1728 #define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings
1744 static stbi_uc stbi__compute_y(int r, int g, int b)
1746 return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8);
1856 static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)
1882 static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp)
1885 stbi_uc *output;
1887 output = (stbi_uc *) stbi__malloc_mad3(x, y, comp, 0);
1896 output[i*comp + k] = (stbi_uc) stbi__float2int(z);
1902 output[i*comp + k] = (stbi_uc) stbi__float2int(z);
1938 stbi_uc fast[1 << FAST_BITS];
1941 stbi_uc values[256];
1942 stbi_uc size[257];
1970 stbi_uc *data;
1972 stbi_uc *linebuf;
1996 void (*idct_block_kernel)(stbi_uc *out, int out_stride, short data[64]);
1997 void (*YCbCr_to_RGB_kernel)(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step);
1998 stbi_uc *(*resample_row_hv_2_kernel)(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs);
2008 h->size[k++] = (stbi_uc) (i+1);
2039 h->fast[c+j] = (stbi_uc) i;
2052 stbi_uc fast = h->fast[i];
2192 static const stbi_uc stbi__jpeg_dezigzag[64+15] =
2414 stbi_inline static stbi_uc stbi__clamp(int x)
2421 return (stbi_uc) x;
2465 static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64])
2468 stbi_uc *o;
2528 static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
2709 static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
2917 static stbi_uc stbi__get_marker(stbi__jpeg *j)
2919 stbi_uc x;
3127 stbi_uc *v;
3339 z->img_comp[i].data = (stbi_uc*) (((size_t) z->img_comp[i].raw_data + 15) & ~15);
3449 typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_uc *in1,
3452 #define stbi__div4(x) ((stbi_uc) ((x) >> 2))
3454 static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
3463 static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
3473 static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
3477 stbi_uc *input = in_near;
3501 #define stbi__div16(x) ((stbi_uc) ((x) >> 4))
3503 static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
3528 static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
3644 static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
3658 static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step)
3675 out[0] = (stbi_uc)r;
3676 out[1] = (stbi_uc)g;
3677 out[2] = (stbi_uc)b;
3684 static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi_uc const *pcb, stbi_uc const *pcr, int count, int step)
3809 out[0] = (stbi_uc)r;
3810 out[1] = (stbi_uc)g;
3811 out[2] = (stbi_uc)b;
3849 stbi_uc *line0,*line1;
3857 static stbi_uc stbi__blinn_8x8(stbi_uc x, stbi_uc y)
3860 return (stbi_uc) ((t + (t >>8)) >> 8);
3863 static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp, int req_comp)
3892 stbi_uc *output;
3893 stbi_uc *coutput[4] = { NULL, NULL, NULL, NULL };
3902 z->img_comp[k].linebuf = (stbi_uc *) stbi__malloc(z->s->img_x + 3);
3920 output = (stbi_uc *) stbi__malloc_mad3(n, z->s->img_x, z->s->img_y, 1);
3925 stbi_uc *out = output + n * z->s->img_x * j;
3941 stbi_uc *y = coutput[0];
3957 stbi_uc m = coutput[3][i];
3967 stbi_uc m = coutput[3][i];
3995 stbi_uc m = coutput[3][i];
3996 stbi_uc r = stbi__blinn_8x8(coutput[0][i], m);
3997 stbi_uc g = stbi__blinn_8x8(coutput[1][i], m);
3998 stbi_uc b = stbi__blinn_8x8(coutput[2][i], m);
4010 stbi_uc *y = coutput[0];
4101 stbi_uc size[STBI__ZNSYMS];
4122 static int stbi__zbuild_huffman(stbi__zhuffman *z, const stbi_uc *sizelist, int num)
4154 z->size [c] = (stbi_uc ) s;
4177 stbi_uc *zbuffer, *zbuffer_end;
4194 stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z)
4308 stbi_uc *p;
4327 p = (stbi_uc *) (zout - dist);
4329 stbi_uc v = *p;
4340 static const stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
4342 stbi_uc lencodes[286+32+137];//padding for maximum single op
4343 stbi_uc codelength_sizes[19];
4354 codelength_sizes[length_dezigzag[i]] = (stbi_uc) s;
4363 lencodes[n++] = (stbi_uc) c;
4365 stbi_uc fill = 0;
4390 stbi_uc header[4];
4397 header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check
4431 static const stbi_uc stbi__zdefault_length[STBI__ZNSYMS] =
4443 static const stbi_uc stbi__zdefault_distance[32] =
4503 a.zbuffer = (stbi_uc *) buffer;
4504 a.zbuffer_end = (stbi_uc *) buffer + len;
4524 a.zbuffer = (stbi_uc *) buffer;
4525 a.zbuffer_end = (stbi_uc *) buffer + len;
4538 a.zbuffer = (stbi_uc *) ibuffer;
4539 a.zbuffer_end = (stbi_uc *) ibuffer + ilen;
4551 a.zbuffer = (stbi_uc *) buffer;
4552 a.zbuffer_end = (stbi_uc *) buffer+len;
4565 a.zbuffer = (stbi_uc *) ibuffer;
4566 a.zbuffer_end = (stbi_uc *) ibuffer + ilen;
4601 static const stbi_uc png_sig[8] = { 137,80,78,71,13,10,26,10 };
4611 stbi_uc *idata, *expanded, *out;
4627 static stbi_uc first_row_filter[5] =
4647 static const stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 };
4650 static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color)
4664 a->out = (stbi_uc *) stbi__malloc_mad3(x, y, output_bytes, 0); // extra bytes to write off the end into
4677 stbi_uc *cur = a->out + stride*j;
4678 stbi_uc *prior;
4779 stbi_uc *cur = a->out + stride*j;
4780 stbi_uc *in = a->out + stride*j + x*out_n - img_width_bytes;
4783 stbi_uc scale = (color == 0) ? stbi__depth_scale_table[depth] : 1; // scale grayscale values to 0..255 range
4851 stbi_uc *cur = a->out;
4862 static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stbi__uint32 image_data_len, int out_n, int depth, int color, int interlaced)
4866 stbi_uc *final;
4872 final = (stbi_uc *) stbi__malloc_mad3(a->s->img_x, a->s->img_y, out_bytes, 0);
4907 static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int out_n)
4911 stbi_uc *p = z->out;
4957 static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int pal_img_n)
4960 stbi_uc *p, *temp_out, *orig = a->out;
4962 p = (stbi_uc *) stbi__malloc_mad2(pixel_count, pal_img_n, 0);
5038 stbi_uc *p = z->out;
5042 stbi_uc t = p[0];
5052 stbi_uc a = p[3];
5053 stbi_uc t = p[0];
5055 stbi_uc half = a / 2;
5068 stbi_uc t = p[0];
5081 stbi_uc palette[1024], pal_img_n=0;
5082 stbi_uc has_trans=0, tc[3]={0};
5166 for (k = 0; k < s->img_n; ++k) tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger
5185 stbi_uc *p;
5190 p = (stbi_uc *) STBI_REALLOC_SIZED(z->idata, idata_limit_old, idata_limit); if (p == NULL) return stbi__err("outofmem", "Out of memory");
5206 z->expanded = (stbi_uc *) stbi_zlib_decode_malloc_guesssize_headerflag((char *) z->idata, ioff, raw_len, (int *) &raw_len, !is_iphone);
5532 stbi_uc *out;
5534 stbi_uc pal[256][4];
5596 out = (stbi_uc *) stbi__malloc_mad3(target, s->img_x, s->img_y, 0);
5712 stbi_uc t;
5714 stbi_uc *p1 = out + j *s->img_x*target;
5715 stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;
5851 static void stbi__tga_read_rgb16(stbi__context *s, stbi_uc* out)
5860 out[0] = (stbi_uc)((r * 255)/31);
5861 out[1] = (stbi_uc)((g * 255)/31);
5862 out[2] = (stbi_uc)((b * 255)/31);
5935 stbi_uc *tga_row = tga_data + row*tga_width*tga_comp;
5956 stbi_uc *pal_entry = tga_palette;
6087 static int stbi__psd_decode_rle(stbi__context *s, stbi_uc *p, int pixelCount)
6107 stbi_uc val;
6132 stbi_uc *out;
6200 out = (stbi_uc *) stbi__malloc_mad3(8, w, h, 0);
6203 out = (stbi_uc *) stbi__malloc(4 * w*h);
6227 stbi_uc *p;
6257 stbi_uc *p = out+channel;
6258 stbi_uc val = channel == 3 ? 255 : 0;
6268 stbi_uc *p = out+channel;
6271 *p = (stbi_uc) (stbi__get16be(s) >> 8);
6313 out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, 4, req_comp, w, h);
6339 if (stbi__get8(s) != (stbi_uc)str[i])
6363 stbi_uc size,type,channel;
6366 static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *dest)
6380 static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src)
6389 static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int height,int *comp, stbi_uc *result)
6422 stbi_uc *dest = result+y*width*4;
6442 stbi_uc count,value[4];
6448 count = (stbi_uc) left;
6466 stbi_uc value[4];
6501 stbi_uc *result;
6524 result = (stbi_uc *) stbi__malloc_mad3(x, y, 4, 0);
6555 stbi_uc first;
6556 stbi_uc suffix;
6562 stbi_uc *out; // output buffer (always 4 components)
6563 stbi_uc *background; // The current "background" as far as a gif is concerned
6564 stbi_uc *history;
6566 stbi_uc pal[256][4];
6567 stbi_uc lpal[256][4];
6569 stbi_uc *color_table;
6596 static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256][4], int num_entries, int transp)
6609 stbi_uc version;
6655 stbi_uc *p, *c;
6690 static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g)
6692 stbi_uc lzw_cs;
6708 g->codes[init_code].first = (stbi_uc) init_code;
6709 g->codes[init_code].suffix = (stbi_uc) init_code;
6777 static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp, stbi_uc *two_back)
6792 g->out = (stbi_uc *) stbi__malloc(4 * pcount);
6793 g->background = (stbi_uc *) stbi__malloc(4 * pcount);
6794 g->history = (stbi_uc *) stbi__malloc(pcount);
6847 stbi_uc *o;
6883 g->color_table = (stbi_uc *) g->lpal;
6885 g->color_table = (stbi_uc *) g->pal;
6943 return (stbi_uc *) s; // using '1' causes warning on some compilers
6951 static void *stbi__load_gif_main_outofmem(stbi__gif *g, stbi_uc *out, int **delays)
6966 stbi_uc *u = 0;
6967 stbi_uc *out = 0;
6968 stbi_uc *two_back = 0;
6984 if (u == (stbi_uc *) s) u = 0; // end of animated gif marker
6993 void *tmp = (stbi_uc*) STBI_REALLOC_SIZED( out, out_size, layers * stride );
7000 out = (stbi_uc*) tmp;
7012 out = (stbi_uc*)stbi__malloc( layers * stride );
7055 stbi_uc *u = 0;
7061 if (u == (stbi_uc *) s) u = 0; // end of animated gif marker
7136 static void stbi__hdr_convert(float *output, stbi_uc *input, int req_comp)
7169 stbi_uc *scanline;
7225 stbi_uc rgbe[4];
7242 stbi_uc rgbe[4];
7243 rgbe[0] = (stbi_uc) c1;
7244 rgbe[1] = (stbi_uc) c2;
7245 rgbe[2] = (stbi_uc) len;
7246 rgbe[3] = (stbi_uc) stbi__get8(s);
7257 scanline = (stbi_uc *) stbi__malloc_mad2(width, 4, 0);
7513 stbi_uc *out;
7530 out = (stbi_uc *) stbi__malloc_mad4(s->img_n, s->img_x, s->img_y, ri->bits_per_channel / 8, 0);
7539 out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, s->img_n, req_comp, s->img_x, s->img_y);
7739 STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp)
7753 STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len)
7883 cast-to-stbi_uc to fix warnings
7900 1.21 fix use of 'stbi_uc' in header (reported by jon blow)