[Interest] [Qt-iOS] How can I linked to libjpeg-turbo?

Liang Jian jianliang79 at gmail.com
Wed Dec 17 14:21:29 CET 2014


    First of all, thank you for the reply!
    libjpeg-turbo uses NEON instruction to accelerate decoding, it should
give significant performance boost. And since QImage will decode jpeg file
into ARGB pixel format which will introduce YUV-->RGB color space
conversion, it is slow to do it in CPU. The way I do it is to use
libjpeg-turbo to decode a jpeg file into YUV planar pixel buffer, and then
I will use GLES2 fragment shader to perform YUV->RGB color space conversion
by GPU and then display it in QtQuick's scene graph, that is the fastest
way I can imagine.
    The first way you have suggested require rebuilding qt-iOS, that is a
burden too heavy for us. In fact in Qt-5.3.2 days, We have to build Qt-iOS
with a patch to work around an landscape issue introduced in iOS 8, but I
have encountered many problems with the qt built by myself , such as I
can't use it in QtCreator but I can use it in xcode(I don't know why :-) ).
    The second way require modification of libjpeg-turbo ( maybe remove the
entire old libjpeg style API ) which is beyond me.

    Is it possible to solve this issue by some kind of linker magic? For
example, MSVC support #pragma comment(lib, "lib"), that will only link the
lib inside the specific object file. But I can't find the equivalent thing
in clang.
    And there is one thing I can't understand: xcode didn't ship libjpeg in
its iOS SDK and I can't find libjpeg shipped with Qt-iOS, then where is the
libjpeg library Qt-iOS linked by default?

On Wed, Dec 17, 2014 at 8:17 PM, René J.V. <rjvbertin at gmail.com> wrote:
>
> On Wednesday December 17 2014 20:00:30 Liang Jian wrote:
>
> > Wrong JPEG library version: library is 62, caller expects 80
> >
> >     I guess this is because qt library shipped in iOS are static
> libraries
> > and Qt itself will also link against libjpeg, and if I specify
> -lturbojpeg
> > in my .pro file, the linker will choose libjpeg-turbo to link and since
> > libjpeg-turbo only implement version 6.2 of libjpeg while Qt require 8.0.
>
> >     How can I work around this issue? Thanks.
>
> I see 2 possibilities if you insist on using libjpeg-turbo (I presume you
> have already demonstrated to yourself that this library indeed gives a
> significant performance boost on iOS?!)
>
> - rebuild Qt for iOS so that it accepts libjpeg-turbo
>
> or if that's not feasible,
>
> - figure out how to change libjpeg-turbo's functions just enough so you
> can have both libraries linked, and then call the turbo functions from your
> code where required.
>
> R.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141217/81044e71/attachment.html>


More information about the Interest mailing list