MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / stbi__psd_info

Function stbi__psd_info

lite/example/cpp_example/mge/cv/stb_image.h:8056–8091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8054
8055#ifndef STBI_NO_PSD
8056static int stbi__psd_info(stbi__context* s, int* x, int* y, int* comp) {
8057 int channelCount, dummy, depth;
8058 if (!x)
8059 x = &dummy;
8060 if (!y)
8061 y = &dummy;
8062 if (!comp)
8063 comp = &dummy;
8064 if (stbi__get32be(s) != 0x38425053) {
8065 stbi__rewind(s);
8066 return 0;
8067 }
8068 if (stbi__get16be(s) != 1) {
8069 stbi__rewind(s);
8070 return 0;
8071 }
8072 stbi__skip(s, 6);
8073 channelCount = stbi__get16be(s);
8074 if (channelCount < 0 || channelCount > 16) {
8075 stbi__rewind(s);
8076 return 0;
8077 }
8078 *y = stbi__get32be(s);
8079 *x = stbi__get32be(s);
8080 depth = stbi__get16be(s);
8081 if (depth != 8 && depth != 16) {
8082 stbi__rewind(s);
8083 return 0;
8084 }
8085 if (stbi__get16be(s) != 3) {
8086 stbi__rewind(s);
8087 return 0;
8088 }
8089 *comp = 4;
8090 return 1;
8091}
8092
8093static int stbi__psd_is16(stbi__context* s) {
8094 int channelCount, depth;

Callers 1

stbi__info_mainFunction · 0.85

Calls 4

stbi__get32beFunction · 0.85
stbi__rewindFunction · 0.85
stbi__get16beFunction · 0.85
stbi__skipFunction · 0.85

Tested by

no test coverage detected