Shop OBEX P1 Docs P2 Docs Learn Events
jpg decoder works! — Parallax Forums

jpg decoder works!

RaymanRayman Posts: 14,665
edited 2013-05-18 07:28 in Propeller 1
was looking around for a jpg decoder for PropGCC and found:

Privacy For Pictures pfp.c v 0.05 22.8.07

Made a few changes to the source and it now compiles :)
Don't know if it is actually working yet, but maybe this weekend I can test it out...

Like MP3, this probably won't be fast enough for P1. But, might be nice for P2.

It includes some kind of cryptography for some reason, but I've cut that out...

Update: It works!

Comments

  • RaymanRayman Posts: 14,665
    edited 2013-05-17 15:57
    It only took around 20 minutes to make this compile and most of that was changing things like this:

    void setpict(i) int i;

    to this:

    void setpict(int i)

    I don't think I've seen this first usage before, and PropGCC doesn't like it.
    But, supposedly this compiles under GCC in DOS, so that's a bit of a mystery to me...
  • Heater.Heater. Posts: 21,230
    edited 2013-05-17 16:05
    That is the old K&R style of function declarations. You still come across code like that from time to time.

    The newer standardized style is better as it allows the compiler to check the function parameter types.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-05-17 16:58
    Very interesting work Rayman.

    Combine this with some of the preliminary html decoder I played around with last year and this could be the beginning of a web browser.

    I'm working with Eric on ways to get Spin2cpp to use existing spin obex objects in C - with large external memory programs we need a new programming style where we explicitly declare some variables as being in hub and some as being in external memory. This may come up in your jpg decoder as well, as it might make the code run faster if you can buffer the picture data in hub rather than external ram.

    Keep up the good work!
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-05-17 18:57
    I looked at JPEG encoding and decoding a while ago when PropGCC was being developed. I was able to port the code from the Independent JPEG Group's website at http://www.ijg.org . It requires external RAM, so I ran it on the C3 board using the XMM mode. It ran painfully slow -- something like one minute to decode a small image of about 128x128 in size.

    It could run faster with optimization, especially in the DCT/IDCT code. It might be feasible to do it on the P2.

    The code that I modified is in the attached zip file. The rest of the code is located at the IJG site. The readme.txt file describes how I built the code.
  • RaymanRayman Posts: 14,665
    edited 2013-05-18 04:42
    I did look at that version first... It's probably better.
    But, this one is tiny and all the code is in one file...

    Not sure which one is faster...
  • RaymanRayman Posts: 14,665
    edited 2013-05-18 07:28
    Just tested it out this morning... It works!

    Decoded this 160x128 bitmap in 16 seconds:
    pengtest.jpg

    I guess that's not too bad... Maybe it'd be faster if I reduced the jpg quality...

    But, it uses a lot of memory, because it buffers the whole picture in RAM...
    However, I'm thinking that with my QMP, maybe I can have it directly write to the lcd's GRAM instead of using up memory.
    Then, perhaps this could even work in non-xmm modes... Actually, no, it's still too big to work in anything but xmm-single or -split
    160 x 120 - 12K
Sign In or Register to comment.