[Pkg-javascript-commits] [pdf.js] 93/139: Support EPH and SOP markers.
David Prévot
taffit at moszumanska.debian.org
Fri Jan 9 21:18:31 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit c7acbfd90148c751fe2093308d14540eff9b0fe5
Author: MaMazav <idanigra at hotmail.com>
Date: Wed Dec 17 12:55:52 2014 +0200
Support EPH and SOP markers.
---
src/core/jpx.js | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/core/jpx.js b/src/core/jpx.js
index c7e1fd4..c665689 100644
--- a/src/core/jpx.js
+++ b/src/core/jpx.js
@@ -324,12 +324,6 @@ var JpxImage = (function JpxImageClosure() {
cod.precinctsSizes = precinctsSizes;
}
var unsupported = [];
- if (cod.sopMarkerUsed) {
- unsupported.push('sopMarkerUsed');
- }
- if (cod.ephMarkerUsed) {
- unsupported.push('ephMarkerUsed');
- }
if (cod.selectiveArithmeticCodingBypass) {
unsupported.push('selectiveArithmeticCodingBypass');
}
@@ -816,6 +810,21 @@ var JpxImage = (function JpxImageClosure() {
bufferSize -= count;
return (buffer >>> bufferSize) & ((1 << count) - 1);
}
+ function skipMarkerIfEqual(value) {
+ if (data[offset + position - 1] === 0xFF &&
+ data[offset + position] === value) {
+ skipBytes(1);
+ return true;
+ } else if (data[offset + position] === 0xFF &&
+ data[offset + position + 1] === value) {
+ skipBytes(2);
+ return true;
+ }
+ return false;
+ }
+ function skipBytes(count) {
+ position += count;
+ }
function alignToByte() {
bufferSize = 0;
if (skipNextBit) {
@@ -843,9 +852,15 @@ var JpxImage = (function JpxImageClosure() {
}
var tileIndex = context.currentTile.index;
var tile = context.tiles[tileIndex];
+ var sopMarkerUsed = context.COD.sopMarkerUsed;
+ var ephMarkerUsed = context.COD.ephMarkerUsed;
var packetsIterator = tile.packetsIterator;
while (position < dataLength) {
alignToByte();
+ if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
+ // Skip also marker segment length and packet sequence ID
+ skipBytes(4);
+ }
if (!readBits(1)) {
continue;
}
@@ -928,6 +943,9 @@ var JpxImage = (function JpxImageClosure() {
});
}
alignToByte();
+ if (ephMarkerUsed) {
+ skipMarkerIfEqual(0x92);
+ }
while (queue.length > 0) {
var packetItem = queue.shift();
codeblock = packetItem.codeblock;
--
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