Skip to content
Myr

Merge branch 'dequant-16-bits' of https://github.com/jeremysawicki/stb into working

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 · parents 014af7b, e08d398 · Browse files · 1 file+6 added−6 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+6 added−6 removed

  • other:+6 added−6 removed

1 file+6 added−6 removed

modified:stb_image.h+6 added-6 removed
1653 unmodified lines
1654{1655 stbi__context *s;1656 stbi__huffman huff_dc[4];1657 stbi__huffman huff_ac[4];1658 stbi_uc dequant[4][64];1658 stbi__uint16 dequant[4][64];1659 stbi__int16 fast_ac[4][1 << FAST_BITS];16601661// sizes for components, interleaved MCUs1662 int img_h_max, img_v_max;
236 unmodified lines
1899 63, 63, 63, 63, 63, 63, 631900};19011902// decode one 64-entry block--1903static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi_uc *dequant)1903static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi__uint16 *dequant)1904{1905 int diff,dc,k;1906 int t;1907
847 unmodified lines
2755 }2756 }2757}27582759static void stbi__jpeg_dequantize(short *data, stbi_uc *dequant)2759static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant)2760{2761 int i;2762 for (i=0; i < 64; ++i)2763 data[i] *= dequant[i];
35 unmodified lines
2799 while (L > 0) {2800 int q = stbi__get8(z->s);2801 int p = q >> 4;2802 int t = q & 15,i;2803 if (p != 0) return stbi__err("bad DQT type","Corrupt JPEG");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");2805 for (i=0; i < 64; ++i)2806 z->dequant[t][stbi__jpeg_dezigzag[i]] = stbi__get8(z->s);2807 L -= 65;2806 z->dequant[t][stbi__jpeg_dezigzag[i]] = p == 0 ? stbi__get8(z->s) : stbi__get16be(z->s);2807 L -= p == 0 ? 65 : 129;2808 }2809 return L==0;28102811 case 0xC4: // DHT - define huffman table
4233 unmodified lines