MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / stbi__decode_jpeg_header

Function stbi__decode_jpeg_header

Source/Utils/stb_image.h:3364–3386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3362#define stbi__SOF_progressive(x) ((x) == 0xc2)
3363
3364static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan)
3365{
3366 int m;
3367 z->jfif = 0;
3368 z->app14_color_transform = -1; // valid values are 0,1,2
3369 z->marker = STBI__MARKER_none; // initialize cached marker to empty
3370 m = stbi__get_marker(z);
3371 if (!stbi__SOI(m)) return stbi__err("no SOI","Corrupt JPEG");
3372 if (scan == STBI__SCAN_type) return 1;
3373 m = stbi__get_marker(z);
3374 while (!stbi__SOF(m)) {
3375 if (!stbi__process_marker(z,m)) return 0;
3376 m = stbi__get_marker(z);
3377 while (m == STBI__MARKER_none) {
3378 // some files have extra padding after their blocks, so ok, we'll scan
3379 if (stbi__at_eof(z->s)) return stbi__err("no SOF", "Corrupt JPEG");
3380 m = stbi__get_marker(z);
3381 }
3382 }
3383 z->progressive = stbi__SOF_progressive(m);
3384 if (!stbi__process_frame_header(z, scan)) return 0;
3385 return 1;
3386}
3387
3388static stbi_uc stbi__skip_jpeg_junk_at_end(stbi__jpeg *j)
3389{

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