Media Engine and Mp3 decoding

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

Media Engine and Mp3 decoding

Post by Shapyi »

I am working with an application that uses the media engine for extra CPU power. I would like to move mp3 decoding from the main CPU and use the media engine hardware method cooleyes discovered. Is it possible to do that or are there some restrictions I should know about before I start working on it? Thanks for the help.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

For simply MP3 decoding you can use the sce* MP3 functions. It will decode on the ME. There are samples in the newer SDK.
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

Post by Shapyi »

I know, but is it possible to run my own code on the media engine and decode mp3 (say in a separate thread maybe)?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Yes you can run your own code on the ME. Search for crazyc's sample.
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

Post by Shapyi »

Yeah I know you could. But I know Sony's PRX sets up the media engine for decoding mp3 audio, or h.264 video. My question is, when the ME is in that state and decoding "media" can I still run my own code on it by using threads or some other method?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Don't know about that :/
I wonder if MP3 uses the ME or the VME??
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

Shapyi wrote:Yeah I know you could. But I know Sony's PRX sets up the media engine for decoding mp3 audio, or h.264 video. My question is, when the ME is in that state and decoding "media" can I still run my own code on it by using threads or some other method?
Most probably the second processor for *EITHER* decoding mp3 audio, or h.264 video *OR* running your own code and not *BOTH*. In both cases, you need a processor to wait for events. Due to the fact that official developers cannot run any code on the second processor, there is very few chances for us to be able to inject our own code to run them when the mp3/h.264 decoding code is idling without messing up.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Then what is the VME for? I was given to believe that the whole point of the VME was to hardware decode Atract and possibly other music codecs, and for applying equalizer effects.

I'm sure the ME handles the video decoding though, cos the VME is only audio. Though I have a feeling, the ME runs the code to "manage" the VME in the case of audio, but the actual decoding is on VME.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

More likely to be the other way around... the ME can't possibly be decoding the video - a 333 MHz MIPS cannot decode 720x480 h.264 in real-time. The VME MUST be doing most of the work. The ME is probably used for decoding the container, moving data, and colorspace conversion at most. It may also be decoding audio formats the VME doesn't understand.
hitchhikr
Posts: 83
Joined: Sat Feb 04, 2006 3:33 pm

Post by hitchhikr »

There's a specific hw component in the console to decode such videos, nothing to do with the VME which is only used for sound, i think.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

hitchhikr wrote:There's a specific hw component in the console to decode such videos, nothing to do with the VME which is only used for sound, i think.
Well, looking at the block diagram, the AVC decoding is shown as a different block, but it's certainly not being decoded by the ME. It's a hardware module doing the heavy lifting. :)
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

Post by Shapyi »

Well for my project I would only need Mp3 decoding using Sony's modules while using the media engine CPU for other operations. Anyone know if that is possible?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

The PS3 must have dedicated H264 decoding hardware too. There's no way a crappy 3.2GHz CPU that's not half as powerful as a desktop 3.2GHz CPU can decode 1080p. My old 3200+ couldn't.
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

Torch wrote:The PS3 must have dedicated H264 decoding hardware too. There's no way a crappy 3.2GHz CPU that's not half as powerful as a desktop 3.2GHz CPU can decode 1080p. My old 3200+ couldn't.
Uhh its PPC.. PPC is hot damn digitty, its about 2x as powerful as your CPU xD
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Wally4000 wrote:Uhh its PPC.. PPC is hot damn digitty, its about 2x as powerful as your CPU xD
It'd probably barely manage the 5MBytes/s Bluray spec on CPU alone. No way it'd play 10+ MBps videos from the XMB if it was just CPU. It can't use the RSX either cos it doesn't support CUDA. 20MBps footage brings my C2Q @ 3.52GHz to its knees, decoding on 3 cores.
Mihawk
Posts: 29
Joined: Tue Apr 03, 2007 2:04 am

Post by Mihawk »

Torch wrote:The PS3 must have dedicated H264 decoding hardware too. There's no way a crappy 3.2GHz CPU that's not half as powerful as a desktop 3.2GHz CPU can decode 1080p. My old 3200+ couldn't.
The hardware is called SPE(s) ;)
Ask and it will be given to you; seek and you will find; knock and the door will be opened to you.
Chrighton
Posts: 58
Joined: Wed Jun 15, 2005 8:24 pm

Post by Chrighton »

If the SPEs had a destiny, it would be signal processing - they should be able to chew through a couple (and I think I'm being conservative) concurrent 1080p sources quite easily.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Shapyi wrote:Well for my project I would only need Mp3 decoding using Sony's modules while using the media engine CPU for other operations. Anyone know if that is possible?
Probably not. The ME is almost certainly used to pass data to/from the VME/AVC decoders, among other tasks. It's clear that Sony loads ME controlling software as part of the codecs, and since the ME is doing the controlling, that's why it's called an ME codec. The ME might not be doing that actual decoding itself, but it's in control of the whole process.

The code we use to run stuff on the ME was based on parts of the code used by Sony to start their stuff on the ME as part of those codecs, so it's a dead certainty they interfere with each other. One or the other, not both.
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

Post by Shapyi »

J.F. wrote:
Shapyi wrote:Well for my project I would only need Mp3 decoding using Sony's modules while using the media engine CPU for other operations. Anyone know if that is possible?
Probably not. The ME is almost certainly used to pass data to/from the VME/AVC decoders, among other tasks. It's clear that Sony loads ME controlling software as part of the codecs, and since the ME is doing the controlling, that's why it's called an ME codec. The ME might not be doing that actual decoding itself, but it's in control of the whole process.

The code we use to run stuff on the ME was based on parts of the code used by Sony to start their stuff on the ME as part of those codecs, so it's a dead certainty they interfere with each other. One or the other, not both.
Makes sense. I haven't been able to get anything running, even as a sample.

So the ME actually, controls the VME... does that mean it might be possible to use the VME? Has anyone been able to access that piece of hardware for use? I know Sony can do as they wish with the VME, but has anyone been able to do anything with it in terms of homebrew?

I am trying to write a media player for PSP and I would like to off load as much to hardware as possible. Sony's modules are too limited in terms of MPEG4 and AVC decoding (resolution restrictions, etc). I read that the VME is a FPGA. I was wondering if it would be possible to access it in order to offload audio decoding, color space conversion and idct in order to save CPU cycles.

Thank you for the answer and keeping this on topic.
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

So the ME actually, controls the VME... does that mean it might be possible to use the VME? Has anyone been able to access that piece of hardware for use? I know Sony can do as they wish with the VME, but has anyone been able to do anything with it in terms of homebrew?
AFAIK, no one knows what the VME or the AVC really are. There's probably a DCT accelerator in there somewhere, but how to use it and what else is in there, Sony only knows.
I read that the VME is a FPGA
I don't think there's any evidence for that.
cheriff
Regular
Posts: 258
Joined: Wed Jun 23, 2004 5:35 pm
Location: Sydney.au

Post by cheriff »

Maybe not an fpga as it were, but it does seem to be reconfigurable under software control in perhaps a similar manner.:

Some slides:
http://www.extremetech.com/slideshow/0, ... 950,00.asp

And some interesting reading from the horse's mouth, on the vme:
http://www.sony.net/Products/SC-HP/cx_n ... view42.pdf

Other than that, there doesn't seem to be a lot out there, but I can guess that reversing the configuration bitstream format from a Sony module to the point of being able to emit custom ones ... would be difficult.
Damn, I need a decent signature!
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Basically, there's only two lines of work here: using Sony's "codecs" for decoding video and audio, and using the ME to run code. The former isn't low-level as it uses the Sony interface from user mode. The latter is COMPLETELY low-level and requires a kernel mode prx for user mode homebrew.
cualquiercosa327
Posts: 5
Joined: Wed Nov 25, 2009 2:52 am

ME/VME...could this be possible?

Post by cualquiercosa327 »

hi.I know some parts of this has been posted before in several post but I dont know where asked it and if it could be an silly question.(correct me if i mistake,please)

First i know we can use me as other cpu (thanks to several people of this forum,using j.f / crazyc prx/samples as StrmnNrmn has done on daedalus.)
I read on a older post StrmnNrmn created a 'job manager' on top mediaengine.prx, which coordinates batches of work between the main CPU and the ME.
he uses J.F.'s MediaEngine.prx ,(i also have read it is not "finished" because some problem as not being able to stop the unit and other things)


The other way we can use is as cooleyes demos/programs using sony'prx and being able to decoder multimedia with hardware (they are many doubts how internally it works,how vme works...)


as PspPet said in a older post (2005):
"It appears the VME software is tied into the ME (Media Engine).

Suggestions/speculation:
If interested in the ME software, take a look at the "mebooter.prx" and "mebooter_umdvideo.prx" system files. Both of these files contain a GZIP copy of the ME software at the end (the mebooter.prx version is bigger, over 800KB).
(ie. the ME code is unziped, saved to memory, and the ME is reset).
You can disassemble this with a MIPS disassembler (the ME is the 2nd MIPS CPU). About half of it is MIPS code. The other half is data, some of which looks like it *might* be FPGA initialization data for the VME. It could also be general data tables (for the ME CPU), and/or code/data for the AVC (MPEG4 decoder).
A lot of reverse engineering required to figure it out."


I imagine the fist part of code of mebooter.prx initialized the ME and pass the data/instruction to vme and load/wait other prx with codec (aac,mp3..) is loaded.

could be posible create other 'job manager' into J.F.'s MediaEngine.prx
and use some parts of this disasmed code also ,making a "multitasking" mediaengine.prx able to use both extra cpu and as sony uses as vme starter/coordinator.


I am not talking to trying to understand the vme code,only reuse (imagine modificating something) the sony's dissasmed code .

dani
SilverSpring
Posts: 110
Joined: Tue Feb 27, 2007 9:43 pm
Contact:

Post by SilverSpring »

The ME firmware was only embedded into those prxs upto 2.00. From 2.50 onwards they are stored in /kd/resource/me_xxx.img

No one has really documented the ME firmware extensively. It's quite complicated and relies heavily upon some type of MMIO at 0x4000000 (which on the main CPU is mapped to the EDRAM of the GE to be used as VRAM). This MMIO on the ME hasn't been documented either.

So at the moment, no one really knows how the VME works or how it's used.
Post Reply