venture doodleloop: the GIF encoder widens its codes when the decoder does, so exported GIFs decode (hand-finished)
This commit is contained in:
1 parent
d28d9f7679
commit
8ab50338ba
1 file changed
+2
-1
@@ -799,7 +799,7 @@
|
||||
emit(prefix);
|
||||
if (nextCode < 4096) {
|
||||
dict[wk] = nextCode++;
|
||||
if (nextCode === (1 << codeSize) && codeSize < 12) codeSize++;
|
||||
if (nextCode === (1 << codeSize) + 1 && codeSize < 12) codeSize++; // the decoder adds each entry one code later
|
||||
} else {
|
||||
emit(clear);
|
||||
dict = Object.create(null);
|
||||
@@ -810,6 +810,7 @@
|
||||
}
|
||||
}
|
||||
emit(wKey.indexOf(",") === -1 ? +wKey : dict[wKey]);
|
||||
if (nextCode === (1 << codeSize) && codeSize < 12) codeSize++; // the decoder's last entry can widen the end code
|
||||
emit(eoi);
|
||||
var acc = 0, nbits = 0, bytesOut = [];
|
||||
for (i = 0; i < outBits.length; i += 2) {
|
||||
|
||||
Reference in new issue
Block a user