Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
150 user(s) are online (130 user(s) are browsing Forums)

Members: 0
Guests: 150

more...

Support us!

Headlines

 
  Register To Post  

« 1 (2) 3 »
Re: Source code of jpeg.library?
Home away from home
Home away from home


See User information
@xenic

No!

openjpeg == jpeg2000

jpeg2000 != jpeg

It's different and incomptable standard from the same group jpeg2000 is a HDR image format whereas jpeg is simplt 24bit


Go to top
Re: Source code of jpeg.library?
Quite a regular
Quite a regular


See User information
New jpeg.library implementation based on libjpeg-turbo with Altivec acceleration is nearly complete. I just wasted the last 3 days on an ISI crash/hangs, slowly rebooting the X1000 a hundred times, caused by a brainfuck in memset(). It was overrunning 1 byte destroying an error handling function pointer inside libjpeg.

Anyway, FIXED last night! Now all that remains is to implement setjmp, the last hurdle of stdlib, and we are good for beta-testing :)

The reader already works, just need to test the writer.

Software developer for Amiga OS3 and OS4.
Develops for OnyxSoft and the Amiga using E and C and occasionally C++
Go to top
Re: Source code of jpeg.library?
Amigans Defender
Amigans Defender


See User information
@Deniil

Quote:
I just wasted the last 3 days on an ISI crash/hangs, slowly rebooting the X1000 a hundred times, caused by a brainfuck in memset(). It was overrunning 1 byte destroying an error handling function pointer inside libjpeg.

Oh, we programmers LOVE such bugs, don't we?

Quote:
Anyway, FIXED last night!

Well done!

The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Go to top
Re: Source code of jpeg.library?
Just popping in
Just popping in


See User information
@Deniil

Sounds fantastic, well done i must say.

Go to top
Re: Source code of jpeg.library?
Quite a regular
Quite a regular


See User information
Error handlers using setjmp tested and working. Jpeg writer also working.

Had to implement setjmp/longjmp from scratch in assembly, with some help from google, since I have no stdlib. All required parts of stdlib are reimplemented from scratch.

Now testing all the different scenarios using the jpeg_library dev examples. Hooks are untested and apparently doesn't quite work...

Software developer for Amiga OS3 and OS4.
Develops for OnyxSoft and the Amiga using E and C and occasionally C++
Go to top
Re: Source code of jpeg.library?
Home away from home
Home away from home


See User information
@Deniil

Quote:

Error handlers using setjmp tested and working. Jpeg writer also working.

Had to implement setjmp/longjmp from scratch in assembly, with some help from google, since I have no stdlib. All required parts of stdlib are reimplemented from scratch.



Why on earth didn't you use newlib? That's what it for?

Quote:

Now testing all the different scenarios using the jpeg_library dev examples. Hooks are untested and apparently doesn't quite work...


If they are amiga hooks make sure you use CallHookPkt() and make sure the argument order is correct.


Go to top
Re: Source code of jpeg.library?
Amigans Defender
Amigans Defender


See User information
@Deniil

Quote:
Had to implement setjmp/longjmp from scratch in assembly, with some help from google, since I have no stdlib.

This sounds like a strange thing to do. I really wonder what stopped you from using newlib, as Broadblues has suggested. In 2015 and in assembly????? I really want to hear the story.

The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Go to top
Re: Source code of jpeg.library?
Just can't stay away
Just can't stay away


See User information
@Deniil

In addition to what others wrote clib2 setjmp/longjmp can be used as well if you think it's too much work to open and close "newlib.library".

@trixie

setjmp/longjmp are very lowlevel functions so they can't be implemented in C.

Go to top
Re: Source code of jpeg.library?
Just can't stay away
Just can't stay away


See User information
@broadblues
Quote:
Why on earth didn't you use newlib? That's what it for?

SDK:newlib/include/setjmp.h says "stubs for future use."; which I would assume means that the functions are not currently implemented in newlib. On the other hand, SDK:clib2/include/setjmp.h looks like those functions might actually be implemented.

Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

Go to top
Re: Source code of jpeg.library?
Quite a regular
Quite a regular


See User information
@broadblues

Quote:
Why on earth didn't you use newlib? That's what it for?


Because this is a library and I read somewhere that one had to compile with -nostartfiles -nostdlib. Besides, it wouldn't be MOS compatible I suppose. And it's fun to implement stdlib :)

Quote:
If they are amiga hooks make sure you use CallHookPkt() and make sure the argument order is correct.


They are not, they are functions. But the examples have bugs; they don't return 0 from the de/compress hooks as the docs say that should unless they want to abort. Seems the docs are wrong and only the progress hook responds to any return value.

@trixie

Quote:
This sounds like a strange thing to do. I really wonder what stopped you from using newlib, as Broadblues has suggested. In 2015 and in assembly????? I really want to hear the story.


As salass00 said, setjmp/longjmp cannot be implemented in C because they play magic tricks on the C code itself. Need 100% control of register usage and the stack since calling longjmp (from anywhere deep inside other code) causes setjmp, somewhere else in the code, to magically return. longjmp never returns, setjmp returns instead. Pretty cool :)

Software developer for Amiga OS3 and OS4.
Develops for OnyxSoft and the Amiga using E and C and occasionally C++
Go to top
Re: Source code of jpeg.library?
Home away from home
Home away from home


See User information
@xenic

setjmp is implmented in newlib.


Go to top
Re: Source code of jpeg.library?
Home away from home
Home away from home


See User information
@Deniil

Quote:

@broadblues

Quote:
Why on earth didn't you use newlib? That's what it for?


Because this is a library and I read somewhere that one had to compile with -nostartfiles -nostdlib.
[/quote]

You don't want believe everything you read on the internet you know

But seriously , -nostdlib is optional, especially now that we have newlib as all you need to do is open newlib.library and initialise INewlib in your library startup. newlib.library handles all the process context stuff internally so you can even call stdio from a .library.

Quote:

Besides, it wouldn't be MOS compatible I suppose.


AWeb for MOS uses clib inside the jpeg / png / gif awebplugins so it's definitle possible to use their clibrary in a .library. Can't recall the details though.

Quote:

And it's fun to implement stdlib :)


Hmm, eductational certainly, fun I'm not so sure

Quote:

Quote:

Quote:
If they are amiga hooks make sure you use CallHookPkt() and make sure the argument order is correct.


They are not, they are functions. But the examples have bugs; they don't return 0 from the de/compress hooks as the docs say that should unless they want to abort. Seems the docs are wrong and only the progress hook responds to any return value.


Okay not really sure about that then.


Go to top
Re: Source code of jpeg.library?
Quite a regular
Quite a regular


See User information
@broadblues

It could of course have been soved using either clib och newlib but I got a headache thinking about it. There are only a few simple stdlib functions I needed so it was faster to implement them rather than try to get newlib or clib in there (at the time). Now I realize newlib is a normal library it could have been fairly easy (on AmigaOS).

This was I can also easily profile the usage of memset and memcpy. And also pretend that fwrite can take a BPTR instead of a FILE*. Makes everything MUCH easier

Software developer for Amiga OS3 and OS4.
Develops for OnyxSoft and the Amiga using E and C and occasionally C++
Go to top
Re: Source code of jpeg.library?
Quite a regular
Quite a regular


See User information
Cool!

I just altivec-optimized memcpy and memset from plain byte-loops to altivec-versions created specifically based on statistical analysis and gained between 11-23% speed in decoding ONLY by optimizing memcpy and memset!

Software developer for Amiga OS3 and OS4.
Develops for OnyxSoft and the Amiga using E and C and occasionally C++
Go to top
Re: Source code of jpeg.library?
Home away from home
Home away from home


See User information
@Deniil

Well done, however you could have used

IExec->CopyMem(Quick) and
IUtility->SetMem / ClearMem

These are aready optimised for the system they are running on, using altivec / DMA / 440 special media instructions etc as available and appropriate.

And er newlib is optimised too.

But still, fun to write your own code





Go to top
Re: Source code of jpeg.library?
Quite a regular
Quite a regular


See User information
Would be interesting to see how CopyMem and SetMem scores here. Can't use CopyMemQuick since the copy data is always totally misaligned due to RGB triplet. The setmem calls otoh. are pretty much always 16-byte aligned due to the altivec source data from libjpeg-turbo.

Software developer for Amiga OS3 and OS4.
Develops for OnyxSoft and the Amiga using E and C and occasionally C++
Go to top
Re: Source code of jpeg.library?
Just popping in
Just popping in


See User information
@broadblues

Are IExec->CopyMem and INewlib->memcpy definitely AltiVec optimised? I'm not so sure, although I do remember it was being toyed with at one stage. Certainly they are well optimised in other ways though.

Go to top
Re: Source code of jpeg.library?
Quite a regular
Quite a regular


See User information
I kind of doubt newlib is, but maybe exec. Anyway, it's still worth experimenting at at some point.

Software developer for Amiga OS3 and OS4.
Develops for OnyxSoft and the Amiga using E and C and occasionally C++
Go to top
Re: Source code of jpeg.library?
Home away from home
Home away from home


See User information
@Deniil

{insert clichéd Darth Vader quote here}




Go to top
Re: Source code of jpeg.library?
Just popping in
Just popping in


See User information
@Deniil

I've been trawling all my old e-mails and trying follow all the discussions on the memcpy/CopyMem subject. The most recent being a couple of years ago, but I did find this:

newlib.library 53.19 (7.1.2012) <ssolie>

- Changed memcpy()/memset()/bzero() to use
IExec->CopyMem()/IUtility->SetMem()/IUtility->ClearMem().

The idea is to let the kernel handle any optimizations and
avoid duplicating the code for these functions.

It doesn't look like anything has changed with that since. I am 99% sure the kernel has no AltiVec optimisations in place at all for these functions, which means neither does newlib. It may also be the case that the X1000/PA6T has less well optimised CopyMem() compared to other machines. So, using an AltiVec memcpy should well be worth it on a G4 and PA6T.

Go to top

  Register To Post
« 1 (2) 3 »

 




Currently Active Users Viewing This Thread: 4 ( 0 members and 4 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project