[Pkg-javascript-commits] [pdf.js] 30/161: Use changingTemplateX, Y and Bit in JBIG2's decodeBitmap
David Prévot
taffit at moszumanska.debian.org
Sat Apr 19 14:16:20 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 0bca56cbb236fbba01aa74db477ffcf3e53c2953
Author: p01 <p01 at opera.com>
Date: Fri Mar 7 17:26:56 2014 +0100
Use changingTemplateX, Y and Bit in JBIG2's decodeBitmap
---
src/core/jbig2.js | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/core/jbig2.js b/src/core/jbig2.js
index 4cf95e5..14ca23c 100755
--- a/src/core/jbig2.js
+++ b/src/core/jbig2.js
@@ -255,9 +255,17 @@ var Jbig2Image = (function Jbig2ImageClosure() {
changingTemplateEntries.push(k);
}
}
- changingTemplateEntries = new Uint8Array(changingTemplateEntries);
var changingEntriesLength = changingTemplateEntries.length;
+ var changingTemplateX = new Int8Array(changingEntriesLength);
+ var changingTemplateY = new Int8Array(changingEntriesLength);
+ var changingTemplateBit = new Uint16Array(changingEntriesLength);
+ for (var c = 0; c < changingEntriesLength; c++) {
+ k = changingTemplateEntries[c];
+ changingTemplateX[c] = template[k].x;
+ changingTemplateY[c] = template[k].y;
+ changingTemplateBit[c] = 1 << (templateLength - 1 - k);
+ }
// Get the safe bounding box edges from the width, height, minX, maxX, minY
var sbb_left = -minX;
@@ -293,16 +301,19 @@ var Jbig2Image = (function Jbig2ImageClosure() {
// If yes, we can just shift the bits that are reusable and only
// fetch the remaining ones.
contextLabel = (contextLabel << 1) & reuseMask;
- for (c = 0; c < changingEntriesLength; c++) {
- k = changingTemplateEntries[c];
- i0 = i + templateY[k];
- j0 = j + templateX[k];
- contextLabel |= bitmap[i0][j0] << (templateLength - 1 - k);
+ for (k = 0; k < changingEntriesLength; k++) {
+ i0 = i + changingTemplateY[k];
+ j0 = j + changingTemplateX[k];
+ bit = bitmap[i0][j0];
+ if (bit) {
+ bit = changingTemplateBit[k];
+ contextLabel |= bit;
+ }
}
} else {
// compute the contextLabel from scratch
contextLabel = 0;
- var shift = templateLength - 1;
+ shift = templateLength - 1;
for (k = 0; k < templateLength; k++, shift--) {
j0 = j + templateX[k];
if (j0 >= 0 && j0 < width) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list