Skip to content
Myr

tweak 16-bit quantization for clarity

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parent 0befbc3 · Browse files · 1 file+4 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−3 removed

  • other:+4 added−3 removed

1 file+4 added−3 removed

modified:stb_image.h+4 added-3 removed
2796 unmodified lines
2797 case 0xDB: // DQT - define quantization table2798 L = stbi__get16be(z->s)-2;2799 while (L > 0) {2800 int q = stbi__get8(z->s);2801 int p = q >> 4;2801 int p = q >> 4, sixteen = (p != 0);2802 int t = q & 15,i;2803 if (p != 0 && p != 1) return stbi__err("bad DQT type","Corrupt JPEG");2804 if (t > 3) return stbi__err("bad DQT table","Corrupt JPEG");28052806 for (i=0; i < 64; ++i)2806 z->dequant[t][stbi__jpeg_dezigzag[i]] = p == 0 ? stbi__get8(z->s) : stbi__get16be(z->s);2807 L -= p == 0 ? 65 : 129;2807 z->dequant[t][stbi__jpeg_dezigzag[i]] = sixteen ? stbi__get16be(z->s) : stbi__get8(z->s);2808 L -= (sixteen ? 129 : 65);2809 }2810 return L==0;28112812 case 0xC4: // DHT - define huffman table
4233 unmodified lines