raj said:
i want VHDL code of reading an image....and view that image after
processing.......with explaination.....i know about TEXTIO
package.......but how to use that.....??
First you will need to read the file in character by character. you
dont even need textio. It can be done like this:
type data_file_t is file of character;
file my_file : data_file_t open READ_MODE is "<path>";
variable c_buf : character;
variable my_int : integer;
then you can read the characters in by using:
read(my_file, c_buf);
You then have a single character. you can convert this to an integer
by:
my_int := character'pos(c_buf).
Now, thats the easy bit. The tricky bit is going to be reading the jpg
file header to determin how big your storage array needs to be, and
you'll probably have to use pointers. It then gets even trickier as
you have to write functions to uncompress the jpg data. you will have
to google that.
I suggest you convert your JPGs into bitmaps as they are alot easier
to read as the data is uncompressed and can be read directly. For an
explination of the BMP file header, see here:
http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html
But overall, VHDL is not really designed for easy file IO. It provides
useful textio functions, and binary fileIO can be done with a bit of a
work around (as shown), but there are no APIs for doing anything you
could easily do in software (like read a jpg file). So you either have
to write the functions in VHDL yourself, or convert the files
externally to something more useful.