Lines Matching refs:g
1726 static stbi_uc stbi__compute_y(int r, int g, int b) in stbi__compute_y() argument
1728 return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8); in stbi__compute_y()
1783 static stbi__uint16 stbi__compute_y_16(int r, int g, int b) in stbi__compute_y_16() argument
1785 return (stbi__uint16) (((r*77) + (g*150) + (29*b)) >> 8); in stbi__compute_y_16()
3604 int r,g,b; in stbi__YCbCr_to_RGB_row() local
3608 …g = y_fixed + (cr*-stbi__float2fixed(0.71414f)) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); in stbi__YCbCr_to_RGB_row()
3611 g >>= 20; in stbi__YCbCr_to_RGB_row()
3614 if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } in stbi__YCbCr_to_RGB_row()
3617 out[1] = (stbi_uc)g; in stbi__YCbCr_to_RGB_row()
3738 int r,g,b; in stbi__YCbCr_to_RGB_simd() local
3742 … g = y_fixed + cr*-stbi__float2fixed(0.71414f) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); in stbi__YCbCr_to_RGB_simd()
3745 g >>= 20; in stbi__YCbCr_to_RGB_simd()
3748 if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } in stbi__YCbCr_to_RGB_simd()
3751 out[1] = (stbi_uc)g; in stbi__YCbCr_to_RGB_simd()
3938 stbi_uc g = stbi__blinn_8x8(coutput[1][i], m); in load_jpeg_image() local
3940 out[0] = stbi__compute_y(r, g, b); in load_jpeg_image()
5773 int g = (px >> 5) & fiveBitMask; in stbi__tga_read_rgb16() local
5777 out[1] = (stbi_uc)((g * 255)/31); in stbi__tga_read_rgb16()
6523 static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_info) in stbi__gif_header() argument
6534 g->w = stbi__get16le(s); in stbi__gif_header()
6535 g->h = stbi__get16le(s); in stbi__gif_header()
6536 g->flags = stbi__get8(s); in stbi__gif_header()
6537 g->bgindex = stbi__get8(s); in stbi__gif_header()
6538 g->ratio = stbi__get8(s); in stbi__gif_header()
6539 g->transparent = -1; in stbi__gif_header()
6541 if (g->w > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); in stbi__gif_header()
6542 if (g->h > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); in stbi__gif_header()
6548 if (g->flags & 0x80) in stbi__gif_header()
6549 stbi__gif_parse_colortable(s,g->pal, 2 << (g->flags & 7), -1); in stbi__gif_header()
6556 stbi__gif* g = (stbi__gif*) stbi__malloc(sizeof(stbi__gif)); in stbi__gif_info_raw() local
6557 if (!g) return stbi__err("outofmem", "Out of memory"); in stbi__gif_info_raw()
6558 if (!stbi__gif_header(s, g, comp, 1)) { in stbi__gif_info_raw()
6559 STBI_FREE(g); in stbi__gif_info_raw()
6563 if (x) *x = g->w; in stbi__gif_info_raw()
6564 if (y) *y = g->h; in stbi__gif_info_raw()
6565 STBI_FREE(g); in stbi__gif_info_raw()
6569 static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code) in stbi__out_gif_code() argument
6576 if (g->codes[code].prefix >= 0) in stbi__out_gif_code()
6577 stbi__out_gif_code(g, g->codes[code].prefix); in stbi__out_gif_code()
6579 if (g->cur_y >= g->max_y) return; in stbi__out_gif_code()
6581 idx = g->cur_x + g->cur_y; in stbi__out_gif_code()
6582 p = &g->out[idx]; in stbi__out_gif_code()
6583 g->history[idx / 4] = 1; in stbi__out_gif_code()
6585 c = &g->color_table[g->codes[code].suffix * 4]; in stbi__out_gif_code()
6592 g->cur_x += 4; in stbi__out_gif_code()
6594 if (g->cur_x >= g->max_x) { in stbi__out_gif_code()
6595 g->cur_x = g->start_x; in stbi__out_gif_code()
6596 g->cur_y += g->step; in stbi__out_gif_code()
6598 while (g->cur_y >= g->max_y && g->parse > 0) { in stbi__out_gif_code()
6599 g->step = (1 << g->parse) * g->line_size; in stbi__out_gif_code()
6600 g->cur_y = g->start_y + (g->step >> 1); in stbi__out_gif_code()
6601 --g->parse; in stbi__out_gif_code()
6606 static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) in stbi__process_gif_raster() argument
6623 g->codes[init_code].prefix = -1; in stbi__process_gif_raster()
6624 g->codes[init_code].first = (stbi_uc) init_code; in stbi__process_gif_raster()
6625 g->codes[init_code].suffix = (stbi_uc) init_code; in stbi__process_gif_raster()
6638 return g->out; in stbi__process_gif_raster()
6658 return g->out; in stbi__process_gif_raster()
6665 p = &g->codes[avail++]; in stbi__process_gif_raster()
6671 p->first = g->codes[oldcode].first; in stbi__process_gif_raster()
6672 p->suffix = (code == avail) ? p->first : g->codes[code].first; in stbi__process_gif_raster()
6676 stbi__out_gif_code(g, (stbi__uint16) code); in stbi__process_gif_raster()
6693 static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp, stbi_u… in stbi__gif_load_next() argument
6703 if (g->out == 0) { in stbi__gif_load_next()
6704 … if (!stbi__gif_header(s, g, comp,0)) return 0; // stbi__g_failure_reason set by stbi__gif_header in stbi__gif_load_next()
6705 if (!stbi__mad3sizes_valid(4, g->w, g->h, 0)) in stbi__gif_load_next()
6707 pcount = g->w * g->h; in stbi__gif_load_next()
6708 g->out = (stbi_uc *) stbi__malloc(4 * pcount); in stbi__gif_load_next()
6709 g->background = (stbi_uc *) stbi__malloc(4 * pcount); in stbi__gif_load_next()
6710 g->history = (stbi_uc *) stbi__malloc(pcount); in stbi__gif_load_next()
6711 if (!g->out || !g->background || !g->history) in stbi__gif_load_next()
6717 memset(g->out, 0x00, 4 * pcount); in stbi__gif_load_next()
6718 memset(g->background, 0x00, 4 * pcount); // state of the background (starts transparent) in stbi__gif_load_next()
6719 memset(g->history, 0x00, pcount); // pixels that were affected previous frame in stbi__gif_load_next()
6723 dispose = (g->eflags & 0x1C) >> 2; in stbi__gif_load_next()
6724 pcount = g->w * g->h; in stbi__gif_load_next()
6732 if (g->history[pi]) { in stbi__gif_load_next()
6733 memcpy( &g->out[pi * 4], &two_back[pi * 4], 4 ); in stbi__gif_load_next()
6739 if (g->history[pi]) { in stbi__gif_load_next()
6740 memcpy( &g->out[pi * 4], &g->background[pi * 4], 4 ); in stbi__gif_load_next()
6751 memcpy( g->background, g->out, 4 * g->w * g->h ); in stbi__gif_load_next()
6755 memset( g->history, 0x00, g->w * g->h ); // pixels that were affected previous frame in stbi__gif_load_next()
6769 if (((x + w) > (g->w)) || ((y + h) > (g->h))) in stbi__gif_load_next()
6772 g->line_size = g->w * 4; in stbi__gif_load_next()
6773 g->start_x = x * 4; in stbi__gif_load_next()
6774 g->start_y = y * g->line_size; in stbi__gif_load_next()
6775 g->max_x = g->start_x + w * 4; in stbi__gif_load_next()
6776 g->max_y = g->start_y + h * g->line_size; in stbi__gif_load_next()
6777 g->cur_x = g->start_x; in stbi__gif_load_next()
6778 g->cur_y = g->start_y; in stbi__gif_load_next()
6785 g->cur_y = g->max_y; in stbi__gif_load_next()
6787 g->lflags = stbi__get8(s); in stbi__gif_load_next()
6789 if (g->lflags & 0x40) { in stbi__gif_load_next()
6790 g->step = 8 * g->line_size; // first interlaced spacing in stbi__gif_load_next()
6791 g->parse = 3; in stbi__gif_load_next()
6793 g->step = g->line_size; in stbi__gif_load_next()
6794 g->parse = 0; in stbi__gif_load_next()
6797 if (g->lflags & 0x80) { in stbi__gif_load_next()
6798 …stbi__gif_parse_colortable(s,g->lpal, 2 << (g->lflags & 7), g->eflags & 0x01 ? g->transparent : -1… in stbi__gif_load_next()
6799 g->color_table = (stbi_uc *) g->lpal; in stbi__gif_load_next()
6800 } else if (g->flags & 0x80) { in stbi__gif_load_next()
6801 g->color_table = (stbi_uc *) g->pal; in stbi__gif_load_next()
6805 o = stbi__process_gif_raster(s, g); in stbi__gif_load_next()
6809 pcount = g->w * g->h; in stbi__gif_load_next()
6810 if (first_frame && (g->bgindex > 0)) { in stbi__gif_load_next()
6813 if (g->history[pi] == 0) { in stbi__gif_load_next()
6814 …g->pal[g->bgindex][3] = 255; // just in case it was made transparent, undo that; It will be reset … in stbi__gif_load_next()
6815 memcpy( &g->out[pi * 4], &g->pal[g->bgindex], 4 ); in stbi__gif_load_next()
6830 g->eflags = stbi__get8(s); in stbi__gif_load_next()
6831 … g->delay = 10 * stbi__get16le(s); // delay - 1/100th of a second, saving as 1/1000ths. in stbi__gif_load_next()
6834 if (g->transparent >= 0) { in stbi__gif_load_next()
6835 g->pal[g->transparent][3] = 255; in stbi__gif_load_next()
6837 if (g->eflags & 0x01) { in stbi__gif_load_next()
6838 g->transparent = stbi__get8(s); in stbi__gif_load_next()
6839 if (g->transparent >= 0) { in stbi__gif_load_next()
6840 g->pal[g->transparent][3] = 0; in stbi__gif_load_next()
6845 g->transparent = -1; in stbi__gif_load_next()
6867 static void *stbi__load_gif_main_outofmem(stbi__gif *g, stbi_uc *out, int **delays) in stbi__load_gif_main_outofmem() argument
6869 STBI_FREE(g->out); in stbi__load_gif_main_outofmem()
6870 STBI_FREE(g->history); in stbi__load_gif_main_outofmem()
6871 STBI_FREE(g->background); in stbi__load_gif_main_outofmem()
6885 stbi__gif g; in stbi__load_gif_main() local
6893 memset(&g, 0, sizeof(g)); in stbi__load_gif_main()
6899 u = stbi__gif_load_next(s, &g, comp, req_comp, two_back); in stbi__load_gif_main()
6903 *x = g.w; in stbi__load_gif_main()
6904 *y = g.h; in stbi__load_gif_main()
6906 stride = g.w * g.h * 4; in stbi__load_gif_main()
6911 return stbi__load_gif_main_outofmem(&g, out, delays); in stbi__load_gif_main()
6920 return stbi__load_gif_main_outofmem(&g, out, delays); in stbi__load_gif_main()
6927 return stbi__load_gif_main_outofmem(&g, out, delays); in stbi__load_gif_main()
6932 return stbi__load_gif_main_outofmem(&g, out, delays); in stbi__load_gif_main()
6942 (*delays)[layers - 1U] = g.delay; in stbi__load_gif_main()
6948 STBI_FREE(g.out); in stbi__load_gif_main()
6949 STBI_FREE(g.history); in stbi__load_gif_main()
6950 STBI_FREE(g.background); in stbi__load_gif_main()
6954 out = stbi__convert_format(out, 4, req_comp, layers * g.w, g.h); in stbi__load_gif_main()
6966 stbi__gif g; in stbi__gif_load() local
6967 memset(&g, 0, sizeof(g)); in stbi__gif_load()
6970 u = stbi__gif_load_next(s, &g, comp, req_comp, 0); in stbi__gif_load()
6973 *x = g.w; in stbi__gif_load()
6974 *y = g.h; in stbi__gif_load()
6979 u = stbi__convert_format(u, 4, req_comp, g.w, g.h); in stbi__gif_load()
6980 } else if (g.out) { in stbi__gif_load()
6982 STBI_FREE(g.out); in stbi__gif_load()
6986 STBI_FREE(g.history); in stbi__gif_load()
6987 STBI_FREE(g.background); in stbi__gif_load()