Swap With Dell 9300

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, August 3, 2008

How I hacked mplayer to work on Motorola ROKR - Part 2

Posted on 7:20 AM by Unknown
It has been over a month since part 1, so let me start off quickly and finish this part. I will try to explain how I got the 19 bpp working in mplayer. It was very straight forward really. I had to edit the following files from the mplayer-cvs (you can download the code from http://code.google.com/p/j2me-ctunes/):
libmpcodecs/img_format.c
libmpcodecs/img_format.h
libmpcodecs/vf_scale.c
libvo/osd.c
libvo/osd.h
libvo/vo_fbdev.c
mplayer.c
postproc/yuv2rgb.c
postproc/swscale.c
In libmpcodecs/img_format.c, libmpcodecs/img_format.c and libmpcodecs/vf_scale.c I added a few lines to return something to say 19-bpp is supported in RGB and BGR formats.

libvo/osd.c is interesting. I added a method called vo_draw_alpha_rgb19() which draws the alpha for 19-bpp.

In libvo/vo_fbdev.c, I disabled some code that was causing problems in ROKR and disabled clipping because it was done elsewhere. In addtion added code to initialize variables for 19-bpp format (i.e. r, g, b offsets and lengths. Each color is 6 bits long with 1 bit for alpha) and drawing alpha (using the method previously added in osd.c)

I fixed a few things in mplayer because there was some weird state change after EOF. It did not work correctly on ROKR. I don't remember what was wrong, but for some reason I added a PAUSE state after a file has been played. I used the slave mode of mplayer (see man mplayer for more details about the slave mode) to play media files. So mplayer was always running and when it is time to play a new media file I just pass the new filename from java to the running process that controls the mplayer process. So when a file has completed playing the state of mplayer used to end in PLAYING state. I did not want it to be in that state for some reason so after a play ended I change the state to PAUSE.

postproc/yuv2rgb.c contains the most important hack of all. It is the one that converts YUV data to RGB 19bpp. It was the most fun of all to write the code. Take data point for each pixel in YUV format and convert it to RGB and then fit it in 19 bpp. A lookup table is created up front and the table is used to do the conversions quickly in realtime when the video is playing. I do know much of MMX or SSE extensions (and not sure if ARM supports them) so I had to do all the conversion in C, but it wasn't bad at all performance wise. I got 24 fps for most video formats on a 320 Mhz XScale processor.

The final change is in postproc/swscale.c which converts YUV to packed RGB format.

That is the end of part 2 :). Pretty simple isn't it. Next time I will explain some audio hacks.
Read More
Posted in | No comments
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • Installing Boxee on Gentoo: my experience
    You have probably heard of Boxee and Gentoo (come on). I wanted to give Boxee a try, because of all the movies and tv shows that I can watc...
  • This is my first stab at blogging!
    Heard the good news about the latest Intel Processor? I have been waiting for this processor for a long time. The conroe (for desktops) and ...
  • How I hacked mplayer to work on Motorola ROKR - Part 1
    Ever since I posted the cTunes video on youtube ( http://youtube.com/watch?v=coV06ChYWJo ), I have been getting a few requests for the app t...
  • InduinoX and wireless relays: Part I
    It has been a while since I received my wireless relay and I finally got some time this weekend to put them to good use. The connections we...
  • VirtualBox 1.6 is out
    The most usable (for me anyway) VirtualBox release for mac is out. I just downloaded 1.6.0 from VirtualBox.org . I was finally able to load ...
  • Looking to buy 8800GT
    How hard is it to buy a graphics card for your desktop? Easy right? Hardly! In my previous post I casually mentioned that my Dell E1705'...
  • Building a linux gaming PC: Update 1
    Today I received my 1GB memory, the upgrade I require to transform my media center desktop PC into a moderately powerful gaming PC. I am sti...
  • InduinoX: Blinking LEDs
    Having received my arduino and basic components kit earlier last week , I sat out to write my first arduino program. A hello world of sorts...
  • Scopes and electronics
    An oscilloscope is very important for any electronic enthusiast. Recently I have been trying to send IR remote codes from an arduino board ...
  • My HTPC
    I have my eye on a new HTPC, but what does my current one look like? Here it is. The desktop PC that acts as my apache, mysql, samba, vnc, n...

Categories

  • 555 timer
  • arduino
  • delay circuit
  • electronics
  • gentoo
  • home automation
  • induinox
  • ir emitter
  • ir receiver
  • ir remote
  • kubuntu
  • lcd
  • ldr
  • leds
  • lucid lynx
  • oscilloscope
  • picoscope
  • probots
  • receiver
  • relay
  • relays
  • scope
  • sensors
  • simple labs
  • sony remote protocol
  • transmitter
  • virtualbox
  • virtualization
  • wireless relay

Blog Archive

  • ►  2011 (12)
    • ►  December (1)
    • ►  November (1)
    • ►  October (6)
    • ►  September (4)
  • ►  2010 (5)
    • ►  May (1)
    • ►  March (1)
    • ►  January (3)
  • ►  2009 (10)
    • ►  December (5)
    • ►  November (3)
    • ►  May (1)
    • ►  April (1)
  • ▼  2008 (29)
    • ▼  August (1)
      • How I hacked mplayer to work on Motorola ROKR - Pa...
    • ►  June (1)
    • ►  May (4)
    • ►  April (1)
    • ►  March (1)
    • ►  February (10)
    • ►  January (11)
  • ►  2007 (7)
    • ►  May (5)
    • ►  April (1)
    • ►  March (1)
  • ►  2006 (8)
    • ►  November (1)
    • ►  October (3)
    • ►  September (2)
    • ►  August (2)
Powered by Blogger.

About Me

Unknown
View my complete profile