Hardware JPEG Decoder for GBA in 100% ASM

DSLSC

Active Member
OP
Newcomer
Joined
Aug 27, 2013
Messages
29
Trophies
0
XP
87
Country
United States
I've always wanted to see just how fast the GBA can decode a full-screen JPEG picture. The JPEG decompression library in Jeff Frohwein's "gfxlib" is based on a decoder originally written for Visual Basic by Dmitry Brant. I used a combination of both versions to write an ASM version. It goes quite fast, but I think it can go faster with some optimizations by those who understand JPEG better.

Currently, my ASM port only supports non-subsampled (1x1) and 2x2 subsampled JPEGs. I don't have any means of saving JPEGs in 2x1, 1x2, etc. formats, and so have left those formats out.

The example binary flips through four JPEGs as fast as possible, including 1x1 and 2x2 JPEGs. The "mandrill.jpg" file is from another JPEG decompression library that takes 1/3 second to decode it. The remaining JPEGs are from a VB6 encoder port of a C-based encoder by Cristian Cuturicu.

As typical, I have heavily commented the source code, in hopes of making it easy to understand and follow, and look forward to hearing about any optimizations, bugfixes, etc. Enjoy!
 

Attachments

  • ASM JPEG Decoder.zip
    178.4 KB · Views: 400

DSLSC

Active Member
OP
Newcomer
Joined
Aug 27, 2013
Messages
29
Trophies
0
XP
87
Country
United States
The GBA is the last Nintendo product with a physical link port, as far as I know, which is all the better for hardware interfacing. Look, an ARM CPU in a case with a built-in display and button pad!
Next: another "first" with a JPEG encoder for the Parallax Propeller...in ASM!

Again, if anyone can optimize this decoder further, or has any bugfixes, by all means post the changes.
One optimization I made in the IDCT routine resulted in a very slight change to some hues of the output picture. Basically, the original code would ">>5" the values in the IDCT; then in the DrawPixel routine, the converted values would be ">>3"d. Well...why not do it all in a ">>8"? Which is what I changed, but with only 32 shades per channel, an error of one bit would probably be visible.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • K3Nv2 @ K3Nv2:
    13,600 MB/s though
  • DinohScene @ DinohScene:
    I got a 980 pro iirc
  • K3Nv2 @ K3Nv2:
    Soldigms been pretty solid
  • DinohScene @ DinohScene:
    yeh 980 pro
  • DinohScene @ DinohScene:
    good enough tbf
  • K3Nv2 @ K3Nv2:
    https://a.co/d/gMNhZNI never heard about them but reviews are good
  • SylverReZ @ SylverReZ:
    @DinohScene, Crucial SSDs work fine. I have one installed in my Xbox.
  • SylverReZ @ SylverReZ:
    Reviews seem positive.
  • DinohScene @ DinohScene:
    I believe I had some Patriot RAM running in a computer somewhere
  • K3Nv2 @ K3Nv2:
    $250 is pretty solid considering
  • K3Nv2 @ K3Nv2:
    With the refund it'll be about $150
  • K3Nv2 @ K3Nv2:
    6tb nvme pc ftw
  • DinohScene @ DinohScene:
    500 GB NVMe, 750 GB
    SATA SSD 1 TB HDD
  • DinohScene @ DinohScene:
    honestly I don't play pc games
  • K3Nv2 @ K3Nv2:
    I don't game
  • K3Nv2 @ K3Nv2:
    Once I buy this I'll be around 20tb worth of storage tho if we're talking all my drives
  • K3Nv2 @ K3Nv2:
    All this crap I got and all I do is pick up the GabeDick to fiddle with his happy stick
  • DinohScene @ DinohScene:
    idk the total storage cap I have
  • DinohScene @ DinohScene:
    50 TB orso
  • SylverReZ @ SylverReZ:
    @DinohScene, I don't play PC games often. Mostly its all 90s-00s games.
  • K3Nv2 @ K3Nv2:
    Hm doing research quite possible my issue with this drive is bios related not detecting it fully
  • DinohScene @ DinohScene:
    run crystaldisk?
  • K3Nv2 @ K3Nv2:
    Don't think it would do much if gnome live even sees it as 2mb
  • K3Nv2 @ K3Nv2:
    Vmd issue possibly
    K3Nv2 @ K3Nv2: Vmd issue possibly