Merge pull request #11544 from Snuffleupagus/decodeHuffman
Make the `decodeHuffman` function, in `src/core/jpg.js`, slightly more efficient
This commit is contained in:
commit
7ae504222f
@ -178,12 +178,13 @@ var JpegImage = (function JpegImageClosure() {
|
||||
var node = tree;
|
||||
while (true) {
|
||||
node = node[readBit()];
|
||||
if (typeof node === "number") {
|
||||
return node;
|
||||
}
|
||||
if (typeof node !== "object") {
|
||||
throw new JpegError("invalid huffman sequence");
|
||||
switch (typeof node) {
|
||||
case "number":
|
||||
return node;
|
||||
case "object":
|
||||
continue;
|
||||
}
|
||||
throw new JpegError("invalid huffman sequence");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user