- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can any one tell us pls.
I am using DE0 board. Reading bmp image from SDCARD display it on VGA instead of SRAM buffer i m using SDRAM. is it possible to display the bmp image.Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes it's possible.. But you have to do the work to make it happen.
If you already have the BMP decoded in SRAM, you just need to send to to the VGA DAC's with the appropriate timing. for the resolution in question.. A place to start is: http://en.wikipedia.org/wiki/video_graphics_array This place has all the correct video timings for different display resolutions. http://tinyvga.com/vga-timing The OLD crt displays were much more forgiving than new LCD panels on display timing. If you aren't close, most likely they will just remain blank. Get the timing correct, you should start seeing an image. I would just try a constant color frame first, until you get the display up, then move forward with the bmp data. Pete- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.... I m using DE0 board....it doesnt have SRAM .So i'm using SDRAM instead of SRAM. I have been used SDCARD controlle for reading the Bmp image . it successfully written to the SDRAM almost got the output but the image displayed it on reverse in the VGA.
i have already tried for constant color frame. it successfully displays the image on VGA. Now i m doing Bmp to display on the VGA. Can u tel how the image data get stored in SDRAM.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The format varies depending on the type of BMP image it is (Color resolution)
http://en.wikipedia.org/wiki/bmp_file_format#pixel_array_.28bitmap_data.29 Should give you the information you need. Read the header info to locate your data format. Then I suggest you have a line fifo to output the lines at a constant rate. Fill it at the rate the SDRAM can provide and have it read out at the video rate. Pete- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how the 16bit bmp file store the values of RGB.
i have written the program as first seperate the header file info. after tat bmp data get starts. is it correct...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is my coding .. i am not able to get the exact ouput .whats wrong with these..anybody can tel us....
int main() { unsigned char byte_r,byte_g,byte_b; int x,i,j; alt_up_sd_card_dev *sd_card_dev = alt_up_sd_card_open_dev("/dev/SDCARD"); sw=IORD_ALTERA_AVALON_PIO_DATA(SWITCH_BASE); if(sw==1) if(sd_card_dev != 0) { if(alt_up_sd_card_is_Present()) { if(alt_up_sd_card_is_FAT16()) printf("Card is FAT16\n"); else printf("Card is not FAT16\n"); sd_fileh= alt_up_sd_card_fopen("Mire.bmp", 0); if(sd_fileh< 0) printf("Problem creating file. Error %i", sd_fileh); else{ printf("\nReading Bmp file"); for(x=0;x<54;x++){ header=(unsigned char)(alt_up_sd_card_read(sd_fileh)); } //printf("%ld",image_size); for(i=0;i<280;i++){for(j=40;j<320;j++) { byte_b=(unsigned char)(alt_up_sd_card_read(sd_fileh)); byte_g=(unsigned char)(alt_up_sd_card_read(sd_fileh)); byte_r=(unsigned char)(alt_up_sd_card_read(sd_fileh)); pixel=((byte_r>>3)<<11)|((byte_g>>2)<<5)|((byte_b>>3)<<0); IOWR_16DIRECT(SDRAM_BASE,(((i+80)*640+(j))-40),pixel); } } } printf("out of loop"); alt_up_sd_card_fclose(sd); } else printf("Card is not available"); } return 0; }- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assuming it's a none compressed bitmap, you need to decode the bitfield
The BITFIELD mechanism described above allows for the definition of tens of thousands different pixel formats, however only several of them are used in practice,[12] such as: R.G.B.A.X 8.8.8.0.0 8.8.8.0.8 8.8.8.8.0 5.5.5.0.1 5.5.5.1.0 5.6.5.0.0 4.4.4.0.4 4.4.4.4.0 All palettized formats (marked in yellow in the table above) For 16 bit pixels, the most common is probably going to be 5.6.5.0.0 which is 5 bits Red, 6 bits green and 5 bits blue with no alpha and no unused bits. Green will always be in the center if you get the red and blue wrong, the color will be off, but you can swap that easily enough. Pete- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi. i am trying to save a bitmap image to sram from sd card through sopc builder and nios2. my problem is i'm not sure if i can directly use alt_up_sd_card_read to read the file because it is a bitmap image. are they the same with reading text file?
and about this: --- Quote Start --- for(i=0;i<280;i++){for(j=40;j<320;j++) { byte_b=(unsigned char)(alt_up_sd_card_read(sd_fileh)); byte_g=(unsigned char)(alt_up_sd_card_read(sd_fileh)); byte_r=(unsigned char)(alt_up_sd_card_read(sd_fileh)); pixel=((byte_r>>3)<<11)|((byte_g>>2)<<5)|((byte_b>>3)<<0); IOWR_16DIRECT(SDRAM_BASE,(((i+80)*640+(j))-40),pixel); } --- Quote End --- can you explain this to me please? this is wrting to pixel memory, right? but how did you come up with this?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes .. U can use the alt_up_sd_card_read to read the bitmap file...first of all read the bitmap information.. it contains header info after that only data gets start.. so tats only i have separated the header info after that read the data info .....
--- Quote Start --- hi. i am trying to save a bitmap image to sram from sd card through sopc builder and nios2. my problem is i'm not sure if i can directly use alt_up_sd_card_read to read the file because it is a bitmap image. are they the same with reading text file? and about this: can you explain this to me please? this is wrting to pixel memory, right? but how did you come up with this? --- Quote End ---- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
for(x=0;x<54;x++){
header=(unsigned char)(alt_up_sd_card_read(sd_fileh)); } this will read the header info of bitmap file..then read the bgr info of bitmap ... (RGB value is stored in reverse).. tats only i used for to read bgr.. the bitmap file is 24 bit format... i have used pixels value converted into 16 bit format... i have tried for 24 bit also but not getting the exact ouptut..while using 16bit means it shows the exact output on VGA...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you very much for replying.
--- Quote Start --- first of all read the bitmap information.. it contains header info after that only data gets start.. so tats only i have separated the header info after that read the data info ..... --- Quote End --- what i understand from this is: i need to make a: bitmap file header like this one: typedef struct { unsigned short int type; /* Magic identifier */ unsigned int size; /* File size in bytes */ unsigned short int reserved1, reserved2; unsigned int offset; /* Offset to image data, bytes */ } HEADER; and a bitmap info header like this one: typedef struct { unsigned int size; /* Header size in bytes */ int width,height; /* Width and height of image */ unsigned short int planes; /* Number of colour planes */ unsigned short int bits; /* Bits per pixel */ unsigned int compression; /* Compression type */ unsigned int imagesize; /* Image size in bytes */ int xresolution,yresolution; /* Pixels per meter */ unsigned int ncolours; /* Number of colours */ unsigned int importantcolours; /* Important colours */ } INFOHEADER; should i also give the values for type, size, offset, reserved, width, height, etc. or just this? and i am going to include this header file to my sd card source file? about the "header=(unsigned char)(alt_up_sd_card_read(sd_fileh));", where did you get the name 'header'? sorry, i'm not really familiar with c so i'm having a hard time with programming in nios but i need to make this work for our project. thanks for the help.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi balakumar,
I'm doing the project containing display image stored in SD card, on VGA. Now, I write the module that read successfully data from SD card, but SD RAM and VGA are the tackles. Could you help me ? By the way, are you using Nios-II or STORM SoC for integrating all of those components ? Thanks,- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You don't need to make any header file. Any .bmp image has by default a header of 54Byte. So when ever you start reading a image, the first 54 reads will correspond to that header and after that the actual data is being read.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page