Thursday, April 12, 2012

Ballroom Bits!

Sat around last night and corrected the DMD export script.
It turns out that the image data was not properly created (wrong colors etc) - I believed this problem was in my "color = color/nr_of_shades" but as it turns out, it was a different problem completely.
This became apparent once I added a previsualization image directly on the computer by simply creating a new temporary image from the converted data, where the image I did the conversion on had already become garbled even before the conversion had begun.

Now every image is first converted to a grayscale 8-bit image, then posterized (gathering similar colors) into a 3-bit image (7 shades + black). Looks stunning and no need to create indexed images first etc.

I also got the bit packing in place so that each pixel only consume 3 bits in the DMD-file. For a single frame image I went from 4096 bytes to 1366 bytes. On top of this I added a header of 2 bytes containing the number of frame in the image, for a total byte count of 2+(1366*amount_of_frames).  Each frame is actually 1365 bytes and 3 bits, with 5 bits padding.

This should mean I get the same amount of data loaded in 1/3 of the time it's previously taken to load an image of the SD card. I say should - because it's untested as I didn't have time to write the matching software on the Chipkit board.

When that's done I need to tweak the preview image so that I get a more accurate preview of the final image as it would appear on the DMD. The current image contains a little too even color distribution where the DMD has most of it's shades in the upper half of the scale. It's either this, or more preferably, tweak the actual DMD rendering routine so that I get a more even color distribution - Hopefully I'll be able to go darker in color now that the SD card loading is faster (more processing time available for rendering).

Now, if only I could get rid of the initial 5 ms unnecessary SD-card buffering as well...

A couple of pics for comparison:
1) As seen on the computer screen. A little too perfect and too red, as the next picture shows...

2)  The same file loaded and displayed on the DMD, complete with smearing on the camera.
As you can see, a lot of the finer shades are not represented properly. I need to tweak this a lot, i.m.h.o.

No comments:

Post a Comment