Hi.
I tried everything. Make all memory zero which is allocated. use calloc in stead of malloc, change to FPM_64BIT and back to FPM_DEFAULT. Changing optimization. Everytime I get the same picture. Nothing helps... Single stepping through the code is also not an option, I don't know anything about MP3 decoding at all. I need an other compiler I think. Somebody knows a free MIPS VR4111 C compiler?
Greetz,
Jeroen
From: Andre armccurdy@yahoo.co.uk To: Jeroen jeroen_t@hotmail.com, mad-dev@lists.mars.org Subject: Re: Problems when porting to MIPS processor using Greenhills compiler Date: Fri, 15 Feb 2002 12:07:09 +0000 (GMT)
Jeroen,
A MIPS connected to a television... cool !!
The waveform looks like its from the start of decoding (ie the first few frames). If you look at the output after many more frames does it get any closer to what you expect ??
Try zeroing the malloc'ed memory in layer3.c and decoder.c before it is used (or remove the mallocs and use static arrays).
Try defining FPM_64BIT instead of FPM_DEFAULT and recompiling.
Did you have to do anything strange to the source or Makefiles to get libmad to build with the ghs compiler ??
Andre
Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
_________________________________________________________________ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com
"Jeroen T" wrote:
[...] Somebody knows a free MIPS VR4111 C compiler?
gcc can generate code for the VR4xxx series CPUs.
Simon. -- Simon Burge simonb@wasabisystems.com NetBSD CDs, Support and Service: http://www.wasabisystems.com/
Jeroen T jeroen_t@hotmail.com wrote:
Hi.
I tried everything. Make all memory zero which is allocated. use calloc instead of malloc, change to FPM_64BIT and back to FPM_DEFAULT. Changing optimization. Everytime I get the same picture. Nothing helps...
Did you try looking at the waveform in the middle of the file ? ie is the strange modulation only at the start (first few frames) of the decoded output, or all the way through ??
Somebody knows a free MIPS VR4111 C compiler?
Yes, gcc !!!
You could build your own, but to save hassle I would recommend that you try one of the precompiled versions available for MIPS. I've personally used the version available from http://www.algor.co.uk although its certainly not the only choice.
Beware that the assembler and object file formats used by gcc may not be the same as those used by ghs, so combining a gcc compiled version of libmad with your existing ghs compiled C runtime environment (startup files, RTOS etc) may not be entirely straightforward... :-)
Andre --
__________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
Hi!
Further on in the file it's still not OK. With the same sourcecode and MP3 data the PC (with Visual C++) is doing OK from the beginning.
I haven't took al look at the GCC compiler. I go to Germany for a few days for my work, so I continue on this problem next week.
Thanks for all the tips.
Jeroen
----- Original Message ----- From: "Andre" armccurdy@yahoo.co.uk To: "Jeroen T" jeroen_t@hotmail.com; mad-dev@lists.mars.org Sent: Monday, February 18, 2002 8:24 PM Subject: Re: [mad-dev] Problems when porting to MIPS processor using Greenhills compiler
Jeroen T jeroen_t@hotmail.com wrote:
Hi.
I tried everything. Make all memory zero which is allocated. use calloc instead of malloc, change to FPM_64BIT and back to FPM_DEFAULT. Changing optimization. Everytime I get the same picture. Nothing helps...
Did you try looking at the waveform in the middle of the file ? ie is the strange modulation only at the start (first few frames) of the decoded output, or all the way through ??
Somebody knows a free MIPS VR4111 C compiler?
Yes, gcc !!!
You could build your own, but to save hassle I would recommend that you try one of the precompiled versions available for MIPS. I've personally used the version available from http://www.algor.co.uk although its certainly not the only choice.
Beware that the assembler and object file formats used by gcc may not be the same as those used by ghs, so combining a gcc compiled version of libmad with your existing ghs compiled C runtime environment (startup files, RTOS etc) may not be entirely straightforward... :-)
Andre
Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
Hi,
I am trying to get the mad decoder working on the Sharp ARM Evaluator board. I want to use the minimad.c as a starting point and i have got this working fine on my linux system using stdin and stdout using the redirection operators but i can't see how to use these without an operating system on the development board.
The way i see it, i need to alter minimad so that it takes a pointer to where the start of the mp3 file is, and then another pointer for where it should start writng the pcm samples. Once i have this working i can get the decoded pcm off the board and play it in a sound program on a pc just to see if it works. Then i can work on sending the data to a DAC rather than writing it to memory.
Does this sound like a reasonable approach to geting started? Any suggestind greatly appreciated.
Gareth
Gareth,
I am trying to get the mad decoder working on the Sharp ARM Evaluator board.
That wouldn't be the AEB1 board with an ARM7DI cpu (ie lacking the enhanced 32x32bit multiply instructions) and a 24 MHz cpu clock would it ??
If so, be aware that you should configure MAD with FPM_DEFAULT, and the fact that you stand no hope at all of listening to any decoded output in real time... :-)
The way i see it, i need to alter minimad so that it takes a pointer to where the start of the mp3 file is, and then another pointer for where it should start writng the pcm samples.
Yes. Remember to update your pointers every time you copy data out of or into your buffers so you know where to read/write on the next call and you should be laughing. (Even so, its probably best to get this far on a PC before going near the ARM board).
Good luck.
Andre --
__________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
Thanks Andre,
I'm not certain about the board but i know it has an ARM7TDMI. The board has written on it : ARM EVALUATION BOARD ASSY : HBI-0041C Will this ARM be able to decode mp3s in real time? No great loss if it won't, this is just a learning exercise :-)
At 11:41 19/02/02 +0000, Andre wrote:
Gareth,
I am trying to get the mad decoder working on the Sharp ARM Evaluator board.
That wouldn't be the AEB1 board with an ARM7DI cpu (ie lacking the enhanced 32x32bit multiply instructions) and a 24 MHz cpu clock would it ??
If so, be aware that you should configure MAD with FPM_DEFAULT, and the fact that you stand no hope at all of listening to any decoded output in real time... :-)
The way i see it, i need to alter minimad so that it takes a pointer to where the start of the mp3 file is, and then another pointer for where it should start writng the pcm samples.
Yes. Remember to update your pointers every time you copy data out of or into your buffers so you know where to read/write on the next call and you should be laughing. (Even so, its probably best to get this far on a PC before going near the ARM board).
Good luck.
Andre
Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
"G.C.Bransby" wrote:
I'm not certain about the board but i know it has an ARM7TDMI. The board has written on it : ARM EVALUATION BOARD ASSY : HBI-0041C Will this ARM be able to decode mp3s in real time? No great loss if it won't, this is just a learning exercise :-)
As an indication a 233MHz SA-110 (ARM9ish??) uses about 30% cpu when decoding 192kb/s mp3s in realtime.
Simon. -- Simon Burge simonb@wasabisystems.com NetBSD CDs, Support and Service: http://www.wasabisystems.com/
"G.C.Bransby" G.C.Bransby-99@student.lboro.ac.uk wrote:
The board has written on it ... ASSY : HBI-0041C
Sounds like an AEB1. If the processor is a Sharp LH77790B it is ARM7DI based (no Thumb Instruction set or enhanced multiply support).
Will this ARM be able to decode mp3s in real time?
It might manage a very low bitrate mono mp3, but only with some effort. Make sure you compile all sources with -mcpu=arm7di by the way.
Have fun.
Andre --
__________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
OK, this may be a really dumb question but here goes anyway. If i compile libmad in linux using the normal ./configure, make, make install routine, will i be able to use the resulting library for development on a windows machine?
I have been playing with minimad for a while now but need some explanations for a few things ;-) The comments say that standard input is mapped into memory using mmap(). So :
Is mmap a C builtin function? What do the arguments mean, especially 'stat.st_size'? fdm is the pointer to where the mp3 has been mapped into memory, right?
Thanks for any input!
On Thursday, February 21, 2002, at 01:59 PM, Gareth wrote:
I have been playing with minimad for a while now but need some explanations for a few things ;-) The comments say that standard input is mapped into memory using mmap(). So :
Is mmap a C builtin function?
mmap() is a POSIX function; it is implemented as a system call on nearly all operating systems having a UNIX-like kernel.
What do the arguments mean, especially 'stat.st_size'? fdm is the pointer to where the mp3 has been mapped into memory, right?
From the Linux mmap(2) man page:
SYNOPSIS #include <unistd.h> #include <sys/mman.h>
caddr_t mmap(void *start, size_t length, int prot , int flags, int fd, off_t offset);
int munmap(void *start, size_t length);
DESCRIPTION The mmap function asks to map length bytes starting at offset offset from the file (or other object) specified by fd into memory, preferably at address start. This latter address is a hint only, and is usually specified as 0. The actual place where the object is mapped is returned by mmap. The prot argument describes the desired memory pro- tection. It has bits
PROT_EXEC Pages may be executed.
PROT_READ Pages may be read.
PROT_WRITE Pages may be written.
PROT_NONE Pages may not be accessed.
The flags parameter specifies the type of the mapped object, mapping options and whether modifications made to the mapped copy of the page are private to the process or are to be shared with other references. It has bits
MAP_FIXED Do not select a different address than the one specified. If the specified address cannot be used, mmap will fail. If MAP_FIXED is speci- fied, start must be a multiple of the pagesize. Use of this option is discouraged.
MAP_SHARED Share this mapping with all other processes that map this object
MAP_PRIVATE Create a private copy-on-write mapping.
You must specify exactly one of MAP_SHARED and MAP_PRI- VATE.
FYI, stat.st_size is simply the size of the file in bytes as it exists in the filesystem. Thus, the entire file is mapped.
-- Rob Leslie rob@mars.org
Rob Leslie wrote:
On Thursday, February 21, 2002, at 01:59 PM, Gareth wrote:
I have been playing with minimad for a while now but need some explanations for a few things ;-) The comments say that standard input is mapped into memory using mmap(). So :
Is mmap a C builtin function?
mmap() is a POSIX function; it is implemented as a system call on nearly all operating systems having a UNIX-like kernel.
Realistically, mmap() is a luxury provided by virtual memory operating systems. As used my minimad it is a simple way to get the system to do the file I/O automatically under the hood, and simplifies the programming model. You will however find doing the stream I/O yourself to be lower overhead and more appropriate for the application environments where libmad is attractive.
On Thursday, February 21, 2002, at 04:20 PM, john cooper wrote:
Realistically, mmap() is a luxury provided by virtual memory operating systems. As used my minimad it is a simple way to get the system to do the file I/O automatically under the hood, and simplifies the programming model. You will however find doing the stream I/O yourself to be lower overhead and more appropriate for the application environments where libmad is attractive.
Granted, without a virtual memory system, mmap() might not be the best or even a possible approach. However, it can have special benefits when available that make it more attractive than traditional I/O. Since mmap() usually provides direct access to memory pages from the filesystem's block cache, the overhead of additional private buffer space and memory copying is avoided. Eliminating the buffer for your own stream I/O can be important especially in low-memory environments, particularly since multiple instances can share memory-mapped pages.
On systems where the secondary data storage is already memory-accessible, such as flash devices, mmap() is an even more obvious choice.
-- Rob Leslie rob@mars.org
Rob Leslie wrote:
On Thursday, February 21, 2002, at 04:20 PM, john cooper wrote:
Realistically, mmap() is a luxury provided by virtual memory operating systems. As used my minimad it is a simple way to get the system to do the file I/O automatically under the hood, and simplifies the programming model. You will however find doing the stream I/O yourself to be lower overhead and more appropriate for the application environments where libmad is attractive.
Granted, without a virtual memory system, mmap() might not be the best or even a possible approach. However, it can have special benefits when available that make it more attractive than traditional I/O. Since mmap() usually provides direct access to memory pages from the filesystem's block cache, the overhead of additional private buffer space and memory copying is avoided. Eliminating the buffer for your own stream I/O can be important especially in low-memory environments, particularly since multiple instances can share memory-mapped pages.
What I was getting at was if hardware FP isn't around I'd predict an MMU won't be either. libmad seems uniquely attractive in resource barren application environments -- perhaps even those forgoing much of an OS. In this case the application can do the required and minimal overhead IO without having to paw at it through OS abstractions.
Even on an embedded Linux/VM system, the overhead of VM mechanisms, policy algorithms, and coherency traffic start to steal valuable cycles from the typical low cost non-superscalar CPU's integer-processing bandwidth.
Of course you can find instances to the contrary as well.
On systems where the secondary data storage is already memory-accessible, such as flash devices, mmap() is an even more obvious choice.
In the case of a VM OS being between the application and physical memory resident data, I agree. Note in this case the MMU mapping is (or can be) static without the overhead of mapping via page fault, pushing dirty pages, aging page buffers, cache coherency, etc..
john cooper wrote:
What I was getting at was if hardware FP isn't around I'd predict an MMU won't be either.
I'd tend to disagree with this, especially in the higher-end embedded market (ie anything based on a modern RISC core). There's quite a few MIPS and PowerPC based CPUs around that don't have FP but do have fully functioning MMUs. Now, as to whether or not your operating environment provides mmap() (and it's efficency if it does) is a different question :-)
Simon. -- Simon Burge simonb@wasabisystems.com NetBSD CDs, Support and Service: http://www.wasabisystems.com/
On Wednesday, February 20, 2002, at 02:29 AM, G.C.Bransby wrote:
OK, this may be a really dumb question but here goes anyway. If i compile libmad in linux using the normal ./configure, make, make install routine, will i be able to use the resulting library for development on a windows machine?
Probably not, due to the different linking requirements of the two platforms.
-- Rob Leslie rob@mars.org