Bug#743677: didjvu: RuntimeError: std::bad_alloc

2014-04-05 Thread Janusz S. Bień
Package: didjvu
Version: 0.2.7-1
Severity: normal

When trying to convert to DjVu the scans from

http://www.polona.pl/item/304920/0/

(you need to log to download them, but a Google account will do)

I get

--8---cut here---start-8---
jsbien@cauda:~/Kazania$ /usr/bin/time --version
GNU time 1.7
jsbien@cauda:~/Kazania$ /usr/bin/time didjvu bundle --fg-subsample 1 
--bg-subsample 1 -o Kazania_1-1.djvu *.jpg
0015.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.9mRyH8.iw44 -- /tmp/didjvu.9mRyH8.iw44 (192953 bytes)
  BG44=/tmp/didjvu.8JrMo7.iw44 -- /tmp/didjvu.8JrMo7.iw44 (273246 bytes)
- 0.413 bits/pixel; 2.337:1, 57.21% saved, 3179253 bytes in, 1360504 bytes out
0016.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.Lmlaxd.iw44 -- /tmp/didjvu.Lmlaxd.iw44 (114707 bytes)
  BG44=/tmp/didjvu.A3RioQ.iw44 -- /tmp/didjvu.A3RioQ.iw44 (643929 bytes)
- 0.305 bits/pixel; 3.708:1, 73.03% saved, 3554038 bytes in, 958587 bytes out
0017.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.StdNIt.iw44 -- /tmp/didjvu.StdNIt.iw44 (39129 bytes)
  BG44=/tmp/didjvu.ulu9av.iw44 -- /tmp/didjvu.ulu9av.iw44 (140061 bytes)
- 0.194 bits/pixel; 4.008:1, 75.05% saved, 782287 bytes in, 195165 bytes out
0018.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.DOXSuu.iw44 -- /tmp/didjvu.DOXSuu.iw44 (41671 bytes)
  BG44=/tmp/didjvu.w_KvYJ.iw44 -- /tmp/didjvu.w_KvYJ.iw44 (103356 bytes)
- 0.205 bits/pixel; 3.918:1, 74.48% saved, 604421 bytes in, 154254 bytes out
0019.jpg:
- reading image
- converting to DjVu
Traceback (most recent call last):
  File /usr/bin/didjvu, line 9, in module
didjvu.main()
  File /usr/share/didjvu/lib/didjvu.py, line 202, in __init__
parser.parse_args(actions=self)
  File /usr/share/didjvu/lib/cli.py, line 217, in parse_args
return action(o)
  File /usr/share/didjvu/lib/didjvu.py, line 343, in bundle
self.bundle_simple(o)
  File /usr/share/didjvu/lib/didjvu.py, line 372, in bundle_simple
parallel_for(o, self._bundle_simple_page, o.input, o.masks, 
component_filenames)
  File /usr/share/didjvu/lib/didjvu.py, line 58, in parallel_for
f(o, *args)
  File /usr/share/didjvu/lib/didjvu.py, line 359, in _bundle_simple_page
self.encode_one(o, input, mask, component, None)
  File /usr/share/didjvu/lib/didjvu.py, line 286, in encode_one
djvu_doc = image_to_djvu(width, height, image, mask, options=o)
  File /usr/share/didjvu/lib/didjvu.py, line 157, in image_to_djvu
bg_djvu = make_layer(image, mask, subsample_bg, options.bg_options)
  File /usr/share/didjvu/lib/didjvu.py, line 138, in make_layer
image, mask = subsampler(image, mask, options)
  File /usr/share/didjvu/lib/didjvu.py, line 134, in subsample_bg
image = image.resize(dim, 1)
RuntimeError: std::bad_alloc
Command exited with non-zero status 1
306.00user 11.22system 4:44.51elapsed 111%CPU (0avgtext+0avgdata 
2479212maxresident)k
36648inputs+1419240outputs (69major+4278373minor)pagefaults 0swaps
jsbien@cauda:~/Kazania$ free
 total   used   free sharedbuffers cached
Mem:   411007212245162885556 155912  28816 299428
-/+ buffers/cache: 8962723213800
Swap:  8450184  118008438384
--8---cut here---end---8---


The same problems occurs with the following invocation:

--8---cut here---start-8---
jsbien@cauda:~/Kazania$  /usr/bin/time didjvu encode --fg-subsample 1 
--bg-subsample 1 --output-template Kazania_1-1_{base-ext}.djvu *.jpg
--8---cut here---end---8---

However it does not occur when the scan are processed one by one, e.g.

--8---cut here---start-8---
jsbien@cauda:~/Kazania$ /usr/bin/time didjvu encode --fg-subsample 1 
--bg-subsample 1 --output-template Kazania_1-1_{base-ext}.djvu 0019.jpg
0019.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.FAdJjC.iw44 -- /tmp/didjvu.FAdJjC.iw44 (418952 bytes)
  BG44=/tmp/didjvu.iFWFeB.iw44 -- /tmp/didjvu.iFWFeB.iw44 (566114 bytes)
- 0.535 bits/pixel; 2.547:1, 60.74% saved, 4294019 bytes in, 1685892 bytes out
100.72user 3.92system 1:28.58elapsed 118%CPU (0avgtext+0avgdata 
1424168maxresident)k
15112inputs+455368outputs (61major+1461927minor)pagefaults 0swaps
--8---cut here---end---8---

Regards

Janusz

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.13-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages didjvu depends on:
ii  djvulibre-bin  3.5.25.4-4
ii  libpython2.7-stdlib [python-argparse]  2.7.6-8
ii  minidjvu   0.8.svn.2010.05.06+dfsg-3
ii  python 2.7.5-5
ii  python-argparse   

Bug#743677: Fwd: Bug#743677: didjvu: RuntimeError: std::bad_alloc

2014-04-05 Thread Daniel Stender
Hi Jakub,

maybe you've seen that already.

Greetings,
Daniel

 Original Message 
Subject: Bug#743677: didjvu: RuntimeError: std::bad_alloc
Resent-Date: Sat, 05 Apr 2014 06:24:02 +
Resent-From: jsb...@mimuw.edu.pl (Janusz S. Bień)
Resent-To: debian-bugs-dist@lists.debian.org
Resent-CC: jsb...@mimuw.edu.pl, Daniel Stender dan...@danielstender.com
Date: Sat, 05 Apr 2014 08:14:29 +0200
From: jsb...@mimuw.edu.pl (Janusz S. Bień)
Reply-To: jsb...@mimuw.edu.pl (Janusz S. Bień), 743...@bugs.debian.org
To: Debian Bug Tracking System sub...@bugs.debian.org

Package: didjvu
Version: 0.2.7-1
Severity: normal

When trying to convert to DjVu the scans from

http://www.polona.pl/item/304920/0/

(you need to log to download them, but a Google account will do)

I get

--8---cut here---start-8---
jsbien@cauda:~/Kazania$ /usr/bin/time --version
GNU time 1.7
jsbien@cauda:~/Kazania$ /usr/bin/time didjvu bundle --fg-subsample 1
--bg-subsample 1 -o Kazania_1-1.djvu *.jpg
0015.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.9mRyH8.iw44 -- /tmp/didjvu.9mRyH8.iw44 (192953 bytes)
  BG44=/tmp/didjvu.8JrMo7.iw44 -- /tmp/didjvu.8JrMo7.iw44 (273246 bytes)
- 0.413 bits/pixel; 2.337:1, 57.21% saved, 3179253 bytes in, 1360504
bytes out
0016.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.Lmlaxd.iw44 -- /tmp/didjvu.Lmlaxd.iw44 (114707 bytes)
  BG44=/tmp/didjvu.A3RioQ.iw44 -- /tmp/didjvu.A3RioQ.iw44 (643929 bytes)
- 0.305 bits/pixel; 3.708:1, 73.03% saved, 3554038 bytes in, 958587
bytes out
0017.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.StdNIt.iw44 -- /tmp/didjvu.StdNIt.iw44 (39129 bytes)
  BG44=/tmp/didjvu.ulu9av.iw44 -- /tmp/didjvu.ulu9av.iw44 (140061 bytes)
- 0.194 bits/pixel; 4.008:1, 75.05% saved, 782287 bytes in, 195165 bytes out
0018.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.DOXSuu.iw44 -- /tmp/didjvu.DOXSuu.iw44 (41671 bytes)
  BG44=/tmp/didjvu.w_KvYJ.iw44 -- /tmp/didjvu.w_KvYJ.iw44 (103356 bytes)
- 0.205 bits/pixel; 3.918:1, 74.48% saved, 604421 bytes in, 154254 bytes out
0019.jpg:
- reading image
- converting to DjVu
Traceback (most recent call last):
  File /usr/bin/didjvu, line 9, in module
didjvu.main()
  File /usr/share/didjvu/lib/didjvu.py, line 202, in __init__
parser.parse_args(actions=self)
  File /usr/share/didjvu/lib/cli.py, line 217, in parse_args
return action(o)
  File /usr/share/didjvu/lib/didjvu.py, line 343, in bundle
self.bundle_simple(o)
  File /usr/share/didjvu/lib/didjvu.py, line 372, in bundle_simple
parallel_for(o, self._bundle_simple_page, o.input, o.masks,
component_filenames)
  File /usr/share/didjvu/lib/didjvu.py, line 58, in parallel_for
f(o, *args)
  File /usr/share/didjvu/lib/didjvu.py, line 359, in _bundle_simple_page
self.encode_one(o, input, mask, component, None)
  File /usr/share/didjvu/lib/didjvu.py, line 286, in encode_one
djvu_doc = image_to_djvu(width, height, image, mask, options=o)
  File /usr/share/didjvu/lib/didjvu.py, line 157, in image_to_djvu
bg_djvu = make_layer(image, mask, subsample_bg, options.bg_options)
  File /usr/share/didjvu/lib/didjvu.py, line 138, in make_layer
image, mask = subsampler(image, mask, options)
  File /usr/share/didjvu/lib/didjvu.py, line 134, in subsample_bg
image = image.resize(dim, 1)
RuntimeError: std::bad_alloc
Command exited with non-zero status 1
306.00user 11.22system 4:44.51elapsed 111%CPU (0avgtext+0avgdata
2479212maxresident)k
36648inputs+1419240outputs (69major+4278373minor)pagefaults 0swaps
jsbien@cauda:~/Kazania$ free
 total   used   free sharedbuffers cached
Mem:   411007212245162885556 155912  28816 299428
-/+ buffers/cache: 8962723213800
Swap:  8450184  118008438384
--8---cut here---end---8---


The same problems occurs with the following invocation:

--8---cut here---start-8---
jsbien@cauda:~/Kazania$  /usr/bin/time didjvu encode --fg-subsample 1
--bg-subsample 1 --output-template Kazania_1-1_{base-ext}.djvu *.jpg
--8---cut here---end---8---

However it does not occur when the scan are processed one by one, e.g.

--8---cut here---start-8---
jsbien@cauda:~/Kazania$ /usr/bin/time didjvu encode --fg-subsample 1
--bg-subsample 1 --output-template Kazania_1-1_{base-ext}.djvu 0019.jpg
0019.jpg:
- reading image
- converting to DjVu
  BG44=/tmp/didjvu.FAdJjC.iw44 -- /tmp/didjvu.FAdJjC.iw44 (418952 bytes)
  BG44=/tmp/didjvu.iFWFeB.iw44 -- /tmp/didjvu.iFWFeB.iw44 (566114 bytes)
- 0.535 bits/pixel; 2.547:1, 60.74% saved, 4294019 bytes in, 1685892
bytes out
100.72user 3.92system 1:28.58elapsed 118%CPU (0avgtext+0avgdata
1424168maxresident)k
15112inputs+455368outputs (61major+1461927minor)pagefaults 0swaps
--8---cut here---end---8---

Regards