MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stbi__pic_load

Function stbi__pic_load

include/stb/stb_image.h:6500–6539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6498}
6499
6500static void *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_comp, stbi__result_info *ri)
6501{
6502 stbi_uc *result;
6503 int i, x,y, internal_comp;
6504 STBI_NOTUSED(ri);
6505
6506 if (!comp) comp = &internal_comp;
6507
6508 for (i=0; i<92; ++i)
6509 stbi__get8(s);
6510
6511 x = stbi__get16be(s);
6512 y = stbi__get16be(s);
6513
6514 if (y > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)");
6515 if (x > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)");
6516
6517 if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pic header)");
6518 if (!stbi__mad3sizes_valid(x, y, 4, 0)) return stbi__errpuc("too large", "PIC image too large to decode");
6519
6520 stbi__get32be(s); //skip `ratio'
6521 stbi__get16be(s); //skip `fields'
6522 stbi__get16be(s); //skip `pad'
6523
6524 // intermediate buffer is RGBA
6525 result = (stbi_uc *) stbi__malloc_mad3(x, y, 4, 0);
6526 if (!result) return stbi__errpuc("outofmem", "Out of memory");
6527 memset(result, 0xff, x*y*4);
6528
6529 if (!stbi__pic_load_core(s,x,y,comp, result)) {
6530 STBI_FREE(result);
6531 result=0;
6532 }
6533 *px = x;
6534 *py = y;
6535 if (req_comp == 0) req_comp = *comp;
6536 result=stbi__convert_format(result,4,req_comp,x,y);
6537
6538 return result;
6539}
6540
6541static int stbi__pic_test(stbi__context *s)
6542{

Callers 1

stbi__load_mainFunction · 0.85

Calls 8

stbi__get8Function · 0.85
stbi__get16beFunction · 0.85
stbi__at_eofFunction · 0.85
stbi__mad3sizes_validFunction · 0.85
stbi__get32beFunction · 0.85
stbi__malloc_mad3Function · 0.85
stbi__pic_load_coreFunction · 0.85
stbi__convert_formatFunction · 0.85

Tested by

no test coverage detected