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

Function stbi__decode_jpeg_header

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

Source from the content-addressed store, hash-verified

3650#define stbi__SOF_progressive(x) ((x) == 0xc2)
3651
3652static int stbi__decode_jpeg_header(stbi__jpeg* z, int scan) {
3653 int m;
3654 z->jfif = 0;
3655 z->app14_color_transform = -1; // valid values are 0,1,2
3656 z->marker = STBI__MARKER_none; // initialize cached marker to empty
3657 m = stbi__get_marker(z);
3658 if (!stbi__SOI(m))
3659 return stbi__err("no SOI", "Corrupt JPEG");
3660 if (scan == STBI__SCAN_type)
3661 return 1;
3662 m = stbi__get_marker(z);
3663 while (!stbi__SOF(m)) {
3664 if (!stbi__process_marker(z, m))
3665 return 0;
3666 m = stbi__get_marker(z);
3667 while (m == STBI__MARKER_none) {
3668 // some files have extra padding after their blocks, so ok, we'll scan
3669 if (stbi__at_eof(z->s))
3670 return stbi__err("no SOF", "Corrupt JPEG");
3671 m = stbi__get_marker(z);
3672 }
3673 }
3674 z->progressive = stbi__SOF_progressive(m);
3675 if (!stbi__process_frame_header(z, scan))
3676 return 0;
3677 return 1;
3678}
3679
3680// decode image to YCbCr format
3681static int stbi__decode_jpeg_image(stbi__jpeg* j) {

Callers 3

stbi__decode_jpeg_imageFunction · 0.85
stbi__jpeg_testFunction · 0.85
stbi__jpeg_info_rawFunction · 0.85

Calls 5

stbi__get_markerFunction · 0.85
stbi__errFunction · 0.85
stbi__process_markerFunction · 0.85
stbi__at_eofFunction · 0.85

Tested by

no test coverage detected