AnsweredAssumed Answered

Blackfin 2D DCT/IDCT (image compression) with BF537 EZ-KIT, write to file (on disk) reconstructed image (Raw pixel data) from BF537 memory

Question asked by floppy on Jan 7, 2012
Latest reply on Jan 11, 2012 by CraigG

I tried this experiment with Digital Image Processing - 2D DCT/IDCT (image compression) with BF537 EZ-KIT implemented by AnalogDevices.


To mention a "resume":

- i build the project;

- load an black&white image (*.bmp) from disk to Blackfin memory at 0x0 with Image Viewer;

- run project;

- push a button (from SW 10 to 13) from the BlackFin board (BF537) and select a level of compression;

- after calculating the quantization table and Start DCT->Quantization->Dequantization->Inverse DCT..  results a reconstructed image at some adress point in BF memory (0x80000);

- with Image Viewer i load that reconstructed grayscale image from BF memory and it's everything ok, and differences are visible;


!mention that when i load image into BF memory from disk with Image Viewer, or from BF memory with Image Viewer, source format is Raw Pixel Data!



BUT all I want to do in addition to this project and DON'T KNOW HOW is:

- to take (create/write) [in C language] that reconstructed image from Blackfin memory into disk (writing a code, or something like that; NOT with Image Viewer feature - Save image as... ).



I tried to fwrite that reconstructed buffer located in memory at 0x80000 into a *.bmp file, but it seems that when i open it i receive errors like: "can't read file header; unknown file format, or file not found...";

               //my code for saving/creating/writing
               //      that reconstructed image = Raw pixel data
               //      from Blackfin memory
          unsigned char *jpeg_buff;
          int jpeg_buff_size;
          //jpeg_buff_size = 480*640*1;
          jpeg_buff_size = 308280;
          FILE *jpegfp = fopen ("myimg_reconstr80000.bmp", "wb");
               fwrite (jpeg_buff, 1, jpeg_buff_size, jpegfp);
          fclose (jpegfp);



Please anyone knows how to create/write *.bmp image from that Raw Pixel Data located in Blackfin memory in C language?



I attached an archive of the entire Visual Dsp project. (using VisualDsp++ 5.0)




*excuse me for my english writing errors