tweak 16-bit quantization for clarity
This commit is contained in:
parent
0befbc3d78
commit
a6dc061137
@ -2798,13 +2798,14 @@ static int stbi__process_marker(stbi__jpeg *z, int m)
|
|||||||
L = stbi__get16be(z->s)-2;
|
L = stbi__get16be(z->s)-2;
|
||||||
while (L > 0) {
|
while (L > 0) {
|
||||||
int q = stbi__get8(z->s);
|
int q = stbi__get8(z->s);
|
||||||
int p = q >> 4;
|
int p = q >> 4, sixteen = (p != 0);
|
||||||
int t = q & 15,i;
|
int t = q & 15,i;
|
||||||
if (p != 0 && p != 1) return stbi__err("bad DQT type","Corrupt JPEG");
|
if (p != 0 && p != 1) return stbi__err("bad DQT type","Corrupt JPEG");
|
||||||
if (t > 3) return stbi__err("bad DQT table","Corrupt JPEG");
|
if (t > 3) return stbi__err("bad DQT table","Corrupt JPEG");
|
||||||
|
|
||||||
for (i=0; i < 64; ++i)
|
for (i=0; i < 64; ++i)
|
||||||
z->dequant[t][stbi__jpeg_dezigzag[i]] = p == 0 ? stbi__get8(z->s) : stbi__get16be(z->s);
|
z->dequant[t][stbi__jpeg_dezigzag[i]] = sixteen ? stbi__get16be(z->s) : stbi__get8(z->s);
|
||||||
L -= p == 0 ? 65 : 129;
|
L -= (sixteen ? 129 : 65);
|
||||||
}
|
}
|
||||||
return L==0;
|
return L==0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user