mirror of https://github.com/nothings/stb.git
Merge branch 'component-ids' of https://github.com/jeremysawicki/stb into working
This commit is contained in:
commit
014af7b78a
|
@ -2929,13 +2929,8 @@ static int stbi__process_frame_header(stbi__jpeg *z, int scan)
|
||||||
for (i=0; i < s->img_n; ++i) {
|
for (i=0; i < s->img_n; ++i) {
|
||||||
static unsigned char rgb[3] = { 'R', 'G', 'B' };
|
static unsigned char rgb[3] = { 'R', 'G', 'B' };
|
||||||
z->img_comp[i].id = stbi__get8(s);
|
z->img_comp[i].id = stbi__get8(s);
|
||||||
if (z->img_comp[i].id != i+1) // JFIF requires
|
if (z->img_comp[i].id == rgb[i])
|
||||||
if (z->img_comp[i].id != i) { // some version of jpegtran outputs non-JFIF-compliant files!
|
++z->rgb;
|
||||||
// somethings output this (see http://fileformats.archiveteam.org/wiki/JPEG#Color_format)
|
|
||||||
if (z->img_comp[i].id != rgb[i])
|
|
||||||
return stbi__err("bad component ID","Corrupt JPEG");
|
|
||||||
++z->rgb;
|
|
||||||
}
|
|
||||||
q = stbi__get8(s);
|
q = stbi__get8(s);
|
||||||
z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return stbi__err("bad H","Corrupt JPEG");
|
z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return stbi__err("bad H","Corrupt JPEG");
|
||||||
z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return stbi__err("bad V","Corrupt JPEG");
|
z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return stbi__err("bad V","Corrupt JPEG");
|
||||||
|
|
Loading…
Reference in New Issue