New shared libraries of zlib and pnglib available

All about the serious stuff.

Moderators: Mug UK, Zorro 2, Moderator Team

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Wed Aug 22, 2018 3:44 am

Hi

I've recently put some effort to make zlib and pnglib, which are widely used, available as shared library for MiNT (*.slb) in a way that should make it really easy to switch from a static version to a shared one, i.e. all the functions are called as usual, without having to look them up first (like when using LDG), or needing to pass extra parameters like function numbers.

You can find them at http://tho-otto.de/sharedlibs.php. There is also a new snapshot tool available there that makes use of them.

Please let me know what you think of it, or if you find any problems.

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Wed Aug 22, 2018 6:37 pm

Hi Thorsten,

Is there any example on how to use this lib (sorry i'm reading.this from my mobile and i may have missed it)?

Also.that would be very nice to have an aranym native feature for this just.like nfjpeg.

Then I would be able.to add png support in vision :—)

User avatar
shoggoth
Nature
Nature
Posts: 945
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: New shared libraries of zlib and pnglib available

Postby shoggoth » Wed Aug 22, 2018 9:41 pm

Nice initiative!!!
Ain't no space like PeP-space.

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

Re: New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Thu Aug 23, 2018 1:06 am

JeanMars wrote:Is there any example on how to use this lib (sorry i'm reading.this from my mobile and i may have missed it)?


Its explained in the readme. A simple example are the test programs in the source archive (example.c in zlib, and pngtest.c in pnglib).

Also.that would be very nice to have an aranym native feature for this just.like nfjpeg.


Yes, that's also planned. Just have to prepare the jpeg library first ;)

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Thu Aug 23, 2018 10:12 am

Thanks for pointing this out, i'll have a look as soon as i have a decent device to read this sample

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

Re: New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Thu Aug 30, 2018 10:13 am

Update: libiconv 1.15 and libjpeg (jpeg-8d) are also available now.

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Thu Aug 30, 2018 7:46 pm

Hi Thorsten,

thanks for the update; just a question to help me design PNG integration into VISION: do you plan to include automatic switch to Aranym native feature into the lib or let the caller decide about this?

I'll be looking into this as soon as I can free some time on my side :-)

Thanks,
Jean

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

Re: New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Fri Aug 31, 2018 3:59 am

JeanMars wrote:do you plan to include automatic switch to Aranym native feature into the lib or let the caller decide about this?


I thought about that too, but it's hardly possible. It would be easy to translate calls to the accelerated JPEGDecodeImage() into a series of jpeglib function calls, but not the other way around. And the DSP/ARAnyM decoder only returns the raw image data, not some other meta-information like jpeglib does. So its better to let the caller decide that, there are only a few functions in that interface, and most of the code needed to use it, is allocating buffers etc.

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Fri Aug 31, 2018 3:38 pm

Ok I'll design on my side to let vision decide!
Thanks,
Jean

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Mon Sep 10, 2018 8:56 pm

Hi Thorsten,

I tried to use pnglib, followed instructions from readme, added both pureC versions of PNGSLB16.LIB and ZLIBSLB.LIB to my project, compiled successfully but got the following link error with PureC:
****** Linker messages:

H:\PURE_C\LIB\PNGSLB16.LIB
Undefined symbol: '_base'
Undefined symbol: '__base'

Any clue?
Thanks,
Jean

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

Re: New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Tue Sep 11, 2018 7:40 am

JeanMars wrote:Any clue?


Oops. That is an alias of the _BasPag pointer in the startup code i usually use, so i didn't notice. As a workaround, you can define those variables in your code, and initialize them before calling any of the loading functions:

Code: Select all

#include <tos.h>
...
BASPAG *_base;
BASPAG *__base;
...

   _base = __base = _BasPag;
   ...
   slb_pnglib_open(NULL);


They are only used by the fallback functions that simulate Slbopen() for systems that lack it.

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

Re: New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Tue Sep 11, 2018 8:37 am

Also fixed now in the download archives.

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Tue Sep 11, 2018 8:58 am

Thanks Thorsten,

I'll try this evening :-)

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Tue Sep 11, 2018 8:17 pm

Hi Thorsten,

looks good, I can load/unload library now :-)
I had to comment out this section in png.h (line 1666-):

#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structrp png_ptr,
png_user_transform_ptr read_user_transform_fn));
#endif

#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structrp png_ptr,
png_user_transform_ptr write_user_transform_fn));
#endif

PureC reported an error on second macro lines. Don't know why, they look pretty similar to other compiling OK. I don't think I would need these user transforms, just to report.

Thanks,
Jean

User avatar
dhedberg
Atari Super Hero
Atari Super Hero
Posts: 820
Joined: Mon Aug 30, 2010 8:36 am
Contact:

Re: New shared libraries of zlib and pnglib available

Postby dhedberg » Tue Sep 11, 2018 9:30 pm

Great work! Thanks!
Daniel, New Beat - http://newbeat.atari.org. Like demos? Have a look at our new Falcon030 demo MORE.

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

Re: New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Tue Sep 11, 2018 9:45 pm

JeanMars wrote:I had to comment out this section in png.h (line 1666-):


That's strange, especially since the same macro is also used in other places. Of course its fine to comment them out if you don't need them, but they might be really useful, and IIRC are also used by the test programs. Do you remember the error message?

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Wed Sep 12, 2018 6:38 am

Hi,

Syntax error... i thoight identifier length was too much but apparently not

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

Re: New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Wed Sep 12, 2018 7:18 am

JeanMars wrote:i thoight identifier length was too much but apparently not


Oh, but that could still be possible. I can't remember whether it was the same location, but for compiling the static library i had to increase the max. identifier length to something like 80, although none of the names is nearly that long. Maybe that fixes it.

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Wed Sep 12, 2018 7:52 am

Thanks for the hint, I'll have a look this evening

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Wed Sep 12, 2018 7:25 pm

Hi Thorsten,

you're correct, I increased "Maximum identifier length" from 32 to 64 in the compiler options and it just compile OK now. The identifier length used in the macro is 24 but I guess this setting is for (data type+identifier) in this case.

Thanks!

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

Re: New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Wed Sep 12, 2018 8:52 pm

Thx for confirmation. i'll add a hint in the readme.

JeanMars
Atari freak
Atari freak
Posts: 53
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: New shared libraries of zlib and pnglib available

Postby JeanMars » Sat Sep 15, 2018 9:18 pm

Hi Thorsten,

OK it looks promising, I just had my first png image successfully loaded into VISION :-)
I noted something incompatible with LDG which VISION uses for additional modules:
if pnglib is loaded via SLB, any subsequent call to ldg_exec just freezes VISION (all other apps/system are OK).
If I call slb_pnglib_close just before ldg_exec, it works fine...

Any clue on this issue?
Thanks,
Jean

ThorstenOtto
Captain Atari
Captain Atari
Posts: 417
Joined: Sun Aug 03, 2014 5:54 pm

Re: New shared libraries of zlib and pnglib available

Postby ThorstenOtto » Sun Sep 16, 2018 2:11 pm

JeanMars wrote:Any clue on this issue?


No sorry, no real idea. They should not interfere, theoretically. Do you use Mint or Magic, where Slbopen() is available? And for LDG, do you have the resident program run from auto-folder?


Social Media

     

Return to “Applications”

Who is online

Users browsing this forum: No registered users and 4 guests