libvpx works on Sega Dreamcast

20 views
Skip to first unread message

Mike Melanson

unread,
Feb 18, 2011, 4:03:21 AM2/18/11
to WebM Discussion
I'm sure I'm the only person who could possibly care about this (and I
don't even care that much), but I managed to get libvpx 0.9.5 ported to
the Sega Dreamcast game console (Hitachi/Renesas SH-4 CPU). It mostly
works too!

It took a little effort but nearly all of the source code compiled
as-is. So, good work with the portability. :)

--
-Mike Melanson

Ralph Hauwert

unread,
Feb 18, 2011, 4:09:55 AM2/18/11
to webm-d...@webmproject.org
Agree, portability is great! How are the FPS on dreamcast ?

Ralph.

> --
> You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
> To post to this group, send email to webm-d...@webmproject.org.
> To unsubscribe from this group, send email to webm-discuss...@webmproject.org.
> For more options, visit this group at http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.
>

Alex Converse

unread,
Feb 18, 2011, 4:11:47 AM2/18/11
to webm-d...@webmproject.org

Mike,

Your crazy hacker spirit never ceases to amaze me. Congrats.

--Alex Converse

Mike Melanson

unread,
Feb 18, 2011, 4:17:46 AM2/18/11
to webm-d...@webmproject.org
On 02/18/2011 01:09 AM, Ralph Hauwert wrote:
> Agree, portability is great! How are the FPS on dreamcast ?

Hard to say at this point. So far, I have only ported the
decode_to_md5.c utility so that I can test bit exactness via a serial
console. I haven't hooked the decoder up to the video output yet.

The decoder does crash after enough frames. I haven't delved into the
'why' yet. I was just startled to see correct MD5 sums start pouring out
of the console.

I wouldn't expect impressive FPS-- the DC struggled to play low-res
MPEG-4 part 2 video.

--
-Mike Melanson

Ralph Hauwert

unread,
Feb 18, 2011, 4:28:01 AM2/18/11
to webm-d...@webmproject.org
I'm curious for sure, if you do get any results on that, would love to hear.

Furthermore, how are you planning to do yuv->rgb conversion ? Does the DC have enough functionality in it's graphics processor to do so ?

Ralph.

Mike Melanson

unread,
Feb 18, 2011, 4:33:28 AM2/18/11
to webm-d...@webmproject.org
On 02/18/2011 01:28 AM, Ralph Hauwert wrote:
> I'm curious for sure, if you do get any results on that, would love to hear.
>
> Furthermore, how are you planning to do yuv->rgb conversion ? Does the DC have enough functionality in it's graphics processor to do so ?

Not directly. But there is a trick with texture blending that can
facilitate conversion:

http://multimedia.cx/yuv-3d-rgb.txt

I'll definitely try to get visual playback happening, just for fun. :)

--
-Mike Melanson

John Koleszar

unread,
Feb 18, 2011, 8:50:54 AM2/18/11
to webm-d...@webmproject.org

Nice work, Mike! And for the parts that didn't, patches welcome -- we
did compile on SH-4 in the past...

Frank Galligan

unread,
Feb 18, 2011, 8:57:35 AM2/18/11
to webm-d...@webmproject.org


--
   -Mike Melanson

--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.
For more options, visit this group at http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.

Cool. I remember working on TM2X on the Dreamcast. That was a long time ago.

Mike Melanson

unread,
Feb 18, 2011, 12:38:48 PM2/18/11
to webm-d...@webmproject.org

I suspect you did so for Linux/SH-4. This was on a custom, purpose-build
RTOS and most of the mods I made just needed to make it fit more nicely
with the RTOS' almost-POSIX-compatible system libraries.

If I get down to figuring out why it's crashing on certain frames (and
if it's truly a bug in libvpx), I'll surely send along a patch.

--
-Mike Melanson

Mike Melanson

unread,
Feb 18, 2011, 12:40:49 PM2/18/11
to webm-d...@webmproject.org
On 02/18/2011 05:57 AM, Frank Galligan wrote:
> Cool. I remember working on TM2X on the Dreamcast. That was a long time ago.

Do you know if any released DC games used TM2X? The only FMV formats I
have seen on DC games are Sofdec and 4XM. In fact, the only place where
I have ever seen TM2 video remains Final Fantasy VII for PC.

--
-Mike Melanson

Mike Melanson

unread,
Feb 18, 2011, 1:34:07 PM2/18/11
to webm-d...@webmproject.org
On 02/18/2011 05:50 AM, John Koleszar wrote:
> Nice work, Mike! And for the parts that didn't, patches welcome -- we
> did compile on SH-4 in the past...

Found the crashing problem: libvpx-v0.9.5/vp8/common/reconinter.c has to
#define MUST_BE_ALIGNED. In the default distribution, this is commented
out with a note that it must be enabled on such architectures as ARM.
Are ARM system integrators expected to figure this out or is there
out-of-file documentation on the matter?

Thanks...
--
-Mike Melanson

Frank Galligan

unread,
Feb 18, 2011, 2:25:21 PM2/18/11
to webm-d...@webmproject.org, Mike Melanson
Yeah there were a few in Japan, not many (I don't remember right now). I also remember Toy commander and an NHL game I think.

If I run across any dreamcast disks with that shipped with TM2X I will let you know. If a disc shipped with TM they usually had  a TM logo on the back, but not always. 



--
   -Mike Melanson

Fritz Koenig

unread,
Feb 18, 2011, 2:36:05 PM2/18/11
to webm-d...@webmproject.org, Mike Melanson
It varies from device to device. Earlier ARM devices we were working
required aligned reads. I believe it's something that can be set up
in configuration registers. Newer devices we were programming for did
not have this restriction.

But no, there is no other documentation, sorry.

Fritz Koenig

unread,
Feb 18, 2011, 2:45:43 PM2/18/11
to webm-d...@webmproject.org, Mike Melanson
This is compiler reference from ARM[1]. Pre v6 does not support
unaligned access, post does, but must be configured.

[1]: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491c/CIHCGCFD.html

Mike Shaver

unread,
Feb 18, 2011, 3:10:28 PM2/18/11
to webm-d...@webmproject.org, Fritz Koenig, Mike Melanson
On Fri, Feb 18, 2011 at 11:36 AM, Fritz Koenig <frko...@google.com> wrote:
> It varies from device to device.  Earlier ARM devices we were working
> required aligned reads.  I believe it's something that can be set up
> in configuration registers.  Newer devices we were programming for did
> not have this restriction.

Even where unaligned access doesn't trap, isn't it a significant
performance penalty?

Mike

Attila Nagy

unread,
Feb 18, 2011, 3:17:47 PM2/18/11
to webm-d...@webmproject.org

On the contrary, it's a speedup on arm. No penalty!
Nice work!

John Koleszar

unread,
Feb 18, 2011, 3:19:39 PM2/18/11
to webm-d...@webmproject.org, Fritz Koenig, Mike Melanson
Yes.. There's a configure switch (--disable-fast-unaligned) that's
supposed to configure whether to try unaligned accesses at all, but it
looks like the functions that used to use it don't anymore. Should be
a straightforward fix to connect it here, or just change the default
behavior in reconinter.c to the safe/slow versions, since nobody's
going to use the C versions of these in production anyway.

Mike Melanson

unread,
Feb 18, 2011, 3:39:22 PM2/18/11
to Mike Shaver, webm-d...@webmproject.org, Fritz Koenig
I think that's generally true. Fortunately, the VP8 code usually aligns its buffers. But for motion compensation (at issue in this case), the unaligned accesses are just part of the game.

-Mike Melanson

Måns Rullgård

unread,
Feb 19, 2011, 7:27:43 AM2/19/11
to webm-d...@webmproject.org
Mike Shaver <mike....@gmail.com>
writes:

One cycle compared to an aligned access.

--
M�ns Rullg�rd
ma...@mansr.com

Mike Melanson

unread,
Feb 20, 2011, 1:29:09 AM2/20/11
to webm-d...@webmproject.org
On 02/18/2011 01:28 AM, Ralph Hauwert wrote:
> I'm curious for sure, if you do get any results on that, would love to hear.

Update: Realtime playback IS possible! ... if the video is 176x144 ...
and you don't do YUV -> RGB conversion (just display the Y plane) ...
and no audio decoding to go along with video playback.

:)

More details here:

http://multimedia.cx/eggs/decoding-vp8-on-a-sega-dreamcast/

--
-Mike Melanson

Reply all
Reply to author
Forward
0 new messages