libjpeg 6b vs libjpeg_turbo

285 views
Skip to first unread message

S.J. Becker

unread,
Sep 24, 2015, 3:14:50 PM9/24/15
to pdfium
I'm building a utility program which outputs group4 tif files for monochrome and jpeg files for color.

I ran into problems linking with a modern jpg library because 6b is linked in from the third_party folder.
Since jpeg_stdio_dest and jpeg_stdio_src are stripped out, I presume that it's being used by pdfium
to read pdf embedded jpg images from memory.

libjpeg_turbo is over twice as fast and proven on all platforms. Modifying my code to cope with the
limitations of 6b works but it's very slow.

Making pdfium use libjpeg_turbo and optionally the system library could really speed up the loading
of pdfs which contain jpeg images from chromium and chrome (and my app).

S.J. Becker

unread,
Sep 25, 2015, 5:42:26 PM9/25/15
to pdfium

I just found:
#if !defined(_FX_JPEG_TURBO_)

at the top of one of the third_party/libjpeg files.

Where does this get defined? What else can I configure?

Lei Zhang

unread,
Oct 15, 2015, 9:40:36 PM10/15/15
to pdfium
I don't know where the _FX_JPEG_TURBO_ checks came from. Maybe FoxIt was experimenting with using libjpeg_turbo. We definitely want to move to that so Chromium does not need to ship with both libraries.

Lei Zhang

unread,
Oct 15, 2015, 10:08:23 PM10/15/15
to pdfium
https://code.google.com/p/chromium/issues/detail?id=541704 is relevant.
> --
> You received this message because you are subscribed to the Google Groups
> "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pdfium+un...@googlegroups.com.
> To post to this group, send email to pdf...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pdfium/3d8aee7a-12b6-435a-86a5-e17482c198e7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

S.J. Becker

unread,
Feb 12, 2016, 7:05:37 PM2/12/16
to pdfium


On Thursday, October 15, 2015 at 7:08:23 PM UTC-7, Lei Zhang wrote:
https://code.google.com/p/chromium/issues/detail?id=541704 is relevant.



I made a post on that issue to further the discussion and found out:
1) as of november, chromium builds without thirdparty/libjpeg
2) my needs concerned pdfium standalone so I needed to create an issue in

So I did.

I also checked out and configured the chromium source tree and then
searched around for libjpeg and found:

libjpeg_gyp_path in the gyp files
   and
use_system_libjpeg in the gn files

So we are probably close to getting the standalone to support
a different copy of libjpeg.

I don't know much about the build systems. Does the standalone
support .gn yet?

TIA

Lei Zhang

unread,
Feb 12, 2016, 7:16:51 PM2/12/16
to S.J. Becker, pdfium
The standalone build uses GYP. It does not support GN yet. If you want
to do standalone PDFium build with libjpeg-turbo, you'll need to:

- Copy the libjpeg-turbo source to third_party/libjpeg_turbo.
- Change the libjpeg_gyp_path variable in build/standalone.gypi to
point to the right place.
- Add 'defines': ['USE_LIBJPEG_TURBO=1'] in the right GYP targets, so
all the places that check for USE_LIBJPEG_TURBO have it defined.
- Generate new build files with gyp_pdfium or gclient runhooks, cross
fingers, and rebuild.
> --
> You received this message because you are subscribed to the Google Groups
> "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pdfium+un...@googlegroups.com.
> To post to this group, send email to pdf...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pdfium/2466222a-e5fb-405f-86a9-0e870b2b1904%40googlegroups.com.

Lei Zhang

unread,
Feb 17, 2016, 8:09:57 PM2/17/16
to S.J. Becker, pdfium
I see you filed
https://bugs.chromium.org/p/pdfium/issues/detail?id=389 - shall we
continue the conversation there?

S.J. Becker

unread,
Feb 18, 2016, 3:15:07 PM2/18/16
to pdfium, sco...@quickeye.us

For the benefit of anyone reading this, if you open this link, you can see
steps to get pdfium linked with the system libjpeg or libjpeg-turbo.

On average turbo is twice as fast as the old libjpeg. If anyone needs to
save the converted image as a jpeg, I can give you some code to accomplish
this.

M ForSure

unread,
May 15, 2022, 11:00:25 PM5/15/22
to pdfium
Has there been any progress with this? 
Scott's idea to keep this thread updates is appreciated, Thanks for that. 

Lei Zhang

unread,
Jun 10, 2022, 6:16:33 PM6/10/22
to M ForSure, pdfium
You are referencing a thread from 6 years ago. What exactly are you
asking about exactly?
https://bugs.chromium.org/p/pdfium/issues/detail?id=389 has been
marked as fixed a several years now.
> --
> You received this message because you are subscribed to the Google Groups "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/a85e052a-2631-41fe-a25d-d08dcbd96492n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages