From 74604d7b8ae98b125f1c800da753f8ab67474eb5 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Sun, 7 Sep 2014 16:32:08 -0400 Subject: cleanup --- djvu.js/image.jb2 | Bin 7726 -> 0 bytes djvu.js/test_djvu.cpp | 19 ------------ djvu.js/zpcoder.js | 83 -------------------------------------------------- string_utils.py | 25 --------------- 4 files changed, 127 deletions(-) delete mode 100644 djvu.js/image.jb2 delete mode 100644 djvu.js/test_djvu.cpp delete mode 100644 djvu.js/zpcoder.js diff --git a/djvu.js/image.jb2 b/djvu.js/image.jb2 deleted file mode 100644 index 774a25d..0000000 Binary files a/djvu.js/image.jb2 and /dev/null differ diff --git a/djvu.js/test_djvu.cpp b/djvu.js/test_djvu.cpp deleted file mode 100644 index 5e09a64..0000000 --- a/djvu.js/test_djvu.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -#include -#include - -int main(){ - int fh = open("image.jb2", O_RDONLY, 0); - int fh2 = open("image.pbm", O_WRONLY | O_CREAT, 0600); - GP gbs = ByteStream::create(fh, "r", true); - GP gbs2 = ByteStream::create(fh2, "w", true); - GP img = JB2Image::create(); - img->decode(gbs, 0, 0); - int w =img->get_width(); - int h = img->get_height(); - GP gbmp = img->get_bitmap(1, 1); - gbmp->save_pbm(*gbs2); - printf("taille est %d %d", w, h); -} diff --git a/djvu.js/zpcoder.js b/djvu.js/zpcoder.js deleted file mode 100644 index 7c31166..0000000 --- a/djvu.js/zpcoder.js +++ /dev/null @@ -1,83 +0,0 @@ -var ZPDecoder = { - create: function(gbs){ - }; - decoder: function(ctx){ - }; - //table - p: new Uint32Array(256); - m: new Uint32Array(256); - up: new Uint8Array(256); - dn: new Uint8Array(256); - //machine independent ffz - ffzt: new Int8Array(256); - ffz: function(x) { - //find first zero bit - return (x>=0xff00) ? (ffzt[x&0xff]+8) : (ffzt[(x>>8)&0xff]); - }; - - init: function() { - var i, j; - for(i = 0; i<256; i++){ - for(j = i; j&0x80; j<<=1){ - this.ffzt[i] += 1; - } - } - this.delay = 25; - this.scount = 0; - this.preload(); - fence = code; - if (code >= 0x8000) - fence = 0x7fff; - }; - - preload: function() { - while(this.scount <= 24){ - if( - } - } - }; - - decode_sub: function(ctx, z){ - // Save bit - var bit = ctx & 1; - // Avoid interval reversion - d = 0x6000 + ((z+a)>>2); - if( z > this.d) - z = this.d; - if( z > this.code) { - /* LPS branch */ - z = 0x10000 - z; - this.a = this.a + z; - this.code = this.code + z; - /* LPS adaptation */ - ctx = this.dn[ctx]; - /* LPS renormalization */ - var shift = ffz(a); - this.scount -= shift; - this.a = (a<>scount) & ((1<= 0x8000) - fence = 0x7fff; - return bit ^ 1; - }else { - /* MPS adaptation */ - if (this.a >= this.m[ctx]) - ctx = up[ctx]; - /* MPS renormalization */ - this.scount -= 1; - a = (unsigned short)(z<<1); - this.code = (code<<1) % 65536 | ((buffer>>scount) & 1); - if (this.scount<16) this.preload(); - /* Adjust fence */ - this.fence = this.code; - if (this.code >= 0x8000) - this.fence = 0x7fff; - return bit; - } - }; - IWdecoder: function(){ - return decode_sub_simple(0, 0x8000 = ((this.a + this.a + this.a) >> 3)); - } -} diff --git a/string_utils.py b/string_utils.py index 0588418..b6c8ce0 100644 --- a/string_utils.py +++ b/string_utils.py @@ -31,31 +31,6 @@ def cut(word, left, right): l = [aux(i) for i in xrange(len(word) + 1)] return min(l, key=lambda x: x[2])[:2] -def LCS(X, Y): - m = len(X) - n = len(Y) - # An (m+1) times (n+1) matrix - C = [[0] * (n+1) for i in range(m+1)] - for i in range(1, m+1): - for j in range(1, n+1): - if X[i-1] == Y[j-1]: - C[i][j] = C[i-1][j-1] + 1 - else: - C[i][j] = max(C[i][j-1], C[i-1][j]) - return C - -def printDiff(C, X, Y, i, j): - if i > 0 and j > 0 and X[i-1] == Y[j-1]: - printDiff(C, X, Y, i-1, j-1) - print " " + X[i-1] - else: - if j > 0 and (i == 0 or C[i][j-1] >= C[i-1][j]): - printDiff(C, X, Y, i, j-1) - print "+ " + Y[j-1] - elif i > 0 and (j == 0 or C[i][j-1] < C[i-1][j]): - printDiff(C, X, Y, i-1, j) - print "- " + X[i-1] - def join_ocr_words(l, c): m = list(l) if len(l) >= 2 and c[-2][2] > c[-1][0] and (not l[-2][-1].isalnum()): -- cgit v1.2.3-70-g09d2