Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
|
|
|
|
Poster | Thread | Hypex
| |
Re: X5000 question Posted on 2-Jun-2017 15:59:04
| | [ #61 ] |
| |
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @NutsAboutAmiga
Quote:
That's exactly what you don't wont, what you won't is same format as file format your loading. If file was created on little endian CPU, you need treat that file as an little endian file. WAV was invented on PC, there is this file format little endian, you can't do anything about that, you can't invent a big endian wav file, because no program will support it. |
The problem is, a file like WAV is bi-endian. It goes both ways. Yes the data is little endian but the header IDs are big endian. For example a WAV header:
52494646 4E738303 5415645 4A554E4B R I F F W A V E J U N K
As you can the text headers ID words are stored in natural order. One can look for "RIFF" and "WAVE" on big endian. On little endian the backwards approach must be taken. Ironic in a way. And yes that was a real WAV header.
Quote:
PowerPC has reverse endian instruction, but C language does not allow the developer to define what is big endian or little endian. |
Given this is an old problem that has been relevant in the recent past I find it rather "old fashioned" that specifying endian is not supported. Some data is in one specific format. Usually when read from disk but these days data generated by scripts such as Javascript is generated as little endian.
One can make macros or things like union structures or even code some ASM to do it but really a high level programmer shouldn't need to fudge in what a compiler can optimise code for.
I've also read advice that if data is little endian then there shouldn't be endian testing with different macros but to simply always converting it. This would favour PPC. But could the compiler be trusted to optimise four bytes shifted into backwards order into a direct long word read on Intel? More likely than not since Intel is well optimised. But the code would still not look as clean.
Quote:
I believe some IBM POWER CPU's can define memory blocks as big or little endian, bypassing the problem. |
That would be interesting. Though those blocks would need to be defined somehow. So good for large data tables but perhaps not single variables.
Quote:
I was shocked when found out intuition / screens bitmap was reversed on Radeon 9250. Trying to swap bytes on write or read, using MMU was interesting, low impact when few pixels where changed, high impact when many pixels where changed, as I understand it Radeon HD card is able to fix this on the GPU (shadier code I guess), freeing the CPU from wasting time on converting bitmaps. |
Nice one. And yes, if the framebuffer is reversed on a 9250 I would be shocked too, since I expected that model to be bi-endian. |
| Status: Offline |
| | NutsAboutAmiga
| |
Re: X5000 question Posted on 2-Jun-2017 17:06:28
| | [ #62 ] |
| |
|
Elite Member |
Joined: 9-Jun-2004 Posts: 12817
From: Norway | | |
|
| @Hypex
Quote:
The problem is, a file like WAV is bi-endian. It goes both ways. Yes the data is little endian but the header IDs are big endian. For example a WAV header: |
No it does not, a char is byte, and per definition a byte can't have a endian format, as it is the smallest unit. (if we ignore bits, but bits have only one format, just image if need to swap bits, )
The WAV header is in "char", as one byte is one byte on little or big endian it works fine. only when you have short, int, long long int, will you get a endien problem.
In the example you give, your trying to treat char's as integer, this is the problem.
Last edited by NutsAboutAmiga on 02-Jun-2017 at 05:58 PM. Last edited by NutsAboutAmiga on 02-Jun-2017 at 05:08 PM. Last edited by NutsAboutAmiga on 02-Jun-2017 at 05:07 PM.
_________________ http://lifeofliveforit.blogspot.no/ Facebook::LiveForIt Software for AmigaOS |
| Status: Offline |
| | iggy
| |
Re: X5000 question Posted on 2-Jun-2017 17:57:22
| | [ #63 ] |
| |
|
Super Member |
Joined: 20-Oct-2010 Posts: 1175
From: Bear, Delaware USA | | |
|
| @WolfpackN64
Quote:
Sometimes I really wonder why Apple ditched their Classic OS |
Because NextStep/OSX is infinitely better, at least on newer hardware. You guys can continue to wax nostalgic about OS9, I wouldn't touch it, anymore than I'd continue to use a Microsoft PC OS introduced before the NT kernel.
|
| Status: Offline |
| | BigD
| |
Re: X5000 question Posted on 2-Jun-2017 18:29:32
| | [ #64 ] |
| |
|
Elite Member |
Joined: 11-Aug-2005 Posts: 7322
From: UK | | |
|
| @WolfpackN64
The Classic OS 9 environment while useful for old scanners etc on OS X Tiger was a buggy mess as far as I remember it on actual G3 era hardware! Constant spinning beach balls, problems ejecting discs or closing applications. It definitely wasn't a multi tasking OS and was not fit for purpose really with a lot of bloat that ruined performance. The puc-mice were the final straw in me eventually hating the original iMac. It was a computer for those that didn't love computers a bit like the Mercedes for non-car people with too much money. OS X was a massive improvement but then they tried to fuse it with iOS and now it has rubbish OpenGL support (because Metal API is the future ) and now has no killer professional apps anymore that people on PCs can't access since they messed up Final Cut Pro and the Mac Pro design (no powerful single GPU boards are supported due to heat)! Adobe Premiere and Photoshop might as well be used on a PC.
Last edited by BigD on 02-Jun-2017 at 06:31 PM.
_________________ "Art challenges technology. Technology inspires the art." John Lasseter, Co-Founder of Pixar Animation Studios |
| Status: Offline |
| | Hypex
| |
Re: X5000 question Posted on 9-Jun-2017 12:16:12
| | [ #65 ] |
| |
|
Elite Member |
Joined: 6-May-2007 Posts: 11204
From: Greensborough, Australia | | |
|
| @NutsAboutAmiga
Quote:
No it does not, a char is byte, and per definition a byte can't have a endian format, as it is the smallest unit. |
That may be so but it happens to fit neatly in a 32-bit space and all code I read loads it in as a pointer and compares it with a backwards number.
Quote:
The WAV header is in "char", as one byte is one byte on little or big endian it works fine. only when you have short, int, long long int, will you get a endien problem. |
It may be char but programmers don't seem to know that. They don't treat it as a string. It's too much work to compare with a string.
Quote:
In the example you give, your trying to treat char's as integer, this is the problem. |
It's not my problem, it's the problem of open source programmers. But the fact is, this RIFF and AIFF for that matter is derivative of IFF. And on IFF the IDs were assembled as long words in the compiler. However, they were correctly assembled from separate char elements into one long word. So, would in theory, be portable. |
| Status: Offline |
| |
|
|
|
[ home ][ about us ][ privacy ]
[ forums ][ classifieds ]
[ links ][ news archive ]
[ link to us ][ user account ]
|