03 December 2014, 23:59 | #41 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
Been a while, was just wondering if your header stripper file-prepping code will make it to a shell command?
|
05 December 2014, 12:24 | #42 |
Registered User
Join Date: May 2011
Location: Cambridge
Posts: 682
|
I use a Linux cross-dev environment, so I have no setup for making Amiga CLI utils. This is one reason why deflate was interesting to me, as I can create compressed streams easily on the Linux host.
|
06 December 2014, 12:01 | #43 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
So how would anyone without your setup prepare a compressed file for use with your decompression source?
|
07 December 2014, 08:55 | #44 |
Registered User
Join Date: May 2011
Location: Cambridge
Posts: 682
|
Produce a gzip file and strip the gzip header (trivial job, format described in RFC 1952, also I provide POSIX C source to do the job). Produce a zlib file and strip the zlib header (trivial job, format described in RFC 1950). Extract deflate stream from a PNG file. And so on; many uses, possibilities, but not a direct replacement for an Amiga-dedicated packer/unpacker toolkit. But there are very many of those, some very good, whereas easy creation of compressed files on a foreign host is a rarer feature.
Last edited by Keir; 07 December 2014 at 09:25. |
07 December 2014, 15:21 | #45 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Unfortunately POSIX only guarantees portability under Unix-like systems, which AmigaOS is not. Also the endian-conversion functions (htobe32, le32toh, etc.) are not POSIX. And you should not depend on 'int' being 32 bits, so I changed insz and outsz to uint32_t. |
|
07 December 2014, 16:24 | #46 | ||
Registered User
Join Date: May 2011
Location: Cambridge
Posts: 682
|
Quote:
Quote:
|
||
07 December 2014, 18:31 | #47 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
|
11 November 2016, 15:07 | #48 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
Hi,
I would like to use this optimised inflate function in NetSurf for PNG decoding but I have no knowledge of asm. Can sb complie an object file so I could link it? What arguments does it take? Code:
int __wrap_inflate(mz_streamp pStream, int flush) { inflate_asm(pStream, flush); } |
13 November 2016, 19:22 | #49 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
Will it work for PNG's at anyway?
|
13 November 2016, 19:51 | #50 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
It seems this is the wrong thread, as you don't want to use kaffer's degzip to inflate your data.
Concerning your questions: Yes, as far as I know PNG uses zlib's inflate-algorithm. For everything else you posted too little information. |
13 November 2016, 20:15 | #51 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
I want to use inflate.asm mentioned in first post, so it should be on topic.
I am sorting out how link vasm a.out with c gcc compiled program. |
14 November 2016, 12:46 | #52 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
I didn't write the code, only ported it to vasm. From looking at the source I would say that you call the "inflate" routine with register A5 pointing to the input stream and A4 pointing to the output buffer for the inflated (uncompressed) data. Quote:
You may also want to rename the inflate function in the assembler source from "inflate" to "_inflate" and export the symbol with "xdef _inflate". So you can call it from C as inflate(). |
||
14 November 2016, 13:47 | #53 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
|
14 November 2016, 15:08 | #54 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
With xdef _inflate and -Fhunk I have linked this.
Now , how do I call inflate. Simply inflate(stream)? |
16 November 2016, 19:26 | #55 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
This how I have implemented inflate.asm in png lib:
Code:
register z_streamp instream __asm("a5"); register int flush __asm("a6"); int inflate_asm(register z_streamp instream __asm("a5") ,register int flush __asm("a6")); int png_zlib_inflate(png_structrp png_ptr, int flush) { ... return inflate_asm(&png_ptr->zstream, flush); } Code:
register int outdata __asm("a4"); register z_streamp instream __asm("a5"); register int flush __asm("a6"); int inflate_asm(register z_streamp instream __asm("a5"), register int outdata __asm("a4") ,register int flush __asm("a6")); int png_zlib_inflate(png_structrp png_ptr, int flush) { ... inflate_asm(&png_ptr->zstream, outdata, flush); return outdata; } Last edited by arti; 16 November 2016 at 19:35. |
16 November 2016, 20:53 | #56 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
I don't know which gcc version you use and how it behaves, but I doubt this will work.
What are you trying to achieve with these global register definitions? Code:
register int outdata __asm("a4"); register z_streamp instream __asm("a5"); register int flush __asm("a6"); And there is no "flush" argument in the assembler implementation of inflate(). Do you know what "flush" is doing? A6 is used for an (optional) alternative stack area, AFAIK, but only when you define the appropriate symbol (it is not used by default). |
17 November 2016, 11:50 | #57 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
My bad, it is first time I work with asm you know.
I do not understand it fully yet. Code:
int inflate_asm(register z_streamp instream __asm("a5"), register int outdata __asm("a4")); int png_zlib_inflate(png_structrp png_ptr, int flush) {int outdata; ... inflate_asm(&png_ptr->zstream, outdata); return outdata;} |
17 November 2016, 12:57 | #58 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
Here is example code:
http://netsurf.baderman.net/inflate.zip |
09 December 2016, 14:31 | #59 |
Registered User
Join Date: May 2011
Location: Cambridge
Posts: 682
|
Hi, Sorry I did not check this thread in a long while. Plumbing into libpng is not as straightforward as you think. It seems the library has a zlib-style streaming interface, and wishes to call an inflate handler which will decompress until the input buffer is empty or the output buffer is full. My inflate asm has a simpler interface where you pass a pointer to the (complete) input in memory, and a pointer to sufficient output space in memory. There is no facility for returning to the caller to collect more input stream or to empty an output buffer. This could be added, it's a question of doing the work and also no doubt slowing down the inflate routine as it will need to check for buffer empty/full conditions within some inner loops.
Alternatively if it can be established or arranged that libpng always fully reads the input into memory and provide sufficient output buffer space then you should be able to pull the input/output buffer pointers out of the z_streamp structure and pass those to inflate_asm() in a5/a6. The 'flush' parameter to png_zlib_inflate can be disregarded. |
12 December 2016, 11:36 | #60 |
Registered User
Join Date: Jul 2008
Location: Poland
Posts: 662
|
Thanks for reply kaffer.
I was hoping it to be as simple as replacing only inflate function. To achieve what you wrote I need to educate myself a bit more first. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga formatted zip disks via USB zip drive in WinUAE? | planetidiot | New to Emulation or Amiga scene | 8 | 02 February 2018 08:43 |
System.zip / bad zip-file | Ztein | project.ClassicWB | 24 | 22 April 2012 02:14 |
Use of 4MB PCMCIA Fast Flash Memory as Fast RAM in A1200 | nkarytia | support.Hardware | 10 | 16 September 2011 13:37 |
Added SIMM to ZIP adapter, now 16MB Fast RAM | tonyyeb | support.Hardware | 18 | 01 September 2008 10:59 |
LZX unpacking??? | Medvind | support.Apps | 25 | 27 November 2002 12:33 |
|
|