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

Function stbi__pic_info

include/stb/stb_image.h:7423–7478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7421
7422#ifndef STBI_NO_PIC
7423static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp)
7424{
7425 int act_comp=0,num_packets=0,chained,dummy;
7426 stbi__pic_packet packets[10];
7427
7428 if (!x) x = &dummy;
7429 if (!y) y = &dummy;
7430 if (!comp) comp = &dummy;
7431
7432 if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) {
7433 stbi__rewind(s);
7434 return 0;
7435 }
7436
7437 stbi__skip(s, 88);
7438
7439 *x = stbi__get16be(s);
7440 *y = stbi__get16be(s);
7441 if (stbi__at_eof(s)) {
7442 stbi__rewind( s);
7443 return 0;
7444 }
7445 if ( (*x) != 0 && (1 << 28) / (*x) < (*y)) {
7446 stbi__rewind( s );
7447 return 0;
7448 }
7449
7450 stbi__skip(s, 8);
7451
7452 do {
7453 stbi__pic_packet *packet;
7454
7455 if (num_packets==sizeof(packets)/sizeof(packets[0]))
7456 return 0;
7457
7458 packet = &packets[num_packets++];
7459 chained = stbi__get8(s);
7460 packet->size = stbi__get8(s);
7461 packet->type = stbi__get8(s);
7462 packet->channel = stbi__get8(s);
7463 act_comp |= packet->channel;
7464
7465 if (stbi__at_eof(s)) {
7466 stbi__rewind( s );
7467 return 0;
7468 }
7469 if (packet->size != 8) {
7470 stbi__rewind( s );
7471 return 0;
7472 }
7473 } while (chained);
7474
7475 *comp = (act_comp & 0x10 ? 4 : 3);
7476
7477 return 1;
7478}
7479#endif
7480

Callers 1

stbi__info_mainFunction · 0.85

Calls 6

stbi__pic_is4Function · 0.85
stbi__rewindFunction · 0.85
stbi__skipFunction · 0.85
stbi__get16beFunction · 0.85
stbi__at_eofFunction · 0.85
stbi__get8Function · 0.85

Tested by

no test coverage detected