2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
Commit Graph

85 Commits

Author SHA1 Message Date
chrox
c2924abac4 Fix OCR fails on native djvu pages
The page_width and page_height were always 600 and 800 before this patch
rendering the OCR engine confused.

This should fix #1379.
2015-03-31 10:31:02 +08:00
Hans-Werner Hilse
22697adf20 switch from scaleByDPI() to scaleBySize() 2014-11-23 12:13:32 +00:00
Hans-Werner Hilse
f9f97163e8 wait for background thread before free()ing koptcontext
This should prevent freeing resources that are actually in use in
a background thread.
2014-11-22 14:44:24 +00:00
chrox
b80dd1f966 add fulltext search for PDF documents 2014-11-17 17:58:44 +08:00
Hans-Werner Hilse
3066c86e38 Refactoring hardware abstraction
This is a major overhaul of the hardware abstraction layer.
A few notes:

General platform distinction happens in
  frontend/device.lua
which will delegate everything else to
  frontend/device/<platform_name>/device.lua
which should extend
  frontend/device/generic/device.lua

Screen handling is implemented in
  frontend/device/screen.lua
which includes the *functionality* to support device specifics.
Actually setting up the device specific functionality, however,
is done in the device specific setup code in the relevant
device.lua file.

The same goes for input handling.
2014-11-02 21:19:04 +01:00
chrox
8c9751744e fix #1064 by adding timestamp of document in cache key
so that when document is modified the persistent cache will
be invalidated automatically because the cache key will not
be matched. There is no perfermance overhead here at all. We
even don't need to check the modification time of the cache item
on disk, because the name of the on disk cache is a md5sum of the
cacheitem key, now the filename of the cache files contains the
modification time information.
If the document is modified since one rendered page is cached to disk,
the cache key won't match the cache file. And the cache file will
be discarded without the need to open the cache file or to check
the modification time of the cache file itself.
2014-10-30 11:05:26 +08:00
chrox
0bc3eadcae refactoring: use Document API getCoverPageImage to get cover image 2014-08-27 11:07:25 +08:00
chrox
120f18737e add advanced option forced_ocr to force ocring text 2014-07-17 22:32:20 +08:00
chrox
f507fd3709 various Android fix
now the android build has nearly the same features as the
Kindle/Kobo build. It's time for Android nightly build?
2014-05-29 16:07:40 +08:00
chrox
55734f6aaa export highlighted rect in scanned page to Evernote 2014-05-15 16:11:26 +08:00
chrox
e1527611c5 show a box indicator when tapping on a link
only for PDF/DJVU docs for now since there is no easy way
to get link box from crengine
2014-05-02 16:50:52 +08:00
chrox
775e5ea3b4 serialize the most recently used blitbuffer/koptcontext
to speedup koreader startup for PDF/DJVU documents
especially when reflowing
2014-04-30 23:24:47 +08:00
chrox
c6c4cbcab1 add dewatermark option for pdf/djvu documents 2014-04-07 00:22:47 +08:00
chrox
92219a1f1e cleanup: expand tab to 4 spaces 2014-03-13 21:52:43 +08:00
chrox
22c437c393 fix init koptcontext with all zero bbox 2014-01-23 19:35:45 +08:00
chrox
d24d5e413e add following page link in reflowed page 2014-01-21 11:59:17 +08:00
Paulo Matias
dacd3d2acb Fix crash trying to select text in an empty page 2014-01-19 01:03:28 -02:00
chrox
eaa9535133 move logMemoryUsage from koptinterface to document 2014-01-02 19:19:03 +08:00
chrox
8e4516b824 add regional zoom mode in pdf/djvu page
In regional zoom mode double tap will zoom to the tapped
region(paragraph or column, etc., detected optically via libk2pdfopt).
As the first demo, this feature is only turned on in flipping mode by
tapping the top-left corner of the screen. Eventually we may incorporate
this feature in "free" zoom mode.
2014-01-02 11:14:26 +08:00
chrox
62e12ddfba import document module on-demand 2013-12-31 13:12:56 +08:00
chrox
7247a9e3a2 add writing direction option when reflowing
This probably will fix #195.
2013-12-22 19:13:12 +08:00
chrox
2fd66e1fa3 typo fix 2013-12-04 22:17:05 +08:00
chrox
84ad0f2307 fix null export highlight in reflowed mode 2013-11-30 21:17:13 +08:00
chrox
71cb2d3f93 fix looking up wrong word in reflowed page
that has a text layer underneath.

For multi-column page reflowing usually fits individual column to
page width and no finner word boxes are available to map reflowed
word box onto native word box. Now the relative position of a reflowed
word center is calculated as portion of the width and height of a larger
block it belongs. This relative position is also considered in
reflow-to-native position transform so that dictionary lookup now works
on multi-column pages in reflowing mode.

This should fix #376.
2013-11-30 18:18:16 +08:00
chrox
5bf56cbf4c check position nullity in getTextFromBoxes 2013-10-28 21:49:54 +08:00
chrox
2590cc7ca5 highlight text from scratch instead of reusing rectmaps in reflowing mode 2013-10-25 13:22:49 +08:00
chrox
184a6f5d21 highlight word from scratch instead of reusing rectmaps in reflowing mode
Totally revert the OCR in reflowed page to build 545.
And this should fix #309.
2013-10-24 23:45:09 +08:00
chrox
90d55cbde4 set auto detect word gap in reflowing by default 2013-10-24 23:45:09 +08:00
chrox
4cfdce6105 fix several local calls of Math.round 2013-10-23 22:37:55 +08:00
HW
2154e7e852 Further refactoring
This should finish the work to make all globals to local variables.
That allows LuaJIT to properly compile things by interning the
references to the relevant parts (rather than looking up globals
all the time which stops a trace).
2013-10-22 17:11:31 +02:00
HW
ef111b99c6 Refactored to use strictly locals 2013-10-18 22:38:07 +02:00
chrox
9f42289226 use pixels from reflowed page when doing OCR in reflowing mode
I hope it will get back OCR accuracy as in build 545.
2013-10-14 23:06:05 +08:00
chrox
2cd5a083ae fix getAutoBBox failed bug
If getAutoBBox is fed with a blank page the returned bbox will be
much smaller than the native page dimensions. The problem is that
in zoom to 'content*' mode document renderer will try to render
the whole page at a zoom level that can cover the screen with the
bbox region of the page. That's if the blank page size is 3000*4000
and the returned autobbox is 300*400, the screen size is 600*800,
then the page will be rendered in 3000*(600/300)*4000*(800/400)
which is so large that the cache manager will not accept.

This patch just check if the returned autobbox is considerablely
much smaller than the native page dimensions. If so it will return
the manual bbox.

This patch should fix #293. And it's tested with the case provided
by @Markismus in #291.
2013-10-14 14:21:08 +08:00
chrox
1ee6d5a9c5 add DEBUGBT function to traceback certain location 2013-10-13 21:59:24 +08:00
chrox
39da1251ec free blitbuffer as soon as tile is kicked out from cache
other than waiting for the lazy garbage collector of lua
2013-10-13 15:30:48 +08:00
chrox
4660a3532b synchronize hightlights in non-/reflowing modes
and there is no need to OCR word if we can extract text from
original page in reflowing mode thanks to the rect maps between
normal page and reflowed page.
2013-10-12 23:07:13 +08:00
chrox
ffd31613a5 estimate cache size of koptcontext
This should fix #285.
2013-09-26 14:51:33 +08:00
chrox
f2cf10a015 refactoring koptcontext creation function 2013-09-14 12:56:10 +08:00
chrox
aefb58f5bf bugfix: fix invalid auto page cropping 2013-07-20 02:51:17 +08:00
chrox
1808c7e5c3 add document language option in config dialog
Document language setting is used for better text extraction and OCR.
2013-07-20 02:46:51 +08:00
chrox
2e5d2b9930 add semi-auto bbox option in page crop dialog 2013-07-13 11:18:49 +08:00
chrox
9cb9999865 semi-automatic bbox finding
Semi-automatic cropping is implemented with a initial
manual cropping that exclude the obvious decorating line or
the spine part in scanned books and then an automatic cropping
ie. background/foreground pixel detection restricted within
the manual cropping area.
This PR is a candidate for the solution of issue #141.
2013-07-09 19:15:45 +08:00
Qingping Hou
18122fe067 add defaults.lua 2013-07-01 02:41:33 -04:00
chrox
7c78e83e49 add hightlight/dictionary lookup in scanned pdf/djvu 2013-05-01 23:43:53 +08:00
chrox
cb873ee528 init/free OCR engine when necessary 2013-04-30 13:52:10 +08:00
chrox
1a8bd4ca8c try to drop cache before OCR 2013-04-27 17:48:59 +08:00
chrox
936dfc6fd1 add text highlight in both reflow and non-reflow mode 2013-04-24 06:59:52 +08:00
chrox
ac548d768c don't bother to consume background context
since now each context is independent and has its own dst bitmap.
2013-04-20 16:12:43 +08:00
chrox
fb05f9a428 add auto page crop 2013-04-14 15:16:42 +08:00
chrox
22b650d0c7 move kopt/cre options into ui/data directory & wrap strings in config options 2013-04-08 22:26:54 +08:00