Optmized decodeRefinement, moving the prediction error outside the inner loop

There is no need to slow down the inner loop with a test for ltp as it can only
change if prediction is true in which case it only changes in the outer loop.
This commit is contained in:
p01 2014-03-10 14:58:32 +01:00
parent 840d9d40b6
commit 2b6cb317db

View File

@ -376,13 +376,13 @@ var Jbig2Image = (function Jbig2ImageClosure() {
if (prediction) {
var sltp = decoder.readBit(contexts, pseudoPixelContext);
ltp ^= sltp;
if (ltp) {
error('JBIG2 error: prediction is not supported');
}
}
var row = new Uint8Array(width);
bitmap.push(row);
for (var j = 0; j < width; j++) {
if (ltp) {
error('JBIG2 error: prediction is not supported');
}
var contextLabel = 0;
for (var k = 0; k < codingTemplateLength; k++) {