Strict Standards: Redefining already defined constructor for class wpdb in /home/mgerards/public_html/blog/wp-includes/wp-db.php on line 52

Deprecated: Assigning the return value of new by reference is deprecated in /home/mgerards/public_html/blog/wp-includes/cache.php on line 36

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/mgerards/public_html/blog/wp-includes/cache.php on line 389

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 556

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /home/mgerards/public_html/blog/wp-includes/classes.php on line 678

Deprecated: Assigning the return value of new by reference is deprecated in /home/mgerards/public_html/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/mgerards/public_html/blog/wp-includes/theme.php on line 507
Marco’s blog

ATA bug fixes

August 14th, 2008

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

Last week I have updated the ATA driver code in GRUB 2. Error handling was broken and delays were long until Colins TSC patch was applied. The current code is now quite resilient to errors. In the meanwhile I removed the ATAPI code. Instead, I have added a SCSI module. The SCSI modules allows other modules to register a SCSI command interface. The SCSI modules exports a disk device that is communicated with using SCSI commands over this SCSI command interface. The ATA driver was changes to uses scsi.mod.

I am working on USB support for Google Summer of Code. One of my goals is implementing USB Mass Storage Device support (USBMSD). USBMSD also uses SCSI commands. Thus this module will be shares between at least USBMSD and ATAPI. Hopefully someone will add SCSI drivers some day.

Sidux boot video

July 15th, 2008

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

A while ago I wrote a blog entry on how to boot iso9660 CDROM images using GRUB 2. Someone made a video out of it and placed it on youtube

Enjoy :-)

Google Summer of Code 2008

May 2nd, 2008

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

Last year I have implemented a Dirac (BBC) decoder for FFmpeg, as a Google Summer of Code project. This year I will be working on a Summer of Code project again, now for GNU GRUB. The goal is to implement a USB framework including some drivers for GRUB 2. When this is implemented, you can access USB HID and USB Mass Storage devices from GRUB, even when the firmware does not support this. You might want to use this when your BIOS does not support USB. More importantly, this increases the usability of GRUB 2 on top of Coreboot (formerly known as LinuxBIOS). Because of this (and other GRUB 2 features we are working on), Coreboot + GRUB 2 might serve as a good (and Free!) BIOS replacement.

The first thing I will do is reading some books about USB, namely “USB Complete” and “Universal Serial Bus System Architecture”. Although I have some doubts about the quality of the second book, it’s better than reading the USB specification from the screen (which I eventually will have to do). I have ordered both books and I am looking forwards to getting started.

Because I will read these books first and because I am busy with my studies, I will not start producing code from the start, you can expect the first code somewhere in June. The first thing I plan to look at is libusb, which makes it possible to play with USB without having a complete UHCI driver. It should be easy to integrate this into grub-emu, more on this later.

As for Dirac, it still isn’t finished (unfortunately!). When I have time to look at this, I will. But if someone is interested in working on this, please tell me. The remaining tasks are not hard.

Dirac updates

December 23rd, 2007

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

BBC research has been updating the Dirac specification again. My work wasn’t updated after August, so I had to go over the changes in the specification. After some frustration and hard work, it’s updated again. The only thing left is adding the new interpolation filter. This should result in a performance gain, because this filter is simpler and can be done using shifts, instead of multiplications :-)

Now I will focus on some cleanups and optimizations. Now I have some time for this because of Christmas holidays (2 weeks). I have several in mind and I will post the performance gain to my blog after the optimizations are committed.

Reading a bit…

November 18th, 2007

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

Last week I started working on my graduation project. It’s a full-time job and at the moment my top priority. During the weekend I try not to spend too much time using the computer. For example, next weekend I will go to a concert of Sonata Arctica :-). Last weekend I have been keeping up with the emails on grub-devel so GRUB 2 will remain to be maintained.

Besides that, I am reading Operating Systems Design and Implementation by Andrew Tanenbaum. Although I know quite a lot on this subject already, I am reading it to refresh my memory on this subject and to prepare myself to read more papers on microkernel design. I have the silly idea to waste my precious time on writing my own microkernel some day. More importantly, I like reading and I do not want to spent too much time working on the computer. I am considering buying the book Modern Operating Systems, also by Andrew Tanenbaum. Can someone tell me if this is a good book and if it doesn’t have too much overlap with the book I am currently reading?

So I do not have much time at the moment. Still, I intend to finish the ATA driver and networking support for GRUB 2 somewhere in 2007. Also, I want to get the Dirac code for FFmpeg in shape so it can be committed soon. I am not sure if doing all this in 2007 is realistic though…

ATA/ATAPI driver for GRUB 2

November 3rd, 2007

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

Last week I committed a patch to add support for ATA and ATAPI to GRUB 2. The ATA driver supports the CHS, ATA and ATA48 sector addressing methods. It should be capable of reading from and writing to every ATA harddisk. The ATAPI support is only capable of reading sectors from CDROM. I still have to add features like reading the sector count.

This driver will be especially useful forĀ  the LinuxBIOS port that has been recently committed. It can also be used to load something from CDROM when the BIOS doesn’t have CDROM support. Although I should further look into this, the only thing I have tested is loading files from CDROM.

There are several shortcomings in this driver. My driver and the one in the BIOS do not like each other. After my driver initializes, disk access from the BIOS might result in a crash. Therefore it disables biosdisk support. It also means that windows, for example, cannot be loaded using this driver because it later on accesses the disk via the BIOS interface. Perhaps this problem can be avoided by not resetting disks or storing the state somehow. I would appreciate it if someone can explain how I should do this properly so it will work on all systems.

Another shortcoming is its speed. For the moment it waits one tick, which is the shortest time GRUB can currently wait. One tick is 1/18th of a second, while it isn’t required to wait this long. Because of this, when the driver waits, it is wasting way too much time.

Keyboard controller

September 15th, 2007

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

During the afternoon I decided to play a bit with my FPGA development board. It has a PS/2 connector and I tried to make a PS/2 controller (using VHDL) that is able to receive PS/2 packets. I have no electrical engineering background, so what I did might just be plain wrong. But I had fun and the design seems simple and clean to me. Feedback is of course welcome!

For now, I just interfaced with a keyboard. My PS/2 controller waits for the start bit, then starts reading the bits (and calculates the parity in parallel). It uses the clock generated by the keyboard to do this. When the byte is received and the parity is correct, a signal is sent to inform another process that the data is available. This process runs using a 27Mhz oscillator and waits for the data to settle before it makes it available.

Of course it is not finished yet. It can’t send commands to the keyboard yet, in order to do this I first have to learn a bit more about tri-states. I haven’t tried connecting a mouse yet. I will do this too and figure out how this works in detail. When everything works, I will make my VHDL code available. Can someone suggest a good license for VHDL code? I will use the GPLv3, unless someone can suggest something that is more appropriate for hardware. Of course I can already show you the schematic of what I currently have:

Keyboard controller RTL

This development board also has VGA output (I implemented something for this already), DRAM, SD interface, RS232, USB, sound, buttons, a 7 segment display (got it working, this one requires scanning) and it has TV output! So it can be used to develop multimedia stuff like MPEG-2, MP3, MJPEG or so. It would be neat to write a decoder or encoder some day. But my idea is to create my own gameboy some day. Although I can not promise I will actually come to this.

Motion Vector packing

September 10th, 2007

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

To implement motion vector packing, I just generate semi-random motion vectors and write these to the bitstream. In that case the rest of the encoding process has to adapt to these (incorrect) vectors. Most importantly: this will result in a bigger residue, thus in a bigger file. But this way this part of the encoder can be tested.

The motion vector packing now works! I have also implemented calculating the residue and fixed many bugs in the other parts of the encoding process. Now the encoder writes intra+inter frames with the semi-random motion vectors for a single reference frame.

So what needs to be done now is searching for (optimal) motion vectors. Perhaps I can use the algorithm from the Snow codec for this, otherwise I will have to implement this myself. I also need support for two reference frames. Actually the support is there, it just has to be enabled properly :-). In order to produce smaller files I need to add quantization.

Despite what’s missing, I think I can say I quite succeeded with writing the Dirac codec during Summer of Code (about 2 months, with a break of one week because of exams). When Summer of Code started, one of the Schrodinger developers called me Biggest Optimist in the Universe and Beyond 2007. Although the encoder is not in a state that it can efficiently code all videos yet, the biggest part has been implemented already. But more importantly, my decoder can play back videos at a decent speed. So I got the “Biggest Optimist in the Universe and Beyond 2007 Award”, now I am waiting for the certificate, medal or whatever comes with the title ;-).

Mike and Michael from the FFmpeg project both wrote a blog entry to wrap up how they look at the last Summer of Code, my work on the Dirac codec is part of this. Summer of Code is finished now so I will start using the FFmpeg category for my future work on Dirac. Don’t worry, I will keep working on Dirac!

Intra frame coding fixed

September 3rd, 2007

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

In a previous post I mentioned that intra frame encoding works, but the reference implementation couldn’t decode my frames yet. Now I fixed this bug, it seemed to be a silly typo, I was using uint8_t instead of int8_t. With this fixed, the reference implementation is capable of decoding the frames encoded by my encoder.

Of course a lot is missing in the encoder. First I will focus on writing the bitstream for the inter frames. So I need motion vectors to write out. First I will just take some random vectors, calculate the residue using these vectors and write both to the bitstream. That way it will become easier to test if writing out this data works, before I start working on Motion Estimation.

Decoder performance

September 2nd, 2007

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/mgerards/public_html/blog/wp-includes/formatting.php on line 74

Today I built the decoder with profiling and debugging information disabled to compare the speed with that of the reference implementation. When building the reference implementation I disabled MMX, so I am just comparing C code with C code. At the end my code can also be speed up using SIMD code.

To measure the speed, I used `time’. The first video I tried is a small video of just a few seconds. Using the reference implementation:

real 0m4.029s
user 0m3.704s
sys 0m0.272s

When using my decoder:

real 0m3.754s
user 0m3.528s
sys 0m0.192s

The first video is a longer video. Using the reference implementation:

real 0m59.709s
user 0m52.447s
sys 0m5.168s

Using my decoder:

real 0m55.814s
user 0m51.327s
sys 0m2.460s

I had a look at what makes the difference. It appears that because I cache halfpel interpolated reference frames I save lots of time. This is not being done for the reference implementation. The reference implementation recalculated the interpolated frame every time.