Realtimestagram
|
Provides functionality for easy reading and writing of netbpm images.
Reading and writing of images has been placed into single package. This way writing and reading them is centralized and easier.
It is completly designed around netbpm image format. This plain version of this format are ascii based and make them suitable for trivial reading and writing from VHDL. The images can directly be viewed in any image viewer and are very protable and recognized by many tools.
For a description of this format see the Wikipedia page about Netbpm.
-- First read the header read_pbmplus_header( pgm_width, pgm_height, max_pixel_value, pgm, file_input_pixel ); -- Then read the pixels read_pixel(file_input_pixel, pixel_tmp, end_of_file);
-- First write the header write_pbmplus_header( pgm_width, pgm_height, max_pixel_value, pgm, file_output_pixel ); -- Then write the pixels write_pixel( val, file_output_pixel);
Functions | |
string | pad_string ( arg_str: in string ret_len_c: in natural 10 fill_char_c: in character ' ' ) |
Procedures | |
read_pbmplus_header( constant exp_width: in integer constant exp_height: in integer constant exp_max_value: in integer constant exp_type_of_pbm: in pbmplustype ) | |
Generic procedure for reading pbm plus headers. | |
write_pbmplus_header( constant p_width: in integer constant p_height: in integer constant max_value: in integer constant type_of_pbm: in pbmplustype ) | |
generic procedure for writing pbm plus headers | |
read_pixel( variable pixel: out integer ,signal end_of_file: out std_logic ) | |
generic procedure for reading single pixel value from pbm file to variable | |
read_pixel( signal pixel: out std_logic_vector ,signal end_of_file: out std_logic ) | |
generic procedure for reading single pixel value from pbm file to signal | |
read_rgb_pixel( variable pixel_r: out integer variable pixel_g: out integer variable pixel_b: out integer signal end_of_file: out std_logic ) | |
generic procedure to read rgb variable from a file | |
read_rgb_pixel( signal pixel_r: out std_logic_vector ( wordsize - 1 downto 0 ) signal pixel_g: out std_logic_vector ( wordsize - 1 downto 0 ) signal pixel_b: out std_logic_vector ( wordsize - 1 downto 0 ) signal end_of_file: out std_logic ) | |
write_pixel( variable pixel: in integer ) | |
generic procedure for writing single pixel value from variable to pbm file | |
write_pixel( signal pixel: in std_logic_vector ) | |
generic procedure for writing single pixel value from signal to pbm file | |
write_bin_pixel( variable pixel: in boolean ) | |
write_bin_pixel( signal pixel: in std_logic ) | |
write_rgb_pixel( variable pixel_r: in integer variable pixel_g: in integer variable pixel_b: in integer ) | |
write_rgb_pixel( signal pixel_r: in unsigned ( 7 downto 0 ) signal pixel_g: in unsigned ( 7 downto 0 ) signal pixel_b: in unsigned ( 7 downto 0 ) ) | |
write_ycbcr_pixel( variable pixel_y: in integer variable pixel_cb: in integer variable pixel_cr: in integer ) | |
write_ycbcr_pixel( signal pixel_y: in unsigned ( 9 downto 0 ) signal pixel_cb: in unsigned ( 9 downto 0 ) signal pixel_cr: in unsigned ( 9 downto 0 ) ) | |
rgb_to_ycbcr( variable r: in unsigned ( 7 downto 0 ) variable g: in unsigned ( 7 downto 0 ) variable b: in unsigned ( 7 downto 0 ) variable y: out unsigned ( 9 downto 0 ) variable cb: out unsigned ( 9 downto 0 ) variable cr: out unsigned ( 9 downto 0 ) ) | |
procedure to convert rgb variables into corresponding ycbcr components | |
ycbcr_to_rgb( variable y: in unsigned ( 9 downto 0 ) variable cb: in unsigned ( 9 downto 0 ) variable cr: in unsigned ( 9 downto 0 ) variable r: out unsigned ( 7 downto 0 ) variable g: out unsigned ( 7 downto 0 ) variable b: out unsigned ( 7 downto 0 ) ) | |
procedure to convert ycbcr variables into corresponding rgb components |
Libraries | |
ieee | |
use standard library |
Use Clauses | |
std_logic_1164 | |
use std_logic_vector | |
numeric_std | |
needed for colorscheme calculations | |
textio | |
used for writing and reading images | |
math_real | |
used only for calculation of constants |
Constants | |
wordsize | integer := 8 |
Number of bits in a pixel. |
Types | |
pbmplustype | ( pbm , pgm , ppm ) |
Enumeration for type of pbm. |
|
Function |
function to pad strings with a fill character
[in] | arg_str | the input string that has to be padded |
[in] | ret_len_c | the length of the output string. (must be larger than length of the input string) |
[in] | fill_char_c | the filling character that should be used to pad the input string |
|
Procedure |
Generic procedure for reading pbm plus headers.
Reads the header from a file and compares the read values to the expected files, by using this it can be asserted the correct input image was provided
[in] | exp_width | Expected width in number of pixels |
[in] | exp_height | Expected height in number of pixels |
[in] | exp_max_value | Expected maximum value |
[in] | exp_type_of_pbm | Expected pbmplustype |
|
Procedure |
generic procedure for reading single pixel value from pbm file to variable
Reads a single pixel every call from the specified file and outputs it as variable
[in] | pbmplus_file | file to read from |
[out] | pixel | variable to place value in |
[out] | end_of_file | signal that is true when end_of_file is reached |
|
Procedure |
generic procedure for reading single pixel value from pbm file to signal
Reads a single pixel every call from the specified file
[in] | pbmplus_file | file to read from |
[out] | pixel | signal to place value in |
[out] | end_of_file | signal that is true when end_of_file is reached |
|
Procedure |
generic procedure to read rgb variable from a file
Reads a single rgb pixel every call from the specified file and outputs it as seperate variable per color channel.
[in] | pbmplus_file | file to read from |
[out] | pixel_r | variable to place red pixel value in |
[out] | pixel_g | variable to place green pixel value in |
[out] | pixel_b | variable to place blue pixel value in |
[out] | end_of_file | signal that is true when end_of_file is reached |
|
Procedure |
Reads a single rgb pixel every call from the specified file and outputs it as seperate signal per color channel.
[in] | pbmplus_file | file to read from |
[out] | pixel_r | signal to place red pixel value in |
[out] | pixel_g | signal to place green pixel value in |
[out] | pixel_b | signal to place blue pixel value in |
[out] | end_of_file | signal that is true when end_of_file is reached |
|
Procedure |
procedure to convert rgb variables into corresponding ycbcr components
|
Procedure |
generic procedure to write binary variable of a file the header must be written with pbm as image type
|
Procedure |
generic procedure to write binary signal of a file the header must be written with pbm as image type
|
Procedure |
generic procedure for writing pbm plus headers
[in] | p_width | Width in number of pixels |
[in] | p_height | Height in number of pixels |
[in] | max_value | Maximum value |
[in] | type_of_pbm | pbmplustype |
|
Procedure |
generic procedure for writing single pixel value from variable to pbm file
|
Procedure |
generic procedure for writing single pixel value from signal to pbm file
|
Procedure |
generic procedure to write rgb variable of a file the header must be written with ppm as image type
|
Procedure |
generic procedure to write rgb signal of a file the header must be written with ppm as image type
|
Procedure |
generic procedure to write ycbcr variable of a file the header must be written with ppm as image type
|
Procedure |
generic procedure to write ycbcr signal of a file the header must be written with ppm as image type
|
Procedure |
procedure to convert ycbcr variables into corresponding rgb components
|
Library |
use standard library
|
Package |
used only for calculation of constants
|
Package |
needed for colorscheme calculations
|
Type |
Enumeration for type of pbm.
There are three types of pbm available, these types are specified in the table below
Type | Description |
---|---|
pbm | Supports monochrome bitmaps (1 bit per pixel). |
pgm | Supports greyscale images. Reads either pbm or pgm formats and writes pgm format. |
ppm | Supports full-color images. Reads either pbm, pgm, or ppm formats, writes ppm format. |
|
Package |
use std_logic_vector
|
Package |
used for writing and reading images
|
Constant |
Number of bits in a pixel.