| <<<Back 1 day (to 2012/12/01) | 2012/12/02 |
Cuong | Hi all, i am using MUPDF library in iOS. It is very slow when opening graphics PDF files. I found the bottleneck at function fz_paint_affine_N_lerp | 08:27.29 |
| Should I optimize the function fz_paint_affine_N_lerp by using OpenGLES? | 08:28.26 |
sebras | Cuong: you should probably be speaking to tor8. | 10:46.25 |
| Cuong: or Robin_Watts. | 10:46.34 |
Cuong | Thanks I already email to Tor8. Waiting for his reply. | 10:47.07 |
sebras | Cuong: alright, hard to know from irc. :) | 10:47.24 |
tor8 | Robin_Watts is a better choice to ask about rendering performance | 10:48.03 |
sebras | Cuong: https://itunes.apple.com/us/app/mupdf/id482941798?mt=8 do you see similar problems when using this ios app? | 10:48.10 |
Cuong | I Open single PDF file is not problem | 10:48.37 |
sebras | tor8: true, I was thinking that you're the go-to guy for ios though. anyway... | 10:48.59 |
Cuong | But opening more than one PDF files. App randomly crashes | 10:49.02 |
| I guess some conflicts in static variables context... | 10:49.48 |
tor8 | Cuong: the iOS app isn't designed for more than one PDF file. It very carefully synchronizes the main and worker thread. | 10:49.56 |
sebras | tor8: maybe we should clarify this about mupdf -- it seems as if it is a common question/issue when using mupdf. | 10:51.07 |
Cuong | But in iPad, user wants to open several PDF files. It is whole different with iPhone situation | 10:51.19 |
sebras | tor8: about multi-threading I mean. | 10:51.20 |
tor8 | Cuong: are you a paying customer? Apple does not look kindly on GPL apps in the app store, so you may want to look into acquiring a commercial license. | 10:51.22 |
| Cuong: the MuPDF core library can do multi-threaded stuff with a bit of care. the iOS viewer doesn't, but that's a limit in the ObjC viewer code rather than the mupdf library. | 10:52.08 |
Cuong | I see. I am new to MuPDF, just want to develop a free app viewing PDF magazines | 10:52.40 |
sebras | Cuong: do you want to distribute you app through Apple's app store? | 10:53.26 |
Cuong | Yes | 10:53.34 |
| Then do I have to pay licensing fee for MuPDF authors? | 10:53.54 |
sebras | Cuong: MuPDF is available under either GNU Public License or a commercial licensen with Artifex (the company that owns MuPDF | 10:55.42 |
| Cuong: since Apple does not seem to allow apps to be released under GPL I guess that option is closed for you. | 10:56.10 |
| Cuong: and that basically only leaves you with the commercial route. | 10:56.26 |
| but I'm not a representative for Artifex, so don't take anything I write too seriously. :) | 10:57.02 |
Cuong | That means I have to buy commercial license of MuPDF to distribute apps to AppStore? | 10:57.25 |
sebras | Cuong: basically yes. | 10:57.34 |
| Cuong: I guess that if you only intend to distribute the source code on your own website for other's to compile on their own then the situation is different. | 10:58.12 |
Cuong | If I can fix some problems in MuPDF then distributing fixed source code (mostly in iOS) is no problem | 10:59.23 |
sebras | Cuong: if you see a bug in MuPDFs code then we'd be happy to have you register a bug over at bugs.ghostscript.com (supplying a patch would be excellent). | 11:01.06 |
Cuong | Sure, I will do. Regarding license of muPDF I will check with Artiflex | 11:01.45 |
sebras | Cuong: if you come back here on monday I'm sure one of the guys working for Artifex will help you. | 11:02.27 |
Cuong | Thanks Sebras, I will back here on Monday. | 11:03.13 |
sebras | Cuong: no problem. :) | 11:03.26 |
tor8 | Cuong: we are also looking into (but long term project, no people or time has been allocated for it yet) using GLES 2 to speed up the renderer | 11:06.51 |
Cuong | I dig into code but don't understand much. I will try to improve performance of UIScrollView first | 11:08.55 |
tor8 | Cuong: fz_paint_affine_N_lerp sounds like a wrong function to be used; we have special case functions for 1, 3 and 4 component images | 11:09.37 |
Cuong | if it does not gain much, I think using OpenGL ES to render may be good choice | 11:09.49 |
| I found fz_paint_affine_N_lerp because it is shown in XCode Instrument | 11:10.19 |
| as the functions that consumes 30-37% CPU time | 11:10.38 |
tor8 | Cuong: I'm not convinced; you'll need lots of FBOs for many different render targets and they're all used dependently to do clipping, soft masks, transparency groups, etc | 11:11.22 |
| so the setup overhead of talking to GL may outweigh the benefits | 11:11.36 |
| Cuong: right. compiled in debug mode? | 11:12.33 |
Cuong | If I understand more how MUPDF renders image of PDF page, then some how I can justify whether using OpenGLES is good or not | 11:13.27 |
tor8 | Cuong: anyway, image drawing is expensive because of the bilinear filtering that needs to be done. | 11:13.29 |
| Cuong: if you look at fz_device structure in fitz-internal.h there is a list of functions that need to be implemented | 11:14.16 |
Cuong | My team developed a filter using GPUImage, a library heavily uses OpenGLES, performance is far better than basic calculations in CPU | 11:14.32 |
tor8 | you probably want to make a new device to draw using GLES to do the work rather than software as our current fz_draw_device | 11:14.45 |
| so all those functions will have to be implemented | 11:15.02 |
Cuong | I see | 11:15.13 |
tor8 | clipping throws a spanner in the works from how opengl normally operates | 11:15.15 |
| otherwise we'd already have done it :) it may be possible to speed up only some operations like drawing an image, and doing the rest in software, if you can get GLES to work on fz_pixmaps as render targets without copying data | 11:16.00 |
sebras | Cuong: I have a contact for you concerning commercial licensing of MuPDF. You ought to contact Scott Sackett, Vice President - Sales & Licensing, Artifex Software, (940) 482-7985, scott.sackett@artifex.com | 11:16.31 |
Cuong | Thanks Sebras | 11:16.46 |
tor8 | Cuong: the apple situation regarding GPL is unfortunate | 11:16.52 |
| but Apple can't legally distribute GPL software in the app store | 11:17.13 |
Cuong | If the app opens source code then can it be legally distributed? | 11:18.08 |
tor8 | Cuong: yes, by you. but not by apple in the app store (since apple applies DRM and breaks many GPL clauses) | 11:19.04 |
| we can do it, because we own the copyright and can make an exception for the app store ourselves | 11:19.50 |
sebras | Cuong: so the MuP | 11:20.14 |
tor8 | you'll need to come in tomorrow and ask again, I'm not a legal expert. | 11:20.41 |
sebras | MuPDF app you see in Apples app store is not distributed under GPL, but the source code you see on mupdf.com _is_. | 11:20.52 |
tor8 | sebras: correct. | 11:21.08 |
sebras | tor8: I wish Apple would ease their restrictions though so this would be easier to explain. | 11:21.49 |
tor8 | sebras: you and me both. but they love their walled garden. | 11:22.04 |
Cuong | One question: an app contains modified code of MuPDF and many other many other codes not relates with MuPDF. Can developer just release modified MuPDf code? | 11:23.18 |
tor8 | cuong: no, your whole source code that uses mupdf needs to be open sourced. we use GPL 3, not LGPL. | 11:24.13 |
| again, we are happy to sell you a commercial license if you don't want to comply :) | 11:24.42 |
Cuong | I see. With commercial license, does developers get any additional support from MuPDF? | 11:26.02 |
tor8 | Cuong: that depends on the exact license. You'll need to talk to Scott about the details. | 11:26.30 |
Cuong | ok, | 11:26.50 |
tor8 | Cuong: we do look at bugs reported by free users, but we can't make any promise to give them any priority | 11:27.09 |
Cuong | I will email to Scott Sackett tomorrow | 11:29.03 |
Robin_Watts | tor8, sebras: Cast your eyes over my bmpbmpc results. | 11:52.20 |
| bmpcmp, even. | 11:52.27 |
| That's the result of me changing all clip planes to be rendered without AA. | 11:52.59 |
| That brings us more into line with what Acrobat does. | 11:53.15 |
| and solves bug 693459. | 11:53.37 |
| Forward 1 day (to 2012/12/03)>>> | |