JPEG decompression from main memory into VRAM is slow. FIXED
Posted: Tue Dec 09, 2008 2:56 pm
I am writing a simple app for the DS that loads jpegs from cart (via libfat) and then, using Burt Radons JPEG decompression library, displays the result in BG_GFX.
My problem is that this process is too slow (somewhere in the order of 18 seconds). If I link the jpeg directly into the binary using bin2s, however, then the process very quick. Below is some example code:
So, most excellent code gurus, WTF? Am I doing it wrong?
Thanks
My problem is that this process is too slow (somewhere in the order of 18 seconds). If I link the jpeg directly into the binary using bin2s, however, then the process very quick. Below is some example code:
Code: Select all
FILE* file = fopen("files/my_image.jpg", "rb");
uint8* buffer1 = new uint8[256*192*4];
uint16* buffer2 = new uint16[256*192*4];
while (!feof(file)){
fread(buffer1, sizeof(unsigned char), 1, file);
}
JPEG_DecompressImage (buffer1, buffer2, 256, 192);
dmaCopy(buffer2, BG_GFX, 256*192);
Thanks